comparison mcabber/src/xmpp.c @ 1663:dcb0b4522ded

Fix GError handling
author Myhailo Danylenko <isbear@ukrpost.net>
date Wed, 13 Jan 2010 12:43:57 +0200
parents fbab3c1300d5
children 1a4890514eb9
comparison
equal deleted inserted replaced
1662:63ebb1d32c7d 1663:dcb0b4522ded
852 } 852 }
853 853
854 static void connection_open_cb(LmConnection *connection, gboolean success, 854 static void connection_open_cb(LmConnection *connection, gboolean success,
855 gpointer user_data) 855 gpointer user_data)
856 { 856 {
857 GError *error; 857 GError *error = NULL;
858 858
859 if (success) { 859 if (success) {
860 const char *password, *resource; 860 const char *password, *resource;
861 char *username; 861 char *username;
862 username = jid_get_username(settings_opt_get("jid")); 862 username = jid_get_username(settings_opt_get("jid"));
868 868
869 if (!lm_connection_authenticate(lconnection, username, password, resource, 869 if (!lm_connection_authenticate(lconnection, username, password, resource,
870 connection_auth_cb, NULL, FALSE, &error)) { 870 connection_auth_cb, NULL, FALSE, &error)) {
871 scr_LogPrint(LPRINT_LOGNORM, "Failed to authenticate: %s\n", 871 scr_LogPrint(LPRINT_LOGNORM, "Failed to authenticate: %s\n",
872 error->message); 872 error->message);
873 g_error_free (error);
873 _try_to_reconnect(); 874 _try_to_reconnect();
874 } 875 }
875 g_free(username); 876 g_free(username);
876 } else { 877 } else {
877 scr_LogPrint(LPRINT_LOGNORM, "There was an error while connecting."); 878 scr_LogPrint(LPRINT_LOGNORM, "There was an error while connecting.");
1748 1749
1749 if (!lm_connection_open(lconnection, connection_open_cb, 1750 if (!lm_connection_open(lconnection, connection_open_cb,
1750 NULL, FALSE, &error)) { 1751 NULL, FALSE, &error)) {
1751 _try_to_reconnect(); 1752 _try_to_reconnect();
1752 scr_LogPrint(LPRINT_LOGNORM, "Failed to open: %s\n", error->message); 1753 scr_LogPrint(LPRINT_LOGNORM, "Failed to open: %s\n", error->message);
1754 g_error_free (error);
1753 } 1755 }
1754 } 1756 }
1755 1757
1756 // insert_entity_capabilities(presence_stanza) 1758 // insert_entity_capabilities(presence_stanza)
1757 // Entity Capabilities (XEP-0115) 1759 // Entity Capabilities (XEP-0115)