summaryrefslogtreecommitdiff
path: root/nocompile
diff options
context:
space:
mode:
Diffstat (limited to 'nocompile')
-rwxr-xr-xnocompile/bin/pipboy.py46
1 files changed, 46 insertions, 0 deletions
diff --git a/nocompile/bin/pipboy.py b/nocompile/bin/pipboy.py
new file mode 100755
index 0000000..cabd69e
--- /dev/null
+++ b/nocompile/bin/pipboy.py
@@ -0,0 +1,46 @@
+#!/usr/pkg/bin/python3.3
+import time
+import socket
+import os
+import fcntl
+import sys
+s=socket.create_connection(("127.0.0.1",6667))
+fcntl.fcntl(sys.stdin.fileno(),fcntl.F_SETFL,os.O_NONBLOCK)
+fcntl.fcntl(s.fileno(),fcntl.F_SETFL,os.O_NONBLOCK)
+s.send(b"NICK pipboy\r\nUSER a b c d\r\nJOIN #pipe\r\n")
+b=b""
+c=b""
+while 1:
+ try:
+ i=s.recv(16)
+ except:
+ pass
+ else:
+ b+=i
+ try:
+ j=sys.stdin.read(16)
+ except:
+ pass
+ else:
+ c+=j.encode()
+ if(b"\n" in c):
+ q=c.split(b'\n')
+ c=b'\n'.join(q[1:])
+ s.send(b'PRIVMSG #pipe :' + q[0] + b'\r\n')
+ if(b"\r\n" in b):
+ p=b.split(b'\r\n')
+ b=b"\r\n".join(p[1:])
+ a=p[0].split(b' ')
+ try:
+ who=a[0].split(b':')[1].split(b'!')[0]
+ except:
+ who=b"#cmd"
+ if(a[0] == b'ERROR'):
+ quit()
+ if(a[0] == b'PING'):
+ s.send(b'PONG ' + a[1] + b'\r\n')
+ if(a[1] == b'PRIVMSG'):
+ if(a[2] == b'#pipe'):
+ print((b" ".join(a[3:])[1:]).decode())
+ sys.stdout.flush()
+ time.sleep(.01)