3
0
mirror of https://github.com/jlu5/PyLink.git synced 2025-01-12 05:02:33 +01:00

Clientbot: use a more specific realname fallback

(cherry picked from commit 288a2fffd7)

This is cherry-picked as a prerequisite for the next commit.
This commit is contained in:
James Lu 2016-10-07 21:08:55 -07:00
parent 9e6e30324f
commit eb64190228

View File

@ -6,6 +6,7 @@ from pylinkirc import utils, conf
from pylinkirc.log import log from pylinkirc.log import log
from pylinkirc.classes import Protocol, IrcUser, IrcServer from pylinkirc.classes import Protocol, IrcUser, IrcServer
FALLBACK_REALNAME = 'PyLink Relay Mirror Client'
COMMON_PREFIXMODES = [('h', 'halfop'), ('a', 'admin'), ('q', 'owner'), ('y', 'owner')] COMMON_PREFIXMODES = [('h', 'halfop'), ('a', 'admin'), ('q', 'owner'), ('y', 'owner')]
class ClientbotWrapperProtocol(Protocol): class ClientbotWrapperProtocol(Protocol):
@ -313,7 +314,7 @@ class ClientbotWrapperProtocol(Protocol):
if (not idsource) and self.irc.pseudoclient: if (not idsource) and self.irc.pseudoclient:
# We don't know the sender, so it most be new. # We don't know the sender, so it most be new.
idsource = self.spawnClient(nick, ident, host, server=self.irc.uplink).uid idsource = self.spawnClient(nick, ident, host, server=self.irc.uplink, realname=FALLBACK_REALNAME).uid
try: try:
func = getattr(self, 'handle_'+command.lower()) func = getattr(self, 'handle_'+command.lower())
@ -402,7 +403,7 @@ class ClientbotWrapperProtocol(Protocol):
# Get the PUID for the given nick. If one doesn't exist, spawn # Get the PUID for the given nick. If one doesn't exist, spawn
# a new virtual user. TODO: wait for WHO responses for each nick before # a new virtual user. TODO: wait for WHO responses for each nick before
# spawning in order to get a real ident/host. # spawning in order to get a real ident/host.
idsource = self.irc.nickToUid(nick) or self.spawnClient(nick, server=self.irc.uplink).uid idsource = self.irc.nickToUid(nick) or self.spawnClient(nick, server=self.irc.uplink, realname=FALLBACK_REALNAME).uid
# Queue these virtual users to be joined if they're not already in the channel, # Queue these virtual users to be joined if they're not already in the channel,
# or we're waiting for a kick acknowledgment for them. # or we're waiting for a kick acknowledgment for them.