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
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
iDB
irker
Commits
7087eeac
Commit
7087eeac
authored
Aug 25, 2012
by
Eric S. Raymond
Browse files
Options
Downloads
Patches
Plain Diff
Run loop is working.
parent
9c5846e7
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
irker.py
+26
-1
26 additions, 1 deletion
irker.py
with
26 additions
and
1 deletion
irker.py
+
26
−
1
View file @
7087eeac
...
@@ -6,5 +6,30 @@ Takes JSON objects of the form {'channel':<channel-url>, 'message':<text>}
...
@@ -6,5 +6,30 @@ Takes JSON objects of the form {'channel':<channel-url>, 'message':<text>}
and relays to IRC channels.
and relays to IRC channels.
"""
"""
import
os
,
sys
,
json
,
irclib
import
os
,
sys
,
json
,
irclib
,
getopt
class
Irker
:
"
Persistent IRC multiplexer.
"
def
__init__
(
self
):
self
.
botpool
=
{}
def
logerr
(
self
,
errmsg
):
"
Log a processing error.
"
sys
.
stderr
.
write
(
errmsg
)
def
run
(
self
,
ifp
):
"
Accept JSON relay requests from specified stream.
"
while
True
:
inp
=
ifp
.
readline
()
if
not
inp
:
break
try
:
request
=
json
.
loads
(
inp
.
strip
())
except
ValueError
:
self
.
logerr
(
"
irker: can
'
t recognize JSON on input.
\n
"
)
break
self
.
relay
(
request
)
def
relay
(
self
,
request
):
print
request
if
__name__
==
'
__main__
'
:
irker
=
Irker
()
irker
.
run
(
sys
.
stdin
)
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