Frage

How can I send data with xmpppy using this method: http://xmpp.org/extensions/xep-0047.html#send

I suppose I should use IBB class but have no idea how to do it. http://xmpppy.sourceforge.net/apidocs/

War es hilfreich?

Lösung

First, if you're on GoogleTalk, ensure that the sender is on the receiver's roster. Next, on the sender side:

from xmpp import *
cl=Client('example.com')
cl.connect()
cl.auth('sender', 'sender_pass')
ibb = filetransfer.IBB()
ibb.PlugIn(cl)

f = open('/tmp/foo')
ibb.OpenStream('123', 'receiver@example.com/resource', f)

It doesn't matter what the stream ID is if you're not doing XEP-95/XEP-96 correctly first.

Andere Tipps

I think something like that:

import StringIO
...
output = StringIO.StringIO()
output.write('String data')
output.close()


client.OpenStream('123', 'receiver@example.com/resource', output)
Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top