def accept_connections(s):
conn, addr = s.accept()
try:
data = ""
d = conn.recv(1024)
while d:
data += d
d = conn.recv(1024)
finally:
conn.close()
if data:
try:
urgency, host, title, body = shlex.split(data)
subprocess.call(["notify-send", "-u", urgency, "-a", "IRC %s" % host, escape(title), escape(body)])
except ValueError as e:
print e
except OSError as e:
print e
accept_connections(s)
评论列表
文章目录