3
0
mirror of https://github.com/jlu5/PyLink.git synced 2025-01-11 20:52:42 +01:00

core: convert IrcUser calls to User

This commit is contained in:
James Lu 2017-06-30 21:44:31 -07:00
parent b81a03fda9
commit a204d2b2db
9 changed files with 18 additions and 19 deletions

View File

@ -58,7 +58,7 @@ def spawn_service(irc, source, command, args):
userobj = irc.spawn_client(nick, ident, host, modes=modes, opertype="PyLink Service",
manipulatable=sbot.manipulatable)
# Store the service name in the IrcUser object for easier access.
# Store the service name in the User object for easier access.
userobj.service = name
sbot.uids[irc.name] = u = userobj.uid

View File

@ -18,7 +18,7 @@ def hook_privmsg(irc, source, command, args):
channel = args['target']
text = args['text']
# irc.pseudoclient stores the IrcUser object of the main PyLink client.
# irc.pseudoclient stores the User object of the main PyLink client.
# (i.e. the user defined in the bot: section of the config)
if utils.isChannel(channel) and irc.pseudoclient.nick in text:
irc.msg(channel, 'hi there!')

View File

@ -4,7 +4,7 @@ import base64
from pylinkirc import utils, conf
from pylinkirc.log import log
from pylinkirc.classes import Protocol, IrcUser, IrcServer, ProtocolError
from pylinkirc.classes import Protocol, User, IrcServer, ProtocolError
FALLBACK_REALNAME = 'PyLink Relay Mirror Client'
COMMON_PREFIXMODES = [('h', 'halfop'), ('a', 'admin'), ('q', 'owner'), ('y', 'owner')]
@ -109,7 +109,7 @@ class ClientbotWrapperProtocol(IRCCommonProtocol):
ts = ts or int(time.time())
log.debug('(%s) spawn_client stub called, saving nick %s as PUID %s', self.name, nick, uid)
u = self.users[uid] = IrcUser(nick, ts, uid, server, ident=ident, host=host, realname=realname,
u = self.users[uid] = User(nick, ts, uid, server, ident=ident, host=host, realname=realname,
manipulatable=manipulatable, realhost=realhost, ip=ip)
self.servers[server].users.add(uid)

View File

@ -105,7 +105,7 @@ class HybridProtocol(TS6Protocol):
realname = realname or conf.conf['bot']['realname']
realhost = realhost or host
raw_modes = self.join_modes(modes)
u = self.users[uid] = IrcUser(nick, ts, uid, server, ident=ident, host=host, realname=realname,
u = self.users[uid] = User(nick, ts, uid, server, ident=ident, host=host, realname=realname,
realhost=realhost, ip=ip, manipulatable=manipulatable)
self.apply_modes(uid, modes)
self.servers[server].users.add(uid)
@ -177,7 +177,7 @@ class HybridProtocol(TS6Protocol):
'host=%s realname=%s ip=%s', self.name, nick, ts, uid,
ident, host, realname, ip)
self.users[uid] = IrcUser(nick, ts, uid, numeric, ident, host, realname, host, ip)
self.users[uid] = User(nick, ts, uid, numeric, ident, host, realname, host, ip)
parsedmodes = self.parse_modes(uid, [modes])
log.debug('(%s) handle_uid: Applying modes %s for %s', self.name, parsedmodes, uid)

View File

@ -53,7 +53,7 @@ class InspIRCdProtocol(TS6BaseProtocol):
realname = realname or conf.conf['bot']['realname']
realhost = realhost or host
raw_modes = self.join_modes(modes)
u = self.users[uid] = IrcUser(nick, ts, uid, server, ident=ident, host=host, realname=realname,
u = self.users[uid] = User(nick, ts, uid, server, ident=ident, host=host, realname=realname,
realhost=realhost, ip=ip, manipulatable=manipulatable, opertype=opertype)
self.apply_modes(uid, modes)
@ -163,7 +163,7 @@ class InspIRCdProtocol(TS6BaseProtocol):
recognize ANY non-burst oper ups.
Plugins don't have to call this function themselves, but they can
set the opertype attribute of an IrcUser object (in self.users),
set the opertype attribute of an User object (in self.users),
and the change will be reflected here."""
userobj = self.users[target]
try:
@ -577,7 +577,7 @@ class InspIRCdProtocol(TS6BaseProtocol):
uid, ts, nick, realhost, host, ident, ip = args[0:7]
self.check_nick_collision(nick)
realname = args[-1]
self.users[uid] = userobj = IrcUser(nick, ts, uid, numeric, ident, host, realname, realhost, ip)
self.users[uid] = userobj = User(nick, ts, uid, numeric, ident, host, realname, realhost, ip)
parsedmodes = self.parse_modes(uid, [args[8], args[9]])
self.apply_modes(uid, parsedmodes)

View File

@ -275,10 +275,9 @@ class P10Protocol(IRCS2SProtocol):
realhost = realhost or host
raw_modes = self.join_modes(modes)
# Initialize an IrcUser instance
u = self.users[uid] = IrcUser(nick, ts, uid, server, ident=ident, host=host, realname=realname,
realhost=realhost, ip=ip, manipulatable=manipulatable,
opertype=opertype)
# Initialize an User instance
u = self.users[uid] = User(nick, ts, uid, server, ident=ident, host=host, realname=realname,
realhost=realhost, ip=ip, manipulatable=manipulatable, opertype=opertype)
# Fill in modes and add it to our users index
self.apply_modes(uid, modes)
@ -856,7 +855,7 @@ class P10Protocol(IRCS2SProtocol):
'host=%s realname=%s realhost=%s ip=%s', self.name, nick, ts, uid,
ident, host, realname, realhost, ip)
uobj = self.users[uid] = IrcUser(nick, ts, uid, source, ident, host, realname, realhost, ip)
uobj = self.users[uid] = User(nick, ts, uid, source, ident, host, realname, realhost, ip)
self.servers[source].users.add(uid)
# https://github.com/evilnet/nefarious2/blob/master/doc/p10.txt#L708

View File

@ -66,7 +66,7 @@ class RatboxProtocol(TS6Protocol):
orig_realhost = realhost
realhost = realhost or host
u = self.users[uid] = IrcUser(nick, ts, uid, server, ident=ident, host=host, realname=realname,
u = self.users[uid] = User(nick, ts, uid, server, ident=ident, host=host, realname=realname,
realhost=realhost, ip=ip, manipulatable=manipulatable)
self.apply_modes(uid, modes)
self.servers[server].users.add(uid)

View File

@ -50,7 +50,7 @@ class TS6Protocol(TS6BaseProtocol):
realname = realname or conf.conf['bot']['realname']
realhost = realhost or host
raw_modes = self.join_modes(modes)
u = self.users[uid] = IrcUser(nick, ts, uid, server, ident=ident, host=host, realname=realname,
u = self.users[uid] = User(nick, ts, uid, server, ident=ident, host=host, realname=realname,
realhost=realhost, ip=ip, manipulatable=manipulatable, opertype=opertype)
self.apply_modes(uid, modes)
@ -512,7 +512,7 @@ class TS6Protocol(TS6BaseProtocol):
if ip == '0': # IP was invalid; something used for services.
ip = '0.0.0.0'
self.users[uid] = IrcUser(nick, ts, uid, numeric, ident, host, realname, realhost, ip)
self.users[uid] = User(nick, ts, uid, numeric, ident, host, realname, realhost, ip)
parsedmodes = self.parse_modes(uid, [modes])
log.debug('Applying modes %s for %s', parsedmodes, uid)

View File

@ -82,7 +82,7 @@ class UnrealProtocol(TS6BaseProtocol):
modes |= {('+x', None), ('+t', None)}
raw_modes = self.join_modes(modes)
u = self.users[uid] = IrcUser(nick, ts, uid, server, ident=ident, host=host, realname=realname,
u = self.users[uid] = User(nick, ts, uid, server, ident=ident, host=host, realname=realname,
realhost=realhost, ip=ip, manipulatable=manipulatable, opertype=opertype)
self.apply_modes(uid, modes)
self.servers[server].users.add(uid)
@ -418,7 +418,7 @@ class UnrealProtocol(TS6BaseProtocol):
realname = args[-1]
self.users[uid] = IrcUser(nick, ts, uid, numeric, ident, host, realname, realhost, ip)
self.users[uid] = User(nick, ts, uid, numeric, ident, host, realname, realhost, ip)
self.servers[numeric].users.add(uid)
# Handle user modes