# HG changeset patch # User Mikael Hallendal # Date 1172286474 -3600 # Node ID 645f722461e3a430a424ccc2e57a55e21689ef45 # Parent 8e1bb9d60aa5af317f3c2d1ca1190dc070a7a8ad Correctly extract the server from a JID when resource is included. If a full JID (including resource) was given to lm_connection_set_jid it wou include the resource part when trying to connect to the server. Patch from Matthias Quasthoff diff -r 8e1bb9d60aa5 -r 645f722461e3 loudmouth/lm-connection.c --- a/loudmouth/lm-connection.c Sat Feb 24 04:06:24 2007 +0100 +++ b/loudmouth/lm-connection.c Sat Feb 24 04:07:54 2007 +0100 @@ -340,6 +340,7 @@ LmMessage *m; gchar *server_from_jid; gchar *ch; + gchar *ch_end; connection = connect_data->connection; @@ -440,9 +441,14 @@ } if (connection->jid != NULL && (ch = strchr (connection->jid, '@')) != NULL) { - server_from_jid = ch + 1; + ch_end = strchr(ch + 1, '/'); + if (ch_end != NULL) { + server_from_jid = g_strndup (ch + 1, ch_end - ch - 1); + } else { + server_from_jid = g_strdup (ch + 1); + } } else { - server_from_jid = connection->server; + server_from_jid = g_strdup (connection->server); } m = lm_message_new (server_from_jid, LM_MESSAGE_TYPE_STREAM); @@ -459,6 +465,7 @@ connection_do_close (connection); } + g_free (server_from_jid); lm_message_unref (m); }