changeset 19458:2bccaf556994

merge of '3ccc848dcffce11aa363f593e383cc1f07d081d0' and '555d85985bc1831a4455fc8cbc5de5b164071807'
author Sadrul Habib Chowdhury <imadil@gmail.com>
date Sun, 26 Aug 2007 23:03:40 +0000
parents 3ad938b84843 (current diff) f2a193f3bc90 (diff)
children b5bf271679e2
files
diffstat 12 files changed, 169 insertions(+), 18 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Sun Aug 26 21:28:58 2007 +0000
+++ b/ChangeLog	Sun Aug 26 23:03:40 2007 +0000
@@ -4,6 +4,9 @@
 	* New protocol plugin: MySpaceIM (Jeff Connelly, Google Summer of
 	  Code)
 
+	Finch:
+	* Per-conversation mute and logging options (accessible from the menu)
+
 version 2.1.1 (08/20/2007):
 	Yahoo:
 	* Added an account action to open your inbox in the yahoo prpl.
--- a/ChangeLog.API	Sun Aug 26 21:28:58 2007 +0000
+++ b/ChangeLog.API	Sun Aug 26 23:03:40 2007 +0000
@@ -6,6 +6,18 @@
 		* pidgin_set_accessible_relations, sets up label-for and labelled-by
 		  ATK relations (broken out from pidgin_set_accessible_label)
 
+	Finch:
+		Added:
+		* finch_sound_is_enabled
+		* The reserved field in the FinchConv is now used to store information
+		  about the conversation (using FinchConversationFlag)
+
+		libgnt:
+		* gnt_slider_set_small_step, gnt_slider_set_large_step to allow more
+		  fine tuned updates of a GntSlider
+		* gnt_util_parse_xhtml_to_textview to parse XHTML strings in a
+		  GntTextView (this works only if libxml2 is available)
+
 Version 2.1.1 (08/20/2007):
 	libpurple:
 		Changed:
--- a/finch/gntconv.c	Sun Aug 26 21:28:58 2007 +0000
+++ b/finch/gntconv.c	Sun Aug 26 23:03:40 2007 +0000
@@ -37,6 +37,7 @@
 #include "gntdebug.h"
 #include "gntplugin.h"
 #include "gntprefs.h"
+#include "gntsound.h"
 #include "gntstatus.h"
 #include "gntpounce.h"
 
@@ -347,6 +348,53 @@
 }
 
 static void
+toggle_logging_cb(GntMenuItem *item, gpointer ggconv)
+{
+	FinchConv *fc = ggconv;
+	PurpleConversation *conv = fc->active_conv;
+	gboolean logging = gnt_menuitem_check_get_checked(GNT_MENU_ITEM_CHECK(item));
+	GList *iter;
+
+	if (logging == purple_conversation_is_logging(conv))
+		return;
+
+	/* Xerox */
+	if (logging) {
+		/* Enable logging first so the message below can be logged. */
+		purple_conversation_set_logging(conv, TRUE);
+
+		purple_conversation_write(conv, NULL,
+				_("Logging started. Future messages in this conversation will be logged."),
+				conv->logs ? (PURPLE_MESSAGE_SYSTEM) :
+				(PURPLE_MESSAGE_SYSTEM | PURPLE_MESSAGE_NO_LOG),
+				time(NULL));
+	} else {
+		purple_conversation_write(conv, NULL,
+				_("Logging stopped. Future messages in this conversation will not be logged."),
+				conv->logs ? (PURPLE_MESSAGE_SYSTEM) :
+				(PURPLE_MESSAGE_SYSTEM | PURPLE_MESSAGE_NO_LOG),
+				time(NULL));
+
+		/* Disable the logging second, so that the above message can be logged. */
+		purple_conversation_set_logging(conv, FALSE);
+	}
+
+	/* Each conversation with the same person will have the same logging setting */
+	for (iter = fc->list; iter; iter = iter->next) {
+		if (iter->data == conv)
+			continue;
+		purple_conversation_set_logging(iter->data, logging);
+	}
+}
+
+static void
+toggle_sound_cb(GntMenuItem *item, gpointer ggconv)
+{
+	FinchConv *fc = ggconv;
+	fc->flags ^= FINCH_CONV_NO_SOUND;
+}
+
+static void
 send_to_cb(GntMenuItem *m, gpointer n)
 {
 	PurpleAccount *account = g_object_get_data(G_OBJECT(m), "purple_account");
@@ -452,6 +500,18 @@
 
 		generate_send_to_menu(ggc);
 	}
+
+	item = gnt_menuitem_check_new(_("Enable Logging"));
+	gnt_menuitem_check_set_checked(GNT_MENU_ITEM_CHECK(item),
+			purple_conversation_is_logging(ggc->active_conv));
+	gnt_menu_add_item(GNT_MENU(sub), item);
+	gnt_menuitem_set_callback(item, toggle_logging_cb, ggc);
+
+	item = gnt_menuitem_check_new(_("Enable Sounds"));
+	gnt_menuitem_check_set_checked(GNT_MENU_ITEM_CHECK(item),
+			!(ggc->flags & FINCH_CONV_NO_SOUND));
+	gnt_menu_add_item(GNT_MENU(sub), item);
+	gnt_menuitem_set_callback(item, toggle_sound_cb, ggc);
 }
 
 static void
@@ -497,6 +557,12 @@
 	else
 		ggc = g_new0(FinchConv, 1);
 
+	/* Each conversation with the same person will have the same logging setting */
+	if (ggc->list) {
+		purple_conversation_set_logging(conv,
+				purple_conversation_is_logging(ggc->list->data));
+	}
+
 	ggc->list = g_list_prepend(ggc->list, conv);
 	ggc->active_conv = conv;
 	conv->ui_data = ggc;
@@ -586,6 +652,9 @@
 		g_signal_connect(G_OBJECT(ggc->entry), "text_changed", G_CALLBACK(send_typing_notification), ggc);
 	}
 
+	if (!finch_sound_is_enabled())
+		ggc->flags |= FINCH_CONV_NO_SOUND;
+
 	gg_create_menu(ggc);
 
 	g_free(title);
@@ -830,6 +899,23 @@
 	gnt_tree_change_text(GNT_TREE(ggc->u.chat->userlist), (gpointer)user, 0, chat_flag_text(cb->flags));
 }
 
+static void
+finch_conv_present(PurpleConversation *conv)
+{
+	FinchConv *fc = FINCH_CONV(conv);
+	if (fc && fc->window)
+		return gnt_window_present(fc->window);
+}
+
+static gboolean
+finch_conv_has_focus(PurpleConversation *conv)
+{
+	FinchConv *fc = FINCH_CONV(conv);
+	if (fc && fc->window)
+		return gnt_widget_has_focus(fc->window);
+	return FALSE;
+}
+
 static PurpleConversationUiOps conv_ui_ops = 
 {
 	finch_create_conversation,
@@ -841,8 +927,8 @@
 	finch_chat_rename_user,
 	finch_chat_remove_users,
 	finch_chat_update_user,
-	NULL, /* present */
-	NULL, /* has_focus */
+	finch_conv_present, /* present */
+	finch_conv_has_focus, /* has_focus */
 	NULL, /* custom_smiley_add */
 	NULL, /* custom_smiley_write */
 	NULL, /* custom_smiley_close */
--- a/finch/gntconv.h	Sun Aug 26 21:28:58 2007 +0000
+++ b/finch/gntconv.h	Sun Aug 26 23:03:40 2007 +0000
@@ -43,6 +43,11 @@
 typedef struct _FinchConvChat FinchConvChat;
 typedef struct _FinchConvIm FinchConvIm;
 
+typedef enum
+{
+	FINCH_CONV_NO_SOUND     = 1 << 0,
+} FinchConversationFlag;
+
 struct _FinchConv
 {
 	GList *list;
@@ -53,7 +58,7 @@
 	GntWidget *tv;            /* text-view */
 	GntWidget *menu;
 	GntWidget *info;
-	void *pad;
+	FinchConversationFlag flags;
 
 	union
 	{
--- a/finch/gntsound.c	Sun Aug 26 21:28:58 2007 +0000
+++ b/finch/gntsound.c	Sun Aug 26 23:03:40 2007 +0000
@@ -40,6 +40,8 @@
 #include "sound.h"
 #include "util.h"
 
+#include "gntconv.h"
+
 #include "gntbox.h"
 #include "gntwindow.h"
 #include "gntcombobox.h"
@@ -173,7 +175,8 @@
 
 		has_focus = purple_conversation_has_focus(conv);
 
-		if (has_focus && !purple_prefs_get_bool(make_pref("/conv_focus")))
+		if ((gntconv->flags & FINCH_CONV_NO_SOUND) ||
+			(has_focus && !purple_prefs_get_bool(make_pref("/conv_focus"))))
 		{
 			return;
 		}
@@ -1061,7 +1064,22 @@
 	load_pref_window(finch_sound_get_active_profile());
 
 	gnt_widget_show(win);
-}	
+}
+
+gboolean finch_sound_is_enabled(void)
+{
+	const char *pref = make_pref("/method");
+	const char *method = purple_prefs_get_string(pref);
+
+	if (!method)
+		return FALSE;
+	if (strcmp(method, "nosound") == 0)
+		return FALSE;
+	if (purple_prefs_get_int(make_pref("/volume")) <= 0)
+		return FALSE;
+
+	return TRUE;
+}
 
 static PurpleSoundUiOps sound_ui_ops =
 {
--- a/finch/gntsound.h	Sun Aug 26 21:28:58 2007 +0000
+++ b/finch/gntsound.h	Sun Aug 26 23:03:40 2007 +0000
@@ -55,6 +55,14 @@
 GList *finch_sound_get_profiles(void);
 
 /**
+ * Determine whether any sound will be played or not.
+ *
+ * @return Returns FALSE if preference is set to 'No sound', or if volume is
+ *         set to zero.
+ */
+gboolean finch_sound_is_enabled(void);
+
+/**
  * Gets GNT sound UI ops.
  *
  * @return The UI operations structure.
--- a/libpurple/protocols/Makefile.am	Sun Aug 26 21:28:58 2007 +0000
+++ b/libpurple/protocols/Makefile.am	Sun Aug 26 23:03:40 2007 +0000
@@ -1,5 +1,5 @@
 EXTRA_DIST = Makefile.mingw
 
-DIST_SUBDIRS = bonjour gg irc jabber msn novell null oscar qq sametime silc silc10 toc simple yahoo zephyr
+DIST_SUBDIRS = bonjour gg irc jabber msn myspace novell null oscar qq sametime silc silc10 toc simple yahoo zephyr
 
 SUBDIRS = $(DYNAMIC_PRPLS) $(STATIC_PRPLS)
--- a/libpurple/protocols/Makefile.mingw	Sun Aug 26 21:28:58 2007 +0000
+++ b/libpurple/protocols/Makefile.mingw	Sun Aug 26 23:03:40 2007 +0000
@@ -8,7 +8,7 @@
 PIDGIN_TREE_TOP := ../..
 include $(PIDGIN_TREE_TOP)/libpurple/win32/global.mak
 
-SUBDIRS = gg irc jabber msn novell null oscar qq sametime silc10 simple yahoo bonjour
+SUBDIRS = gg irc jabber msn novell null oscar qq sametime silc10 simple yahoo bonjour myspace
 
 .PHONY: all install clean
 
--- a/libpurple/protocols/jabber/roster.c	Sun Aug 26 21:28:58 2007 +0000
+++ b/libpurple/protocols/jabber/roster.c	Sun Aug 26 23:03:40 2007 +0000
@@ -58,6 +58,7 @@
 {
 	GSList *buddies, *g2, *l;
 	gchar *my_bare_jid;
+	GList *pool = NULL;
 
 	buddies = purple_find_buddies(js->gc->account, jid);
 
@@ -89,13 +90,20 @@
 			g_free(l->data);
 			g2 = g_slist_delete_link(g2, l);
 		} else {
-			purple_blist_remove_buddy(b);
+			pool = g_list_prepend(pool, b);
 		}
 	}
 
 	while(g2) {
-		PurpleBuddy *b = purple_buddy_new(js->gc->account, jid, alias);
 		PurpleGroup *g = purple_find_group(g2->data);
+		PurpleBuddy *b = NULL;
+
+		if (pool) {
+			b = pool->data;
+			pool = g_list_delete_link(pool, pool);
+		} else {			
+			b = purple_buddy_new(js->gc->account, jid, alias);
+		}
 
 		if(!g) {
 			g = purple_group_new(g2->data);
@@ -121,6 +129,12 @@
 		g2 = g_slist_delete_link(g2, g2);
 	}
 
+	while (pool) {
+		PurpleBuddy *b = pool->data;
+		purple_blist_remove_buddy(b);
+		pool = g_list_delete_link(pool, pool);
+	}
+
 	g_free(my_bare_jid);
 	g_slist_free(buddies);
 }
--- a/libpurple/protocols/yahoo/yahoo.c	Sun Aug 26 21:28:58 2007 +0000
+++ b/libpurple/protocols/yahoo/yahoo.c	Sun Aug 26 23:03:40 2007 +0000
@@ -238,14 +238,18 @@
 		case 8: /* how many online buddies we have */
 			break;
 		case 7: /* the current buddy */
-			if (name && f) /* update the previous buddy before changing the variables */
-				yahoo_update_status(gc, name, f);
-			name = pair->value;
-			if (name && g_utf8_validate(name, -1, NULL))
+			/* update the previous buddy before changing the variables */
+			if (f) {
+				if (message)
+					yahoo_friend_set_status_message(f, yahoo_string_decode(gc, message, unicode));
+				if (name)
+					yahoo_update_status(gc, name, f);
+			}
+			name = message = NULL;
+			f = NULL;
+			if (pair->value && g_utf8_validate(pair->value, -1, NULL)) {
+				name = pair->value;
 				f = yahoo_friend_find_or_new(gc, name);
-			else {
-				f = NULL;
-				name = NULL;
 			}
 			break;
 		case 10: /* state */
@@ -779,7 +783,7 @@
 		purple_conversation_write(conv, NULL, buf, PURPLE_MESSAGE_SYSTEM|PURPLE_MESSAGE_NOTIFY, time(NULL));
 		g_free(buf);
 	}
-    	
+
 }
 
 
--- a/pidgin/gtkdialogs.c	Sun Aug 26 21:28:58 2007 +0000
+++ b/pidgin/gtkdialogs.c	Sun Aug 26 23:03:40 2007 +0000
@@ -381,7 +381,7 @@
 		  "libpurple which is capable of connecting to "
 		  "AIM, MSN, Yahoo!, XMPP, ICQ, IRC, SILC, SIP/SIMPLE, "
 		  "Novell GroupWise, Lotus Sametime, Bonjour, Zephyr, "
-		  "Gadu-Gadu, and QQ all at once.  "
+		  "MySpaceIM, Gadu-Gadu, and QQ all at once.  "
 		  "It is written using GTK+.<BR><BR>"
 		  "You may modify and redistribute the program under "
 		  "the terms of the GPL (version 2 or later).  A copy of the GPL is "
--- a/pidgin/win32/nsis/pidgin-installer.nsi	Sun Aug 26 21:28:58 2007 +0000
+++ b/pidgin/win32/nsis/pidgin-installer.nsi	Sun Aug 26 23:03:40 2007 +0000
@@ -710,6 +710,7 @@
     Delete "$INSTDIR\plugins\libicq.dll"
     Delete "$INSTDIR\plugins\libirc.dll"
     Delete "$INSTDIR\plugins\libmsn.dll"
+    Delete "$INSTDIR\plugins\libmyspace.dll"
     Delete "$INSTDIR\plugins\libnapster.dll"
     Delete "$INSTDIR\plugins\libnovell.dll"
     Delete "$INSTDIR\plugins\libqq.dll"