简体   繁体   English

XMPP传输到另一个协议

[英]XMPP transport to another protocol

I would like to add support of ICQ in my application using jabber-transport. 我想使用jabber-transport在我的应用程序中添加对ICQ的支持。 I use xmpp4r ruby's library. 我使用xmpp4r ruby​​的库。

All that I found doesn't show how to login to external (icq) server and how to send messages. 我发现的所有内容都没有显示如何登录外部(icq)服务器以及如何发送消息。

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.) (可能未使用xmpp4r和ruby,我只需要一个提示。)

I found solution thanks to canhaschat plugin source code 由于canhaschat插件源代码,我找到了解决方案

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM