mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-11-27 05:09:23 +01:00
Cleaner implementation of noticeNonPrivmsgs. You'd think the variable name would've clued me in.
This commit is contained in:
parent
c350baa2ae
commit
094e2c15e0
@ -422,24 +422,14 @@ class Relay(callbacks.Privmsg):
|
||||
else:
|
||||
network = self._getIrcName(irc)
|
||||
s = self._formatPrivmsg(msg.nick, network, msg)
|
||||
m = ircmsgs.privmsg(channel, s)
|
||||
m = self._msgmaker(channel, s)
|
||||
self._sendToOthers(irc, m)
|
||||
|
||||
_noticeCommands = sets.Set([
|
||||
'JOIN',
|
||||
'PART',
|
||||
'QUIT',
|
||||
'NICK',
|
||||
'MODE',
|
||||
'KICK',
|
||||
'TOPIC',
|
||||
'ERROR',
|
||||
])
|
||||
def _msgmaker(self, target, s):
|
||||
msg = dynamic.msg
|
||||
channel = dynamic.channel
|
||||
if self.registryValue('noticeNonPrivmsgs', dynamic.channel) and \
|
||||
msg.command in self._noticeCommands:
|
||||
msg.command != 'PRIVMSG':
|
||||
return ircmsgs.notice(target, s)
|
||||
else:
|
||||
return ircmsgs.privmsg(target, s)
|
||||
@ -567,7 +557,7 @@ class Relay(callbacks.Privmsg):
|
||||
if channel in self.registryValue('channels'):
|
||||
network = self._getIrcName(irc)
|
||||
s = self._formatPrivmsg(irc.nick, network, msg)
|
||||
relayMsg = ircmsgs.privmsg(channel, s)
|
||||
relayMsg = self._msgmaker(channel, s)
|
||||
self._sendToOthers(irc, relayMsg)
|
||||
return msg
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user