Mercurial > ~mikael > mcabber > hg
comparison mcabber/src/xmpp.c @ 1611:f9bf561e54d0
Use the username for authentication, added jid_get_username() to utils.c
author | franky |
---|---|
date | Sun, 11 Oct 2009 20:58:20 +0200 |
parents | 6db9f403f707 |
children | 04e3b502aeb4 |
comparison
equal
deleted
inserted
replaced
1610:6db9f403f707 | 1611:f9bf561e54d0 |
---|---|
850 } | 850 } |
851 | 851 |
852 static void connection_open_cb(LmConnection *connection, gboolean success, | 852 static void connection_open_cb(LmConnection *connection, gboolean success, |
853 gpointer user_data) | 853 gpointer user_data) |
854 { | 854 { |
855 const char *userjid, *password, *resource, *servername; | 855 const char *username, *password, *resource, *servername; |
856 GError *error; | 856 GError *error; |
857 | 857 |
858 if (success) { | 858 if (success) { |
859 servername = settings_opt_get("server"); | 859 servername = settings_opt_get("server"); |
860 userjid = settings_opt_get("jid"); | 860 username = jid_get_username(settings_opt_get("jid")); |
861 password = settings_opt_get("password"); | 861 password = settings_opt_get("password"); |
862 resource = strchr(lm_connection_get_jid(connection), | 862 resource = strchr(lm_connection_get_jid(connection), |
863 JID_RESOURCE_SEPARATOR); | 863 JID_RESOURCE_SEPARATOR); |
864 if (resource) | 864 if (resource) |
865 resource++; | 865 resource++; |
866 | 866 |
867 if (!lm_connection_authenticate(lconnection, userjid, password, resource, | 867 if (!lm_connection_authenticate(lconnection, username, password, resource, |
868 connection_auth_cb, NULL, FALSE, &error)) { | 868 connection_auth_cb, NULL, FALSE, &error)) { |
869 scr_LogPrint(LPRINT_LOGNORM, "Failed to authenticate: %s\n", | 869 scr_LogPrint(LPRINT_LOGNORM, "Failed to authenticate: %s\n", |
870 error->message); | 870 error->message); |
871 _try_to_reconnect(); | 871 _try_to_reconnect(); |
872 } | 872 } |
873 g_free(username); | |
873 } else { | 874 } else { |
874 scr_LogPrint(LPRINT_LOGNORM, "There was an error while connecting."); | 875 scr_LogPrint(LPRINT_LOGNORM, "There was an error while connecting."); |
875 _try_to_reconnect(); | 876 _try_to_reconnect(); |
876 } | 877 } |
877 } | 878 } |