summaryrefslogtreecommitdiff
path: root/mibbit.py
blob: 73a929da3a4cb6d77bde2cecd139919e7d3597a7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#!/usr/bin/python
import re

class Mibbit(object):
	def onRecv(self, IRC, line, data):
		if data==None: return
		(origin, ident, host, cmd, target, params, extinfo)=data
		if len(target) and target[0]!="#":
			#print target
			#print cmd
			#print extinfo
			target=IRC.user(target)
			if cmd=="NOTICE" and target==IRC.identity:
				matches=re.findall("^\\*\\*\\* CONNECT: Client connecting on port ([0-9]+) \\(class (.*?)\\): (.+)!([0-9a-f]{8})@(.+\\.mibbit\\.com) \\((.+)\\) \\[(.+)\\]$",extinfo)
				#print matches
				"*** REMOTECONNECT: Client connecting at hypocrisy.insomniairc.net: B!463df443@ircip4.mibbit.com (109.169.29.95) [rrcs-70-61-244-67.central.biz.rr.com]"
				if matches:
					(port, cls, nick, hexip, mibbithost, mibbitip, host)=matches[0]
					IRC.raw("CHGHOST %s %s"%(nick, host))
					IRC.raw("CHGIDENT %s %s"%(nick, "mibbit"))
					IRC.raw("CHGNAME %s %s"%(nick, "Mibbit User"))
					return
				matches=re.findall("^\\*\\*\\* REMOTECONNECT: Client connecting at (.+?): (.+)!([0-9a-f]{8})@(.+\\.mibbit\\.com) \\((.+)\\) \\[(.+)\\]$",extinfo)
				#print matches
				"*** REMOTECONNECT: Client connecting at hypocrisy.insomniairc.net: B!463df443@ircip4.mibbit.com (109.169.29.95) [rrcs-70-61-244-67.central.biz.rr.com]"
				if matches:
					(remotehost, nick, hexip, mibbithost, mibbitip, host)=matches[0]
					IRC.raw("CHGHOST %s %s"%(nick, host))
					IRC.raw("CHGIDENT %s %s"%(nick, "mibbit"))
					IRC.raw("CHGNAME %s %s"%(nick, "Mibbit User"))
					return