Author Topic: IRC bot: Remove duplicates.  (Read 413 times)

0 Members and 1 Guest are viewing this topic.

Offline kenjoe41

  • Symphorophiliac Programmer
  • Administrator
  • Baron
  • *
  • Posts: 990
  • Cookies: 224
    • View Profile
IRC bot: Remove duplicates.
« on: 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.
If you can't explain it to a 6 year old, you don't understand it yourself.
http://upload.alpha.evilzone.org/index.php?page=img&img=GwkGGneGR7Pl222zVGmNTjerkhkYNGtBuiYXkpyNv4ScOAWQu0-Y8[<NgGw/hsq]>EvbQrOrousk[/img]

Offline flowjob

  • Knight
  • **
  • Posts: 327
  • Cookies: 46
  • Pastafarian
    • View Profile
Re: IRC bot: Remove duplicates.
« Reply #1 on: 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:
Code: [Select]
[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:
Code: [Select]
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 **
 
« Last Edit: January 04, 2015, 02:28:21 pm by flowjob »
Quote
<phil> I'm gonna DDOS the washing machine with clothes packets.
<deviant_sheep> dont use too much soap or youll cause a bubble overflow