예제 #1
0
파일: plugin.py 프로젝트: Kefkius/mazabot
 def doNickservNotice(self, irc, msg):
     nick = self._getNick()
     s = ircutils.stripFormatting(msg.args[1].lower())
     on = 'on %s' % irc.network
     networkGroup = conf.supybot.networks.get(irc.network)
     if 'incorrect' in s or 'denied' in s:
         log = 'Received "Password Incorrect" from NickServ %s.  ' \
               'Resetting password to empty.' % on
         self.log.warning(log)
         self.sentGhost = time.time()
         self._setNickServPassword(nick, '')
     elif self._ghosted(s):
         self.log.info('Received "GHOST succeeded" from NickServ %s.', on)
         self.sentGhost = None
         self.identified = False
         irc.queueMsg(ircmsgs.nick(nick))
     elif 'is not registered' in s:
         self.log.info('Received "Nick not registered" from NickServ %s.',
                       on)
     elif 'currently' in s and 'isn\'t' in s or 'is not' in s:
         # The nick isn't online, let's change our nick to it.
         self.sentGhost = None
         irc.queueMsg(ircmsgs.nick(nick))
     elif ('owned by someone else' in s) or \
          ('nickname is registered and protected' in s) or \
          ('nick belongs to another user' in s):
         # freenode, arstechnica, chatjunkies
         # oftc, zirc.org
         # sorcery
         self.log.info('Received "Registered nick" from NickServ %s.', on)
     elif '/msg' in s and 'id' in s and 'password' in s:
         # Usage info for identify command; ignore.
         self.log.debug('Got usage info for identify command %s.', on)
     elif ('please choose a different nick' in s): # oftc, part 3
         # This is a catch-all for redundant messages from nickserv.
         pass
     elif ('now recognized' in s) or \
          ('already identified' in s) or \
          ('password accepted' in s) or \
          ('now identified' in s):
         # freenode, oftc, arstechnica, zirc, ....
         # sorcery
         self.log.info('Received "Password accepted" from NickServ %s.', on)
         self.identified = True
         for channel in irc.state.channels.keys():
             self.checkPrivileges(irc, channel)
         for channel in self.channels:
             irc.queueMsg(networkGroup.channels.join(channel))
         if self.waitingJoins:
             for m in self.waitingJoins:
                 irc.sendMsg(m)
             self.waitingJoins = []
     elif 'not yet authenticated' in s:
         # zirc.org has this, it requires an auth code.
         email = s.split()[-1]
         self.log.warning('Received "Nick not yet authenticated" from '
                          'NickServ %s.  Check email at %s and send the '
                          'auth command to NickServ.', on, email)
     else:
         self.log.debug('Unexpected notice from NickServ %s: %q.', on, s)
 def testNick(self):
     self.prefix = "[email protected]"
     self.assertRegexp("gpg ident", "are identified")
     self.irc.feedMsg(msg=ircmsgs.nick("newnick", prefix=self.prefix))
     self.assertRegexp("gpg ident", "not identified")
     self.prefix = "newnick" + "!" + self.prefix.split("!", 1)[1]
     self.assertRegexp("gpg ident", "You are identified")
 def testNick(self):
     self.prefix = '[email protected]'
     self.assertRegexp('gpg ident', 'are identified')
     self.irc.feedMsg(msg=ircmsgs.nick('newnick', prefix=self.prefix))
     self.assertRegexp('gpg ident', 'not identified')
     self.prefix = 'newnick' + '!' + self.prefix.split('!',1)[1]
     self.assertRegexp('gpg ident', 'You are identified')
예제 #4
0
 def testNick(self):
     self.prefix = '[email protected]'
     self.assertRegexp('gpg ident', 'are identified')
     self.irc.feedMsg(msg=ircmsgs.nick('newnick', prefix=self.prefix))
     self.assertRegexp('gpg ident', 'not identified')
     self.prefix = 'newnick' + '!' + self.prefix.split('!', 1)[1]
     self.assertRegexp('gpg ident', 'You are identified')
예제 #5
0
파일: test_irclib.py 프로젝트: krattai/AEBL
 def testFirstCommands(self):
     try:
         originalNick = conf.supybot.nick()
         originalUser = conf.supybot.user()
         originalPassword = conf.supybot.networks.test.password()
         nick = 'nick'
         conf.supybot.nick.setValue(nick)
         user = '******'
         conf.supybot.user.setValue(user)
         expected = [ircmsgs.nick(nick), ircmsgs.user('supybot', user)]
         irc = irclib.Irc('test')
         msgs = [irc.takeMsg()]
         while msgs[-1] != None:
             msgs.append(irc.takeMsg())
         msgs.pop()
         self.assertEqual(msgs, expected)
         password = '******'
         conf.supybot.networks.test.password.setValue(password)
         irc = irclib.Irc('test')
         msgs = [irc.takeMsg()]
         while msgs[-1] != None:
             msgs.append(irc.takeMsg())
         msgs.pop()
         expected.insert(0, ircmsgs.password(password))
         self.assertEqual(msgs, expected)
     finally:
         conf.supybot.nick.setValue(originalNick)
         conf.supybot.user.setValue(originalUser)
         conf.supybot.networks.test.password.setValue(originalPassword)
예제 #6
0
 def testFirstCommands(self):
     try:
         originalNick = conf.supybot.nick()
         originalUser = conf.supybot.user()
         originalPassword = conf.supybot.networks.test.password()
         nick = 'nick'
         conf.supybot.nick.setValue(nick)
         user = '******'
         conf.supybot.user.setValue(user)
         expected = [
             ircmsgs.IrcMsg(command='CAP', args=('LS', '302')),
             ircmsgs.nick(nick),
             ircmsgs.user('limnoria', user),
         ]
         irc = irclib.Irc('test')
         msgs = [irc.takeMsg()]
         while msgs[-1] is not None:
             msgs.append(irc.takeMsg())
         msgs.pop()
         self.assertEqual(msgs, expected)
         password = '******'
         conf.supybot.networks.test.password.setValue(password)
         irc = irclib.Irc('test')
         msgs = [irc.takeMsg()]
         while msgs[-1] is not None:
             msgs.append(irc.takeMsg())
         msgs.pop()
         expected.insert(1, ircmsgs.password(password))
         self.assertEqual(msgs, expected)
     finally:
         conf.supybot.nick.setValue(originalNick)
         conf.supybot.user.setValue(originalUser)
         conf.supybot.networks.test.password.setValue(originalPassword)
예제 #7
0
파일: plugin.py 프로젝트: 7UR7L3/supybot
 def doNick(self, irc, msg):
     nick = self._getNick()
     if ircutils.strEqual(msg.args[0], irc.nick) and \
        ircutils.strEqual(irc.nick, nick):
         self._doIdentify(irc)
     elif ircutils.strEqual(msg.nick, nick):
         irc.sendMsg(ircmsgs.nick(nick))
예제 #8
0
 def doNick(self, irc, msg):
     nick = self._getNick()
     if ircutils.strEqual(msg.args[0], irc.nick) and \
        ircutils.strEqual(irc.nick, nick):
         self._doIdentify(irc)
     elif ircutils.strEqual(msg.nick, nick):
         irc.sendMsg(ircmsgs.nick(nick))
예제 #9
0
파일: plugin.py 프로젝트: fbesser/Limnoria
    def nick(self, irc, msg, args, nick):
        """[<nick>]

        Changes the bot's nick to <nick>.  If no nick is given, returns the
        bot's current nick.
        """
        if nick:
            conf.supybot.nick.setValue(nick)
            irc.queueMsg(ircmsgs.nick(nick))
            self.pendingNickChanges[irc.getRealIrc()] = irc
        else:
            irc.reply(irc.nick)
예제 #10
0
    def nick(self, irc, msg, args, nick):
        """[<nick>]

        Changes the bot's nick to <nick>.  If no nick is given, returns the
        bot's current nick.
        """
        if nick:
            conf.supybot.nick.setValue(nick)
            irc.queueMsg(ircmsgs.nick(nick))
            self.pendingNickChanges[irc.getRealIrc()] = irc
        else:
            irc.reply(irc.nick)
예제 #11
0
    def nick(self, irc, msg, args, nick, network):
        """[<nick>] [<network>]

        Changes the bot's nick to <nick>.  If no nick is given, returns the
        bot's current nick.
        """
        network = network or irc.network
        if nick:
            group = getattr(conf.supybot.networks, network)
            group.nick.setValue(nick)
            irc.queueMsg(ircmsgs.nick(nick))
            self.pendingNickChanges[irc.getRealIrc()] = irc
        else:
            irc.reply(irc.nick)
예제 #12
0
파일: plugin.py 프로젝트: 7UR7L3/supybot
 def __call__(self, irc, msg):
     self.__parent.__call__(irc, msg)
     if self.disabled(irc):
         return
     nick = self._getNick()
     if nick not in self.registryValue('nicks'):
         return
     nickserv = self.registryValue('NickServ')
     password = self._getNickServPassword(nick)
     ghostDelay = self.registryValue('ghostDelay')
     if nick and nickserv and password and \
        not ircutils.strEqual(nick, irc.nick):
         if irc.afterConnect and (self.sentGhost is None or
            (self.sentGhost + ghostDelay) < time.time()):
             if nick in irc.state.nicksToHostmasks:
                 self._doGhost(irc)
             else:
                 irc.sendMsg(ircmsgs.nick(nick)) # 433 is handled elsewhere.
예제 #13
0
 def __call__(self, irc, msg):
     self.__parent.__call__(irc, msg)
     if self.disabled(irc):
         return
     nick = self._getNick()
     if nick not in self.registryValue('nicks'):
         return
     nickserv = self.registryValue('NickServ')
     password = self._getNickServPassword(nick)
     ghostDelay = self.registryValue('ghostDelay')
     if nick and nickserv and password and \
        not ircutils.strEqual(nick, irc.nick):
         if irc.afterConnect and (self.sentGhost is None or
            (self.sentGhost + ghostDelay) < time.time()):
             if nick in irc.state.nicksToHostmasks:
                 self._doGhost(irc)
             else:
                 irc.sendMsg(ircmsgs.nick(nick)) # 433 is handled elsewhere.
예제 #14
0
 def testFirstCommands(self):
     try:
         originalNick = conf.supybot.nick()
         originalUser = conf.supybot.user()
         originalPassword = conf.supybot.networks.test.password()
         nick = 'nick'
         conf.supybot.nick.setValue(nick)
         user = '******'
         conf.supybot.user.setValue(user)
         expected = [
             ircmsgs.nick(nick),
             ircmsgs.user('limnoria', user),
             ircmsgs.IrcMsg(command='CAP', args=('REQ', 'account-notify')),
             ircmsgs.IrcMsg(command='CAP', args=('REQ', 'extended-join')),
             ircmsgs.IrcMsg(command='CAP', args=('REQ', 'multi-prefix')),
             ircmsgs.IrcMsg(command='CAP', args=('REQ', 'metadata-notify')),
             ircmsgs.IrcMsg(command='CAP', args=('REQ', 'account-tag')),
             ircmsgs.IrcMsg(command='CAP', args=('END',)),
         ]
         irc = irclib.Irc('test')
         msgs = [irc.takeMsg()]
         while msgs[-1] != None:
             msgs.append(irc.takeMsg())
         msgs.pop()
         self.assertEqual(msgs, expected)
         password = '******'
         conf.supybot.networks.test.password.setValue(password)
         irc = irclib.Irc('test')
         msgs = [irc.takeMsg()]
         while msgs[-1] != None:
             msgs.append(irc.takeMsg())
         msgs.pop()
         expected.insert(0, ircmsgs.password(password))
         self.assertEqual(msgs, expected)
     finally:
         conf.supybot.nick.setValue(originalNick)
         conf.supybot.user.setValue(originalUser)
         conf.supybot.networks.test.password.setValue(originalPassword)
예제 #15
0
 def testFirstCommands(self):
     try:
         originalNick = conf.supybot.nick()
         originalUser = conf.supybot.user()
         originalPassword = conf.supybot.networks.test.password()
         nick = 'nick'
         conf.supybot.nick.setValue(nick)
         user = '******'
         conf.supybot.user.setValue(user)
         expected = [
             ircmsgs.nick(nick),
             ircmsgs.IrcMsg(command='CAP', args=('REQ', 'account-notify')),
             ircmsgs.IrcMsg(command='CAP', args=('REQ', 'extended-join')),
             ircmsgs.IrcMsg(command='CAP', args=('REQ', 'multi-prefix')),
             ircmsgs.IrcMsg(command='CAP', args=('END', )),
             ircmsgs.user('limnoria', user)
         ]
         irc = irclib.Irc('test')
         msgs = [irc.takeMsg()]
         while msgs[-1] != None:
             msgs.append(irc.takeMsg())
         msgs.pop()
         self.assertEqual(msgs, expected)
         password = '******'
         conf.supybot.networks.test.password.setValue(password)
         irc = irclib.Irc('test')
         msgs = [irc.takeMsg()]
         while msgs[-1] != None:
             msgs.append(irc.takeMsg())
         msgs.pop()
         expected.insert(0, ircmsgs.password(password))
         self.assertEqual(msgs, expected)
     finally:
         conf.supybot.nick.setValue(originalNick)
         conf.supybot.user.setValue(originalUser)
         conf.supybot.networks.test.password.setValue(originalPassword)
예제 #16
0
파일: plugin.py 프로젝트: rostob/Limnoria
 def _sendNick(self, irc, nick):
     self.log.info('Attempting to switch to nick %s on %s.',
                   nick, irc.network)
     irc.sendMsg(ircmsgs.nick(nick))
예제 #17
0
 def doQuit(self, irc, msg):
     if ircmsgs.isSplit(msg):
         irc.reply("GOOD JOB OPERS!", prefixNick=False)
         if msg.nick == self.oper_nick:
             irc.queueMsg(ircmsgs.nick(self.oper_nick))
예제 #18
0
 def doNickservNotice(self, irc, msg):
     if self.disabled(irc):
         return
     nick = self._getNick(irc.network)
     s = ircutils.stripFormatting(msg.args[1].lower())
     on = "on %s" % irc.network
     networkGroup = conf.supybot.networks.get(irc.network)
     if "incorrect" in s or "denied" in s:
         log = 'Received "Password Incorrect" from NickServ %s.  ' "Resetting password to empty." % on
         self.log.warning(log)
         self.sentGhost = time.time()
         self._setNickServPassword(nick, "")
     elif self._ghosted(irc, s):
         self.log.info('Received "GHOST succeeded" from NickServ %s.', on)
         self.sentGhost = None
         self.identified = False
         irc.queueMsg(ircmsgs.nick(nick))
     elif "is not registered" in s:
         self.log.info('Received "Nick not registered" from NickServ %s.', on)
     elif "currently" in s and "isn't" in s or "is not" in s:
         # The nick isn't online, let's change our nick to it.
         self.sentGhost = None
         irc.queueMsg(ircmsgs.nick(nick))
     elif (
         ("owned by someone else" in s)
         or ("nickname is registered and protected" in s)
         or ("nick belongs to another user" in s)
     ):
         # freenode, arstechnica, chatjunkies
         # oftc, zirc.org
         # sorcery
         self.log.info('Received "Registered nick" from NickServ %s.', on)
     elif "/msg" in s and "id" in s and "password" in s:
         # Usage info for identify command; ignore.
         self.log.debug("Got usage info for identify command %s.", on)
     elif "please choose a different nick" in s:  # oftc, part 3
         # This is a catch-all for redundant messages from nickserv.
         pass
     elif (
         ("now recognized" in s)
         or ("already identified" in s)
         or ("already logged in" in s)
         or ("successfully identified" in s)
         or ("password accepted" in s)
         or ("now identified" in s)
     ):
         # freenode, oftc, arstechnica, zirc, ....
         # sorcery
         self.log.info('Received "Password accepted" from NickServ %s.', on)
         self.identified = True
         for channel in irc.state.channels.keys():
             self.checkPrivileges(irc, channel)
         for channel in self.channels:
             irc.queueMsg(networkGroup.channels.join(channel))
         waitingJoins = self.waitingJoins.pop(irc.network, None)
         if waitingJoins:
             for m in waitingJoins:
                 irc.sendMsg(m)
     elif "not yet authenticated" in s:
         # zirc.org has this, it requires an auth code.
         email = s.split()[-1]
         self.log.warning(
             'Received "Nick not yet authenticated" from '
             "NickServ %s.  Check email at %s and send the "
             "auth command to NickServ.",
             on,
             email,
         )
     else:
         self.log.debug("Unexpected notice from NickServ %s: %q.", on, s)
예제 #19
0
 def nick():
     irc.queueMsg(ircmsgs.nick(target))
예제 #20
0
파일: plugin.py 프로젝트: Ban3/Limnoria
 def nick():
     irc.queueMsg(ircmsgs.nick(target))
예제 #21
0
 def _sendNick(self, irc, nick):
     self.log.info('Attempting to switch to nick %s on %s.',
                   nick, irc.network)
     irc.sendMsg(ircmsgs.nick(nick))