summaryrefslogtreecommitdiff
path: root/miniircd
diff options
context:
space:
mode:
authorJoel Rosdahl <joel@rosdahl.net>2003-11-05 18:21:04 +0000
committerJoel Rosdahl <joel@rosdahl.net>2011-08-21 15:53:50 +0200
commita719970eb5a2edaed93781de543026a9cf735012 (patch)
treefb734f926e30e854da510483cf48d66c98b97860 /miniircd
parent22056375ecb7152bd2e2b601e0e523ee2bec8734 (diff)
downloadminiircd-a719970eb5a2edaed93781de543026a9cf735012.tar.gz
miniircd-a719970eb5a2edaed93781de543026a9cf735012.zip
Correct argument parsing and QUIT message
The text "QUIT :foo bar" was interpreted as command "QUIT" and arguments [":foo"]. Fixed. The real quit message (if given, otherwise the nickname as dictated by the RFC) is now sent to other clients. Previously, "Client quit" was always sent.
Diffstat (limited to 'miniircd')
-rwxr-xr-xminiircd17
1 files changed, 12 insertions, 5 deletions
diff --git a/miniircd b/miniircd
index 504153a..a0794f4 100755
--- a/miniircd
+++ b/miniircd
@@ -114,10 +114,13 @@ class Client(object):
if len(x) == 1:
arguments = []
else:
- y = string.split(x[1], " :", 1)
- arguments = string.split(y[0])
- if len(y) == 2:
- arguments.append(y[1])
+ if len(x[1]) > 0 and x[1][0] == ":":
+ arguments = [x[1][1:]]
+ else:
+ y = string.split(x[1], " :", 1)
+ arguments = string.split(y[0])
+ if len(y) == 2:
+ arguments.append(y[1])
if command == "DEBUG":
self.__server.debug()
self.__handleCommand(command, arguments)
@@ -421,7 +424,11 @@ class Client(object):
elif command == "PONG":
pass
elif command == "QUIT":
- self.disconnect("Client quit")
+ if len(arguments) < 1:
+ quitmsg = self.nickname
+ else:
+ quitmsg = arguments[0]
+ self.disconnect(quitmsg)
elif command == "TOPIC":
if len(arguments) < 1:
self.message(