Esempio n. 1
0
 def on_names(self, server, channel, names):
     for name in names:
         if names[name] in ("+", "%", "@") and name in self._command_queues["voice"]:  # Has at least voice
             for command in self._command_queues["voice"][name]:
                 self.execute(command[3], command[4], command[5], command[6].split(), command[1], command[2])
             self._command_queues["voice"][name] = []
         if names[name] in ("%", "@") and name in self._command_queues["half-op"]:  # Has at least Half-OP
             for command in self._command_queues["half-op"][name]:
                 self.execute(command[3], command[4], command[5], command[6].split(), command[1], command[2])
             self._command_queues["half-op"][name] = []
         if names[name] == "@" and name in self._command_queues["op"]:  # Has OP
             for command in self._command_queues["op"][name]:
                 self.execute(command[3], command[4], command[5], command[6].split(), command[1], command[2])
             self._command_queues["op"][name] = []
         # Move the remaining commands to the owner queue
         if not name in self._command_queues["master"]:
             self._command_queues["master"][name] = []
         if name in self._command_queues["voice"]:
             self._command_queues["master"][name] += self._command_queues["voice"][name]
             self._command_queues["voice"][name] = []
         if name in self._command_queues["half-op"]:
             self._command_queues["master"][name] += self._command_queues["half-op"][name]
             self._command_queues["half-op"][name] = []
         if name in self._command_queues["op"]:
             self._command_queues["master"][name] += self._command_queues["op"][name]
             self._command_queues["op"][name] = []
         if len(self._command_queues["master"][name]) > 0:
             ns(self.bot.client, "ACC", name)
Esempio n. 2
0
 def welcome(self, *args):
     '''Wait for the RPL_WELCOME before joining channels.'''
     self.busy -= 1
     # We don't really care whether this succeeds.
     helpers.ns(self.client, 'IDENTIFY', self.settings['password'])
     for chan in self.channels:
         self.channels[chan] = KevinBotGM(self, chan)
Esempio n. 3
0
 def authorize_voice(self, server, channel, nick, message, plugin, cmd):
     """
     Nick must have voice in the channel, or must be able to gain voice any
     time because of flags specified in ChanServ's ACCESS LIST. The latter
     only works if the bot is identified, because ChanServ (at least on
     FreeNode) entrusts that info only to identified users.
     """
     self._enqueue("authenticated", "voice", plugin, cmd, server, channel, nick, message)
     ns(self.bot.client, "ACC", nick.split("!")[0])
Esempio n. 4
0
 def authorize_master(self, server, channel, nick, message, plugin, cmd):
     """
     Master authorization requires nick to be authenticated with NickServ.
     Additionally, nick must be named master in the bot configuration.
     """
     if not self.master:
         self.master = self.bot.master
     user = nick.split("!")[0]
     if user == self.master:
         self._enqueue("authenticated", None, plugin, cmd, server, channel, nick, message)
         ns(self.bot.client, "ACC", user)
     else:
         self._respond_denial(server, channel, nick)
Esempio n. 5
0
 def authorize_authenticated(self, server, channel, nick, message, plugin, cmd):
     """Nick must be authenticated with NickServ."""
     self._enqueue("authenticated", None, plugin, cmd, server, channel, nick, message)
     ns(self.bot.client, "ACC", nick.split("!")[0])
Esempio n. 6
0
 def connect_cb(c):
     if identify: 
         helpers.ns(c, "IDENTIFY", identify)
     for room in rooms:
         helpers.join(c, "#"+room)