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
c2637030
Commit
c2637030
authored
11 years ago
by
Eric S. Raymond
Browse files
Options
Downloads
Patches
Plain Diff
Reinstate a simpler irk that only works with irkerd running.
parent
3170384c
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
irk
+41
-0
41 additions, 0 deletions
irk
with
41 additions
and
0 deletions
irk
0 → 100755
+
41
−
0
View file @
c2637030
#!/usr/bin/env python
# Illustrates how to test irkerd.
#
# First argument must be a channel URL. If it does not begin with "irc",
# the base URL for freenode is prepended.
#
# Second argument must be a payload string. Standard C-style escapes
# such as \n and \t are decoded.
#
import
json
import
socket
import
sys
import
fileinput
import
subprocess
import
time
import
os
def
send
(
target
,
message
):
data
=
{
"
to
"
:
target
,
"
privmsg
"
:
message
}
#print(json.dumps(data))
try
:
s
=
socket
.
create_connection
((
"
localhost
"
,
6659
))
s
.
sendall
(
json
.
dumps
(
data
))
except
socket
.
error
,
e
:
sys
.
stderr
.
write
(
"
irk: write to server failed: %r
\n
"
%
e
)
try
:
s
=
socket
.
create_connection
((
"
localhost
"
,
6659
))
except
:
print
"
No irker is running.
"
target
=
sys
.
argv
[
1
]
if
not
"
irc:
"
in
target
:
target
=
"
irc://chat.freenode.net/{0}
"
.
format
(
target
)
message
=
"
"
.
join
(
sys
.
argv
[
2
:])
message
=
message
.
decode
(
'
string_escape
'
)
if
message
==
'
-
'
:
for
line
in
fileinput
.
input
(
'
-
'
):
send
(
target
,
line
.
rstrip
(
'
\n
'
))
else
:
send
(
target
,
message
)
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