XMPP传输到另一个协议

XMPP传输到另一个协议

问题描述:

我想使用jabber-transport在我的应用程序中添加对ICQ的支持.我使用xmpp4r ruby​​的库.

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

我发现的所有内容都没有显示如何登录到外部(icq)服务器以及如何发送消息.

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

您能显示代码示例或文本说明的方法吗? (可能没有使用xmpp4r和ruby,我只需要一个提示.)

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.)

感谢canhaschat插件源代码,我找到了解决方案

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