diff options
author | Joel Rosdahl <joel@rosdahl.net> | 2003-11-05 18:21:04 +0000 |
---|---|---|
committer | Joel Rosdahl <joel@rosdahl.net> | 2011-08-21 15:53:50 +0200 |
commit | a719970eb5a2edaed93781de543026a9cf735012 (patch) | |
tree | fb734f926e30e854da510483cf48d66c98b97860 | |
parent | 22056375ecb7152bd2e2b601e0e523ee2bec8734 (diff) | |
download | miniircd-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.
-rwxr-xr-x | miniircd | 17 |
1 files changed, 12 insertions, 5 deletions
@@ -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( |