# HG changeset patch # User Mikael Hallendal # Date 1172338932 -3600 # Node ID a519eff901e6a4d90426eca2273bf7364e4f0ad9 # Parent ef2e388b841210b6b2946b257631ea439dda3908 Slight code refactoring in _lm_connection_socket_result Use connection_get_server_from_jid here as well. diff -r ef2e388b8412 -r a519eff901e6 loudmouth/lm-connection.c --- a/loudmouth/lm-connection.c Sat Feb 24 16:52:45 2007 +0100 +++ b/loudmouth/lm-connection.c Sat Feb 24 18:42:12 2007 +0100 @@ -1,6 +1,6 @@ /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ /* - * Copyright (C) 2003-2006 Imendio AB + * Copyright (C) 2003-2007 Imendio AB * Copyright (C) 2006 Nokia Corporation. All rights reserved. * Copyright (C) 2007 Collabora Ltd. * @@ -773,10 +773,8 @@ void _lm_connection_socket_result (LmConnection *connection, gboolean result) { - LmMessage *m; - gchar *server_from_jid; - gchar *ch; - gchar *ch_end; + LmMessage *m; + gchar *server_from_jid; if (!result) { _lm_connection_do_close (connection); @@ -805,14 +803,7 @@ return; } - if (connection->jid != NULL && (ch = strchr (connection->jid, '@')) != NULL) { - 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 { + if (!connection_get_server_from_jid (connection->jid, &server_from_jid)) { server_from_jid = g_strdup (connection->server); } @@ -824,6 +815,7 @@ "version", "1.0", NULL); + g_free (server_from_jid); lm_verbose ("Opening stream..."); if (!lm_connection_send (connection, m, NULL)) { @@ -831,7 +823,6 @@ _lm_connection_do_close (connection); } - g_free (server_from_jid); lm_message_unref (m); }