diff --git a/protocols/clientbot.py b/protocols/clientbot.py index f73605a..2a768c7 100644 --- a/protocols/clientbot.py +++ b/protocols/clientbot.py @@ -42,16 +42,6 @@ class ClientbotWrapperProtocol(IRCCommonProtocol): # are essentially all fatal errors for connections. self.handle_463 = self.handle_464 = self.handle_465 = self.handle_error - def _expandPUID(self, uid): - """ - Returns the real nick for the given PUID. - """ - if uid in self.users: - nick = self.users[uid].nick - log.debug('(%s) Mangling target PUID %s to nick %s', self.name, uid, nick) - return nick - return uid - def post_connect(self): """Initializes a connection to a server.""" # (Re)initialize counter-based pseudo UID generators diff --git a/protocols/ircs2s_common.py b/protocols/ircs2s_common.py index ff6fca1..31f1ad9 100644 --- a/protocols/ircs2s_common.py +++ b/protocols/ircs2s_common.py @@ -167,6 +167,20 @@ class IRCCommonProtocol(IRCNetwork): """Sends a RFC 459-style raw command from the given sender.""" self.send(':%s %s' % (source, msg), **kwargs) + def _expandPUID(self, uid): + """ + Returns the nick for the given UID; this method helps support protocol modules that use + PUIDs internally but must send nicks in the server protocol. + """ + # TODO: stop hardcoding @ as separator + if uid in self.users and '@' in uid: + # UID exists and has a @ in it, meaning it's a PUID (orignick@counter style). + # Return this user's nick accordingly. + nick = self.users[uid].nick + log.debug('(%s) Mangling target PUID %s to nick %s', self.name, uid, nick) + return nick + return uid + class IRCS2SProtocol(IRCCommonProtocol): COMMAND_TOKENS = {} @@ -260,14 +274,6 @@ class IRCS2SProtocol(IRCCommonProtocol): else: raise LookupError("No such PyLink client exists.") - - def _expandPUID(self, uid): - """ - Returns the nick for the given UID; this method helps support protocol modules that use - PUIDs internally but must send nicks in the server protocol. - """ - return uid - def message(self, numeric, target, text): """Sends a PRIVMSG from a PyLink client.""" if not self.is_internal_client(numeric): diff --git a/protocols/unreal.py b/protocols/unreal.py index 42e3df1..df469d8 100644 --- a/protocols/unreal.py +++ b/protocols/unreal.py @@ -41,20 +41,6 @@ class UnrealProtocol(TS6BaseProtocol): # Some command aliases self.handle_svskill = self.handle_kill - def _expandPUID(self, uid): - """ - Returns the outgoing nick for the given UID. For PUIDs (used to store UID-less - 3.2 users), this will change the PUID given to the actual user's nick, - so that that the older IRCds can understand it. - """ - if uid in self.users and '@' in uid: - # UID exists and has a @ in it, meaning it's a PUID (orignick@counter style). - # Return this user's nick accordingly. - nick = self.users[uid].nick - log.debug('(%s) Mangling target PUID %s to nick %s', self.name, uid, nick) - return nick - return uid - ### OUTGOING COMMAND FUNCTIONS def spawn_client(self, nick, ident='null', host='null', realhost=None, modes=set(), server=None, ip='0.0.0.0', realname=None, ts=None, opertype='IRC Operator',