mirror of
https://github.com/jlu5/PyLink.git
synced 2024-12-25 04:02:45 +01:00
unreal: add NOTICE and PRIVMSG (inbound/outbound)
This commit is contained in:
parent
b63d7619da
commit
76246dea70
@ -8,7 +8,7 @@ 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
|
||||||
from ts6_common import parseArgs, removeClient, _send
|
from ts6_common import parseArgs, removeClient, _send, messageClient, noticeClient
|
||||||
from ts6_common import handle_quit, handle_part, handle_nick, handle_kill
|
from ts6_common import handle_quit, handle_part, handle_nick, handle_kill
|
||||||
from classes import *
|
from classes import *
|
||||||
|
|
||||||
@ -17,6 +17,8 @@ proto_ver = 2351
|
|||||||
|
|
||||||
hook_map = {}
|
hook_map = {}
|
||||||
|
|
||||||
|
### OUTGOING COMMAND FUNCTIONS
|
||||||
|
|
||||||
def spawnClient(irc, nick, ident='null', host='null', realhost=None, modes=set(),
|
def spawnClient(irc, 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=None):
|
||||||
server = server or irc.sid
|
server = server or irc.sid
|
||||||
@ -52,6 +54,8 @@ 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))
|
||||||
|
|
||||||
|
### HANDLERS
|
||||||
|
|
||||||
def connect(irc):
|
def connect(irc):
|
||||||
ts = irc.start_ts
|
ts = irc.start_ts
|
||||||
irc.caps = []
|
irc.caps = []
|
||||||
@ -196,6 +200,13 @@ def _sidToServer(irc, sname):
|
|||||||
if v.name.lower() == nick:
|
if v.name.lower() == nick:
|
||||||
return k
|
return k
|
||||||
|
|
||||||
|
def _convertNick(irc, target):
|
||||||
|
target = utils.nickToUid(irc, target) or target
|
||||||
|
if target not in irc.users:
|
||||||
|
log.warning("(%s) Possible desync? Got command target %s, who "
|
||||||
|
"isn't in our user list!")
|
||||||
|
return target
|
||||||
|
|
||||||
def handle_events(irc, data):
|
def handle_events(irc, data):
|
||||||
# Unreal's protocol has three styles of commands, @servernumeric, :user, and plain commands.
|
# Unreal's protocol has three styles of commands, @servernumeric, :user, and plain commands.
|
||||||
# e.g. NICK introduction looks like:
|
# e.g. NICK introduction looks like:
|
||||||
@ -229,3 +240,12 @@ def handle_events(irc, data):
|
|||||||
parsed_args = func(irc, numeric, command, args)
|
parsed_args = func(irc, numeric, command, args)
|
||||||
if parsed_args is not None:
|
if parsed_args is not None:
|
||||||
return [numeric, command, parsed_args]
|
return [numeric, command, parsed_args]
|
||||||
|
|
||||||
|
def handle_privmsg(irc, source, command, args):
|
||||||
|
# Convert nicks to UIDs, where they exist.
|
||||||
|
target = _convertNick(irc, args[0])
|
||||||
|
# We use lowercase channels internally, but uppercase UIDs.
|
||||||
|
if utils.isChannel(target):
|
||||||
|
target = utils.toLower(irc, target)
|
||||||
|
return {'target': target, 'text': args[1]}
|
||||||
|
handle_notice = handle_privmsg
|
||||||
|
Loading…
Reference in New Issue
Block a user