Any examples using Blather and File Transfer?

231 views
Skip to first unread message

Henry H

unread,
Jun 7, 2011, 10:54:21 PM6/7/11
to xmpp-b...@googlegroups.com
I created a simple Blather bot, but it doesn't show "send file" available from my Jabber-compatible client.  Does anyone have a simple of example of using the Blather gem to send and receive files?

Thanks,
Henry

Anton Mironov

unread,
Jun 9, 2011, 2:31:12 AM6/9/11
to Blather
Hi Henry,

At the moment Blather can only receive files and can't send them.
Your Jabber client doesn't show the "send file" available because you
should advertise your bot's capabilities first.

Sorry, I don't have an example on how to do that with the latest
trunk, but I suppose Ben should have one.

To receive files in your bot you should write a file-transfer handler:

client.register_handler :file_transfer do |iq|
transfer = Blather::FileTransfer.new(client, iq)
transfer.accept(Blather::FileTransfer::SimpleFileReceiver, "/path/to/
save/#{iq.si.file["name"]}", iq.si.file["size"].to_i)
end

For more examples please see http://blather.squishtech.com/yard/Blather/Stanza/Iq/Si.html

Ben Langfeld

unread,
Jun 9, 2011, 6:27:38 AM6/9/11
to xmpp-b...@googlegroups.com
Something like this should do you on the caps front: https://gist.github.com/1016487

Regards,
Ben Langfeld


--
You received this message because you are subscribed to the Google Groups "Blather" group.
To post to this group, send email to xmpp-b...@googlegroups.com.
To unsubscribe from this group, send email to xmpp-blather...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/xmpp-blather?hl=en.


Alex Maurin

unread,
Sep 11, 2012, 4:25:43 AM9/11/12
to xmpp-b...@googlegroups.com, b...@langfeld.me
this looks really awesome.

so you can automatically accept file transfers over xmpp, and potentially publish these files with a nifty link? that sounds like fun.

Ben Langfeld

unread,
Sep 11, 2012, 4:47:45 AM9/11/12
to Alex Maurin, xmpp-b...@googlegroups.com
Correct.

Regards,
Ben Langfeld
Reply all
Reply to author
Forward
0 new messages