3
0
mirror of https://github.com/jlu5/PyLink.git synced 2024-12-28 13:42:37 +01:00

Merge handle_invite into IRCS2SProtocol (#454)

This commit is contained in:
James Lu 2017-06-29 22:16:41 -07:00
parent 2034bfcc83
commit 741528b0b3
5 changed files with 21 additions and 40 deletions

View File

@ -673,14 +673,6 @@ class InspIRCdProtocol(TS6BaseProtocol):
# SVSTOPIC is used by InspIRCd module m_topiclock - its arguments are the same as FTOPIC
handle_svstopic = handle_ftopic
def handle_invite(self, numeric, command, args):
"""Handles incoming INVITEs."""
# <- :70MAAAAAC INVITE 0ALAAAAAA #blah 0
target = args[0]
channel = self.toLower(args[1])
# We don't actually need to process this; just send the hook so plugins can use it
return {'target': target, 'channel': channel}
def handle_knock(self, numeric, command, args):
"""Handles channel KNOCKs."""
# <- :70MAAAAAA ENCAP * KNOCK #blah :abcdefg

View File

@ -234,6 +234,27 @@ class IRCS2SProtocol(IRCCommonProtocol):
self.users[numeric].away = text = ''
return {'text': text}
def handle_invite(self, numeric, command, args):
"""Handles incoming INVITEs."""
# TS6:
# <- :70MAAAAAC INVITE 0ALAAAAAA #blah 12345
# P10:
# <- ABAAA I PyLink-devel #services 1460948992
# Note that the target is a nickname, not a numeric.
target = self._get_UID(args[0])
channel = self.toLower(args[1])
curtime = int(time.time())
try:
ts = int(args[2])
except IndexError:
ts = curtime
ts = ts or curtime # Treat 0 timestamps (e.g. inspircd) as the current time.
return {'target': target, 'channel': channel, 'ts': ts}
def handle_kill(self, source, command, args):
"""Handles incoming KILLs."""
killed = args[0]

View File

@ -1171,18 +1171,6 @@ class P10Protocol(IRCS2SProtocol):
return {'channel': channel, 'setter': args[1], 'text': topic,
'oldtopic': oldtopic}
def handle_invite(self, source, command, args):
"""Handles incoming INVITEs."""
# From P10 docs:
# 1 <target nick>
# 2 <channel>
# - note that the target is a nickname, not a numeric.
# <- ABAAA I PyLink-devel #services 1460948992
target = self._get_UID(args[0])
channel = self.toLower(args[1])
return {'target': target, 'channel': channel}
def handle_clearmode(self, numeric, command, args):
"""Handles CLEARMODE, which is used to clear a channel's modes."""
# <- ABAAA CM #test ovpsmikbl

View File

@ -632,18 +632,6 @@ class TS6Protocol(TS6BaseProtocol):
self.channels[channel].topicset = True
return {'channel': channel, 'setter': setter, 'ts': ts, 'text': topic}
def handle_invite(self, numeric, command, args):
"""Handles incoming INVITEs."""
# <- :70MAAAAAC INVITE 0ALAAAAAA #blah 12345
target = args[0]
channel = self.toLower(args[1])
try:
ts = args[2]
except IndexError:
ts = int(time.time())
# We don't actually need to process this; it's just something plugins/hooks can use
return {'target': target, 'channel': channel, 'ts': ts}
def handle_chghost(self, numeric, command, args):
"""Handles incoming CHGHOST commands."""
target = self._get_UID(args[0])

View File

@ -934,14 +934,6 @@ class UnrealProtocol(TS6BaseProtocol):
self.users[target].realname = newgecos = args[1]
return {'target': target, 'newgecos': newgecos}
def handle_invite(self, numeric, command, args):
"""Handles incoming INVITEs."""
# <- :GL INVITE PyLink-devel :#a
target = self._get_UID(args[0])
channel = self.toLower(args[1])
# We don't actually need to process this; it's just something plugins/hooks can use
return {'target': target, 'channel': channel}
def handle_kill(self, numeric, command, args):
"""Handles incoming KILLs."""
# <- :GL| KILL GLolol :hidden-1C620195!GL| (test)