I'm trying to use xmpppy for sending jabber-messages from a django-website. This works entirely fine.
However, the message only gets sent to the -first- of the recipients in the list. This happens when I run the following function from django, and also if I run it from an interactive python-shell. The weird part though, is that if I extract the -body- of the function and run that interactively, then all the recipients (there's just 2 at the moment) get the message.
Also, I do know that the inner for-loop gets run the correct count times (2), because the print-statement does run twice, and return two different message-ids.
The function looks like this:
def hello_jabber(request, text):
jid=xmpp.protocol.JID(settings.JABBER_ID)
cl=xmpp.Client(jid开发者_StackOverflow社区.getDomain(),debug=[])
con=cl.connect()
auth=cl.auth(jid.getNode(),settings.JABBER_PW,resource=jid.getResource())
for friend in settings.JABBER_FRIENDS:
id=cl.send(xmpp.protocol.Message(friend,friend + ' is awesome:' + text))
print 'sent message with id ' + str(id)
cl.disconnect()
return render_to_response('jabber/sent.htm', locals())
Activate the debug options in xmpppy to see what does the xmpp client.
精彩评论