xmpp non sasl authenticate does not need the resource name
[citadel.git] / citadel / modules / xmpp / serv_xmpp.c
index 20f2089e33aab30f55098115fb890e41874b2c5a..d62bcfe468ee99ced792b01fde6632897838bbb7 100644 (file)
@@ -392,8 +392,7 @@ void xmpp_xml_end(void *data, const char *supplied_el) {
                        xmpp_non_sasl_authenticate(
                                XMPP->iq_id,
                                XMPP->iq_client_username,
-                               XMPP->iq_client_password,
-                               XMPP->iq_client_resource
+                               XMPP->iq_client_password
                        );
                }       
 
@@ -403,17 +402,17 @@ void xmpp_xml_end(void *data, const char *supplied_el) {
                else if (
                        (XMPP->bind_requested)
                        && (!IsEmptyStr(XMPP->iq_id))
-                       && (!IsEmptyStr(XMPP->iq_client_resource))
                        && (CC->logged_in)
-                       ) {
+               ) {
 
-                       /* Generate the "full JID" of the client resource */
+                       /* If the client has not specified a client resource, generate one */
 
-                       snprintf(XMPP->client_jid, sizeof XMPP->client_jid,
-                               "%s/%s",
-                               CC->cs_inet_email,
-                               XMPP->iq_client_resource
-                       );
+                       if (IsEmptyStr(XMPP->iq_client_resource)) {
+                               snprintf(XMPP->iq_client_resource, sizeof XMPP->iq_client_resource, "%d", CC->cs_pid);
+                       }
+
+                       /* Generate the "full JID" of the client resource */
+                       snprintf(XMPP->client_jid, sizeof XMPP->client_jid, "%s/%s", CC->cs_inet_email, XMPP->iq_client_resource);
 
                        /* Tell the client what its JID is */