Пример #1
0
 def testJoin(self):
     st = irclib.IrcState()
     st.addMsg(self.irc, ircmsgs.join('#foo', prefix=self.irc.prefix))
     self.failUnless('#foo' in st.channels)
     self.failUnless(self.irc.nick in st.channels['#foo'].users)
     st.addMsg(self.irc, ircmsgs.join('#foo', prefix='foo!bar@baz'))
     self.failUnless('foo' in st.channels['#foo'].users)
     st2 = st.copy()
     st.addMsg(self.irc, ircmsgs.quit(prefix='foo!bar@baz'))
     self.failIf('foo' in st.channels['#foo'].users)
     self.failUnless('foo' in st2.channels['#foo'].users)
Пример #2
0
 def testJoin(self):
     st = irclib.IrcState()
     st.addMsg(self.irc, ircmsgs.join('#foo', prefix=self.irc.prefix))
     self.failUnless('#foo' in st.channels)
     self.failUnless(self.irc.nick in st.channels['#foo'].users)
     st.addMsg(self.irc, ircmsgs.join('#foo', prefix='foo!bar@baz'))
     self.failUnless('foo' in st.channels['#foo'].users)
     st2 = st.copy()
     st.addMsg(self.irc, ircmsgs.quit(prefix='foo!bar@baz'))
     self.failIf('foo' in st.channels['#foo'].users)
     self.failUnless('foo' in st2.channels['#foo'].users)
Пример #3
0
    def quit(self, irc, msg, args, text):
        """[<text>]

        Exits the bot with the QUIT message <text>.  If <text> is not given,
        the default quit message (supybot.plugins.Owner.quitMsg) will be used.
        If there is no default quitMsg set, your nick will be used.
        """
        text = text or self.registryValue('quitMsg') or msg.nick
        irc.noReply()
        m = ircmsgs.quit(text)
        world.upkeep()
        for irc in world.ircs[:]:
            irc.queueMsg(m)
            irc.die()
Пример #4
0
    def reconnect(self, irc, msg, args, otherIrc, quitMsg):
        """[<network>] [<quit message>]

        Disconnects and then reconnects to <network>.  If no network is given,
        disconnects and then reconnects to the network the command was given
        on.  If no quit message is given, uses the configured one
        (supybot.plugins.Owner.quitMsg) or the nick of the person giving the
        command.
        """
        quitMsg = quitMsg or conf.supybot.plugins.Owner.quitMsg() or msg.nick
        otherIrc.queueMsg(ircmsgs.quit(quitMsg))
        if otherIrc != irc:
            # No need to reply if we're reconnecting ourselves.
            irc.replySuccess()
Пример #5
0
    def reconnect(self, irc, msg, args, otherIrc, quitMsg):
        """[<network>] [<quit message>]

        Disconnects and then reconnects to <network>.  If no network is given,
        disconnects and then reconnects to the network the command was given
        on.  If no quit message is given, uses the configured one
        (supybot.plugins.Owner.quitMsg) or the nick of the person giving the
        command.
        """
        quitMsg = quitMsg or conf.supybot.plugins.Owner.quitMsg() or msg.nick
        otherIrc.queueMsg(ircmsgs.quit(quitMsg))
        if otherIrc != irc:
            # No need to reply if we're reconnecting ourselves.
            irc.replySuccess()
Пример #6
0
    def disconnect(self, irc, msg, args, otherIrc, quitMsg):
        """[<network>] [<quit message>]

        Disconnects from the network represented by the network <network>.
        If <quit message> is given, quits the network with the given quit
        message.  <network> is only necessary if the network is different
        from the network the command is sent on.
        """
        quitMsg = quitMsg or conf.supybot.plugins.Owner.quitMsg() or msg.nick
        otherIrc.queueMsg(ircmsgs.quit(quitMsg))
        otherIrc.die()
        conf.supybot.networks().discard(otherIrc.network)
        if otherIrc != irc:
            irc.replySuccess(_("Disconnection to %s initiated.") % otherIrc.network)
Пример #7
0
    def quit(self, irc, msg, args, text):
        """[<text>]

        Exits the bot with the QUIT message <text>.  If <text> is not given,
        the default quit message (supybot.plugins.Owner.quitMsg) will be used.
        If there is no default quitMsg set, your nick will be used.
        """
        text = text or self.registryValue('quitMsg') or msg.nick
        irc.noReply()
        m = ircmsgs.quit(text)
        world.upkeep()
        for irc in world.ircs[:]:
            irc.queueMsg(m)
            irc.die()
Пример #8
0
    def disconnect(self, irc, msg, args, otherIrc, quitMsg):
        """[<network>] [<quit message>]

        Disconnects from the network represented by the network <network>.
        If <quit message> is given, quits the network with the given quit
        message.  <network> is only necessary if the network is different
        from the network the command is sent on.
        """
        quitMsg = quitMsg or conf.supybot.plugins.Owner.quitMsg() or msg.nick
        otherIrc.queueMsg(ircmsgs.quit(quitMsg))
        otherIrc.die()
        conf.supybot.networks().discard(otherIrc.network)
        if otherIrc != irc:
            irc.replySuccess('Disconnection to %s initiated.' %
                             otherIrc.network)
Пример #9
0
    def quit(self, irc, msg, args, text):
        """[<text>]

        Exits the bot with the QUIT message <text>.  If <text> is not given,
        the default quit message (supybot.plugins.Owner.quitMsg) will be used.
        If there is no default quitMsg set, your nick will be used. The standard
        substitutions ($version, $nick, etc.) are all handled appropriately.
        """
        text = text or self.registryValue('quitMsg') or msg.nick
        text = ircutils.standardSubstitute(irc, msg, text)
        irc.noReply()
        m = ircmsgs.quit(text)
        world.upkeep()
        for irc in world.ircs[:]:
            irc.queueMsg(m)
            irc.die()
Пример #10
0
    def quit(self, irc, msg, args, text):
        """[<text>]

        Exits the bot with the QUIT message <text>.  If <text> is not given,
        the default quit message (supybot.plugins.Owner.quitMsg) will be used.
        If there is no default quitMsg set, your nick will be used. The standard
        substitutions ($version, $nick, etc.) are all handled appropriately.
        """
        text = text or self.registryValue('quitMsg') or msg.nick
        text = ircutils.standardSubstitute(irc, msg, text)
        irc.noReply()
        m = ircmsgs.quit(text)
        world.upkeep()
        for irc in world.ircs[:]:
            irc.queueMsg(m)
            irc.die()
Пример #11
0
    def disconnect(self, irc, msg, args, otherIrc, quitMsg):
        """<network> [<quit message>]

        Disconnects from the network represented by the network <network>.
        If <quit message> is given, quits the network with the given quit
        message.
        """
        standard_msg = conf.supybot.plugins.Owner.quitMsg()
        if standard_msg:
            standard_msg = ircutils.standardSubstitute(irc, msg, standard_msg)
        quitMsg = quitMsg or standard_msg or msg.nick
        otherIrc.queueMsg(ircmsgs.quit(quitMsg))
        otherIrc.die()
        conf.supybot.networks().discard(otherIrc.network)
        if otherIrc != irc:
            irc.replySuccess(
                _('Disconnection to %s initiated.') % otherIrc.network)
 def testOuit(self):
     self.prefix = '[email protected]'
     self.irc.feedMsg(msg=ircmsgs.quit(prefix=self.prefix))
     self.assertRegexp('gpg ident', 'not identified')
     chan = irclib.ChannelState()
Пример #13
0
 def testQuit(self):
     self.failUnless(ircmsgs.quit(prefix='foo!bar@baz'))
Пример #14
0
 def testOuit(self):
     self.prefix = '[email protected]'
     self.irc.feedMsg(msg=ircmsgs.quit(prefix=self.prefix))
     self.assertRegexp('gpg ident', 'not identified')
     chan = irclib.ChannelState()
Пример #15
0
 def testQuit(self):
     self.assertTrue(ircmsgs.quit(prefix='foo!bar@baz'))
Пример #16
0
 def testOuit(self):
     self.prefix = "[email protected]"
     self.irc.feedMsg(msg=ircmsgs.quit(prefix=self.prefix))
     self.assertRegexp("gpg ident", "not identified")
     chan = irclib.ChannelState()
Пример #17
0
 def testQuit(self):
     self.failUnless(ircmsgs.quit(prefix='foo!bar@baz'))