From a719970eb5a2edaed93781de543026a9cf735012 Mon Sep 17 00:00:00 2001 From: Joel Rosdahl Date: Wed, 5 Nov 2003 18:21:04 +0000 Subject: 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. --- miniircd | 17 ++++++++++++----- 1 file 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( -- cgit v1.2.3