XMPP transport to another protocol

2019-03-05 14:16发布

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 example of code or text explanation how to do so? (may be not using xmpp4r and ruby, I only need a hint.)

1条回答
一夜七次
2楼-- · 2019-03-05 14:54

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
查看更多
登录 后发表回答