示例#1
0
 def send_connect_message(self, key, aliases):
     (local_address, remote_address)=(key[0], key[2])
     packet=format_header(local_address, remote_address, ElementTree.Element("connect"))
     packet.attrib['xmlns']="hexchat:connect"
     
     packet=self.add_aliases(packet, aliases)
            
     logging.debug("%s:%d" % local_address + " sending connect request to %s:%d" % remote_address)
     
     message=Message()
     message['to']=key[1]
     message['type']='chat'
     message.append(packet)
     
     self.send(message, aliases)
示例#2
0
    def send_disconnect_error(self, key, from_aliases, to_alias, message=False):
        (local_address, remote_address)=(key[0], key[2])
        packet=format_header(local_address, remote_address, ElementTree.Element("disconnect_error"))
        packet.attrib['xmlns']="hexchat:disconnect_error"
        packet=self.add_aliases(packet, from_aliases)
        logging.debug("%s:%d" % local_address + " sending disconnect_error request to %s:%d" % remote_address)

        if message:
            msg=Message()
            msg['type']='chat'
        else:
            msg=Iq()
            msg['type']='set'
            
        msg['to']=to_alias
        msg.append(packet)

        self.send(msg, from_aliases)