Does not update a forced nick change, and mishandles nick changes.

Back to PHP-IRC Bugs

Page: 1  
From User Message Body
Post #573
Date: 9:19 am, Jul 20 2007
Posts: 1

While testing on EFNet, I noticed that the server changed my nickname when it was too long.

I haven't worked with anything involving the IRC protocol in many years, so please forgive me for the following code (although it does work) and correct me about a simpler method to do this.

On line 1264 of irc.php, I added the following:
                // Nickname fix
                if (!empty($this->lVars['to']) && empty($this->lVars['fromNick']) && $this->lVars['to']{0} != '#' && $this->lVars['to']{0} != '&' && $this->lVars['to'] != $this->nick)
                    $this->nick = $this->lVars['to'];

It simply checks to see that the 'to' field is not empty, that it is being sent from the server (not a nickname), and that it is not a channel (does not begin with # or &). Then, if the nickname does not match the one PHP-IRC knows of, it updates the variable.

Now, the second bug is related to the first. Again, when the server does not allow nicknames beyond a certain length, AND our initial nickname choice is in use, PHP-IRC tries to rename itself to "nicknameRANDOMNUMBER". However, because our random name is too long, the server tries to rename the bot to the shortened name (already in use).

So, for example, our nick is 'a-long-nickname'. Imagine the server only allows 11 characters, so it is truncated to 'a-long-nick' -- but, someone is already named 'a-long-nick' on the server (it could even be another instance of your bot). So, the bot will run in a loop, attempting to rename itself to 'a-long-nickname531', etc, which all get truncated to 'a-long-nick'.

I didn't write any code to fix this, because I'm only using EFNet for testing.

Other than that, excellent bot! It's very easy to use. I've only been working with it for an hour or so, and I'm loving it already.


Back to PHP-IRC Bugs