mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-11-27 13:19:24 +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:
|
else:
|
||||||
network = self._getIrcName(irc)
|
network = self._getIrcName(irc)
|
||||||
s = self._formatPrivmsg(msg.nick, network, msg)
|
s = self._formatPrivmsg(msg.nick, network, msg)
|
||||||
m = ircmsgs.privmsg(channel, s)
|
m = self._msgmaker(channel, s)
|
||||||
self._sendToOthers(irc, m)
|
self._sendToOthers(irc, m)
|
||||||
|
|
||||||
_noticeCommands = sets.Set([
|
|
||||||
'JOIN',
|
|
||||||
'PART',
|
|
||||||
'QUIT',
|
|
||||||
'NICK',
|
|
||||||
'MODE',
|
|
||||||
'KICK',
|
|
||||||
'TOPIC',
|
|
||||||
'ERROR',
|
|
||||||
])
|
|
||||||
def _msgmaker(self, target, s):
|
def _msgmaker(self, target, s):
|
||||||
msg = dynamic.msg
|
msg = dynamic.msg
|
||||||
channel = dynamic.channel
|
channel = dynamic.channel
|
||||||
if self.registryValue('noticeNonPrivmsgs', dynamic.channel) and \
|
if self.registryValue('noticeNonPrivmsgs', dynamic.channel) and \
|
||||||
msg.command in self._noticeCommands:
|
msg.command != 'PRIVMSG':
|
||||||
return ircmsgs.notice(target, s)
|
return ircmsgs.notice(target, s)
|
||||||
else:
|
else:
|
||||||
return ircmsgs.privmsg(target, s)
|
return ircmsgs.privmsg(target, s)
|
||||||
@ -567,7 +557,7 @@ class Relay(callbacks.Privmsg):
|
|||||||
if channel in self.registryValue('channels'):
|
if channel in self.registryValue('channels'):
|
||||||
network = self._getIrcName(irc)
|
network = self._getIrcName(irc)
|
||||||
s = self._formatPrivmsg(irc.nick, network, msg)
|
s = self._formatPrivmsg(irc.nick, network, msg)
|
||||||
relayMsg = ircmsgs.privmsg(channel, s)
|
relayMsg = self._msgmaker(channel, s)
|
||||||
self._sendToOthers(irc, relayMsg)
|
self._sendToOthers(irc, relayMsg)
|
||||||
return msg
|
return msg
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user