]> git.0d.be Git - empathy.git/commitdiff
Chech if there is already a Salut account before creating a new one and
authorXavier Claessens <xclaesse@gmail.com>
Fri, 24 Aug 2007 21:05:34 +0000 (21:05 +0000)
committerXavier Claessens <xclaesse@src.gnome.org>
Fri, 24 Aug 2007 21:05:34 +0000 (21:05 +0000)
2007-08-24 Xavier Claessens  <xclaesse@gmail.com>

* src/empathy.c: Chech if there is already a Salut account before
creating a new one and add more debug messages.

svn path=/trunk/; revision=269

ChangeLog
src/empathy.c

index bb0e6eb571d5159bd8349596355095d0192aa66c..f25c0bb3fbc2ff26d9bb329bacff515b42f591b0 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2007-08-24 Xavier Claessens  <xclaesse@gmail.com>
+
+       * src/empathy.c: Chech if there is already a Salut account before
+       creating a new one and add more debug messages.
+
 2007-08-24 Xavier Claessens  <xclaesse@gmail.com>
 
        * configure.ac:
index 81fdf1e4b57ac497214172a5d8285792e3b2f56d..e1a32a0b6d8e05ae41ed756c90d9f5b3b5126ac8 100644 (file)
@@ -157,6 +157,7 @@ create_salut_account (void)
        McProtocol *protocol;
        gboolean    salut_created;
        McAccount  *account;
+       GList      *accounts;
        EBook      *book;
        EContact   *contact;
        gchar      *nickname = NULL;
@@ -166,6 +167,7 @@ create_salut_account (void)
        gchar      *email = NULL;
        gchar      *jid = NULL;
 
+       /* Check if we already created a salut account */
        if (!empathy_conf_get_bool (empathy_conf_get(),
                                    EMPATHY_PREFS_SALUT_ACCOUNT_CREATED,
                                    &salut_created)) {
@@ -175,15 +177,22 @@ create_salut_account (void)
                return;
        }
 
+       empathy_debug (DEBUG_DOMAIN, "Try to add a salut account...");
+
+       /* Check if the salut CM is installed */
        profile = mc_profile_lookup ("salut");
        protocol = mc_profile_get_protocol (profile);
        if (!protocol) {
+               empathy_debug (DEBUG_DOMAIN, "Salut not installed");
                g_object_unref (profile);
                return;
        }
        g_object_unref (protocol);
 
+       /* Get self EContact from EDS */
        if (!e_book_get_self (&contact, &book, NULL)) {
+               empathy_debug (DEBUG_DOMAIN, "Failed to get self econtact");
+               g_object_unref (profile);
                return;
        }
 
@@ -191,6 +200,15 @@ create_salut_account (void)
                               EMPATHY_PREFS_SALUT_ACCOUNT_CREATED,
                               TRUE);
 
+       /* Check if there is already a salut account */
+       accounts = mc_accounts_list_by_profile (profile);
+       if (accounts) {
+               empathy_debug (DEBUG_DOMAIN, "There is already a salut account");
+               mc_accounts_list_free (accounts);
+               g_object_unref (profile);
+               return;
+       }
+
        account = mc_account_create (profile);
        mc_account_set_display_name (account, _("People nearby"));
        
@@ -210,6 +228,15 @@ create_salut_account (void)
                published_name = g_strdup (g_get_real_name ());
        }
 
+       empathy_debug (DEBUG_DOMAIN, "Salut account created:\n"
+                                    "  nickname=%s\n"
+                                    "  published-name=%s\n"
+                                    "  first-name=%s\n"
+                                    "  last-name=%s\n"
+                                    "  email=%s\n"
+                                    "  jid=%s\n",
+                      nickname, published_name, first_name, last_name, email, jid);
+
        mc_account_set_param_string (account, "nickname", nickname ? nickname : "");
        mc_account_set_param_string (account, "published-name", published_name ? published_name : "");
        mc_account_set_param_string (account, "first-name", first_name ? first_name : "");