示例#1
0
 def _join_private_channel(self, nick: IrcNickWithMode):
     cid = ChannelID.private(nick.nick)
     self._add_channel(cid)
     channel = self._chat[cid]
     self._add_or_update_from_nick(channel, nick)
     self._add_or_update_from_name(channel, self._irc.my_username)
     return channel
示例#2
0
 def on_names(self, channel_name, users: List[IrcNickWithMode]):
     channel_id = ChannelID.public(channel_name)
     if channel_id not in self._chat:
         return
     channel = self._chat[channel_id]
     for nick in users:
         self._add_or_update_from_nick(channel, nick)
示例#3
0
 def on_join(self, channel_name, nick: IrcNickWithMode):
     channel_id = ChannelID.public(channel_name)
     if nick.nick == self._irc.my_username:
         self._add_channel(channel_id)
     if channel_id not in self._chat:
         return
     channel = self._chat[channel_id]
     self._add_or_update_from_nick(channel, nick)
示例#4
0
    def on_part(self, channel_name, nick: IrcNickWithMode, message):
        channel_id = ChannelID.public(channel_name)
        if channel_id not in self._chat:
            return
        channel = self._chat[channel_id]
        self._remove_from_nick(channel, nick)

        if nick.nick == self._irc.my_username:
            self._remove_channel(channel_id)
示例#5
0
 def join_private_channel(self, nick: str, from_channel):
     cid = ChannelID.public(from_channel)
     if cid not in self._chat:
         return
     channel = self._chat[cid]
     if nick not in channel.chatters:
         return
     chatter = channel.chatters[nick]
     nwm = IrcNickWithMode(chatter.nick, chatter.mode)
     self._join_private_channel(nwm)
示例#6
0
 def on_message(self, nick: IrcNickWithMode, target, text,
                type_: MessageType):
     if self._chat_filter(nick.nick):
         return
     public_channel = ChannelID.public(target)
     if public_channel in self._chat:
         channel = self._chat[public_channel]
         self._on_public_msg(nick, channel, text, type_)
     elif target == self._irc.my_username:
         self._on_other_private_msg(nick, text, type_)
     elif nick.nick == self._irc.my_username:
         self._on_my_private_msg(target, text, type_)
示例#7
0
 def leave_private_channel(self, channel_name):
     channel_id = ChannelID.private(channel_name)
     self._remove_channel(channel_id)
示例#8
0
 def on_topic(self, channel, message):
     channel_id = ChannelID.public(channel)
     if channel_id not in self._chat:
         return
     channel = self._chat[channel_id]
     channel.topic = message