3
0
mirror of https://github.com/jlu5/PyLink.git synced 2024-11-24 11:39:25 +01:00

unreal: update imports, add (shared) handlers for QUIT, PART, NICK, and KILL

This commit is contained in:
James Lu 2015-09-04 11:50:13 -07:00
parent 3469603763
commit 6d00309f9f

View File

@ -1,14 +1,15 @@
import time import time
import sys import sys
import os import os
import re
import time import time
import ipaddress
curdir = os.path.dirname(__file__) curdir = os.path.dirname(__file__)
sys.path += [curdir, os.path.dirname(curdir)] sys.path += [curdir, os.path.dirname(curdir)]
import utils import utils
from log import log from log import log
import proto_common from ts6_common import parseArgs, removeClient, _send
from ts6_common import handle_quit, handle_part, handle_nick, handle_kill
from classes import * from classes import *
casemapping = 'ascii' casemapping = 'ascii'
@ -28,9 +29,6 @@ def pingServer(irc, source=None, target=None):
if not (target is None or source is None): if not (target is None or source is None):
_send(irc, source, 'PING %s %s' % (irc.servers[source].name, irc.servers[target].name)) _send(irc, source, 'PING %s %s' % (irc.servers[source].name, irc.servers[target].name))
def _send(irc, sid, msg):
irc.send(':%s %s' % (sid, msg))
def connect(irc): def connect(irc):
ts = irc.start_ts ts = irc.start_ts
irc.caps = [] irc.caps = []
@ -47,6 +45,7 @@ def connect(irc):
# VL - Sends version string in below SERVER message # VL - Sends version string in below SERVER message
# UMODE2 - used for users setting modes on themselves (one less argument needed) # UMODE2 - used for users setting modes on themselves (one less argument needed)
# EAUTH - Early auth? (Unreal 3.4 linking protocol) # EAUTH - Early auth? (Unreal 3.4 linking protocol)
# ~~NICKIP - sends the IP in the NICK/UID command~~ Doesn't work with SID/UID support
f('PROTOCTL SJ3 NOQUIT NICKv2 VL UMODE2 PROTOCTL EAUTH=%s SID=%s' % (irc.serverdata["hostname"], irc.sid)) f('PROTOCTL SJ3 NOQUIT NICKv2 VL UMODE2 PROTOCTL EAUTH=%s SID=%s' % (irc.serverdata["hostname"], irc.sid))
sdesc = irc.serverdata.get('serverdesc') or irc.botdata['serverdesc'] sdesc = irc.serverdata.get('serverdesc') or irc.botdata['serverdesc']
f('SERVER %s 1 U%s-h6e-%s :%s' % (host, proto_ver, irc.sid, sdesc)) f('SERVER %s 1 U%s-h6e-%s :%s' % (host, proto_ver, irc.sid, sdesc))
@ -124,7 +123,7 @@ def handle_events(irc, data):
# <- @servernumeric SJOIN <ts> <chname> [<modes>] [<mode para> ...] :<[[*~@%+]member] [&"ban/except] ...> # <- @servernumeric SJOIN <ts> <chname> [<modes>] [<mode para> ...] :<[[*~@%+]member] [&"ban/except] ...>
# Same deal as TS6 with :'s indicating a long argument lasting to the # Same deal as TS6 with :'s indicating a long argument lasting to the
# end of the line. # end of the line.
args = proto_common.parseArgs(data.split(" ")) args = parseArgs(data.split(" "))
# Message starts with a SID/UID prefix. # Message starts with a SID/UID prefix.
if args[0][0] in ':@': if args[0][0] in ':@':
numeric = args[0].lstrip(':@') numeric = args[0].lstrip(':@')