changeset 18300:9171c96ab475

merge of '957d8b98b97eb5f2d3f58208e8ad28a55f3f81b8' and 'f4ded9af5084e9c7c677eeede3544c679323adfd'
author Sadrul Habib Chowdhury <imadil@gmail.com>
date Tue, 26 Jun 2007 21:09:22 +0000
parents 73b3da7608f5 (current diff) ba67200a69d1 (diff)
children f8f726b74b5c
files
diffstat 16 files changed, 105 insertions(+), 79 deletions(-) [+]
line wrap: on
line diff
--- a/COPYRIGHT	Tue Jun 26 21:08:41 2007 +0000
+++ b/COPYRIGHT	Tue Jun 26 21:09:22 2007 +0000
@@ -356,6 +356,7 @@
 Cestonaro Thilo
 Will Thompson
 Douglas Thrift (douglaswth)
+Mark Tiefenbruck
 Andrew Tinney
 Jeffery To
 Warren Togami
--- a/libpurple/Makefile.am	Tue Jun 26 21:08:41 2007 +0000
+++ b/libpurple/Makefile.am	Tue Jun 26 21:09:22 2007 +0000
@@ -157,10 +157,10 @@
 purple_build_coreheaders = $(addprefix $(srcdir)/, $(purple_coreheaders))
 dbus_build_exported = $(addprefix $(srcdir)/, $(dbus_exported))
 
-dbus-types.c: dbus-analyze-types.py $(purple_coreheaders)
+dbus-types.c: dbus-analyze-types.py $(purple_build_coreheaders)
 	cat $(purple_build_coreheaders) | $(PYTHON) $(srcdir)/dbus-analyze-types.py --pattern=PURPLE_DBUS_DEFINE_TYPE\(%s\) > $@
 
-dbus-types.h: dbus-analyze-types.py $(dbus_coreheaders)
+dbus-types.h: dbus-analyze-types.py $(purple_build_coreheaders)
 	cat $(purple_build_coreheaders) | $(PYTHON) $(srcdir)/dbus-analyze-types.py --pattern=PURPLE_DBUS_DECLARE_TYPE\(%s\) > $@
 
 dbus-bindings.c: dbus-analyze-functions.py $(dbus_exported)
--- a/libpurple/plugins/perl/scripts/signals-test.pl	Tue Jun 26 21:08:41 2007 +0000
+++ b/libpurple/plugins/perl/scripts/signals-test.pl	Tue Jun 26 21:09:22 2007 +0000
@@ -7,7 +7,7 @@
 	name => "Perl: $MODULE_NAME",
 	version => "0.1",
 	summary => "Signals Test plugin for the Perl interpreter.",
-	description => "Demonstrate the user of purple signals from " .
+	description => "Demonstrate the use of purple signals from " .
 		       "a perl plugin.",
 	author => "Sadrul Habib Chowdhury <sadrul\@pidgin.im>",
 	url => "http://developer.pidgin.im/wiki/sadrul/",
--- a/libpurple/protocols/bonjour/buddy.c	Tue Jun 26 21:08:41 2007 +0000
+++ b/libpurple/protocols/bonjour/buddy.c	Tue Jun 26 21:09:22 2007 +0000
@@ -17,6 +17,7 @@
 #include <glib.h>
 #include <stdlib.h>
 
+#include "internal.h"
 #include "buddy.h"
 #include "account.h"
 #include "blist.h"
--- a/libpurple/protocols/bonjour/jabber.c	Tue Jun 26 21:08:41 2007 +0000
+++ b/libpurple/protocols/bonjour/jabber.c	Tue Jun 26 21:09:22 2007 +0000
@@ -31,6 +31,7 @@
 #include <unistd.h>
 #include <fcntl.h>
 
+#include "internal.h"
 #include "network.h"
 #include "eventloop.h"
 #include "connection.h"
--- a/libpurple/protocols/bonjour/mdns_common.c	Tue Jun 26 21:08:41 2007 +0000
+++ b/libpurple/protocols/bonjour/mdns_common.c	Tue Jun 26 21:09:22 2007 +0000
@@ -16,6 +16,7 @@
 
 #include <string.h>
 
+#include "internal.h"
 #include "config.h"
 #include "mdns_common.h"
 #include "bonjour.h"
--- a/libpurple/protocols/bonjour/mdns_win32.c	Tue Jun 26 21:08:41 2007 +0000
+++ b/libpurple/protocols/bonjour/mdns_win32.c	Tue Jun 26 21:09:22 2007 +0000
@@ -14,6 +14,7 @@
  *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  */
 
+#include "internal.h"
 #include "mdns_win32.h"
 
 #include "debug.h"
--- a/libpurple/protocols/jabber/presence.c	Tue Jun 26 21:08:41 2007 +0000
+++ b/libpurple/protocols/jabber/presence.c	Tue Jun 26 21:09:22 2007 +0000
@@ -565,9 +565,7 @@
 		}
 
 		if((found_jbr = jabber_buddy_find_resource(jb, NULL))) {
-			if(!jbr || jbr == found_jbr) {
-				purple_prpl_got_user_status(js->gc->account, buddy_name, jabber_buddy_state_get_status_id(state), "priority", found_jbr->priority, found_jbr->status ? "message" : NULL, found_jbr->status, NULL);
-			}
+			purple_prpl_got_user_status(js->gc->account, buddy_name, jabber_buddy_state_get_status_id(state), "priority", found_jbr->priority, found_jbr->status ? "message" : NULL, found_jbr->status, NULL);
 		} else {
 			purple_prpl_got_user_status(js->gc->account, buddy_name, "offline", status ? "message" : NULL, status, NULL);
 		}
--- a/libpurple/protocols/oscar/family_auth.c	Tue Jun 26 21:08:41 2007 +0000
+++ b/libpurple/protocols/oscar/family_auth.c	Tue Jun 26 21:09:22 2007 +0000
@@ -211,7 +211,7 @@
 
 #ifdef USE_XOR_FOR_ICQ
 	/* If we're signing on an ICQ account then use the older, XOR login method */
-	if (isdigit(sn[0]))
+	if (aim_sn_is_icq(sn))
 		return goddamnicq2(od, conn, sn, password, ci);
 #endif
 
@@ -224,7 +224,7 @@
 
 	/* Truncate ICQ and AOL passwords, if necessary */
 	password_len = strlen(password);
-	if (isdigit(sn[0]) && (password_len > MAXICQPASSLEN))
+	if (aim_sn_is_icq(sn) && (password_len > MAXICQPASSLEN))
 		password_len = MAXICQPASSLEN;
 	else if (truncate_pass && password_len > 8)
 		password_len = 8;
@@ -477,7 +477,7 @@
 		return -EINVAL;
 
 #ifdef USE_XOR_FOR_ICQ
-	if (isdigit(sn[0]))
+	if (aim_sn_is_icq(sn))
 		return goddamnicq(od, conn, sn);
 #endif
 
--- a/libpurple/protocols/oscar/oscar.c	Tue Jun 26 21:08:41 2007 +0000
+++ b/libpurple/protocols/oscar/oscar.c	Tue Jun 26 21:09:22 2007 +0000
@@ -425,7 +425,7 @@
 		charsetstr1 = "UCS-2BE";
 		charsetstr2 = "UTF-8";
 	} else if (charset == AIM_CHARSET_CUSTOM) {
-		if ((sourcesn != NULL) && isdigit(sourcesn[0]))
+		if ((sourcesn != NULL) && aim_sn_is_icq(sourcesn))
 			charsetstr1 = purple_account_get_string(account, "encoding", OSCAR_DEFAULT_CUSTOM_ENCODING);
 		else
 			charsetstr1 = "ISO-8859-1";
@@ -1258,7 +1258,7 @@
 
 	if (!aim_snvalid(purple_account_get_username(account))) {
 		gchar *buf;
-		buf = g_strdup_printf(_("Unable to login: Could not sign on as %s because the screen name is invalid.  Screen names must either start with a letter and contain only letters, numbers and spaces, or contain only numbers."), purple_account_get_username(account));
+		buf = g_strdup_printf(_("Unable to login: Could not sign on as %s because the screen name is invalid.  Screen names must be a valid email address, or start with a letter and contain only letters, numbers and spaces, or contain only numbers."), purple_account_get_username(account));
 		gc->wants_to_die = TRUE;
 		purple_connection_error(gc, buf);
 		g_free(buf);
@@ -4623,7 +4623,7 @@
 
 	if (!aim_snvalid(buddy->name)) {
 		gchar *buf;
-		buf = g_strdup_printf(_("Could not add the buddy %s because the screen name is invalid.  Screen names must either start with a letter and contain only letters, numbers and spaces, or contain only numbers."), buddy->name);
+		buf = g_strdup_printf(_("Could not add the buddy %s because the screen name is invalid.  Screen names must be a valid email address, or start with a letter and contain only letters, numbers and spaces, or contain only numbers."), buddy->name);
 		if (!purple_conv_present_error(buddy->name, purple_connection_get_account(gc), buf))
 			purple_notify_error(gc, NULL, _("Unable To Add"), buf);
 		g_free(buf);
@@ -5060,7 +5060,8 @@
 			default: { /* La la la */
 				gchar *buf;
 				purple_debug_error("oscar", "ssi: Action 0x%04hx was unsuccessful with error 0x%04hx\n", retval->action, retval->ack);
-				buf = g_strdup_printf(_("Could not add the buddy %s for an unknown reason.  The most common reason for this is that you have the maximum number of allowed buddies in your buddy list."), (retval->name ? retval->name : _("(no name)")));
+				buf = g_strdup_printf(_("Could not add the buddy %s for an unknown reason."),
+						(retval->name ? retval->name : _("(no name)")));
 				if ((retval->name != NULL) && !purple_conv_present_error(retval->name, purple_connection_get_account(gc), buf))
 					purple_notify_error(gc, NULL, _("Unable To Add"), buf);
 				g_free(buf);
--- a/libpurple/protocols/oscar/util.c	Tue Jun 26 21:08:41 2007 +0000
+++ b/libpurple/protocols/oscar/util.c	Tue Jun 26 21:09:22 2007 +0000
@@ -37,6 +37,7 @@
  *   -- DMP.
  *
  */
+/* TODO: Get rid of this and use glib functions */
 int
 aimutil_tokslen(char *toSearch, int theindex, char dl)
 {
@@ -138,6 +139,7 @@
  * Check if the given screen name is a valid AIM screen name.
  * Example: BobDole
  * Example: Henry_Ford@mac.com
+ * Example: 1KrazyKat@example.com
  *
  * @return TRUE if the screen name is valid, FALSE if not.
  */
@@ -146,9 +148,16 @@
 {
 	int i;
 
+	if (purple_email_is_valid(sn))
+		return TRUE;
+
+	/* Normal AIM screen names can't start with a number */
+	if (isdigit(sn[0]))
+		return FALSE;
+
 	for (i = 0; sn[i] != '\0'; i++) {
 		if (!isalnum(sn[i]) && (sn[i] != ' ') &&
-			(sn[i] != '@') && (sn[i] != '.') &&
+			(sn[i] != '.') &&
 			(sn[i] != '_') && (sn[i] != '-'))
 			return FALSE;
 	}
@@ -169,10 +178,10 @@
 
 	for (i = 0; sn[i] != '\0'; i++) {
 		if (!isdigit(sn[i]))
-			return 0;
+			return FALSE;
 	}
 
-	return 1;
+	return TRUE;
 }
 
 /**
@@ -187,14 +196,14 @@
 	int i;
 
 	if (sn[0] != '+')
-		return 0;
+		return FALSE;
 
 	for (i = 1; sn[i] != '\0'; i++) {
 		if (!isdigit(sn[i]))
-			return 0;
+			return FALSE;
 	}
 
-	return 1;
+	return TRUE;
 }
 
 /**
@@ -206,70 +215,37 @@
 aim_snvalid(const char *sn)
 {
 	if ((sn == NULL) || (*sn == '\0'))
-		return 0;
+		return FALSE;
 
-	if (isalpha(sn[0]))
-		return aim_snvalid_aim(sn);
-	else if (isdigit(sn[0]))
-		return aim_snvalid_icq(sn);
-	else if (sn[0] == '+')
-		return aim_snvalid_sms(sn);
-
-	return 0;
+	return aim_snvalid_icq(sn) || aim_snvalid_sms(sn) || aim_snvalid_aim(sn);
 }
 
 /**
  * Determine if a given screen name is an ICQ screen name
- * (i.e. it begins with a number).
+ * (i.e. it is composed of only numbers).
  *
- * @sn A valid AIM or ICQ screen name.
+ * @param sn A valid AIM or ICQ screen name.
  * @return TRUE if the screen name is an ICQ screen name.  Otherwise
  *         FALSE is returned.
  */
 gboolean
 aim_sn_is_icq(const char *sn)
 {
-	if (isalpha(sn[0]))
-		return FALSE;
-	return TRUE;
+	return aim_snvalid_icq(sn);
 }
 
 /**
  * Determine if a given screen name is an SMS number
  * (i.e. it begins with a +).
  *
- * @sn A valid AIM or ICQ screen name.
+ * @param sn A valid AIM or ICQ screen name.
  * @return TRUE if the screen name is an SMS number.  Otherwise
  *         FALSE is returned.
  */
 gboolean
 aim_sn_is_sms(const char *sn)
 {
-	if (sn[0] != '+')
-		return FALSE;
-	return TRUE;
-}
-
-/**
- * This takes a screen name and returns its length without
- * spaces.  If there are no spaces in the SN, then the
- * return is equal to that of strlen().
- */
-int
-aim_snlen(const char *sn)
-{
-	int i = 0;
-
-	if (!sn)
-		return 0;
-
-	while (*sn != '\0') {
-		if (*sn != ' ')
-			i++;
-		sn++;
-	}
-
-	return i;
+	return (sn[0] == '+');
 }
 
 /**
@@ -279,9 +255,9 @@
  * ignored, with the exception that screen names can not start with
  * a space).
  *
- * Return: 0 if equal
- *     non-0 if different
+ * @return 0 if equal, non-0 if different
  */
+/* TODO: Do something different for email addresses. */
 int
 aim_sncmp(const char *sn1, const char *sn2)
 {
--- a/libpurple/protocols/qq/Makefile.mingw	Tue Jun 26 21:08:41 2007 +0000
+++ b/libpurple/protocols/qq/Makefile.mingw	Tue Jun 26 21:09:22 2007 +0000
@@ -54,7 +54,6 @@
 	group_im.c \
 	group_info.c \
 	group_join.c \
-	group_misc.c \
 	group_network.c \
 	group_opt.c \
 	group_search.c \
--- a/libpurple/win32/win32dep.c	Tue Jun 26 21:08:41 2007 +0000
+++ b/libpurple/win32/win32dep.c	Tue Jun 26 21:09:22 2007 +0000
@@ -32,6 +32,7 @@
 #include <glib.h>
 #include <glib/gstdio.h>
 
+#include "internal.h"
 #include "debug.h"
 #include "notify.h"
 
--- a/pidgin/eggtrayicon.c	Tue Jun 26 21:08:41 2007 +0000
+++ b/pidgin/eggtrayicon.c	Tue Jun 26 21:09:22 2007 +0000
@@ -152,6 +152,26 @@
     }
 }
 
+static Display *
+egg_tray_icon_get_x_display(EggTrayIcon *icon)
+{
+  Display *xdisplay = NULL;
+
+#if GTK_CHECK_VERSION(2,1,0)
+  {
+    GdkDisplay *display = gtk_widget_get_display (GTK_WIDGET (icon));
+    if (!GDK_IS_DISPLAY (display))
+      display = gdk_display_get_default ();
+
+    xdisplay = GDK_DISPLAY_XDISPLAY (display);
+  }
+#else
+  xdisplay = gdk_display;
+#endif
+
+  return xdisplay;
+}
+
 static void
 egg_tray_icon_get_orientation_property (EggTrayIcon *icon)
 {
@@ -168,11 +188,10 @@
 
   g_return_if_fail(icon->manager_window != None);
 
-#if GTK_CHECK_VERSION(2,1,0)
-  xdisplay = GDK_DISPLAY_XDISPLAY (gtk_widget_get_display (GTK_WIDGET (icon)));
-#else
-  xdisplay = gdk_display;
-#endif
+  xdisplay = egg_tray_icon_get_x_display(icon);
+
+  if (xdisplay == NULL)
+    return;
 
   gdk_error_trap_push ();
   type = None;
@@ -321,11 +340,10 @@
   if (icon->manager_window != None)
     return;
 
-#if GTK_CHECK_VERSION(2,1,0)
-  xdisplay = GDK_DISPLAY_XDISPLAY (gtk_widget_get_display (GTK_WIDGET (icon)));
-#else
-  xdisplay = gdk_display;
-#endif
+  xdisplay = egg_tray_icon_get_x_display(icon);
+
+  if (xdisplay == NULL)
+    return;
 
   XGrabServer (xdisplay);
   
@@ -424,12 +442,15 @@
 
   make_transparent (widget, NULL);
 
+  xdisplay = egg_tray_icon_get_x_display(icon);
+
+  if (xdisplay == NULL)
+    return;
+
 #if GTK_CHECK_VERSION(2,1,0)
   screen = gdk_screen_get_number (gtk_widget_get_screen (widget));
-  xdisplay = GDK_DISPLAY_XDISPLAY (gtk_widget_get_display (widget));
 #else
   screen = XScreenNumberOfScreen (DefaultScreenOfDisplay (gdk_display));
-  xdisplay = gdk_display;
 #endif
 
   /* Now see if there's a manager window around */
@@ -519,11 +540,10 @@
       XClientMessageEvent ev;
       Display *xdisplay;
 
-#if GTK_CHECK_VERSION(2,1,0)
-      xdisplay = GDK_DISPLAY_XDISPLAY (gtk_widget_get_display (GTK_WIDGET (icon)));
-#else
-      xdisplay = gdk_display;
-#endif
+      xdisplay = egg_tray_icon_get_x_display(icon);
+
+      if (xdisplay == NULL)
+        return;
 
       ev.type = ClientMessage;
       ev.window = (Window)gtk_plug_get_id (GTK_PLUG (icon));
--- a/pidgin/gtkblist.c	Tue Jun 26 21:08:41 2007 +0000
+++ b/pidgin/gtkblist.c	Tue Jun 26 21:09:22 2007 +0000
@@ -174,6 +174,7 @@
 
 static gboolean gtk_blist_window_state_cb(GtkWidget *w, GdkEventWindowState *event, gpointer data)
 {
+#if GTK_CHECK_VERSION(2,2,0)
 	if(event->changed_mask & GDK_WINDOW_STATE_WITHDRAWN) {
 		if(event->new_window_state & GDK_WINDOW_STATE_WITHDRAWN)
 			purple_prefs_set_bool(PIDGIN_PREFS_ROOT "/blist/list_visible", FALSE);
@@ -195,6 +196,28 @@
 		if (!(event->new_window_state & GDK_WINDOW_STATE_ICONIFIED))
 			pidgin_blist_refresh_timer(purple_get_blist());
 	}
+#else
+	/* At least gtk+ 2.0.6 does not properly set the change_mask when unsetting a
+	 * GdkWindowState flag. To work around, the window state will be explicitly
+	 * queried on these older versions of gtk+. See pidgin ticket #739.
+	 */
+	GdkWindowState new_window_state = gdk_window_get_state(G_OBJECT(gtkblist->window->window));
+
+	if(new_window_state & GDK_WINDOW_STATE_WITHDRAWN) {
+		purple_prefs_set_bool(PIDGIN_PREFS_ROOT "/blist/list_visible", FALSE);
+	} else {
+		purple_prefs_set_bool(PIDGIN_PREFS_ROOT "/blist/list_visible", TRUE);
+		pidgin_blist_refresh_timer(purple_get_blist());
+	}
+
+	if(new_window_state & GDK_WINDOW_STATE_MAXIMIZED)
+		purple_prefs_set_bool(PIDGIN_PREFS_ROOT "/blist/list_maximized", TRUE);
+	else
+		purple_prefs_set_bool(PIDGIN_PREFS_ROOT "/blist/list_maximized", FALSE);
+
+	if (!(new_window_state & GDK_WINDOW_STATE_ICONIFIED))
+		pidgin_blist_refresh_timer(purple_get_blist());
+#endif
 
 	return FALSE;
 }
--- a/pidgin/gtkutils.c	Tue Jun 26 21:08:41 2007 +0000
+++ b/pidgin/gtkutils.c	Tue Jun 26 21:09:22 2007 +0000
@@ -1147,6 +1147,9 @@
 	acc = gtk_widget_get_accessible (w);
 	label = gtk_widget_get_accessible (l);
 
+	/* Make sure mnemonics work */
+        gtk_label_set_mnemonic_widget(GTK_LABEL(l), w);
+	
 	/* If this object has no name, set it's name with the label text */
 	existing_name = atk_object_get_name (acc);
 	if (!existing_name) {