changeset 15488:d562dbb64e70

merge of '02579a62368e29abc96596d62ad6d418fc23ddda' and 'c3a638dab420277672a7c02fcb3bf8f30ea16507'
author Sadrul Habib Chowdhury <imadil@gmail.com>
date Fri, 02 Feb 2007 04:38:35 +0000
parents 5e5f9ffa5b72 (current diff) 5369a4999f1c (diff)
children 29e8e230d1b6
files gaim.desktop.in
diffstat 13 files changed, 172 insertions(+), 73 deletions(-) [+]
line wrap: on
line diff
--- a/Makefile.am	Wed Jan 31 06:59:45 2007 +0000
+++ b/Makefile.am	Fri Feb 02 04:38:35 2007 +0000
@@ -13,7 +13,7 @@
 		gaim.pc.in \
 		gaim.spec.in \
 		gaim.apspec.in \
-		gaim.desktop.in \
+		pidgin.desktop.in \
 		gaim.service.in \
 		gaim-installer.nsi \
 		intltool-extract.in \
@@ -40,7 +40,7 @@
 #	cp libpurple/plugins/perl/common/Gaim.pm $(distdir)/libpurple/plugins/perl/common
 
 appsdir = $(datadir)/applications
-apps_in_files = gaim.desktop.in
+apps_in_files = pidgin.desktop.in
 apps_DATA = $(apps_in_files:.desktop.in=.desktop)
 @INTLTOOL_DESKTOP_RULE@
 
@@ -69,7 +69,7 @@
 distuninstallcheck_listfiles = \
 	find . -type f -print | grep -v perl | grep -v Gaim.3pm
 
-DISTCLEANFILES= gaim.desktop libpurple/gconf/gaim.schemas intltool-extract \
+DISTCLEANFILES= pidgin.desktop libpurple/gconf/gaim.schemas intltool-extract \
 			intltool-merge intltool-update
 
 ACLOCAL_AMFLAGS = -I m4
--- a/gaim.desktop.in	Wed Jan 31 06:59:45 2007 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,11 +0,0 @@
-[Desktop Entry]
-Encoding=UTF-8
-_Name=Pidgin Internet Messenger
-_GenericName=Internet Messenger
-_Comment=Send instant messages over multiple protocols
-Exec=gaim
-Icon=gaim.png
-StartupNotify=true
-Terminal=false
-Type=Application
-Categories=Network;InstantMessaging;
--- a/libpurple/account.c	Wed Jan 31 06:59:45 2007 +0000
+++ b/libpurple/account.c	Fri Feb 02 04:38:35 2007 +0000
@@ -57,6 +57,13 @@
 
 } GaimAccountSetting;
 
+typedef struct
+{
+	GaimAccountRequestType type;
+	GaimAccount *account;
+	void *ui_handle;
+
+} GaimAccountRequestInfo;
 
 static GaimAccountUiOps *account_ui_ops = NULL;
 
@@ -64,6 +71,7 @@
 static guint    save_timer = 0;
 static gboolean accounts_loaded = FALSE;
 
+static GList *handles = NULL;
 
 /*********************************************************************
  * Writing to disk                                                   *
@@ -1053,21 +1061,82 @@
 		ui_ops->request_add(account, remote_user, id, alias, message);
 }
 
-void
+static void
+gaim_account_request_close_info(GaimAccountRequestInfo *info)
+{
+	GaimAccountUiOps *ops;
+
+	ops = gaim_accounts_get_ui_ops();
+
+	if (ops != NULL && ops->close_account_request != NULL)
+		ops->close_account_request(info->ui_handle);
+
+	g_free(info);
+}
+
+void 
+gaim_account_request_close_with_account(GaimAccount *account)
+{
+	GList *l, *l_next;
+	
+	g_return_if_fail(account != NULL);
+	
+	for (l = handles; l != NULL; l = l_next) {
+		GaimAccountRequestInfo *info = l->data;
+		
+		l_next = l->next;
+		
+		if (info->account == account) {
+			handles = g_list_remove(handles, info);
+			gaim_account_request_close_info(info);
+		}
+	}
+}
+
+void 
+gaim_account_request_close(void *ui_handle)
+{
+	GList *l, *l_next;
+	
+	g_return_if_fail(ui_handle != NULL);
+	
+	for (l = handles; l != NULL; l = l_next) {
+		GaimAccountRequestInfo *info = l->data;
+		
+		l_next = l->next;
+		
+		if (info->ui_handle == ui_handle) {
+			handles = g_list_remove(handles, info);
+			gaim_account_request_close_info(info);
+		}
+	}
+}
+
+void *
 gaim_account_request_authorization(GaimAccount *account, const char *remote_user,
 			           const char *id, const char *alias, const char *message, gboolean on_list,
 				   GCallback auth_cb, GCallback deny_cb, void *user_data)
 {
-        GaimAccountUiOps *ui_ops;
-
-	g_return_if_fail(account     != NULL);
-        g_return_if_fail(remote_user != NULL);
-
-        ui_ops = gaim_accounts_get_ui_ops();
-
-        if (ui_ops != NULL && ui_ops->request_authorize != NULL)
-               ui_ops->request_authorize(account, remote_user, id, alias, message, on_list, auth_cb, deny_cb, user_data);
-						
+	GaimAccountUiOps *ui_ops;
+	GaimAccountRequestInfo *info;
+
+	g_return_val_if_fail(account     != NULL, NULL);
+	g_return_val_if_fail(remote_user != NULL, NULL);
+
+	ui_ops = gaim_accounts_get_ui_ops();
+
+	if (ui_ops != NULL && ui_ops->request_authorize != NULL) {
+		info            = g_new0(GaimAccountRequestInfo, 1);
+		info->type      = GAIM_ACCOUNT_REQUEST_AUTHORIZATION;
+		info->account   = account;
+		info->ui_handle = ui_ops->request_authorize(account, remote_user, id, alias, message,
+									on_list, auth_cb, deny_cb, user_data);
+		
+		handles = g_list_append(handles, info);
+		return info->ui_handle;
+	}
+	
+	return NULL;
 }
 
 static void
--- a/libpurple/account.h	Wed Jan 31 06:59:45 2007 +0000
+++ b/libpurple/account.h	Fri Feb 02 04:38:35 2007 +0000
@@ -42,6 +42,14 @@
 #include "prpl.h"
 #include "status.h"
 
+/**
+ * Account request types.
+ */
+typedef enum
+{
+	GAIM_ACCOUNT_REQUEST_AUTHORIZATION = 0 /* Account authorization request */
+} GaimAccountRequestType;
+
 struct _GaimAccountUiOps
 {
 	/* A buddy we already have added us to their buddy list. */
@@ -53,9 +61,10 @@
 	void (*request_add)(GaimAccount *account, const char *remote_user,
 	                    const char *id, const char *alias,
 	                    const char *message);
-	void (*request_authorize)(GaimAccount *account, const char *remote_user, const char *id,
+	void *(*request_authorize)(GaimAccount *account, const char *remote_user, const char *id,
 				 const char *alias, const char *message, gboolean on_list, 
 				 GCallback authorize_cb, GCallback deny_cb, void *user_data);
+	void (*close_account_request)(void *ui_handle);
 };
 
 struct _GaimAccount
@@ -192,12 +201,28 @@
  * @param auth_cb      The callback called when the local user accepts
  * @param deny_cb      The callback called when the local user rejects
  * @param user_data    Data to be passed back to the above callbacks
+ *
+ * @return A UI-specific handle.
  */
-void gaim_account_request_authorization(GaimAccount *account, const char *remote_user,
+void *gaim_account_request_authorization(GaimAccount *account, const char *remote_user,
 					const char *id, const char *alias, const char *message, gboolean on_list,
 					GCallback auth_cb, GCallback deny_cb, void *user_data);
 
 /**
+ * Close account requests registered for the given GaimAccount
+ *
+ * @param handle	   The account for which requests should be closed
+ */
+void gaim_account_request_close_with_account(GaimAccount *account);
+
+/**
+ * Close the account request for the given ui handle
+ *
+ * @param handle	   The ui specific handle for which requests should be closed
+ */
+void gaim_account_request_close(void *ui_handle);
+
+/**
  * Requests information from the user to change the account's password.
  *
  * @param account The account to change the password on.
--- a/libpurple/connection.c	Wed Jan 31 06:59:45 2007 +0000
+++ b/libpurple/connection.c	Fri Feb 02 04:38:35 2007 +0000
@@ -225,6 +225,7 @@
 	}
 #endif
 
+	gaim_account_request_close_with_account(account);
 	gaim_request_close_with_handle(gc);
 	gaim_notify_close_with_handle(gc);
 
--- a/libpurple/protocols/qq/buddy_info.c	Wed Jan 31 06:59:45 2007 +0000
+++ b/libpurple/protocols/qq/buddy_info.c	Fri Feb 02 04:38:35 2007 +0000
@@ -741,6 +741,7 @@
 	qq_send_cmd(gc, QQ_CMD_GET_LEVEL, TRUE, 0, TRUE, buf, 5);
 }
 
+/*
 void qq_send_packet_get_buddies_levels(GaimConnection *gc)
 {
 	guint8 *buf, *tmp, size;
@@ -749,8 +750,10 @@
 	GList *node = qd->buddies;
 
 	if (qd->buddies) {
+*/
 		/* server only sends back levels for online buddies, no point
  	 	* in asking for anyone else */
+/*
 		size = 4*g_list_length(qd->buddies) + 1;
 		buf = g_new0(guint8, size);
 		tmp = buf + 1;
@@ -767,8 +770,9 @@
 		}
 		qq_send_cmd(gc, QQ_CMD_GET_LEVEL, TRUE, 0, TRUE, buf, size);
 		g_free(buf);
-        }
+	}
 }
+*/
 
 void qq_process_get_level_reply(guint8 *buf, gint buf_len, GaimConnection *gc)
 {
--- a/libpurple/protocols/qq/buddy_info.h	Wed Jan 31 06:59:45 2007 +0000
+++ b/libpurple/protocols/qq/buddy_info.h	Fri Feb 02 04:38:35 2007 +0000
@@ -93,7 +93,9 @@
 void qq_process_get_info_reply(guint8 *buf, gint buf_len, GaimConnection *gc);
 void qq_info_query_free(qq_data *qd);
 void qq_send_packet_get_level(GaimConnection *gc, guint32 uid);
+/*
 void qq_send_packet_get_buddies_levels(GaimConnection *gc);
+*/
 void qq_process_get_level_reply(guint8 *buf, gint buf_len, GaimConnection *gc);
 
 #endif
--- a/libpurple/protocols/qq/buddy_list.c	Wed Jan 31 06:59:45 2007 +0000
+++ b/libpurple/protocols/qq/buddy_list.c	Fri Feb 02 04:38:35 2007 +0000
@@ -215,8 +215,7 @@
 				q_bud->flag1 = fe->flag1;
 				q_bud->comm_flag = fe->comm_flag;
 				qq_update_buddy_contact(gc, q_bud);
-			}
-			else {
+			} else {
 				gaim_debug(GAIM_DEBUG_ERROR, "QQ", 
 						"Got an online buddy %d, but not in my buddy list\n", fe->s->uid);
 			}
@@ -234,9 +233,8 @@
 			gaim_debug(GAIM_DEBUG_INFO, "QQ", "Has more online buddies, position from %d\n", position);
 
 			qq_send_packet_get_buddies_online(gc, position);
-		}
-		else {
-			qq_send_packet_get_buddies_levels(gc);
+		} else {
+			/* qq_send_packet_get_buddies_levels(gc); */
 			qq_refresh_all_buddy_status(gc);
 		}
 
--- a/libpurple/protocols/qq/char_conv.c	Wed Jan 31 06:59:45 2007 +0000
+++ b/libpurple/protocols/qq/char_conv.c	Fri Feb 02 04:38:35 2007 +0000
@@ -33,7 +33,7 @@
 #define QQ_SMILEY_AMOUNT      96
 
 #define UTF8                  "UTF-8"
-#define QQ_CHARSET_ZH_CN      "GBK"
+#define QQ_CHARSET_ZH_CN      "GB18030"
 #define QQ_CHARSET_ENG        "ISO-8859-1"
 
 #define QQ_NULL_MSG           "(NULL)"	/* return this if conversion fails */
--- a/libpurple/protocols/qq/char_conv.h	Wed Jan 31 06:59:45 2007 +0000
+++ b/libpurple/protocols/qq/char_conv.h	Fri Feb 02 04:38:35 2007 +0000
@@ -27,7 +27,7 @@
 
 #include <glib.h>
 
-#define QQ_CHARSET_DEFAULT      "GBK"
+#define QQ_CHARSET_DEFAULT      "GB18030"
 
 gint convert_as_pascal_string(guint8 *data, gchar **ret, const gchar *from_charset);
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/pidgin.desktop.in	Fri Feb 02 04:38:35 2007 +0000
@@ -0,0 +1,11 @@
+[Desktop Entry]
+Encoding=UTF-8
+_Name=Pidgin Internet Messenger
+_GenericName=Internet Messenger
+_Comment=Send instant messages over multiple protocols
+Exec=pidgin
+Icon=pidgin.png
+StartupNotify=true
+Terminal=false
+Type=Application
+Categories=Network;InstantMessaging;
--- a/pidgin/gtkaccount.c	Wed Jan 31 06:59:45 2007 +0000
+++ b/pidgin/gtkaccount.c	Fri Feb 02 04:38:35 2007 +0000
@@ -2478,7 +2478,7 @@
 	g_free(aa);
 }
 
-static void
+static void *
 gaim_gtk_accounts_request_authorization(GaimAccount *account, const char *remote_user,
 					const char *id, const char *alias, const char *message, gboolean on_list,
 					GCallback auth_cb, GCallback deny_cb, void *user_data)
@@ -2528,6 +2528,14 @@
 	gaim_gtk_blist_add_alert(alert);
 
 	g_free(buffer);
+	
+	return NULL;
+}
+
+static void
+gaim_gtk_accounts_request_close(void *ui_handle)
+{
+	
 }
 
 static GaimAccountUiOps ui_ops =
@@ -2535,7 +2543,8 @@
 	gaim_gtk_accounts_notify_added,
 	NULL,
 	gaim_gtk_accounts_request_add,
-	gaim_gtk_accounts_request_authorization
+	gaim_gtk_accounts_request_authorization,
+	gaim_gtk_accounts_request_close
 };
 
 GaimAccountUiOps *
--- a/pidgin/gtkblist.c	Wed Jan 31 06:59:45 2007 +0000
+++ b/pidgin/gtkblist.c	Fri Feb 02 04:38:35 2007 +0000
@@ -1267,8 +1267,7 @@
 					continue;
 
 				menuitem = gtk_image_menu_item_new_with_label(buddy->name);
-				buf = gaim_gtk_blist_get_status_icon(bnode,
-										GAIM_STATUS_ICON_SMALL);
+				buf = gaim_gtk_create_prpl_icon(buddy->account,PIDGIN_PRPL_ICON_SMALL);
 				image = gtk_image_new_from_pixbuf(buf);
 				g_object_unref(G_OBJECT(buf));
 				gtk_image_menu_item_set_image(GTK_IMAGE_MENU_ITEM(menuitem),
@@ -2108,21 +2107,6 @@
 				if (!(icon = gaim_buddy_icons_find(buddy->account, buddy->name))) /* Not sure I like this...*/
 					return NULL;
 			data = gaim_buddy_icon_get_data(icon, &len);
-		} else if(chat != NULL) {
-			if(prpl_info && prpl_info->list_icon) {
-				char *contents;
-				char *image = g_strdup_printf("%s.png", prpl_info->list_icon(account, NULL));
-				char *filename = g_build_filename(DATADIR, "pixmaps", "pidgin", "status", "32", image, NULL);
-				g_free(image);
-
-				gaim_debug_info("icon", "Using %s as a buddy icon for a chat\n");
-
-				/* we'll exit below with data == NULL if this fails */
-				if(g_file_get_contents(filename, &contents, &len, NULL)) {
-					data = (const guchar*)contents;
-				}
-				g_free(filename);
-			}
 		}
 		custom = FALSE;  /* We are not using the custom icon */
 	}
@@ -2289,6 +2273,8 @@
 {
 	GtkStyle *style;
 	int current_height, max_width;
+	int max_text_width;
+	int max_avatar_width;
 	GList *l;
 	int prpl_col = 0;
 
@@ -2299,16 +2285,20 @@
 	gtk_paint_flat_box(style, gtkblist->tipwindow->window, GTK_STATE_NORMAL, GTK_SHADOW_OUT,
 			NULL, gtkblist->tipwindow, "tooltip", 0, 0, -1, -1);
 
-	max_width = 0;
+	max_text_width = 0;
+	max_avatar_width = 0;
+
 	for(l = gtkblist->tooltipdata; l; l = l->next)
 	{
 		struct tooltip_data *td = l->data;
-		max_width = MAX(max_width,
-				TOOLTIP_BORDER + STATUS_SIZE + SMALL_SPACE +
-				MAX(td->width, td->name_width) + SMALL_SPACE + td->avatar_width + TOOLTIP_BORDER);
-		prpl_col = MAX(prpl_col, 
-				TOOLTIP_BORDER + STATUS_SIZE + SMALL_SPACE + td->name_width - PRPL_SIZE);
-	}
+
+		max_text_width = MAX(max_text_width,
+				MAX(td->width, td->name_width));
+		max_avatar_width = MAX(max_avatar_width, td->avatar_width);
+	}
+
+	max_width = TOOLTIP_BORDER + STATUS_SIZE + SMALL_SPACE + max_text_width + SMALL_SPACE + max_avatar_width + TOOLTIP_BORDER;
+	prpl_col = TOOLTIP_BORDER + STATUS_SIZE + SMALL_SPACE + max_text_width - PRPL_SIZE;
 
 	current_height = 12;
 	for(l = gtkblist->tooltipdata; l; l = l->next)
@@ -2321,7 +2311,6 @@
 					max_width - (td->avatar_width+ TOOLTIP_BORDER)-1,
 					current_height-1,td->avatar_width+2, td->avatar_height+2);
 
-
 #if GTK_CHECK_VERSION(2,2,0)
 		gdk_draw_pixbuf(GDK_DRAWABLE(gtkblist->tipwindow->window), NULL, td->status_icon,
 				0, 0, TOOLTIP_BORDER, current_height, -1 , -1, GDK_RGB_DITHER_NONE, 0, 0);
@@ -2341,20 +2330,19 @@
 		if(td->avatar)
 			gdk_pixbuf_render_to_drawable(td->avatar,
 					GDK_DRAWABLE(gtkblist->tipwindow->window), NULL, 0, 0,
-					max_width - (td->avatar_width + 12),
+					max_width - (td->avatar_width + TOOLTIP_BORDER),
 					current_height, -1, -1, GDK_RGB_DITHER_NONE, 0, 0);
 #endif
 
 		gtk_paint_layout (style, gtkblist->tipwindow->window, GTK_STATE_NORMAL, FALSE,
 				NULL, gtkblist->tipwindow, "tooltip",
 				TOOLTIP_BORDER + STATUS_SIZE + SMALL_SPACE, current_height, td->name_layout);
-		current_height += td->name_height;
 
 		gtk_paint_layout (style, gtkblist->tipwindow->window, GTK_STATE_NORMAL, FALSE,
 				NULL, gtkblist->tipwindow, "tooltip",
-				TOOLTIP_BORDER + STATUS_SIZE + SMALL_SPACE, current_height, td->layout);
-
-		current_height += td->height + TOOLTIP_BORDER;
+				TOOLTIP_BORDER + STATUS_SIZE + SMALL_SPACE, current_height + td->name_height, td->layout);
+
+		current_height += MAX(td->name_height + td->height, td->avatar_height) + TOOLTIP_BORDER;
 	}
 }
 
@@ -2476,14 +2464,17 @@
 	if(GAIM_BLIST_NODE_IS_CHAT(node) || GAIM_BLIST_NODE_IS_BUDDY(node)) {
 		struct tooltip_data *td = create_tip_for_node(node, TRUE);
 		gtkblist->tooltipdata = g_list_append(gtkblist->tooltipdata, td);
-		w = TOOLTIP_BORDER + STATUS_SIZE + SMALL_SPACE + 
+		w = TOOLTIP_BORDER + STATUS_SIZE + SMALL_SPACE +
 			MAX(td->width, td->name_width) + SMALL_SPACE + td->avatar_width + TOOLTIP_BORDER;
 		h = TOOLTIP_BORDER + MAX(td->height + td->name_height, MAX(STATUS_SIZE, td->avatar_height))
 			+ TOOLTIP_BORDER;
 	} else if(GAIM_BLIST_NODE_IS_CONTACT(node)) {
 		GaimBlistNode *child;
 		GaimBuddy *b = gaim_contact_get_priority_buddy((GaimContact *)node);
+		int max_text_width = 0;
+		int max_avatar_width = 0;
 		w = h = 0;
+
 		for(child = node->child; child; child = child->next)
 		{
 			if(GAIM_BLIST_NODE_IS_BUDDY(child) && buddy_is_displayable((GaimBuddy*)child)) {
@@ -2493,13 +2484,13 @@
 				} else {
 					gtkblist->tooltipdata = g_list_append(gtkblist->tooltipdata, td);
 				}
-				w = MAX(w, TOOLTIP_BORDER + STATUS_SIZE + SMALL_SPACE + 
-					MAX(td->width, td->name_width) + SMALL_SPACE + 
-					td->avatar_width + TOOLTIP_BORDER);
-				h += MAX(TOOLTIP_BORDER + MAX(STATUS_SIZE,td->avatar_height) + TOOLTIP_BORDER, 
-					 TOOLTIP_BORDER + td->height + td->name_height + TOOLTIP_BORDER);
+				max_text_width = MAX(max_text_width, MAX(td->width, td->name_width));
+				max_avatar_width = MAX(max_avatar_width, td->avatar_width);
+				h += MAX(TOOLTIP_BORDER + MAX(STATUS_SIZE,td->avatar_height) + TOOLTIP_BORDER,
+						TOOLTIP_BORDER + td->height + td->name_height + TOOLTIP_BORDER);
 			}
 		}
+		w = TOOLTIP_BORDER + STATUS_SIZE + SMALL_SPACE + max_text_width + SMALL_SPACE + max_avatar_width + TOOLTIP_BORDER;
 	} else {
 		gtk_widget_destroy(gtkblist->tipwindow);
 		gtkblist->tipwindow = NULL;