Exemplo n.º 1
0
def _update_client_info(client, event):
    command = event.command
    params = event.params
    if command == "RPL_WELCOME":
        if client.nickname != event.target:
            client.nickname = event.target
    if command == "ERR_ERRONEUSNICKNAME":
        client.set_nickname(protocol.filter_nick(client.nickname))
    elif command == "ERR_NICKNAMEINUSE":
        client.set_nickname(client.nickname + "_")
    elif command == "ERR_UNAVAILRESOURCE":
        if not protocol.is_channel(event.params[0]):
            client.nickname = client._prev_nickname
    elif command == "NICK" and event.source == client.nickname:
        client.nickname = event.target
    
    if command in ["ERR_INVITEONLYCHAN", "ERR_CHANNELISFULL",  "ERR_BANNEDFROMCHAN", 
                   "ERR_BADCHANNELKEY", "ERR_TOOMANYCHANNELS", "ERR_NOSUCHCHANNEL"
                   "ERR_BADCHANMASK"]:
        channel_name = params[0].lower()
        if channel_name in client.channels:
            del client.channels[channel_name]
    elif command == "ERR_UNAVAILRESOURCE":
        channel_name = params[0].lower()
        if protocol.is_channel(channel_name) and channel_name in client.channels:
            del client.channels[channel_name]
Exemplo n.º 2
0
 def notify(self, client, event):
     if event.command == "NOTICE":
         if protocol.is_channel(event.target):
             self.activate_handlers(client, event)
Exemplo n.º 3
0
 def notify(self, client, event):
     if event.command == "NOTICE":
         if protocol.is_channel(event.target):
             self.activate_handlers(client, event)