cl-irc assigns the final argument of an IRC message to the TRAILING-ARGUMENT slot if it begins with a colon. However, the colon is purely a syntactic marker that indicates all following text to the end of the line is part of the final argument. Colons always precede final arguments containing spaces, but they might also precede arguments that will never contain spaces (such as channel names) and might be omitted from a final argument that happens not to have any spaces.
For example, the following messages are equivalent:
:Joe!bob@example.com JOIN #lisp :Joe!bob@example.com JOIN :#lisp
And so are these:
:Joe!bob@example.com PRIVMSG #lisp Hello! :Joe!bob@example.com PRIVMSG #lisp :Hello!
And these:
:Joe!bob@example.com QUIT Leaving :Joe!bob@example.com QUIT :Leaving
Unfortunately, cl-irc parses each one of them differently.
Would it be possible to change how IRC-MESSAGE objects are created to put the final argument into the ARGUMENTS slot?
Zach
On Jan 8, 2004, at 3:57 PM, Zach Beane wrote:
Would it be possible to change how IRC-MESSAGE objects are created to put the final argument into the ARGUMENTS slot?
Can anyone think of a problem with doing this? I'm not sure I can and if no one else can then I don't see why we shouldn't do what Zach suggests in the interest of reducing some complexity.
Erik.
On Thu, Jan 08, 2004 at 07:24:11PM -0500, Erik Enge wrote:
On Jan 8, 2004, at 3:57 PM, Zach Beane wrote:
Would it be possible to change how IRC-MESSAGE objects are created to put the final argument into the ARGUMENTS slot?
Can anyone think of a problem with doing this? I'm not sure I can and if no one else can then I don't see why we shouldn't do what Zach suggests in the interest of reducing some complexity.
Appended is a small patch that would do it.
I noticed parse-message.lisp has a strange style; why are cond forms wrapped in progns in e.g. create-irc-message?
Zach
Index: parse-message.lisp =================================================================== RCS file: /project/cl-irc/cvsroot/cl-irc/parse-message.lisp,v retrieving revision 1.1.1.1 diff -u -r1.1.1.1 parse-message.lisp --- parse-message.lisp 5 Jan 2004 14:13:04 -0000 1.1.1.1 +++ parse-message.lisp 12 Jan 2004 17:07:07 -0000 @@ -166,6 +166,8 @@ (setf class (find-irc-message-class command)))))) (when ctcp (setf class (find-ctcp-message-class ctcp))) + (when trailing-argument + (setf arguments (nconc arguments (list trailing-argument)))) (let ((instance (make-instance class :source source :user user