mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-12-23 03:02:52 +01:00
Removed reply.withPrivate notice, replaced with two separate variables, reply.withNotice and reply.inPrivate.
This commit is contained in:
parent
efc34691bf
commit
3fa477dc90
@ -1,3 +1,7 @@
|
||||
* Removed supybot.reply.withPrivateNotice and split it into two
|
||||
separate configuration variables, supybot.reply.withNotice and
|
||||
supybot.reply.inPrivate.
|
||||
|
||||
* Added supybot.log.stdout.wrap, to allow optional (defaulting to
|
||||
True) wrapping of stdout logs.
|
||||
|
||||
|
@ -127,34 +127,32 @@ def reply(msg, s, prefixName=True, private=None,
|
||||
notice=None, to=None, action=None):
|
||||
# Ok, let's make the target:
|
||||
target = ircutils.replyTo(msg)
|
||||
if notice is None:
|
||||
notice = conf.supybot.reply.withNotice()
|
||||
if private is None:
|
||||
private = conf.supybot.reply.inPrivate()
|
||||
if private:
|
||||
prefixName = False
|
||||
if to is not None:
|
||||
target = to
|
||||
else:
|
||||
if to is None:
|
||||
target = msg.nick
|
||||
# XXX: User value.
|
||||
if conf.supybot.reply.withNoticeWhenPrivate() and notice is None:
|
||||
notice = True
|
||||
else:
|
||||
target = to
|
||||
# XXX: User value for reply.withNoticeWhenPrivate.
|
||||
if to is None:
|
||||
to = msg.nick
|
||||
# Ok, now let's make the payload:
|
||||
s = ircutils.safeArgument(s)
|
||||
if not s and not action:
|
||||
s = 'Error: I tried to send you an empty message.'
|
||||
# Let's may sure we don't do, "#channel: foo.".
|
||||
if prefixName and ircutils.isChannel(target):
|
||||
# Let's may sure we don't do, "#channel: foo.".
|
||||
if not ircutils.isChannel(to):
|
||||
s = '%s: %s' % (to, s)
|
||||
# And now, let's decide whether it's a PRIVMSG or a NOTICE.
|
||||
msgmaker = ircmsgs.privmsg
|
||||
if notice:
|
||||
msgmaker = ircmsgs.notice
|
||||
if conf.supybot.reply.withPrivateNotice():
|
||||
if private is None:
|
||||
target = msg.nick
|
||||
if notice is None:
|
||||
msgmaker = ircmsgs.notice
|
||||
# We don't use elif here because actions can't be sent as NOTICEs.
|
||||
if action:
|
||||
msgmaker = ircmsgs.action
|
||||
# Finally, we'll return the actual message.
|
||||
|
@ -458,9 +458,11 @@ class WithPrivateNoticeTestCase(ChannelPluginTestCase):
|
||||
self.failIf(m.command == 'NOTICE')
|
||||
self.failUnless(ircutils.isChannel(m.args[0]))
|
||||
# Check abnormal behavior.
|
||||
original = conf.supybot.reply.withPrivateNotice()
|
||||
originalInPrivate = conf.supybot.reply.inPrivate()
|
||||
originalWithNotice = conf.supybot.reply.withNotice()
|
||||
try:
|
||||
conf.supybot.reply.withPrivateNotice.setValue(True)
|
||||
conf.supybot.reply.inPrivate.setValue(True)
|
||||
conf.supybot.reply.withNotice.setValue(True)
|
||||
m = self.assertNotError('normal')
|
||||
self.failUnless(m.command == 'NOTICE')
|
||||
self.failIf(ircutils.isChannel(m.args[0]))
|
||||
@ -468,7 +470,8 @@ class WithPrivateNoticeTestCase(ChannelPluginTestCase):
|
||||
self.failIf(m.command == 'NOTICE')
|
||||
self.failUnless(ircutils.isChannel(m.args[0]))
|
||||
finally:
|
||||
conf.supybot.reply.withPrivateNotice.setValue(original)
|
||||
conf.supybot.reply.inPrivate.setValue(originalInPrivate)
|
||||
conf.supybot.reply.withNotice.setValue(originalWithNotice)
|
||||
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user