summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xminiircd11
-rw-r--r--test.py11
2 files changed, 21 insertions, 1 deletions
diff --git a/miniircd b/miniircd
index c740315..4d6bfc9 100755
--- a/miniircd
+++ b/miniircd
@@ -221,6 +221,14 @@ class Client(object):
def away_handler():
pass
+ def ison_handler():
+ if len(arguments) < 1:
+ self.reply_461("ISON")
+ return
+ nicks = arguments
+ online = [n for n in nicks if server.get_client(n)]
+ self.reply("303 %s :%s" % (self.nickname, " ".join(online)))
+
def join_handler():
if len(arguments) < 1:
self.reply_461("JOIN")
@@ -500,6 +508,7 @@ class Client(object):
handler_table = {
"AWAY": away_handler,
+ "ISON": ison_handler,
"JOIN": join_handler,
"LIST": list_handler,
"MODE": mode_handler,
@@ -820,3 +829,5 @@ def main(argv):
main(sys.argv)
+
+# ex:et:sw=4:ts=4
diff --git a/test.py b/test.py
index 463c63f..7b008fe 100644
--- a/test.py
+++ b/test.py
@@ -77,7 +77,7 @@ class ServerFixture(object):
signal.alarm(1) # Give the server 1 second to respond
line = self.connections[nick].readline().rstrip()
signal.alarm(0) # Cancel the alarm
- regexp = "^%s$" % regexp
+ regexp = ("^%s$" % regexp).replace(r"local\S+", socket.getfqdn())
m = re.match(regexp, line)
if m:
return m
@@ -241,6 +241,15 @@ class TestBasicStuff(ServerFixture):
self.expect("lemur", r":lemur!lemur@127.0.0.1 PART #fisk :boa")
self.expect("apa", r":lemur!lemur@127.0.0.1 PART #fisk :boa")
+ def test_ison(self):
+ self.connect("apa")
+ self.send("apa", "ISON apa lemur")
+ self.expect("apa", r":local\S+ 303 apa :apa")
+
+ self.connect("lemur")
+ self.send("apa", "ISON apa lemur")
+ self.expect("apa", r":local\S+ 303 apa :apa lemur")
+
class TestTwoChannelsStuff(TwoClientsTwoChannelsFixture):
def test_privmsg_to_channel(self):