diff --git a/classes.py b/classes.py index a0dbb2a..e26c6f5 100644 --- a/classes.py +++ b/classes.py @@ -521,7 +521,7 @@ class IrcUser(): """PyLink IRC user class.""" def __init__(self, nick, ts, uid, ident='null', host='null', realname='PyLink dummy client', realhost='null', - ip='0.0.0.0', manipulatable=False): + ip='0.0.0.0', manipulatable=False, opertype='IRC Operator'): self.nick = nick self.ts = ts self.uid = uid @@ -535,6 +535,9 @@ class IrcUser(): # Tracks PyLink identification status self.identified = '' + # Tracks oper type (for display only) + self.opertype = opertype + # Tracks services identification status self.services_account = '' diff --git a/protocols/inspircd.py b/protocols/inspircd.py index 9eb27d4..48b1fcf 100644 --- a/protocols/inspircd.py +++ b/protocols/inspircd.py @@ -35,7 +35,7 @@ class InspIRCdProtocol(TS6BaseProtocol): ### Outgoing commands def spawnClient(self, nick, ident='null', host='null', realhost=None, modes=set(), - server=None, ip='0.0.0.0', realname=None, ts=None, opertype=None, + server=None, ip='0.0.0.0', realname=None, ts=None, opertype='IRC Operator', manipulatable=False): """Spawns a client with nick on the given IRC connection. @@ -52,7 +52,7 @@ class InspIRCdProtocol(TS6BaseProtocol): realhost = realhost or host raw_modes = utils.joinModes(modes) u = self.irc.users[uid] = IrcUser(nick, ts, uid, ident=ident, host=host, realname=realname, - realhost=realhost, ip=ip, manipulatable=manipulatable) + realhost=realhost, ip=ip, manipulatable=manipulatable, opertype=opertype) utils.applyModes(self.irc, uid, modes) self.irc.servers[server].users.add(uid) self._send(server, "UID {uid} {ts} {nick} {realhost} {host} {ident} {ip}" @@ -61,7 +61,7 @@ class InspIRCdProtocol(TS6BaseProtocol): modes=raw_modes, ip=ip, realname=realname, realhost=realhost)) if ('o', None) in modes or ('+o', None) in modes: - self._operUp(uid, opertype=opertype or 'IRC Operator') + self._operUp(uid, opertype) return u def join(self, client, channel): diff --git a/protocols/ts6.py b/protocols/ts6.py index 522d2b8..835c5ba 100644 --- a/protocols/ts6.py +++ b/protocols/ts6.py @@ -31,7 +31,7 @@ class TS6Protocol(TS6BaseProtocol): ### OUTGOING COMMANDS def spawnClient(self, nick, ident='null', host='null', realhost=None, modes=set(), - server=None, ip='0.0.0.0', realname=None, ts=None, opertype=None, + server=None, ip='0.0.0.0', realname=None, ts=None, opertype='IRC Operator', manipulatable=False): """Spawns a client with nick on the given IRC connection. @@ -51,7 +51,7 @@ class TS6Protocol(TS6BaseProtocol): realhost = realhost or host raw_modes = utils.joinModes(modes) u = self.irc.users[uid] = IrcUser(nick, ts, uid, ident=ident, host=host, realname=realname, - realhost=realhost, ip=ip, manipulatable=manipulatable) + realhost=realhost, ip=ip, manipulatable=manipulatable, opertype=opertype) utils.applyModes(self.irc, uid, modes) self.irc.servers[server].users.add(uid) self._send(server, "EUID {nick} 1 {ts} {modes} {ident} {host} {ip} {uid} " diff --git a/protocols/unreal.py b/protocols/unreal.py index ac2daf3..c897e26 100644 --- a/protocols/unreal.py +++ b/protocols/unreal.py @@ -51,7 +51,7 @@ class UnrealProtocol(TS6BaseProtocol): ### OUTGOING COMMAND FUNCTIONS def spawnClient(self, nick, ident='null', host='null', realhost=None, modes=set(), - server=None, ip='0.0.0.0', realname=None, ts=None, opertype=None, + server=None, ip='0.0.0.0', realname=None, ts=None, opertype='IRC Operator', manipulatable=False): """Spawns a client with nick on the given IRC connection. @@ -60,15 +60,15 @@ class UnrealProtocol(TS6BaseProtocol): server = server or self.irc.sid if not self.irc.isInternalServer(server): raise ValueError('Server %r is not a PyLink server!' % server) - # Unreal 3.4 uses TS6-style UIDs. They don't start from AAAAAA like other IRCd's - # do, but we can do that fine... + # Unreal 4.0 uses TS6-style UIDs. They don't start from AAAAAA like other IRCd's + # do, but that doesn't matter to us... uid = self.uidgen.setdefault(server, utils.TS6UIDGenerator(server)).next_uid() ts = ts or int(time.time()) realname = realname or self.irc.botdata['realname'] realhost = realhost or host raw_modes = utils.joinModes(modes) u = self.irc.users[uid] = IrcUser(nick, ts, uid, ident=ident, host=host, realname=realname, - realhost=realhost, ip=ip, manipulatable=manipulatable) + realhost=realhost, ip=ip, manipulatable=manipulatable, opertype=opertype) utils.applyModes(self.irc, uid, modes) self.irc.servers[server].users.add(uid)