From: Adam "Dodek" Michalik
Subject: cl-irc crashes on numeric replies
Date: 
Message-ID: <dad6bc51-a3fc-4ce2-8d88-99eb5c90cf23@b38g2000prf.googlegroups.com>
Hey,
I suppose I should send this message to cl-irc mailing list, but it's
kinda dead, so I send it here.

I was going to write a tool using cl-irc library. Unfortunately,
trying to implement identifying to NickServ, I came across strange
error:

No such reply 901.
   [Condition of type CL-IRC:NO-SUCH-REPLY]

Backtrace:
  0: (CL-IRC:FIND-REPLY-NAME 901)
  1: (CL-IRC::CREATE-IRC-MESSAGE ":verne.freenode.net 901 clacz clacz
n=Claczka 77-254-229-148.adsl.inetia.pl :You are now logged in. (id
clacz, username n=Claczka, hostname 77-254-229-148.adsl.inetia.pl)")

The server sends 901 reply to identify request. The exact message sent
by server is:

:heinlein.freenode.net 901 clacz clacz n=clacz
77-254-229-148.adsl.inetia.pl :You are now logged in. (id clacz,
username n=clacz, hostname 77-254-229-148.adsl.inetia.pl)

Does the RFC let IRC servers send numeric replies? Has anyone
experienced similar error?

From: Joshua Taylor
Subject: Re: cl-irc crashes on numeric replies
Date: 
Message-ID: <db62297d-17de-4662-8d3d-6d4fbc69a521@r2g2000vbp.googlegroups.com>
On Dec 24, 2:34 pm, "Adam \"Dodek\" Michalik" <·······@gmail.com>
wrote:
> Hey,
> I suppose I should send this message to cl-irc mailing list, but it's
> kinda dead, so I send it here.
>
> I was going to write a tool using cl-irc library. Unfortunately,
> trying to implement identifying to NickServ, I came across strange
> error:
>
> No such reply 901.
>    [Condition of type CL-IRC:NO-SUCH-REPLY]
>
> Backtrace:
>   0: (CL-IRC:FIND-REPLY-NAME 901)
>   1: (CL-IRC::CREATE-IRC-MESSAGE ":verne.freenode.net 901 clacz clacz
> n=Claczka 77-254-229-148.adsl.inetia.pl :You are now logged in. (id
> clacz, username n=Claczka, hostname 77-254-229-148.adsl.inetia.pl)")
>
> The server sends 901 reply to identify request. The exact message sent
> by server is:
>
> :heinlein.freenode.net 901 clacz clacz n=clacz
> 77-254-229-148.adsl.inetia.pl :You are now logged in. (id clacz,
> username n=clacz, hostname 77-254-229-148.adsl.inetia.pl)
>
> Does the RFC let IRC servers send numeric replies? Has anyone
> experienced similar error?

From http://www.faqs.org/rfcs/rfc2812.html

"2.4 Numeric replies

Most of the messages sent to the server generate a reply of some sort.
The most common reply is the numeric reply, used for both errors and
normal replies. The numeric reply must be sent as one message
consisting of the sender prefix, the three digit numeric, and the
target of the reply. A numeric reply is not allowed to originate from
a client; any such messages received by a server are silently dropped.
In all other respects, a numeric reply is just like a normal message,
except that the keyword is made up of 3 numeric digits rather than a
string of letters. A list of different replies is supplied in section
6."

In parse-message.lisp of cl-irc, the definition of FIND-REPLY-NAME is

(defun find-reply-name (reply-number &key (reply-names *reply-names*))
  "Numeric replies in the IRC RFCs have more meaningful names.  Given
a numeric reply (`reply-number') this function will either return the
symbol representing the reply or raise a continuable error
(`no-such-reply') which gives you the opportunity to ignore the
situation."
  (let ((name (assoc reply-number reply-names)))
    (if name
        (cadr name)
        (progn
          (cerror "Ignore unknown reply."
                  'no-such-reply :reply-number reply-number)
          :unknown-reply))))

And so it's easy to see where the NO-SUCH-REPLY error is coming from.
*REPLY-NAMES* is defined in variable.lisp:

(defparameter *reply-names*
  '((1 :rpl_welcome)
    (2 :rpl_yourhost)
    (3 :rpl_created)
    ...
    (514 :err_noforwarding) ; Seen in dancer ircd source
    (515 :err_nounidentified) ; Seen in dancer ircd source
    (516 :err_last_err_msg))) ; Seen in dancer ircd source

where I've cut a whole bunch out, and not every number is a defined
code, but they're in order, and only go up to 516. Now, a bit of
Google for 901 and IRC gets me someplace that might be defining the
901 code:

http://www.invlogic.com/irc/exten_08.html

"901 - IRCERR_BADPREFIX
    <command> :Bad command prefix specified
    A message prefix is not supported for this command. "

Of course, another document gives a different definition:

http://tools.ietf.org/html/draft-pfenning-irc-extensions-04

"901 - IRCERR_TOOMANYARGUMENTS
   <command> :Too many arguments
   Response to too many arguments being provided for a command."

I don't know enough about IRC (nor did I read those documents closely
enough) to tell you whether one just an updated version of the other
(one is from 1997, the other from 1998), or what the server that's
responding to you is intending to send. At any rate, though, it looks
like you could track down what that range of codes it for, and add
them to *REPLY-NAMES*, and maybe get the update to the CL-IRC
maintainers, or, since the error is continuable, you could set up a
handler for it so as to continue automatically, if that's appropriate.

Best luck,
//JT
From: Adam "Dodek" Michalik
Subject: Re: cl-irc crashes on numeric replies
Date: 
Message-ID: <04faf9c0-a2c6-4b40-b210-b9489ffd14bb@p2g2000prn.googlegroups.com>
On 24 Gru, 21:17, Joshua Taylor <···········@gmail.com> wrote:
> (...)

Thank you for such elaborate answer. I was afraid it was a bug in cl-
irc, but it seems I should handle it myself. I'm returning to hacking
then.
From: Stanisław Halik
Subject: Re: cl-irc crashes on numeric replies
Date: 
Message-ID: <giufgo$1r5l$1@opal.icpnet.pl>
thus spoke "Adam \"Dodek\" Michalik" <·······@gmail.com>:

> No such reply 901.
>   [Condition of type CL-IRC:NO-SUCH-REPLY]
>:heinlein.freenode.net 901 clacz clacz n=clacz
> 77-254-229-148.adsl.inetia.pl :You are now logged in. (id clacz,
> username n=clacz, hostname 77-254-229-148.adsl.inetia.pl)
> Does the RFC let IRC servers send numeric replies? Has anyone

The IRC RFCs only define a bunch numerics, but as you can see, there are
1000 of possible numeric codes in various ircd implementations.
Recommend removing the ERROR call or creating a catch-all event handler
for unknown numeric types.

-- 
You only have power over people so long as you don’t take everything
away from them. But when you’ve robbed a man of everything he’s no longer
in your power — he’s free again. -- Aleksandr Isayevich Solzhenitsyn