3
0
mirror of https://github.com/jlu5/PyLink.git synced 2024-11-01 09:19:23 +01:00

coremods: migrate irc.proto calls to irc

This commit is contained in:
James Lu 2017-06-25 02:06:49 -07:00
parent 7814914a05
commit 748c1bc158
2 changed files with 6 additions and 6 deletions

View File

@ -11,7 +11,7 @@ def handle_whois(irc, source, command, args):
target = args['target'] target = args['target']
user = irc.users.get(target) user = irc.users.get(target)
f = lambda num, source, text: irc.proto.numeric(irc.sid, num, source, text) f = lambda num, source, text: irc.numeric(irc.sid, num, source, text)
# Get the server that the target is on. # Get the server that the target is on.
server = irc.getServer(target) server = irc.getServer(target)
@ -118,7 +118,7 @@ def handle_mode(irc, source, command, args):
# client, revert any forced deoper attempts. # client, revert any forced deoper attempts.
if irc.isInternalClient(target) and not irc.isInternalClient(source): if irc.isInternalClient(target) and not irc.isInternalClient(source):
if ('-o', None) in modes and (target == irc.pseudoclient.uid or not irc.isManipulatableClient(target)): if ('-o', None) in modes and (target == irc.pseudoclient.uid or not irc.isManipulatableClient(target)):
irc.proto.mode(irc.sid, target, {('+o', None)}) irc.mode(irc.sid, target, {('+o', None)})
utils.add_hook(handle_mode, 'MODE') utils.add_hook(handle_mode, 'MODE')
def handle_operup(irc, source, command, args): def handle_operup(irc, source, command, args):
@ -143,11 +143,11 @@ def handle_version(irc, source, command, args):
"""Handles requests for the PyLink server version.""" """Handles requests for the PyLink server version."""
# 351 syntax is usually "<server version>. <server hostname> :<anything else you want to add> # 351 syntax is usually "<server version>. <server hostname> :<anything else you want to add>
fullversion = irc.version() fullversion = irc.version()
irc.proto.numeric(irc.sid, 351, source, fullversion) irc.numeric(irc.sid, 351, source, fullversion)
utils.add_hook(handle_version, 'VERSION') utils.add_hook(handle_version, 'VERSION')
def handle_time(irc, source, command, args): def handle_time(irc, source, command, args):
"""Handles requests for the PyLink server time.""" """Handles requests for the PyLink server time."""
timestring = time.ctime() timestring = time.ctime()
irc.proto.numeric(irc.sid, 391, source, '%s :%s' % (irc.hostname(), timestring)) irc.numeric(irc.sid, 391, source, '%s :%s' % (irc.hostname(), timestring))
utils.add_hook(handle_time, 'TIME') utils.add_hook(handle_time, 'TIME')

View File

@ -14,7 +14,7 @@ def spawn_service(irc, source, command, args):
# Service name # Service name
name = args['name'] name = args['name']
if name != 'pylink' and not irc.proto.hasCap('can-spawn-clients'): if name != 'pylink' and not irc.hasCap('can-spawn-clients'):
log.debug("(%s) Not spawning service %s because the server doesn't support spawning clients", log.debug("(%s) Not spawning service %s because the server doesn't support spawning clients",
irc.name, name) irc.name, name)
return return
@ -55,7 +55,7 @@ def spawn_service(irc, source, command, args):
userobj = irc.users[u] userobj = irc.users[u]
else: else:
log.debug('(%s) spawn_service: Spawning new client %s', irc.name, nick) log.debug('(%s) spawn_service: Spawning new client %s', irc.name, nick)
userobj = irc.proto.spawnClient(nick, ident, host, modes=modes, opertype="PyLink Service", userobj = irc.spawnClient(nick, ident, host, modes=modes, opertype="PyLink Service",
manipulatable=sbot.manipulatable) manipulatable=sbot.manipulatable)
# Store the service name in the IrcUser object for easier access. # Store the service name in the IrcUser object for easier access.