XMPP 传输到另一个协议

发布于 2024-10-04 21:53:51 字数 180 浏览 0 评论 0原文

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

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

您能展示代码示例或文本解释如何做到这一点吗? (可能没有使用 xmpp4r 和 ruby​​,我只需要一个提示。)

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

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

毁我热情 2024-10-11 21:53:51

感谢 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

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
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文