diff --git a/protocols/clientbot.py b/protocols/clientbot.py index e898b6f..e74ebc9 100644 --- a/protocols/clientbot.py +++ b/protocols/clientbot.py @@ -103,7 +103,8 @@ class ClientbotWrapperProtocol(IRCCommonProtocol): f('NICK %s' % nick) f('USER %s 8 * :%s' % (ident, realname)) - self.pseudoclient = User(self, nick, int(time.time()), self.uidgen.next_uid(prefix='@ClientbotInternal'), self.sid, + self.pseudoclient = User(self, nick, int(time.time()), + self.uidgen.next_uid(prefix='@ClientbotInternal'), self.sid, ident=ident, realname=realname, host=self.hostname()) self.users[self.pseudoclient.uid] = self.pseudoclient @@ -121,7 +122,7 @@ class ClientbotWrapperProtocol(IRCCommonProtocol): ts = ts or int(time.time()) log.debug('(%s) spawn_client stub called, saving nick %s as PUID %s', self.name, nick, uid) - u = self.users[uid] = User(self, nick, ts, uid, server, ident=ident, host=host, realname=realname, + u = self.users[uid] = User(self, nick, ts, uid, server, ident=ident, host=host, realname=realname, manipulatable=manipulatable, realhost=realhost, ip=ip) self.servers[server].users.add(uid) diff --git a/protocols/hybrid.py b/protocols/hybrid.py index 24f4703..24143ab 100644 --- a/protocols/hybrid.py +++ b/protocols/hybrid.py @@ -110,10 +110,13 @@ class HybridProtocol(TS6Protocol): realname = realname or conf.conf['pylink']['realname'] realhost = realhost or host raw_modes = self.join_modes(modes) - u = self.users[uid] = User(self, nick, ts, uid, server, ident=ident, host=host, realname=realname, + + u = self.users[uid] = User(self, nick, ts, uid, server, ident=ident, host=host, realname=realname, realhost=realhost, ip=ip, manipulatable=manipulatable) + self.apply_modes(uid, modes) self.servers[server].users.add(uid) + self._send_with_prefix(server, "UID {nick} {hopcount} {ts} {modes} {ident} {host} {ip} {uid} " "* :{realname}".format(ts=ts, host=host, nick=nick, ident=ident, uid=uid, @@ -188,13 +191,14 @@ class HybridProtocol(TS6Protocol): nick = args[0] self._check_nick_collision(nick) ts, modes, ident, host, ip, uid, account, realname = args[2:10] + ts = int(ts) if account == '*': account = None log.debug('(%s) handle_uid: got args nick=%s ts=%s uid=%s ident=%s ' 'host=%s realname=%s ip=%s', self.name, nick, ts, uid, ident, host, realname, ip) - self.users[uid] = User(self, nick, ts, uid, numeric, ident, host, realname, host, ip) + self.users[uid] = User(self, nick, ts, uid, numeric, ident, host, realname, host, ip) parsedmodes = self.parse_modes(uid, [modes]) log.debug('(%s) handle_uid: Applying modes %s for %s', self.name, parsedmodes, uid) diff --git a/protocols/inspircd.py b/protocols/inspircd.py index ced7557..a2368b1 100644 --- a/protocols/inspircd.py +++ b/protocols/inspircd.py @@ -63,8 +63,9 @@ class InspIRCdProtocol(TS6BaseProtocol): realname = realname or conf.conf['pylink']['realname'] realhost = realhost or host raw_modes = self.join_modes(modes) - u = self.users[uid] = User(self, nick, ts, uid, server, ident=ident, host=host, realname=realname, - realhost=realhost, ip=ip, manipulatable=manipulatable, opertype=opertype) + u = self.users[uid] = User(self, nick, ts, uid, server, ident=ident, host=host, + realname=realname, realhost=realhost, ip=ip, + manipulatable=manipulatable, opertype=opertype) self.apply_modes(uid, modes) self.servers[server].users.add(uid) @@ -598,9 +599,12 @@ class InspIRCdProtocol(TS6BaseProtocol): """Handles incoming UID commands (user introduction).""" # :70M UID 70MAAAAAB 1429934638 GL 0::1 hidden-7j810p.9mdf.lrek.0000.0000.IP gl 0::1 1429934638 +Wioswx +ACGKNOQXacfgklnoqvx :realname uid, ts, nick, realhost, host, ident, ip = args[0:7] + + ts = int(ts) + self._check_nick_collision(nick) realname = args[-1] - self.users[uid] = userobj = User(self, nick, ts, uid, numeric, ident, host, realname, realhost, ip) + self.users[uid] = userobj = User(self, nick, ts, uid, numeric, ident, host, realname, realhost, ip) parsedmodes = self.parse_modes(uid, [args[8], args[9]]) self.apply_modes(uid, parsedmodes) diff --git a/protocols/ngircd.py b/protocols/ngircd.py index a93b03a..a03892a 100644 --- a/protocols/ngircd.py +++ b/protocols/ngircd.py @@ -88,8 +88,10 @@ class NgIRCdProtocol(IRCS2SProtocol): realname = realname or conf.conf['pylink']['realname'] uid = self._uidgen.next_uid(prefix=nick) - userobj = self.users[uid] = User(self, nick, ts or int(time.time()), uid, server, ident=ident, host=host, realname=realname, - manipulatable=manipulatable, opertype=opertype, realhost=host) + userobj = self.users[uid] = User(self, nick, ts or int(time.time()), uid, server, + ident=ident, host=host, realname=realname, + manipulatable=manipulatable, opertype=opertype, + realhost=host) self.apply_modes(uid, modes) self.servers[server].users.add(uid) @@ -451,7 +453,8 @@ class NgIRCdProtocol(IRCS2SProtocol): realname = args[-1] ts = int(time.time()) - self.users[uid] = User(self, nick, ts, uid, source, ident=ident, host=host, realname=realname, realhost=host) + self.users[uid] = User(self, nick, ts, uid, source, ident=ident, host=host, + realname=realname, realhost=host) parsedmodes = self.parse_modes(uid, [args[5]]) self.apply_modes(uid, parsedmodes) diff --git a/protocols/p10.py b/protocols/p10.py index 16bc5b5..c69f333 100644 --- a/protocols/p10.py +++ b/protocols/p10.py @@ -306,7 +306,7 @@ class P10Protocol(IRCS2SProtocol): raw_modes = self.join_modes(modes) # Initialize an User instance - u = self.users[uid] = User(self, nick, ts, uid, server, ident=ident, host=host, realname=realname, + u = self.users[uid] = User(self, nick, ts, uid, server, ident=ident, host=host, realname=realname, realhost=realhost, ip=ip, manipulatable=manipulatable, opertype=opertype) # Fill in modes and add it to our users index @@ -919,6 +919,7 @@ class P10Protocol(IRCS2SProtocol): nick = args[0] self._check_nick_collision(nick) ts, ident, host = args[2:5] + ts = int(ts) realhost = host ip = args[-3] ip = self.decode_p10_ip(ip) @@ -929,7 +930,7 @@ class P10Protocol(IRCS2SProtocol): 'host=%s realname=%s realhost=%s ip=%s', self.name, nick, ts, uid, ident, host, realname, realhost, ip) - uobj = self.users[uid] = User(self, nick, ts, uid, source, ident, host, realname, realhost, ip) + uobj = self.users[uid] = User(self, nick, ts, uid, source, ident, host, realname, realhost, ip) self.servers[source].users.add(uid) # https://github.com/evilnet/nefarious2/blob/master/doc/p10.txt#L708 diff --git a/protocols/ts6.py b/protocols/ts6.py index 48d63dc..b0e7e18 100644 --- a/protocols/ts6.py +++ b/protocols/ts6.py @@ -561,6 +561,7 @@ class TS6Protocol(TS6BaseProtocol): nick = args[0] self._check_nick_collision(nick) ts, modes, ident, host, ip, uid, realhost, accountname, realname = args[2:11] + ts = int(ts) if realhost == '*': realhost = host @@ -572,7 +573,7 @@ class TS6Protocol(TS6BaseProtocol): if ip == '0': # IP was invalid; something used for services. ip = '0.0.0.0' - self.users[uid] = User(self, nick, ts, uid, numeric, ident, host, realname, realhost, ip) + self.users[uid] = User(self, nick, ts, uid, numeric, ident, host, realname, realhost, ip) parsedmodes = self.parse_modes(uid, [modes]) log.debug('Applying modes %s for %s', parsedmodes, uid) diff --git a/protocols/unreal.py b/protocols/unreal.py index 83396fa..fb46a2a 100644 --- a/protocols/unreal.py +++ b/protocols/unreal.py @@ -395,6 +395,7 @@ class UnrealProtocol(TS6BaseProtocol): nick = args[0] self._check_nick_collision(nick) ts, ident, realhost, uid, accountname, modestring, host = args[2:9] + ts = int(ts) if host == '*': # A single * means that there is no displayed/virtual host, and @@ -421,7 +422,7 @@ class UnrealProtocol(TS6BaseProtocol): realname = args[-1] - self.users[uid] = User(self, nick, ts, uid, numeric, ident, host, realname, realhost, ip) + self.users[uid] = User(self, nick, ts, uid, numeric, ident, host, realname, realhost, ip) self.servers[numeric].users.add(uid) # Handle user modes