changeset 20551:51285cbe582d

merge of 'd96ec25855462962b1e1e2f093f242522695c122' and 'f44e0598263b3a48b69fd305c3ba361e95d28188'
author Sadrul Habib Chowdhury <imadil@gmail.com>
date Wed, 19 Sep 2007 10:07:03 +0000
parents 4195e0a93b1e (current diff) 28493a27849b (diff)
children b7460582a135 d1ed74d50a9c
files
diffstat 3 files changed, 29 insertions(+), 26 deletions(-) [+]
line wrap: on
line diff
--- a/finch/finch.c	Wed Sep 19 09:43:07 2007 +0000
+++ b/finch/finch.c	Wed Sep 19 10:07:03 2007 +0000
@@ -297,6 +297,7 @@
 	if (opt_version) {
 		/* Translators may want to transliterate the name.
 		 It is not to be translated. */
+		gnt_quit();
 		printf("%s %s\n", _("Finch"), VERSION);
 		return 0;
 	}
@@ -419,13 +420,13 @@
 
 	gnt_init();
 
-	gnt_start(&argc, &argv);
-
-	gnt_main();
+	if (gnt_start(&argc, &argv)) {
+		gnt_main();
 
 #ifdef STANDALONE
-	purple_core_quit();
+		purple_core_quit();
 #endif
+	}
 
 	return 0;
 }
--- a/libpurple/blist.c	Wed Sep 19 09:43:07 2007 +0000
+++ b/libpurple/blist.c	Wed Sep 19 10:07:03 2007 +0000
@@ -843,6 +843,13 @@
 		ops->update(purplebuddylist, (PurpleBlistNode *)buddy);
 }
 
+static gboolean
+purple_strings_are_different(const char *one, const char *two)
+{
+	return !((one && two && g_utf8_collate(one, two) == 0) ||
+			((one == NULL || *one == '\0') && (two == NULL || *two == '\0')));
+}
+
 void purple_blist_alias_contact(PurpleContact *contact, const char *alias)
 {
 	PurpleBlistUiOps *ops = purple_blist_get_ui_ops();
@@ -852,6 +859,9 @@
 
 	g_return_if_fail(contact != NULL);
 
+	if (!purple_strings_are_different(contact->alias, alias))
+		return;
+
 	old_alias = contact->alias;
 
 	if ((alias != NULL) && (*alias != '\0'))
@@ -886,6 +896,9 @@
 
 	g_return_if_fail(chat != NULL);
 
+	if (!purple_strings_are_different(chat->alias, alias))
+		return;
+
 	old_alias = chat->alias;
 
 	if ((alias != NULL) && (*alias != '\0'))
@@ -911,6 +924,9 @@
 
 	g_return_if_fail(buddy != NULL);
 
+	if (!purple_strings_are_different(buddy->alias, alias))
+		return;
+
 	old_alias = buddy->alias;
 
 	if ((alias != NULL) && (*alias != '\0'))
@@ -941,6 +957,9 @@
 
 	g_return_if_fail(buddy != NULL);
 
+	if (!purple_strings_are_different(buddy->server_alias, alias))
+		return;
+
 	old_alias = buddy->server_alias;
 
 	if ((alias != NULL) && (*alias != '\0') && g_utf8_validate(alias, -1, NULL))
@@ -1423,26 +1442,7 @@
 
 void purple_contact_set_alias(PurpleContact *contact, const char *alias)
 {
-	PurpleBlistUiOps *ops = purple_blist_get_ui_ops();
-	char *old_alias;
-
-	g_return_if_fail(contact != NULL);
-
-	old_alias = contact->alias;
-
-	if ((alias != NULL) && (*alias != '\0'))
-		contact->alias = g_strdup(alias);
-	else
-		contact->alias = NULL;
-
-	purple_blist_schedule_save();
-
-	if (ops && ops->update)
-		ops->update(purplebuddylist, (PurpleBlistNode*)contact);
-
-	purple_signal_emit(purple_blist_get_handle(), "blist-node-aliased",
-					 contact, old_alias);
-	g_free(old_alias);
+	purple_blist_alias_contact(contact,alias);
 }
 
 const char *purple_contact_get_alias(PurpleContact* contact)
--- a/libpurple/blist.h	Wed Sep 19 09:43:07 2007 +0000
+++ b/libpurple/blist.h	Wed Sep 19 10:07:03 2007 +0000
@@ -65,11 +65,11 @@
 
 typedef enum
 {
-	PURPLE_BLIST_NODE_FLAG_NO_SAVE = 1 /**< node should not be saved with the buddy list */
+	PURPLE_BLIST_NODE_FLAG_NO_SAVE      = 1 << 0, /**< node should not be saved with the buddy list */
 
 } PurpleBlistNodeFlags;
 
-#define PURPLE_BLIST_NODE_HAS_FLAG(b, f) ((b)->flags & (f))
+#define PURPLE_BLIST_NODE_HAS_FLAG(b, f) (((PurpleBlistNode*)(b))->flags & (f))
 #define PURPLE_BLIST_NODE_SHOULD_SAVE(b) (! PURPLE_BLIST_NODE_HAS_FLAG(b, PURPLE_BLIST_NODE_FLAG_NO_SAVE))
 
 #define PURPLE_BLIST_NODE_NAME(n) ((n)->type == PURPLE_BLIST_CHAT_NODE  ? purple_chat_get_name((PurpleChat*)n) :        \
@@ -488,6 +488,8 @@
  *
  * @param contact  The contact
  * @param alias    The alias to set, or NULL to unset
+ *
+ * @deprecated Use purple_blist_alias_contact() instead.
  */
 void purple_contact_set_alias(PurpleContact *contact, const char *alias);