Пример #1
0
    def _handle_mode(self, message):
        prefix, command, parameters = Irc.split_message(message)

        # Auto-join servers after MODE received from NickServ.
        if prefix.lower() == ':nickserv':
            for channel in self.config['channels']:
                self._send_message(Irc.join(channel))
Пример #2
0
    def join(self, channel, password=None):
        """ join a channel .. use optional password. """

        result = Irc.join(self, channel, password)
        if result != 1:
            return result
        if not self.channels.has_key(channel):
            # init channel data
            self.channels.setdefault(channel, {})
        chan = self.channels[channel]
        # if password is provided set it
        got = False
        if password:
            chan['key'] = password
            got = True
        # check for control char .. if its not there init to !
        if not chan.has_key('cc'):
            chan['cc'] = self.cfg['defaultcc'] or '!'
            got = True
        if not chan.has_key('perms'):
            chan['perms'] = []
            got = True
        if not chan.has_key('mode'):
            chan['mode'] = ""
            got = True
        if got:
            self.channels.save()
        self.getchannelmode(channel)
        return 1
Пример #3
0
    def join(self, channel, password=None):

        """ join a channel .. use optional password. """

        result = Irc.join(self, channel, password)
        if result != 1:
            return result
        if not self.channels.has_key(channel):
            # init channel data
            self.channels.setdefault(channel, {})
        chan = self.channels[channel]
        # if password is provided set it
        got = False
        if password:
            chan['key'] = password
            got = True
        # check for control char .. if its not there init to !
        if not chan.has_key('cc'):
            chan['cc'] = self.cfg['defaultcc'] or '!'
            got = True
        if not chan.has_key('perms'):
            chan['perms'] = []
            got = True
        if not chan.has_key('mode'):
            chan['mode'] = ""
            got = True
        if got:
            self.channels.save()
        self.getchannelmode(channel)
        return 1
Пример #4
0
    def _join_event(self, event):
        event_type, data = event
        message = data[0][0]
        destination = data[0][1]

        if data[0][2][0] == '#':
            destination = data[0][2]

        channel = message.split(" ")[1]
        if channel[0] == '#':
            self._send_response("Joining {}".format(channel), destination)
            self._send_message(Irc.join(channel))
Пример #5
0
 def join(self, channel, password=None):
     """ join a channel .. use optional password. """
     result = Irc.join(self, channel, password)
     if result != 1:
         return result
     chan = ChannelBase(channel, self.botname)
     got = False
     if password:
         chan.setkey('IRC',password)
         got = True
     if not chan.data.cc:
         chan.data.cc = self.cfg.defaultcc or '!'
         got = True
     if not chan.data.perms:
         chan.data.perms = []
         got = True
     if not chan.data.mode:
         chan.data.mode = ""
         got = True
     if got:
         chan.save()
     self.getchannelmode(channel)
     return 1
Пример #6
0
 def join(self, channel, password=None):
     """ join a channel .. use optional password. """
     chan = ChannelBase(channel, self.cfg.name)
     if password:
         chan.data.key = password.strip()
         chan.save()
     result = Irc.join(self, channel, chan.data.key)
     if result != 1:
         return result
     got = False
     if not chan.data.cc:
         chan.data.cc = self.cfg.globalcc or ''
         got = True
     if not chan.data.perms:
         chan.data.perms = []
         got = True
     if not chan.data.mode:
         chan.data.mode = ""
         got = True
     if got:
         chan.save()
     self.getchannelmode(channel)
     return 1
Пример #7
0
 def join(self, channel, password=None):
     """ join a channel .. use optional password. """
     chan = ChannelBase(channel, self.cfg.name)
     if password:
         chan.data.key = password.strip()
         chan.save()
     result = Irc.join(self, channel, chan.data.key)
     if result != 1:
         return result
     got = False
     if not chan.data.cc:
         chan.data.cc = self.cfg.globalcc or ''
         got = True
     if not chan.data.perms:
         chan.data.perms = []
         got = True
     if not chan.data.mode:
         chan.data.mode = ""
         got = True
     if got:
         chan.save()
     self.getchannelmode(channel)
     return 1
Пример #8
0
Файл: bot.py Проект: code2u/jsb
 def join(self, channel, password=None):
     """ join a channel .. use optional password. """
     chan = ChannelBase(channel, self.cfg.name)
     if password:
         chan.data.key = password.strip()
         chan.save()
         # logging.warn("%s - using key %s for channel %s" % (self.cfg.name, chan.data.key, channel))
     result = Irc.join(self, channel, chan.data.key)
     if result != 1:
         return result
     got = False
     if not chan.data.cc:
         chan.data.cc = self.cfg.defaultcc or "!"
         got = True
     if not chan.data.perms:
         chan.data.perms = []
         got = True
     if not chan.data.mode:
         chan.data.mode = ""
         got = True
     if got:
         chan.save()
     self.getchannelmode(channel)
     return 1