使用Python在XMPP bot中发送和接收文件

时间:2013-10-22 08:17:05

标签: python xmpp bots

我正在使用以下机器人(基于xmppy):

import xmpp, os

user = 'uname'
password = 'pass'
server="talk.google.com"

def message_handler(connect_object, message_node): 
        messageFromCounterPart = message_node.getBody()
        connect_object.send( xmpp.Message( message_node.getFrom() ,message_node.getBody()))


jid = xmpp.JID(user) 
connection = xmpp.Client(jid.getDomain()) 
connection.connect(server = (server, 5223)) 
result = connection.auth(jid.getNode(), password, "LFY-client") 
connection.RegisterHandler('message', message_handler) 
connection.sendInitPresence()     
while connection.Process(1): 
    pass

如何使其接收和发送文件?在这种情况下,节有特殊名称吗? (比如connection.RegisterHandler('message', message_handler)) 感谢。

0 个答案:

没有答案