[ejabberd] Re: Py*-t and ejabberd?

Magnus Henoch mange at freemail.hu
Sat Dec 25 18:48:47 MSK 2004

I think I found the problem.  ejabberd doesn't handle subscription
requests addressed to a JID with resource (foo at example.com/bar as
opposed to foo at example.com), but that's what Py*-t sends when a user

Section 5.1.6 of RFC 3921 says:

"If the subscription request is being sent to an instant messaging
contact, the JID supplied in the 'to' attribute SHOULD be of the form
<contact at example.org> rather than <contact at example.org/resource>"

To me, it seems to mean that both ejabberd and PyICQ-t are conforming
to the standard, but still can't interoperate...

Here's a patch for PyICQ-t that fixes the problem.  I think ejabberd
should be fixed too, but I'm not quite sure how to do that.

--- orig/src/register.py
+++ mod/src/register.py
@@ -130,7 +130,9 @@
 				debug.log("RegisterManager: Sent off a result Iq")
 				# If they're in a session right now, we do nothing
 				if(not self.pytrans.sessions.has_key(source)):
-					jabw.sendPresence(self.pytrans, to=incoming.getAttribute("from"), fro=config.jid, ptype="subscribe")
+					# strip resource
+					(user,host,_) = jid.parse(incoming.getAttribute("from"))
+					jabw.sendPresence(self.pytrans, to=("%s@%s" % (user,host)), fro=config.jid, ptype="subscribe")


More information about the ejabberd mailing list