【发布时间】:2009-12-24 07:43:45
【问题描述】:
好的,这不是问题。我看到的所有 wokkel 和 twisted 的例子都没有正确观察 JID 中生成的资源。
使用 wokkel/twisted 构建的 Google Talk 客户端通常会中断,因为它们没有在响应中设置完整的 JID,从而导致(非常隐藏、低级别)错误,例如:
<message to="example@gmail.com" from="example2@synthasite.com/Example2C2F32A1" type="error"><body>echo: None</body><error code="400" type="modify"><bad-request xmlns="urn:ietf:params:xml:ns:xmpp-stanzas"/><text xmlns="urn:ietf:params:xml:ns:xmpp-stanzas">If set, the 'from' attribute must be set to the user's full JID.</text></error></message>
可以在协议处理程序中从 self.parent.authenticator.jid.full() 获取完整的、服务器发出的 jid
因此,在发送消息时,请确保您在 from 字段中使用完整的 jid,否则某些服务器会不喜欢您,您会拔出所有头发,然后哭泣。
【问题讨论】:
-
你可以从一个问题开始(How can I make this example wokkel code not barf when using gtalk,看到这个奇怪的错误)和你的代码以及发送/接收 xmpp 数据包.然后用你已经在 self.parent.authenticator.jid.full() 中找到的内容回答你的问题。然后你有一个可参考的问题/答案,而不是咆哮。
标签: python xmpp twisted google-talk