Whois?

Back to PHP-IRC Support

Page: 1  
From User Message Body
danzarinrostro
Post #260
Member
Date: 3:29 pm, Jun 29 2006
Posts: 1


Hi there.

My name is Diego, this is my first post to this forums, I hope you could help me with a question about php-irc, I need my bot to follow users across channels, so if a user leave a channel and join a different one, my bot must part the channel and join the new one, following the user.

The way I think to do that is querying the server via whois, getting the channel list for the user, joining that channels, if the user parts, I part and make a new whois query, and so on...

I need documentation on php-irc, or a few guidelines on how to make a whois, join a channel and other basic operations on irc.

Thanks in advance.

Diego.

Manick
Post #262
user avatar
Admin
Date: 7:24 pm, Jun 29 2006
Posts: 223


Yes this is possible. The mod would be a bit complicated but not too hard...

Upon a whois, the channel data for the user is sent via the '319' irc code.

here is an example:

:irc.gamepad.ca 319 lost_boy Manick :%#TOWNL @#boilermaker-anime %#thehellsingproject

The channels would be held in $line['text']. You could use explode() to get them separated and then you would need to have a way to get rid of the @ and % and ! and etc.. (which may not be there for a specific channel).

To capture 319 you would do in your function file:

type 319 module function
319 my_mod my_func

I tried to put some documentation in the readme.txt about making your own modules, so you should look there for some explanations.

Then, you could basically just capture the 'part' irc code:

part my_mod my_func

and then check $line['fromNick'] to see if it is the nick of the person you want to follow. If it is, then you could do a

$this->ircClass->sendRaw("WHOIS :" . $line['fromNick']);

Then, the 319 code would be sent (or not.. depending on if the user is on any non-invisible channels). Then in the 319 function you could part your channel and join the channel that the user is in. This could fail however if the user is not in any channels or is not in any visible channels because then the 319 code would never be called. If you wanted to somehow catch this, you could start an anonymous timer in the PART function which would run after 15 seconds to make sure that your bot isn't lost.

I hope some of this helps.

--Manick
PHP-IRC Developer
   

Back to PHP-IRC Support