Ejemplo n.º 1
0
    def DoAnnouncements(self, curTime):
        nextDay = curTime + (3600 * 24)
        firstFr = self.Date_FFIM(curTime)
        aTime = self.Date_NextAnnouncement(firstFr)
        fTime = self.Date_NextFeedback(firstFr)

        #lt = ctime
        #tmsg = privmsg(self.sendChannel, "atime: %s ftime: %s nextday: %s firstdo: %s curtime: %s" % (lt(aTime), lt(fTime), lt(nextDay), lt(mktime(firstFr)), lt(curTime)))
        #self.irc.queueMsg(tmsg)
        if (aTime <= curTime) and (curTime <= nextDay) and (fTime > curTime):
            if not self.topicAnnounced:
                n_firstFr = self.Date_FFIM(curTime + 3600 * 24 * 3)
                showDate = ctime(mktime(n_firstFr) - 3600)
                mts = self.msgSeparator.join(["Next show: %s (%s)" % (self.nextSendung, showDate)] + self.miscStuff)
                tmsg = topic(self.sendChannel, mts)
                self.irc.queueMsg(tmsg)
                self.topicAnnounced = True
        elif (fTime <= curTime) and (curTime <= nextDay):
            if not self.feedbackAnnounced:
                n_firstFr = self.Date_FFIM(curTime + 3600 * 24 * 3)
                showDate = ctime(mktime(n_firstFr) - 3600)
                mts = self.msgSeparator.join([self.feedbackMsg, "Next show %s" % showDate] + self.miscStuff)
                tmsg = topic(self.sendChannel, mts)
                self.irc.queueMsg(tmsg)
                self.feedbackAnnounced = True
                self.topicAnnounced = False
        else:
            self.feedbackAnnounced = False
            self.topicAnnounced = False
Ejemplo n.º 2
0
 def FCT_settopic(self, params):
     if not self.authed:
         self.s.sendall('503 auth first\n')
         return
     t_un = ''
     if len(params) < 1:
         tmsg = topic(self.plugin.sendChannel, ' ')
         t_un = 'un'
     else:
         mytopic = " | ".join(params)
         tmsg = topic(self.plugin.sendChannel, mytopic)
     self.plugin.irc.queueMsg(tmsg)
     self.s.sendall('200 topic %sset\n' % t_un)
Ejemplo n.º 3
0
 def topic_update(self):
     score = self.game.nice_score()
     quarter = self.get_quarter()
     topic = "%s - %s" % (score, quarter)
     if topic != self.topic:
         self.topic = topic
         self.irc.queueMsg(ircmsgs.topic(self.chan, self.topic))
Ejemplo n.º 4
0
 def _sendTopics(self, irc, channel, topics, isDo=False, fit=False):
     topics = [s for s in topics if s and not s.isspace()]
     self.lastTopics[channel] = topics
     newTopic = self._joinTopic(channel, topics)
     try:
         maxLen = irc.state.supported["topiclen"]
         if fit:
             while len(newTopic) > maxLen:
                 topics.pop(0)
                 self.lastTopics[channel] = topics
                 newTopic = self._joinTopic(channel, topics)
         elif len(newTopic) > maxLen:
             if self.registryValue("recognizeTopiclen", channel):
                 irc.error(
                     format(
                         _("That topic is too long for this " "server (maximum length: %i; this topic: " "%i)."),
                         maxLen,
                         len(newTopic),
                     ),
                     Raise=True,
                 )
     except KeyError:
         pass
     self._addUndo(channel, topics)
     if not isDo and channel in self.redos:
         del self.redos[channel]
     irc.queueMsg(ircmsgs.topic(channel, newTopic))
     irc.noReply()
Ejemplo n.º 5
0
 def _checkTopic(self):
     menu = self._menu()
     channels = self.registryValue('channels').split(',')
     for channel in channels:
         topic = self.irc.state.channels[channel].topic
         if topic != menu:
             self.irc.queueMsg(ircmsgs.topic(channel, menu))
Ejemplo n.º 6
0
 def _sendTopics(self, irc, channel, topics, isDo=False, fit=False):
     topics = [s for s in topics if s and not s.isspace()]
     self.lastTopics[channel] = topics
     newTopic = self._joinTopic(channel, topics)
     try:
         maxLen = irc.state.supported['topiclen']
         if fit:
             while len(newTopic) > maxLen:
                 topics.pop(0)
                 self.lastTopics[channel] = topics
                 newTopic = self._joinTopic(channel, topics)
         elif len(newTopic) > maxLen:
             if self.registryValue('recognizeTopiclen', channel):
                 irc.error(format(
                     'That topic is too long for this server '
                     '(maximum length: %i; this topic: %i).', maxLen,
                     len(newTopic)),
                           Raise=True)
     except KeyError:
         pass
     self._addUndo(channel, topics)
     if not isDo and channel in self.redos:
         del self.redos[channel]
     irc.queueMsg(ircmsgs.topic(channel, newTopic))
     irc.noReply()
Ejemplo n.º 7
0
    def doTopic(self, irc, msg):
        irc = self._getRealIrc(irc)
        (channel, newTopic) = msg.args
        if channel not in self.registryValue('channels'):
            return
        network = self._getIrcName(irc)
        if self.registryValue('topicSync', channel):
            m = ircmsgs.topic(channel, newTopic)
            for otherIrc in world.ircs:
                if irc != otherIrc:
                    try:
                        if otherIrc.state.getTopic(channel) != newTopic:
                            if (otherIrc, newTopic) not in self.queuedTopics:
                                self.queuedTopics.add((otherIrc, newTopic))
                                otherIrc.queueMsg(m)
                            else:
                                self.queuedTopics.remove((otherIrc, newTopic))

                    except KeyError:
                        self.log.warning('Not on %s on %s, '
                                         'can\'t sync topics.',
                                         channel, otherIrc.network)
        else:
            s = format(_('topic change by %s on %s: %s'),
                       msg.nick, network, newTopic)
            m = self._msgmaker(channel, s)
            self._sendToOthers(irc, m)
Ejemplo n.º 8
0
 def DoFinish(self):
     self.playing = None
     self.LogMessage(self.irc, "S", self.playing)
     mts = self.irc.state.channels[self.sendChannel].topic
     pos = mts.find(self.sendMsg)
     if pos != -1:
         mts = mts[0:pos]
         tmsg = topic(self.sendChannel, mts)
         self.irc.queueMsg(tmsg)
Ejemplo n.º 9
0
 def replace_topic(self, irc, channel, pattern, replacement):
     """
     Looks for pattern in channel topic and replaces it with replacement
     string.
     """
     curtopic = irc.state.getTopic(channel)
     newtopic = re.sub(pattern, lambda m: replacement, curtopic, count=1,
                       flags=re.IGNORECASE)
     irc.queueMsg(ircmsgs.topic(channel, newtopic))
Ejemplo n.º 10
0
 def _sendTopics(self, irc, channel, topics=None, isDo=False, fit=False):
     if isinstance(topics, list) or isinstance(topics, tuple):
         assert topics is not None
         topics = self._formatTopics(irc, channel, topics, fit)
     self._addUndo(irc, channel, topics)
     if not isDo and channel in self.redos:
         del self.redos[channel]
     irc.queueMsg(ircmsgs.topic(channel, topics))
     irc.noReply()
Ejemplo n.º 11
0
 def _sendTopics(self, irc, channel, topics=None, isDo=False, fit=False):
     if isinstance(topics, list) or isinstance(topics, tuple):
         assert topics is not None
         topics = self._formatTopics(irc, channel, topics, fit)
     self._addUndo(channel, topics)
     if not isDo and channel in self.redos:
         del self.redos[channel]
     irc.queueMsg(ircmsgs.topic(channel, topics))
     irc.noReply()
Ejemplo n.º 12
0
 def autotopics(self):
     for c in self.irc.state.channels:
         url = self.registryValue('url', c)
         if url and self.registryValue('doTopic', c):
             if url not in self.cache:
                 self.update(url)
             events = self.filter(self.cache[url], c)
             #if events[0].is_on() and self.firstevent[c].summary == events[0].summary:
             #    continue
             newtopic = self.maketopic(c, template=self.registryValue('topic',c))
             if newtopic.strip() != self.irc.state.getTopic(c).strip():
                 self.irc.queueMsg(ircmsgs.topic(c, newtopic))
Ejemplo n.º 13
0
    def joinedGameChannel(self, irc, channel_obj):
        """Called after a game-associated channel has been joined by the bot.

        The bot should setup the channel with ChanServ,
        set the topic, op bot admins and (TODO) log users
        in the channel."""

        if not self._game:
            return
        irc.queueMsg(ircmsgs.topic(channel_obj.name, channel_obj.topic))
        if channel_obj.name != self._game.lobby.name:
            self.register(irc,channel_obj.name)
Ejemplo n.º 14
0
    def activate(self, irc, msg, args, channel, trackID):
        """[<channel>] [<trackID>]

            Activate song in the playlist. If trackID is not
            specified, the next track in the queue is used."""

        if not self.Checkpriv(irc, msg, channel): return
        if not len(self.pl):
            irc.error("The playlist is empty! Add a song by calling 'add \"album\" \"title\"")
            return

        if not self.sendChannel in irc.state.channels:
            irc.error("I am not joined in %s" % self.sendChannel)
            return

        try:
            album, title = self.pl.pop(trackID)
            self.saved = False
        except:
            irc.error("Invalid ID. Issue !show to see all valid IDs")
            return

        self.playing[channel] = {"album": album, "title": title}
        self.LogMessage(irc, "M", (channel, self.playing))

        #mts = self.sendMsg % (title, album)
        #pmsg = privmsg(self.sendChannel, mts)
        #irc.queueMsg(pmsg)

        anChannel = self.registryValue('announcementChannel', channel)
        if (len(anChannel) < 1) or (anChannel[0] != '#'):
            for line in """No announcement channel is defined for this control channel.
This usually means that you're in the wrong channel or forgot to
configure an announcement channel.
Hint: for #c-radar, the control channel is #c-radar-intern ;)""".split("\n"): irc.error(line)
            return
        if not anChannel in irc.state.channels:
            irc.error("I'm not on channel %s, to which the announcements should go" % anChannel)
            return
        if irc.nick not in irc.state.channels[anChannel].ops:
            irc.error("I need to be opped in %s" % anChannel)
            return
        mts = irc.state.channels[anChannel].topic
        pos = mts.find(self.sendMsg)
        if pos != -1: mts = mts[0:pos]
        mts = mts + self.sendMsg + (self.titleFormat % self.playing)

        tmsg = topic(anChannel, mts)
        irc.queueMsg(tmsg)

        irc.replySuccess()
Ejemplo n.º 15
0
    def DoActivate(self):
        irc = self.irc
        self.LogMessage(irc, "M", self.playing)

        #mts = self.sendMsg % (title, album)
        #pmsg = privmsg(self.sendChannel, mts)
        #irc.queueMsg(pmsg)

        mts = irc.state.channels[self.sendChannel].topic
        pos = mts.find(self.sendMsg)
        if pos != -1: mts = mts[0:pos]
        mts = mts + self.sendMsg + (self.titleFormat % self.playing)

        tmsg = topic(self.sendChannel, mts)
        irc.queueMsg(tmsg)
Ejemplo n.º 16
0
    def start(self, irc, msg, args, channel):
        """[<channel>]
        
        Starts the meeting
        """

        # get the meeting id
        meeting_id = self._get_current(channel, 'meeting')
        if meeting_id is None:
            irc.error("No active meeting on channel %s" % channel)
            return

        # get the database
        db = self.getDb(channel)

        # get the meeting details       
        cursor = db.cursor()
        cursor.execute("""SELECT name, start_time, end_time
                          FROM meeting
                          WHERE id=?""", (meeting_id, ))

        results = cursor.fetchall()
        if len(results)==0:
            irc.error("This shouldn't happen... current meeting id %d invalid" % meeting_id)
            return
        
        meeting_name, start_time, end_time = results[0]
        
        # check for a current meeting and prevent starting it if it's in progress or adjourned
        if end_time is not None:
            irc.error("The meeting has already adjourned. Try preparing a new one.")
            return
        if start_time is not None:
            irc.error("This meeting has already started")
            return
        
        # mark the meeting as started
        cursor.execute("""UPDATE meeting
                          SET start_time=datetime('now')
                          WHERE id=? """, (meeting_id,))       
        db.commit()

        # initialise the agenda and motion pointers
        self._set_current(channel, 'agenda', None)
        self._set_current(channel, 'motion', None)

        irc.queueMsg(ircmsgs.topic(channel, meeting_name))
        irc.reply("The meeting has started. Meeting topic: %s (meeting id %d)" % (meeting_name, meeting_id))
Ejemplo n.º 17
0
def _context(plugin, irc, msg) -> interface.Context:
    """Create context for a command or message."""
    channel = msg.args[0]

    # noinspection PyShadowingNames
    def get_topic(irc, channel):
        return irc.state.channels[
            channel].topic if channel in irc.state.channels else ""

    return interface.Context(
        get_topic=lambda: get_topic(irc, channel),
        set_topic=lambda topic: irc.sendMsg(ircmsgs.topic(channel, topic)),
        send_reply=irc.reply
        if hasattr(irc, "reply") and callable(irc.reply) else lambda x: None,
        send_message=lambda message: irc.sendMsg(
            ircmsgs.privmsg(channel, message)),
    )
Ejemplo n.º 18
0
    def voicecommander(self, irc, msg, args):
        channel = msg.args[0]
        chan = irc.state.channels[channel]

        if msg.nick not in chan.users:
            self.log.info("User %s (%s) tried to use VoiceCommander without joined any channel.", \
                            msg.nick, irc.state.nickToHostmask(msg.nick))
            return

        if not chan.isVoice(msg.nick) and not chan.isOp(msg.nick):
            irc.error("You are missing capability: op or voice")
            return

        if (len(args) == 0):
            irc.reply("Usage: @voicecommander [topic] [voice] argument(s)")
            return

        cmd = args[0]

        self.randomdelay() # Mitigate against excess flooding

        # Ability to change topic
        if cmd.lower() == "topic":
            if len(args) < 2:
                irc.error("Ehh.. forgot something? Like.... topic?")
                return

            topic = ' '.join(args[1:])
            irc.queueMsg(ircmsgs.topic(channel, topic))

        # Ability to delegate voices
        elif cmd.lower() == "voice":
            if len(args) < 2:
                irc.error("Need nick as an argument, you fool")
                return

            for whom in args[1:]:
                #whom = args[1]
                if whom not in chan.users:
                    irc.reply("Nick '%s' not in channel %s" % (whom, channel))
                    return
                #if irc.nick in irc.state.channels[channel].voices:
                #    irc.reply("Nick '%s' already voiced" % (whom))
                #    return
                irc.queueMsg(ircmsgs.voice(channel, whom))
Ejemplo n.º 19
0
    def topic(self, irc, msg, args):
        """No args
        Updates the topics in the channel
        """
        c = msg.args[0]
        url = self.registryValue('url', c)
        if not url or not self.registryValue('doTopic',channel=c):
            return
        self.update(url)

        events = self.filter(self.cache[url], c)
        if events and events[0].is_on():
            irc.error("Won't update topic while a meeting is in progress")
            return
            
        newtopic = self.maketopic(c, template=self.registryValue('topic',c))
        if not (newtopic.strip() == irc.state.getTopic(c).strip()):
            irc.queueMsg(ircmsgs.topic(c, newtopic))
Ejemplo n.º 20
0
    def setlastnew(self, irc, msg, args):
        """

        setlastnew takes no parameter"""

        re_topic = re.compile(r"(.*)\s+\|\| last NEW ended:\s+\w{3} \d\d \d\d:\d\d UTC \d{4}(?:\s+\|\|\s+(.*))?")
        topic = irc.state.channels[self.channel].topic
        m = re_topic.match(topic)
        newtopic = ""
        if m:
            newtopic = "%s || %s" % (m.group(1),
                                     time.strftime("last NEW ended:  %b %d %H:%M UTC %Y", time.gmtime()))
            if m.group(2):
                newtopic += " || %s" % (m.group(2))
        else:
            # Woot, looks we never had this part in the topic yet
            newtopic = "%s || %s" % (topic,
                                     time.strftime("last NEW ended:  %b %d %H:%M UTC %Y", time.gmtime()))
        irc.queueMsg(ircmsgs.topic(self.channel, newtopic))
        irc.reply("Ok master")
Ejemplo n.º 21
0
    def finished(self, irc, msg, args, channel):
        """[<channel>]

            Mark a song as finished. Should be called as soon as a song if over."""

        if not self.Checkpriv(irc, msg, channel): return
        if self.playing == None:
            irc.error("No song is playing right now")
            return
        self.LogMessage(irc, "S", self.playing)
        self.playing = None

        mts = irc.state.channels[self.sendChannel].topic
        pos = mts.find(self.sendMsg)
        if pos != -1:
            mts = mts[0:pos]
            tmsg = topic(self.sendChannel, mts)
            irc.queueMsg(tmsg)

        irc.replySuccess()
Ejemplo n.º 22
0
 def run(self):
     while self.dorun:
         sleep(self.SLEEP_TIME)
         try:
             self.lock.acquire_lock()
             try: message = self.messages[0]
             except: continue
             try: atime, msg = message
             except:
                 print "Fatal error! Here's something terribly wrong. Dumping"
                 print "the structure..."
                 print repr(self.messages)
                 print "===== self.messages = [] ====="
                 self.messages = []
                 continue
             if atime < time():
                 tmsg = topic(self.channel, msg)
                 self.irc.queueMsg(tmsg)
                 del self.messages[0]
         finally: self.lock.release_lock()
Ejemplo n.º 23
0
 def run(self):
     for item in self.pubsub.listen():
         try:
             if item['type'] != 'message':
                 continue
             log.warning('{%s}' % item['data'][0:6])
             if item['channel'] == 'safehouse':
                 tokens = callbacks.tokenize(item['data'])
                 msg = ircmsgs.privmsg(self.to, item['data'], prefix=self.sender, msg=None)
                 self.plugin.Proxy(self.irc.irc, msg, tokens)
                 continue
             if lower(item['data'][0:7]) == '/topic ':
                 msg = ircmsgs.topic(item['channel'], item['data'][7:])
                 self.irc.queueMsg(msg)
                 continue
             msg = ircmsgs.privmsg(item['channel'], item['data'])
             self.irc.queueMsg(msg)
         # exceptions, sometimes you've gotta catch em all
         # supybot seemed to swallow mine
         #pylint: disable=W0703
         except Exception as error:
         #pylint: enable=W0703
             log.warning('Error sendering %s' % error)
Ejemplo n.º 24
0
    def adjourn(self, irc, msg, args, channel):
        """[<channel>]
        
        Adjourns the meeting
        """

        # get the meeting id
        meeting_id = self._get_current(channel, 'meeting')        
        if meeting_id is None:
            irc.error("No active meeting on channel %s" % channel)
            return

        # get the database
        db = self.getDb(channel)

        # get the meeting details       
        cursor = db.cursor()
        cursor.execute("""SELECT name
                          FROM meeting
                          WHERE id=?""", (meeting_id, ))

        results = cursor.fetchall()
        if len(results)==0:
            irc.error("This shouldn't happen... current meeting id %d invalid" % meeting_id)
            return
        
        meeting_name = results[0][0]
        
        # mark the meeting as ended
        cursor.execute("""UPDATE meeting
                          SET end_time=datetime('now')
                          WHERE id=? """, (meeting_id,))       
        db.commit()
                
        irc.queueMsg(ircmsgs.topic(channel, meeting_name))
        irc.reply("The meeting has adjourned. Meeting topic: %s (meeting id %d)" % (meeting_name, meeting_id))
Ejemplo n.º 25
0
 def _setTopic(self, irc, msg, descr, players):
     channel = msg.args[0]
     playersline = ", ".join(sorted(players, key=unicode.lower))
     topic = "%s | %d | %s" % (descr, len(players), playersline)
     irc.queueMsg(ircmsgs.topic(channel, topic.encode(ENCODING)))
Ejemplo n.º 26
0
class IrcMsgQueueTestCase(SupyTestCase):
    mode = ircmsgs.op('#foo', 'jemfinch')
    msg = ircmsgs.privmsg('#foo', 'hey, you')
    msgs = [ircmsgs.privmsg('#foo', str(i)) for i in range(10)]
    kick = ircmsgs.kick('#foo', 'PeterB')
    pong = ircmsgs.pong('123')
    ping = ircmsgs.ping('123')
    topic = ircmsgs.topic('#foo')
    notice = ircmsgs.notice('jemfinch', 'supybot here')
    join = ircmsgs.join('#foo')
    who = ircmsgs.who('#foo')

    def testInit(self):
        q = irclib.IrcMsgQueue([self.msg, self.topic, self.ping])
        self.assertEqual(len(q), 3)

    def testLen(self):
        q = irclib.IrcMsgQueue()
        q.enqueue(self.msg)
        self.assertEqual(len(q), 1)
        q.enqueue(self.mode)
        self.assertEqual(len(q), 2)
        q.enqueue(self.kick)
        self.assertEqual(len(q), 3)
        q.enqueue(self.topic)
        self.assertEqual(len(q), 4)
        q.dequeue()
        self.assertEqual(len(q), 3)
        q.dequeue()
        self.assertEqual(len(q), 2)
        q.dequeue()
        self.assertEqual(len(q), 1)
        q.dequeue()
        self.assertEqual(len(q), 0)

    def testContains(self):
        q = irclib.IrcMsgQueue()
        q.enqueue(self.msg)
        q.enqueue(self.msg)
        q.enqueue(self.msg)
        self.failUnless(self.msg in q)
        q.dequeue()
        self.failUnless(self.msg in q)
        q.dequeue()
        self.failUnless(self.msg in q)
        q.dequeue()
        self.failIf(self.msg in q)

    def testRepr(self):
        q = irclib.IrcMsgQueue()
        self.assertEqual(repr(q), 'IrcMsgQueue([])')
        q.enqueue(self.msg)
        try:
            repr(q)
        except Exception as e:
            self.fail('repr(q) raised an exception: %s' % utils.exnToString(e))

    def testEmpty(self):
        q = irclib.IrcMsgQueue()
        self.failIf(q)

    def testEnqueueDequeue(self):
        q = irclib.IrcMsgQueue()
        q.enqueue(self.msg)
        self.failUnless(q)
        self.assertEqual(self.msg, q.dequeue())
        self.failIf(q)
        q.enqueue(self.msg)
        q.enqueue(self.notice)
        self.assertEqual(self.msg, q.dequeue())
        self.assertEqual(self.notice, q.dequeue())
        for msg in self.msgs:
            q.enqueue(msg)
        for msg in self.msgs:
            self.assertEqual(msg, q.dequeue())

    def testPrioritizing(self):
        q = irclib.IrcMsgQueue()
        q.enqueue(self.msg)
        q.enqueue(self.mode)
        self.assertEqual(self.mode, q.dequeue())
        self.assertEqual(self.msg, q.dequeue())
        q.enqueue(self.msg)
        q.enqueue(self.kick)
        self.assertEqual(self.kick, q.dequeue())
        self.assertEqual(self.msg, q.dequeue())
        q.enqueue(self.ping)
        q.enqueue(self.msgs[0])
        q.enqueue(self.kick)
        q.enqueue(self.msgs[1])
        q.enqueue(self.mode)
        self.assertEqual(self.kick, q.dequeue())
        self.assertEqual(self.mode, q.dequeue())
        self.assertEqual(self.ping, q.dequeue())
        self.assertEqual(self.msgs[0], q.dequeue())
        self.assertEqual(self.msgs[1], q.dequeue())

    def testNoIdenticals(self):
        configVar = conf.supybot.protocols.irc.queuing.duplicates
        original = configVar()
        try:
            configVar.setValue(True)
            q = irclib.IrcMsgQueue()
            q.enqueue(self.msg)
            q.enqueue(self.msg)
            self.assertEqual(self.msg, q.dequeue())
            self.failIf(q)
        finally:
            configVar.setValue(original)

    def testJoinBeforeWho(self):
        q = irclib.IrcMsgQueue()
        q.enqueue(self.join)
        q.enqueue(self.who)
        self.assertEqual(self.join, q.dequeue())
        self.assertEqual(self.who, q.dequeue())


##         q.enqueue(self.who)
##         q.enqueue(self.join)
##         self.assertEqual(self.join, q.dequeue())
##         self.assertEqual(self.who, q.dequeue())

    def testTopicBeforePrivmsg(self):
        q = irclib.IrcMsgQueue()
        q.enqueue(self.msg)
        q.enqueue(self.topic)
        self.assertEqual(self.topic, q.dequeue())
        self.assertEqual(self.msg, q.dequeue())

    def testModeBeforePrivmsg(self):
        q = irclib.IrcMsgQueue()
        q.enqueue(self.msg)
        q.enqueue(self.mode)
        self.assertEqual(self.mode, q.dequeue())
        self.assertEqual(self.msg, q.dequeue())
        q.enqueue(self.mode)
        q.enqueue(self.msg)
        self.assertEqual(self.mode, q.dequeue())
        self.assertEqual(self.msg, q.dequeue())
Ejemplo n.º 27
0
 def testEmptyTopic(self):
     state = irclib.IrcState()
     state.addMsg(self.irc, ircmsgs.topic('#foo'))
Ejemplo n.º 28
0
 def testEmptyTopic(self):
     state = irclib.IrcState()
     state.addMsg(self.irc, ircmsgs.topic('#foo'))
Ejemplo n.º 29
0
 def _setTopic(x):
     irc.queueMsg(ircmsgs.topic(channel, x))
Ejemplo n.º 30
0
 def _setTopic(x):
     irc.sendMsg(ircmsgs.topic(channel, x))
Ejemplo n.º 31
0
 def SetTopic(self, topicToSet):
     if self.irc.state.channels[self.sendChannel].topic != topicToSet:
         tmsg = topic(self.sendChannel, topicToSet)
         self.irc.queueMsg(tmsg)
         self.topicAnnounced = True
Ejemplo n.º 32
0
 def _setTopic(x):
     irc.sendMsg(ircmsgs.topic(channel, x))