EvilZone

Programming and Scripting => Projects and Discussion => : kenjoe41 January 04, 2015, 01:18:55 PM

: IRC bot: Remove duplicates.
: kenjoe41 January 04, 2015, 01:18:55 PM
Well, i have an IRC bot i am coding. It is pretty simple but one of its functionalities, probably its backbone, is to connect to quite alot of IRC servers, get whatever it gets, then move on.

My one problem is that i feed it a list of IRC servers and some servers tend to have alot of URLs lead to the same server/network e.g. chat.freenode.net and irc.freenode.net. There are other examples with URLs logically looking as though they are for a different networks but end up on the same network

Anyone think of something, cos i would better use that thread reconnecting to the same server, to o something else.
: Re: IRC bot: Remove duplicates.
: flowjob January 04, 2015, 02:09:16 PM
If you send the VERSION command to a server it replys with a bunch of key=value pairs, one of these may be NETWORK= wich contains the unique network name.
If you keep a list of all unique network names you could then compare a new servers NETWORK with the ones you've already got, and thus check if you're already connected to this network.

EDIT:
Not all networks send this key tho...
Freenode for example does so:
:
[14:15] == ircd-seven-1.1.3(20111112-b71671d1e846,charybdis-3.4-dev). herbert.freenode.net eHIKMpSZ6 TS6ow 43U
[14:15] == CHANTYPES=# EXCEPTS INVEX CHANMODES=eIbq,k,flj,CFLMPQScgimnprstz CHANLIMIT=#:120 PREFIX=(ov)@+ MAXLIST=bqeI:100 MODES=4 NETWORK=freenode KNOCK STATUSMSG=@+ CALLERID=g are supported by this server
[14:15] == CASEMAPPING=rfc1459 CHARSET=ascii NICKLEN=16 CHANNELLEN=50 TOPICLEN=390 ETRACE CPRIVMSG CNOTICE DEAF=D MONITOR=100 FNC TARGMAX=NAMES:1,LIST:1,KICK:1,WHOIS:1,PRIVMSG:4,NOTICE:4,ACCEPT:,MONITOR: are supported by this server
[14:15] == EXTBAN=$,ajrxz WHOX CLIENTVER=3.0 SAFELIST ELIST=CTU are supported by this server
Evilzone doesn't send the NETWORK key=value pair:
:
14:24 ** Fhin6XeOoZEM3 [*=2311] **
14:25 ** 25 MAXLIST=b:60,e:60,I:60 NICKLEN=30 CHANNELLEN=32 TOPICLEN=307 KICKLEN=307 AWAYLEN=307 :are supported by this server **
14:25 ** are supported by this server **
14:25 ** are supported by this server **