开发者

XMPP transport to another protocol

开发者 https://www.devze.com 2023-01-27 09:24 出处:网络
I would like to add support of ICQ in my application using jabber-transport. I use xmpp4r ruby\'s library.

I would like to add support of ICQ in my application using jabber-transport. I use xmpp4r ruby's library.

All that I found doesn't show how to login to external (icq) server and how to send messages.

Can you show e开发者_StackOverflowxample of code or text explanation how to do so? (may be not using xmpp4r and ruby, I only need a hint.)


I found solution thanks to canhaschat plugin source code

require 'xmpp4r'

#connect to jabber
jid=Jabber::JID.new "your_jid"
client=Jabber::Client.new jid
client.connect
client.auth "your_jabber_password"

#connect to transport
reg=Jabber::Iq.new_register "your_login (e.g 123456789)", "your_password (e.g. qwerty)"
reg.to="transport server url (e.g. icq.udaff.com)"
client.send reg

#send message
client.send Jabber::Message.new "recipient_login@transport", "Hi there!"

#end of work... 
client.close
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号