changeset 32575:8cf9251e49ef

propagate from branch 'im.pidgin.pidgin' (head f11c46cb59c07c862176434fa78eaa1a8ca2c600) to branch 'im.pidgin.cpw.qulogic.gtk3' (head 81d9c509e85b2b828391a84eb6a2d257e579576a)
author Elliott Sales de Andrade <qulogic@pidgin.im>
date Sat, 18 Apr 2009 22:14:49 +0000
parents 4fa36f6928e3 (current diff) 99d0b82d5362 (diff)
children 604bec1b4582
files
diffstat 10 files changed, 106 insertions(+), 54 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Sat Apr 18 07:37:40 2009 +0000
+++ b/ChangeLog	Sat Apr 18 22:14:49 2009 +0000
@@ -26,6 +26,9 @@
 	IRC:
 	* Correctly handle WHOIS for users who are joined to a large number of
 	  channels.
+	* Notify the user if a /nick command fails, rather than trying
+	  fallback nicks.
+	
 
 	Pidgin:
 	* Added -f command line option to tell Pidgin to ignore NetworkManager
--- a/doc/TCL-HOWTO.dox	Sat Apr 18 07:37:40 2009 +0000
+++ b/doc/TCL-HOWTO.dox	Sat Apr 18 22:14:49 2009 +0000
@@ -173,6 +173,7 @@
 purple::connection displayname gc
 purple::connection handle
 purple::connection list
+purple::connection state
 @endcode
 
   @c purple::connection is a collection of subcommands pertaining to
@@ -192,6 +193,9 @@
   this list are appropriate as @c gc arguments to the other
   @c purple::connection subcommands or other commands requiring a gc.
 
+  @c state returns the PurpleConnectionState of this account as one of
+  the strings "connected", "disconnected", or "connecting".
+
 @code
 purple::conv_send account who text
 @endcode
--- a/libpurple/plugins/perl/perl-common.c	Sat Apr 18 07:37:40 2009 +0000
+++ b/libpurple/plugins/perl/perl-common.c	Sat Apr 18 22:14:49 2009 +0000
@@ -403,7 +403,7 @@
 static SV *
 purple_perl_sv_from_subtype(const PurpleValue *value, void *arg)
 {
-	const char *stash = NULL;
+	const char *stash = "Purple"; /* ? */
 
 	switch (purple_value_get_subtype(value)) {
 		case PURPLE_SUBTYPE_ACCOUNT:
@@ -442,6 +442,9 @@
 		case PURPLE_SUBTYPE_STATUS:
 			stash = "Purple::Status";
 			break;
+		case PURPLE_SUBTYPE_SAVEDSTATUS:
+			stash = "Purple::SavedStatus";
+			break;
 		case PURPLE_SUBTYPE_LOG:
 			stash = "Purple::Log";
 			break;
@@ -451,10 +454,19 @@
 		case PURPLE_SUBTYPE_XMLNODE:
 			stash = "Purple::XMLNode";
 			break;
-
-		default:
-			stash = "Purple"; /* ? */
-	}
+ 		case PURPLE_SUBTYPE_USERINFO:
+ 			stash = "Purple::NotifyUserInfo";
+ 			break;
+ 		case PURPLE_SUBTYPE_STORED_IMAGE:
+ 			stash = "Purple::StoredImage";
+ 			break;
+ 		case PURPLE_SUBTYPE_CERTIFICATEPOOL:
+ 			stash = "Purple::Certificate::Pool";
+ 			break;
+ 		case PURPLE_SUBTYPE_UNKNOWN:
+ 			stash = "Purple::Unknown";
+ 			break;
+  	}
 
 	return sv_2mortal(purple_perl_bless_object(arg, stash));
 }
--- a/libpurple/plugins/tcl/tcl_cmds.c	Sat Apr 18 07:37:40 2009 +0000
+++ b/libpurple/plugins/tcl/tcl_cmds.c	Sat Apr 18 22:14:49 2009 +0000
@@ -683,8 +683,9 @@
 int tcl_cmd_connection(ClientData unused, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[])
 {
 	Tcl_Obj *list, *elem;
-	const char *cmds[] = { "account", "displayname", "handle", "list", NULL };
-	enum { CMD_CONN_ACCOUNT, CMD_CONN_DISPLAYNAME, CMD_CONN_HANDLE, CMD_CONN_LIST } cmd;
+	const char *cmds[] = { "account", "displayname", "handle", "list", "state", NULL };
+	enum { CMD_CONN_ACCOUNT, CMD_CONN_DISPLAYNAME, CMD_CONN_HANDLE,
+	       CMD_CONN_LIST, CMD_CONN_STATE } cmd;
 	int error;
 	GList *cur;
 	PurpleConnection *gc;
@@ -739,6 +740,25 @@
 		}
 		Tcl_SetObjResult(interp, list);
 		break;
+	case CMD_CONN_STATE:
+		if (objc != 3) {
+			Tcl_WrongNumArgs(interp, 2, objv, "gc");
+			return TCL_ERROR;
+		}
+		if ((gc = tcl_validate_gc(objv[2], interp)) == NULL)
+			return TCL_ERROR;
+		switch (purple_connection_get_state(gc)) {
+		case PURPLE_DISCONNECTED:
+			Tcl_SetObjResult(interp, Tcl_NewStringObj("disconnected", -1));
+			break;
+		case PURPLE_CONNECTED:
+			Tcl_SetObjResult(interp, Tcl_NewStringObj("connected", -1));
+			break;
+		case PURPLE_CONNECTING:
+			Tcl_SetObjResult(interp, Tcl_NewStringObj("connecting", -1));
+			break;
+		}
+		break;
 	}
 
 	return TCL_OK;
--- a/libpurple/protocols/irc/msgs.c	Sat Apr 18 07:37:40 2009 +0000
+++ b/libpurple/protocols/irc/msgs.c	Sat Apr 18 22:14:49 2009 +0000
@@ -1004,10 +1004,23 @@
 void irc_msg_nickused(struct irc_conn *irc, const char *name, const char *from, char **args)
 {
 	char *newnick, *buf, *end;
+	PurpleConnection *gc = purple_account_get_connection(irc->account);
 
 	if (!args || !args[1])
 		return;
 
+	if (gc && purple_connection_get_state(gc) == PURPLE_CONNECTED) {
+		/* We only want to do the following dance if the connection
+		   has not been successfully completed.  If it has, just
+		   notify the user that their /nick command didn't go. */
+		buf = g_strdup_printf(_("The nickname \"%s\" is already being used."),
+				      irc->reqnick);
+		purple_notify_error(gc, _("Nickname in use"),
+				    _("Nickname in use"), buf);
+		g_free(buf);
+		g_free(irc->reqnick);
+	}
+
 	if (strlen(args[1]) < strlen(irc->reqnick) || irc->nickused)
 		newnick = g_strdup(args[1]);
 	else
--- a/pidgin/gtkdocklet.c	Sat Apr 18 07:37:40 2009 +0000
+++ b/pidgin/gtkdocklet.c	Sat Apr 18 22:14:49 2009 +0000
@@ -482,7 +482,7 @@
 }
 
 static GtkWidget *
-new_menu_item_with_status_icon(GtkWidget *menu, const char *str, PurpleStatusPrimitive primitive, GtkSignalFunc sf, gpointer data, guint accel_key, guint accel_mods, char *mod)
+new_menu_item_with_status_icon(GtkWidget *menu, const char *str, PurpleStatusPrimitive primitive, GCallback cb, gpointer data, guint accel_key, guint accel_mods, char *mod)
 {
 	GtkWidget *menuitem;
 	GdkPixbuf *pixbuf;
@@ -493,8 +493,8 @@
 	if (menu)
 		gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem);
 
-	if (sf)
-		g_signal_connect(G_OBJECT(menuitem), "activate", sf, data);
+	if (cb)
+		g_signal_connect(G_OBJECT(menuitem), "activate", cb, data);
 
 	pixbuf = pidgin_create_status_icon(primitive, menu, PIDGIN_ICON_SIZE_TANGO_EXTRA_SMALL);
 	image = gtk_image_new_from_pixbuf(pixbuf);
--- a/pidgin/gtkutils.c	Sat Apr 18 07:37:40 2009 +0000
+++ b/pidgin/gtkutils.c	Sat Apr 18 22:14:49 2009 +0000
@@ -358,7 +358,7 @@
 }
 
 GtkWidget *pidgin_new_check_item(GtkWidget *menu, const char *str,
-		GtkSignalFunc sf, gpointer data, gboolean checked)
+		GCallback cb, gpointer data, gboolean checked)
 {
 	GtkWidget *menuitem;
 	menuitem = gtk_check_menu_item_new_with_mnemonic(str);
@@ -368,8 +368,8 @@
 
 	gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menuitem), checked);
 
-	if (sf)
-		g_signal_connect(G_OBJECT(menuitem), "activate", sf, data);
+	if (cb)
+		g_signal_connect(G_OBJECT(menuitem), "activate", cb, data);
 
 	gtk_widget_show_all(menuitem);
 
@@ -439,7 +439,7 @@
 }
 
 
-GtkWidget *pidgin_new_item_from_stock(GtkWidget *menu, const char *str, const char *icon, GtkSignalFunc sf, gpointer data, guint accel_key, guint accel_mods, char *mod)
+GtkWidget *pidgin_new_item_from_stock(GtkWidget *menu, const char *str, const char *icon, GCallback cb, gpointer data, guint accel_key, guint accel_mods, char *mod)
 {
 	GtkWidget *menuitem;
 	/*
@@ -456,8 +456,8 @@
 	if (menu)
 		gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem);
 
-	if (sf)
-		g_signal_connect(G_OBJECT(menuitem), "activate", sf, data);
+	if (cb)
+		g_signal_connect(G_OBJECT(menuitem), "activate", cb, data);
 
 	if (icon != NULL) {
 		image = gtk_image_new_from_stock(icon, gtk_icon_size_from_name(PIDGIN_ICON_SIZE_TANGO_EXTRA_SMALL));
--- a/pidgin/gtkutils.h	Sat Apr 18 07:37:40 2009 +0000
+++ b/pidgin/gtkutils.h	Sat Apr 18 22:14:49 2009 +0000
@@ -233,14 +233,14 @@
  *
  * @param menu     The menu to which to append the check menu item.
  * @param str      The title to use for the newly created menu item.
- * @param sf       A function to call when the menu item is activated.
+ * @param cb       A function to call when the menu item is activated.
  * @param data     Data to pass to the signal function.
  * @param checked  The initial state of the check item
  *
  * @return The newly created menu item.
  */
 GtkWidget *pidgin_new_check_item(GtkWidget *menu, const char *str,
-		GtkSignalFunc sf, gpointer data, gboolean checked);
+		GCallback cb, gpointer data, gboolean checked);
 
 /**
  * Creates a menu item.
@@ -249,7 +249,7 @@
  * @param str        The title for the menu item.
  * @param icon       An icon to place to the left of the menu item,
  *                   or @c NULL for no icon.
- * @param sf         A function to call when the menu item is activated.
+ * @param cb         A function to call when the menu item is activated.
  * @param data       Data to pass to the signal function.
  * @param accel_key  Something.
  * @param accel_mods Something.
@@ -258,7 +258,7 @@
  * @return The newly created menu item.
  */
 GtkWidget *pidgin_new_item_from_stock(GtkWidget *menu, const char *str,
-									const char *icon, GtkSignalFunc sf,
+									const char *icon, GCallback cb,
 									gpointer data, guint accel_key,
 									guint accel_mods, char *mod);
 
--- a/pidgin/plugins/contact_priority.c	Sat Apr 18 07:37:40 2009 +0000
+++ b/pidgin/plugins/contact_priority.c	Sat Apr 18 22:14:49 2009 +0000
@@ -31,7 +31,7 @@
 select_account(GtkWidget *widget, PurpleAccount *account, gpointer data)
 {
 	gtk_spin_button_set_value(GTK_SPIN_BUTTON(data),
-														(gdouble)purple_account_get_int(account, "score", 0));
+	                          (gdouble)purple_account_get_int(account, "score", 0));
 }
 
 static void
@@ -142,18 +142,18 @@
 	spin = gtk_spin_button_new((GtkAdjustment *)adj, 1, 0);
 
 	optmenu = pidgin_account_option_menu_new(NULL, TRUE,
-																						 G_CALLBACK(select_account),
-																						 NULL, spin);
+	                                         G_CALLBACK(select_account),
+	                                         NULL, spin);
 	gtk_box_pack_start(GTK_BOX(hbox), optmenu, FALSE, FALSE, 0);
 
 	/* this is where we set up the spin button we made above */
 	account = g_object_get_data(G_OBJECT(gtk_menu_get_active(GTK_MENU(gtk_option_menu_get_menu(GTK_OPTION_MENU(optmenu))))),
-															"account");
+	                            "account");
 	gtk_spin_button_set_value(GTK_SPIN_BUTTON(spin),
-														(gdouble)purple_account_get_int(account, "score", 0));
+	                          (gdouble)purple_account_get_int(account, "score", 0));
 	gtk_spin_button_set_adjustment(GTK_SPIN_BUTTON(spin), GTK_ADJUSTMENT(adj));
 	g_signal_connect(G_OBJECT(spin), "value-changed",
-									 G_CALLBACK(account_update), optmenu);
+	                 G_CALLBACK(account_update), optmenu);
 	gtk_box_pack_start(GTK_BOX(hbox), spin, FALSE, FALSE, 0);
 
 	gtk_widget_show_all(ret);
@@ -178,29 +178,29 @@
 	PURPLE_PLUGIN_MAGIC,
 	PURPLE_MAJOR_VERSION,
 	PURPLE_MINOR_VERSION,
-	PURPLE_PLUGIN_STANDARD,                             /**< type           */
+	PURPLE_PLUGIN_STANDARD,                         /**< type           */
 	PIDGIN_PLUGIN_TYPE,                             /**< ui_requirement */
-	0,                                                /**< flags          */
-	NULL,                                             /**< dependencies   */
-	PURPLE_PRIORITY_DEFAULT,                            /**< priority       */
+	0,                                              /**< flags          */
+	NULL,                                           /**< dependencies   */
+	PURPLE_PRIORITY_DEFAULT,                        /**< priority       */
 
-	CONTACT_PRIORITY_PLUGIN_ID,                       /**< id             */
-	N_("Contact Priority"),                           /**< name           */
-	DISPLAY_VERSION,                                  /**< version        */
+	CONTACT_PRIORITY_PLUGIN_ID,                     /**< id             */
+	N_("Contact Priority"),                         /**< name           */
+	DISPLAY_VERSION,                                /**< version        */
                                                     /**< summary        */
 	N_("Allows for controlling the values associated with different buddy states."),
                                                     /**< description    */
 	N_("Allows for changing the point values of idle/away/offline states for buddies in contact priority computations."),
-	"Etan Reisner <deryni@eden.rutgers.edu>",         /**< author         */
-	PURPLE_WEBSITE,                                     /**< homepage       */
+	"Etan Reisner <deryni@eden.rutgers.edu>",       /**< author         */
+	PURPLE_WEBSITE,                                 /**< homepage       */
 
-	NULL,                                             /**< load           */
-	NULL,                                             /**< unload         */
-	NULL,                                             /**< destroy        */
-	&ui_info,                                         /**< ui_info        */
-	NULL,                                             /**< extra_info     */
-	NULL,                                             /**< prefs_info     */
-	NULL,                                             /**< actions        */
+	NULL,                                           /**< load           */
+	NULL,                                           /**< unload         */
+	NULL,                                           /**< destroy        */
+	&ui_info,                                       /**< ui_info        */
+	NULL,                                           /**< extra_info     */
+	NULL,                                           /**< prefs_info     */
+	NULL,                                           /**< actions        */
 
 	/* padding */
 	NULL,
--- a/pidgin/plugins/win32/transparency/win2ktrans.c	Sat Apr 18 07:37:40 2009 +0000
+++ b/pidgin/plugins/win32/transparency/win2ktrans.c	Sat Apr 18 22:14:49 2009 +0000
@@ -182,7 +182,7 @@
 
 	/* On slider val change, update window's transparency level */
 	g_signal_connect(GTK_OBJECT(slider), "value-changed",
-		GTK_SIGNAL_FUNC(change_alpha), win);
+		G_CALLBACK(change_alpha), win);
 
 	gtk_box_pack_start(GTK_BOX(hbox), slider, FALSE, TRUE, 5);
 
@@ -563,7 +563,7 @@
 	button = pidgin_prefs_checkbox(_("_IM window transparency"),
 		OPT_WINTRANS_IM_ENABLED, imtransbox);
 	g_signal_connect(GTK_OBJECT(button), "clicked",
-		GTK_SIGNAL_FUNC(update_convs_wintrans),
+		G_CALLBACK(update_convs_wintrans),
 		(gpointer) OPT_WINTRANS_IM_ENABLED);
 
 	trans_box = gtk_vbox_new(FALSE, 18);
@@ -572,12 +572,12 @@
 	gtk_widget_show(trans_box);
 
 	g_signal_connect(GTK_OBJECT(button), "clicked",
-		GTK_SIGNAL_FUNC(pidgin_toggle_sensitive), trans_box);
+		G_CALLBACK(pidgin_toggle_sensitive), trans_box);
 
 	button = pidgin_prefs_checkbox(_("_Show slider bar in IM window"),
 		OPT_WINTRANS_IM_SLIDER, trans_box);
 	g_signal_connect(GTK_OBJECT(button), "clicked",
-		GTK_SIGNAL_FUNC(update_convs_wintrans),
+		G_CALLBACK(update_convs_wintrans),
 		(gpointer) OPT_WINTRANS_IM_SLIDER);
 
 	button = pidgin_prefs_checkbox(
@@ -587,7 +587,7 @@
 	button = pidgin_prefs_checkbox(_("Always on top"), OPT_WINTRANS_IM_ONTOP,
 		trans_box);
 	g_signal_connect(GTK_OBJECT(button), "clicked",
-		GTK_SIGNAL_FUNC(update_convs_wintrans),
+		G_CALLBACK(update_convs_wintrans),
 		(gpointer) OPT_WINTRANS_IM_ONTOP);
 
 	gtk_box_pack_start(GTK_BOX(imtransbox), trans_box, FALSE, FALSE, 5);
@@ -604,9 +604,9 @@
 	gtk_widget_set_usize(GTK_WIDGET(slider), 200, -1);
 
 	g_signal_connect(GTK_OBJECT(slider), "value-changed",
-		GTK_SIGNAL_FUNC(alpha_change), NULL);
+		G_CALLBACK(alpha_change), NULL);
 	g_signal_connect(GTK_OBJECT(slider), "focus-out-event",
-		GTK_SIGNAL_FUNC(alpha_pref_set_int),
+		G_CALLBACK(alpha_pref_set_int),
 		(gpointer) OPT_WINTRANS_IM_ALPHA);
 
 	gtk_box_pack_start(GTK_BOX(hbox), slider, FALSE, TRUE, 5);
@@ -620,7 +620,7 @@
 	button = pidgin_prefs_checkbox(_("_Buddy List window transparency"),
 		OPT_WINTRANS_BL_ENABLED, bltransbox);
 	g_signal_connect(GTK_OBJECT(button), "clicked",
-		GTK_SIGNAL_FUNC(set_blist_trans),
+		G_CALLBACK(set_blist_trans),
 		(gpointer) OPT_WINTRANS_BL_ENABLED);
 
 	trans_box = gtk_vbox_new(FALSE, 18);
@@ -628,14 +628,14 @@
 		gtk_widget_set_sensitive(GTK_WIDGET(trans_box), FALSE);
 	gtk_widget_show(trans_box);
 	g_signal_connect(GTK_OBJECT(button), "clicked",
-		GTK_SIGNAL_FUNC(pidgin_toggle_sensitive), trans_box);
+		G_CALLBACK(pidgin_toggle_sensitive), trans_box);
 	button = pidgin_prefs_checkbox(
 		_("Remove Buddy List window transparency on focus"),
 		OPT_WINTRANS_BL_ONFOCUS, trans_box);
 	button = pidgin_prefs_checkbox(_("Always on top"), OPT_WINTRANS_BL_ONTOP,
 		trans_box);
 	g_signal_connect(GTK_OBJECT(button), "clicked",
-		GTK_SIGNAL_FUNC(set_blist_trans),
+		G_CALLBACK(set_blist_trans),
 		(gpointer) OPT_WINTRANS_BL_ONTOP);
 	gtk_box_pack_start(GTK_BOX(bltransbox), trans_box, FALSE, FALSE, 5);
 
@@ -652,9 +652,9 @@
 	gtk_widget_set_usize(GTK_WIDGET(slider), 200, -1);
 
 	g_signal_connect(GTK_OBJECT(slider), "value-changed",
-		GTK_SIGNAL_FUNC(bl_alpha_change), NULL);
+		G_CALLBACK(bl_alpha_change), NULL);
 	g_signal_connect(GTK_OBJECT(slider), "focus-out-event",
-		GTK_SIGNAL_FUNC(alpha_pref_set_int),
+		G_CALLBACK(alpha_pref_set_int),
 		(gpointer) OPT_WINTRANS_BL_ALPHA);
 
 	gtk_box_pack_start(GTK_BOX(hbox), slider, FALSE, TRUE, 5);