使用nodejs和node-xmpp在google talk中进行用户授权

发布于 2024-12-01 00:56:59 字数 382 浏览 2 评论 0原文

我正在使用node-xmpp 在node.js 中编写一个机器人。到目前为止,它非常简单,除了我在弄清楚 google Talk 如何处理其用户授权时遇到问题(当处理请求与不在您名册上的人聊天时)。

我正在捕获所有通过的节并将它们记录到控制台,但没有来自请求授权的用户的数据。

关于我应该寻找什么的任何解释,或者这个事件是否发生在 jabber 协议上。

[附加]我知道,从技术上讲,当发出订阅请求时,会随订阅请求一起发送存在节。由于某种原因,我无法使用 node-xmpp 看到这些内容通过网络传输。另外,我需要找到一种方法来确定当我的机器人登录时哪些存在请求“待处理”。我认为(无意中)它们会在名册中列出并带有某种标志,但这是不正确的。

任何关于找出从这里去哪里的帮助都会很有用。

I'm writing a bot in node.js using node-xmpp. So far it's pretty straight forward except I'm having an issue with figuring out how google Talk handles it's user authorization (when dealing with requesting to chat with someone NOT on your roster).

I'm catching all stanzas coming through and logging them to the console but there is no data coming from the user that is requesting authorization.

Any explanations of what I should be looking for or if this event even happens over the jabber protocol.

[appended] I know that technically when a subscription request is made a presence stanza is sent with the subscription request. I can't see these coming over the wire using node-xmpp for some reason. Also, I need to find out a way to determine what presence requests are "pending" when my bot logs in. I thought (innacurrately) that they would be listed in the roster with some sort of flag, but that's not correct.

Any help with finding out where to go from here would be useful.

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

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

发布评论

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

评论(2

鹿童谣 2024-12-08 00:56:59

好吧,我终于弄清楚如何在发出订阅请求后获取订阅请求了。那里没有太多信息,所以我将整理一篇博客文章,但我觉得在这里回答它可能也很好。

我发现,如果我根据以下信息进行谷歌花名册查询:

http:// /code.google.com/apis/talk/jep_extensions/roster_attributes.html

示例节:

<iq from="[email protected]/D2D4E5A8" type="get" id="google-roster-1"><query xmlns="jabber:iq:roster" xmlns:gr="google:roster" gr:ext="2"/></iq>

服务器将首先响应您的待处理服务器订阅“presence”节,

例如:

<presence type="subscribe" from="[email protected]" to="[email protected]/D2D4E5A8" xmlns:stream="http://etherx.jabber.org/streams" xmlns="jabber:client"/>

和然后是你名册中其余的“存在”节。请务必注意,除非您执行名册查询,否则您的订阅“存在”节不会从服务器发送给您。我不确定为什么会这样,为什么它没有在某个地方记录下来,这超出了我的范围。无论如何,至少我现在可以获得尝试访问我的机器人的人员列表。

Ok, I finally figured out how to get the subscription requests after they have been made. There isn't much info on it out there so I'll put together a blog post, but I feel that answering it here might be good as well.

I found that if I did a google roster query based on the below information:

http://code.google.com/apis/talk/jep_extensions/roster_attributes.html

example stanza:

<iq from="[email protected]/D2D4E5A8" type="get" id="google-roster-1"><query xmlns="jabber:iq:roster" xmlns:gr="google:roster" gr:ext="2"/></iq>

The server would respond first with your pending server subscription "presence" stanzas

ex:

<presence type="subscribe" from="[email protected]" to="[email protected]/D2D4E5A8" xmlns:stream="http://etherx.jabber.org/streams" xmlns="jabber:client"/>

and then the rest of your roster's "presence" stanzas. It's important to note that your subscription "presence" stanzas don't get sent to you from the server unless you do a roster query. I'm not sure why this is and why it's not documented somewhere is beyond me. Anyways, at least I can get the list of people trying to get access to my bot now.

幻想少年梦 2024-12-08 00:56:59

注意:这不是我的知识领域,只是我的兴趣。我没有实际经验,只是进行了一些研究。这本来是一条评论,但是对这个主题进行了更多搜索,我想出了一些可能有帮助的东西。

这是一个 Google Chat 聊天室主页 http://partychapp.appspot.com/您可以获取来源http://code.google.com/p/ partychapp/

这些链接来自http://xmpp.org/2010/02/xmpp-roundup-13- services/ 其中有很多其他可能有用的资源。

http://code.google.com/p/node-xmpp-bosh/ 有一些关于此的代码,我还没有做过,但这个主题很有趣。

我希望您在写完博客文章和/或项目并分享后确实找到了答案。我对此很感兴趣。

Note: This is not my area of knowledge just an interest of mine. I have not got practical experience just a bit of research. This would have been a comment however doing some more searching on the topic, I have come up with some more things that might help.

Here's a google chat chat room homepage http://partychapp.appspot.com/ you can get the source http://code.google.com/p/partychapp/

Those links came from http://xmpp.org/2010/02/xmpp-roundup-13-services/ which has quite a few other resources that might be helpful.

http://code.google.com/p/node-xmpp-bosh/ has some code about that, I've not done it but the topic is interesting.

I hope if you do find the answer your after you write up a blog post and or a project and share it. It would be of interest to me.

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