Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
I
irker
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Releases
Package Registry
Model registry
Operate
Terraform modules
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
iDB
irker
Commits
aa4a469c
Commit
aa4a469c
authored
12 years ago
by
Eric S. Raymond
Browse files
Options
Downloads
Patches
Plain Diff
Preparing IRC setup.
parent
6934eb31
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
irker.py
+7
-4
7 additions, 4 deletions
irker.py
with
7 additions
and
4 deletions
irker.py
+
7
−
4
View file @
aa4a469c
...
...
@@ -18,7 +18,8 @@ class SessionException(exceptions.Exception):
class
Session
():
"
IRC session and message queue processing.
"
def
__init__
(
self
,
url
):
count
=
1
def
__init__
(
self
,
ircserver
,
url
):
self
.
url
=
url
# The consumer thread
self
.
queue
=
Queue
.
Queue
()
...
...
@@ -38,9 +39,10 @@ class Session():
raise
SessionException
(
"
invalid port number
"
)
else
:
self
.
port
=
6667
(
self
.
server
,
self
.
channel
)
=
parts
[
0
].
split
(
"
/
"
,
1
)
(
self
.
server
name
,
self
.
channel
)
=
parts
[
0
].
split
(
"
/
"
,
1
)
# Client setup
self
.
client
=
irclib
.
SimpleIRCClient
()
#self.ircserver.connect(self.servername, self.port, "irk"+str(Session.count))
Session
.
count
+=
1
def
enqueue
(
self
,
message
):
"
Enque a message for transmission.
"
self
.
queue
.
put
(
message
)
...
...
@@ -60,6 +62,7 @@ class Session():
class
Irker
:
"
Persistent IRC multiplexer.
"
def
__init__
(
self
):
self
.
irc
=
irclib
.
IRC
()
self
.
sessions
=
{}
def
logerr
(
self
,
errmsg
):
"
Log a processing error.
"
...
...
@@ -86,7 +89,7 @@ class Irker:
channel
=
request
[
'
channel
'
]
message
=
request
[
'
message
'
]
if
channel
not
in
self
.
sessions
:
self
.
sessions
[
channel
]
=
Session
(
channel
)
self
.
sessions
[
channel
]
=
Session
(
self
.
irc
.
server
(),
channel
)
self
.
sessions
[
channel
].
enqueue
(
message
)
if
__name__
==
'
__main__
'
:
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment