changeset 22460:4baa8b7ad5b4

merge of '1ba8fbd2ac54a6b25df759681a854ccc43e6abff' and 'a4c67ebda7af92f03a3da8f978c16b2a4e6d0891'
author Evan Schoenberg <evan.s@dreskin.net>
date Tue, 11 Mar 2008 23:00:03 +0000
parents 9b154f484d64 (diff) 8ec6ac1b9e26 (current diff)
children 57fef22fa7a8
files
diffstat 8 files changed, 63 insertions(+), 95 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/account.h	Tue Mar 11 22:58:36 2008 +0000
+++ b/libpurple/account.h	Tue Mar 11 23:00:03 2008 +0000
@@ -31,7 +31,9 @@
 #include <glib.h>
 #include <glib-object.h>
 
+/** @copydoc _PurpleAccountUiOps */
 typedef struct _PurpleAccountUiOps PurpleAccountUiOps;
+/** @copydoc _PurpleAccount */
 typedef struct _PurpleAccount      PurpleAccount;
 
 typedef gboolean (*PurpleFilterAccountFunc)(PurpleAccount *account);
@@ -105,6 +107,8 @@
 	void (*_purple_reserved4)(void);
 };
 
+/** Structure representing an account.
+ */
 struct _PurpleAccount
 {
 	char *username;             /**< The username.                          */
--- a/libpurple/ntlm.c	Tue Mar 11 22:58:36 2008 +0000
+++ b/libpurple/ntlm.c	Tue Mar 11 23:00:03 2008 +0000
@@ -31,6 +31,7 @@
 #include "util.h"
 #include "ntlm.h"
 #include "cipher.h"
+#include "debug.h"
 #include <string.h>
 
 #define NTLM_NEGOTIATE_NTLM2_KEY 0x00080000
@@ -291,20 +292,32 @@
 
 	tmp = (char *)tmsg + sizeof(struct type3_message);
 
-	ucs2le = g_convert(domain, -1, "UCS-2LE", "UTF-8", NULL, NULL, NULL);
-	memcpy(tmp, ucs2le, domainlen);
-	g_free(ucs2le);
-	tmp += domainlen;
+	ucs2le = g_convert(domain, -1, "UTF-16LE", "UTF-8", NULL, NULL, NULL);
+	if (ucs2le != NULL) {
+		memcpy(tmp, ucs2le, domainlen);
+		g_free(ucs2le);
+		tmp += domainlen;
+	} else {
+		purple_debug_info("ntlm", "Unable to encode domain in UTF-16LE.\n");
+	}
 
-	ucs2le = g_convert(username, -1, "UCS-2LE", "UTF-8", NULL, NULL, NULL);
-	memcpy(tmp, ucs2le, usernamelen);
-	g_free(ucs2le);
-	tmp += usernamelen;
+	ucs2le = g_convert(username, -1, "UTF-16LE", "UTF-8", NULL, NULL, NULL);
+	if (ucs2le != NULL) {
+		memcpy(tmp, ucs2le, usernamelen);
+		g_free(ucs2le);
+		tmp += usernamelen;
+	} else {
+		purple_debug_info("ntlm", "Unable to encode username in UTF-16LE.\n");
+	}
 
-	ucs2le = g_convert(hostname, -1, "UCS-2LE", "UTF-8", NULL, NULL, NULL);
-	memcpy(tmp, ucs2le, hostnamelen);
-	g_free(ucs2le);
-	tmp += hostnamelen;
+	ucs2le = g_convert(hostname, -1, "UTF-16LE", "UTF-8", NULL, NULL, NULL);
+	if (ucs2le != NULL) {
+		memcpy(tmp, ucs2le, hostnamelen);
+		g_free(ucs2le);
+		tmp += hostnamelen;
+	} else {
+		purple_debug_info("ntlm", "Unable to encode hostname in UTF-16LE.\n");
+	}
 
 	/* LM */
 	if (passwlen > 14)
@@ -327,7 +340,7 @@
 	tmp += 0x18;
 
 	/* NTLM */
-	/* Convert the password to UCS-2LE */
+	/* Convert the password to UTF-16LE */
 	lennt = strlen(passw);
 	for (idx = 0; idx < lennt; idx++)
 	{
--- a/libpurple/protocols/irc/dcc_send.c	Tue Mar 11 22:58:36 2008 +0000
+++ b/libpurple/protocols/irc/dcc_send.c	Tue Mar 11 23:00:03 2008 +0000
@@ -135,7 +135,7 @@
 		
 		purple_xfer_set_end_fnc(xfer, irc_dccsend_recv_destroy);
 		purple_xfer_set_request_denied_fnc(xfer, irc_dccsend_recv_destroy);
-		purple_xfer_set_cancel_send_fnc(xfer, irc_dccsend_recv_destroy);
+		purple_xfer_set_cancel_recv_fnc(xfer, irc_dccsend_recv_destroy);
 		
 		purple_xfer_request(xfer);
 	}
@@ -179,7 +179,7 @@
 {
 	PurpleXfer *xfer = data;
 	struct irc_xfer_send_data *xd = xfer->data;
-	char *buffer[16];
+	char buffer[64];
 	int len;
 
 	len = read(source, buffer, sizeof(buffer));
--- a/libpurple/protocols/oscar/oscar.c	Tue Mar 11 22:58:36 2008 +0000
+++ b/libpurple/protocols/oscar/oscar.c	Tue Mar 11 23:00:03 2008 +0000
@@ -6230,6 +6230,7 @@
 	if (!aim_sncmp(purple_account_get_username(purple_connection_get_account(gc)), nick)) {
 		if (!flap_connection_getbytype(od, SNAC_FAMILY_ADMIN)) {
 			od->setnick = TRUE;
+			g_free(od->newsn);
 			od->newsn = g_strdup(nick);
 			aim_srv_requestnew(od, SNAC_FAMILY_ADMIN);
 		} else {
--- a/libpurple/protocols/oscar/util.c	Tue Mar 11 22:58:36 2008 +0000
+++ b/libpurple/protocols/oscar/util.c	Tue Mar 11 23:00:03 2008 +0000
@@ -156,7 +156,7 @@
 		return FALSE;
 
 	for (i = 0; sn[i] != '\0'; i++) {
-		if (!isalnum(sn[i]) && (sn[i] != ' '))
+		if (!isalnum(sn[i]) && (sn[i] != ' ') && (sn[i] != '.'))
 			return FALSE;
 	}
 
--- a/libpurple/request.h	Tue Mar 11 22:58:36 2008 +0000
+++ b/libpurple/request.h	Tue Mar 11 23:00:03 2008 +0000
@@ -238,6 +238,11 @@
 } PurpleRequestUiOps;
 
 typedef void (*PurpleRequestInputCb)(void *, const char *);
+
+/** The type of callbacks passed to purple_request_action().  The first
+ *  argument is the @a user_data parameter; the second is the index in the list
+ *  of actions of the one chosen.
+ */
 typedef void (*PurpleRequestActionCb)(void *, int);
 typedef void (*PurpleRequestChoiceCb)(void *, int);
 typedef void (*PurpleRequestFieldsCb)(void *, PurpleRequestFields *fields);
@@ -1264,37 +1269,7 @@
 	void *user_data, ...) G_GNUC_NULL_TERMINATED;
 
 /**
- * Prompts the user for multiple-choice input.
- *
- * @param handle        The plugin or connection handle.  For some things this
- *                      is <em>extremely</em> important.  See the comments on
- *                      purple_request_input().
- * @param title         The title of the message, or @c NULL if it should have
- *                      no title.
- * @param primary       The main point of the message, or @c NULL if you're
- *                      feeling enigmatic.
- * @param secondary     Secondary information, or @c NULL if there is none.
- * @param default_value The default choice; this should be one of the values
- *                      listed in the varargs.
- * @param ok_text       The text for the @c OK button, which may not be @c NULL.
- * @param ok_cb         The callback for the @c OK button, which may not be @c
- *                      NULL.
- * @param cancel_text   The text for the @c Cancel button, which may not be @c
- *                      NULL.
- * @param cancel_cb     The callback for the @c Cancel button, or @c NULL to do
- *                      nothing.
- * @param account       The #PurpleAccount associated with this request, or @c
- *                      NULL if none is
- * @param who           The username of the buddy associated with this request,
- *                      or @c NULL if none is
- * @param conv          The #PurpleConversation associated with this request, or
- *                      @c NULL if none is
- * @param user_data     The data to pass to the callback.
- * @param choices       The choices, which should be pairs of <tt>char *</tt>
- *                      descriptions and <tt>int</tt> values, terminated with a
- *                      @c NULL parameter.
- *
- * @return A UI-specific handle.
+ * <tt>va_list</tt> version of purple_request_choice(); see its documentation.
  */
 void *purple_request_choice_varg(void *handle, const char *title,
 	const char *primary, const char *secondary, int default_value,
@@ -1330,10 +1305,10 @@
  * @param action_count   The number of actions.
  * @param ...            A list of actions.  These are pairs of
  *                       arguments.  The first of each pair is the
- *                       <tt>char *</tt> that appears on the button.  It should
- *                       have an underscore before the letter you want
- *                       to use as the accelerator key for the button.
- *                       The second of each pair is the <tt>GCallback</tt>
+ *                       <tt>char *</tt> label that appears on the button.  It
+ *                       should have an underscore before the letter you want
+ *                       to use as the accelerator key for the button.  The
+ *                       second of each pair is the #PurpleRequestActionCb
  *                       function to use when the button is clicked.
  *
  * @return A UI-specific handle.
@@ -1344,39 +1319,7 @@
 	size_t action_count, ...);
 
 /**
- * Prompts the user for an action.
- *
- * This is often represented as a dialog with a button for each action.
- *
- * @param handle         The plugin or connection handle.  For some things this
- *                       is <em>extremely</em> important.  See the comments on
- *                       purple_request_input().
- * @param title          The title of the message, or @c NULL if it should have
- *                       no title.
- * @param primary        The main point of the message, or @c NULL if you're
- *                       feeling enigmatic.
- * @param secondary      Secondary information, or @c NULL if there is none.
- * @param default_action The default action, zero-indexed; if the third action
- *                       supplied should be the default, supply <tt>2</tt>.
- *                       The should be the action that users are most likely
- *                       to select.
- * @param account        The #PurpleAccount associated with this request, or @c
- *                       NULL if none is.
- * @param who            The username of the buddy associated with this request,
- *                       or @c NULL if none is.
- * @param conv           The #PurpleConversation associated with this request, or
- *                       @c NULL if none is.
- * @param user_data      The data to pass to the callback.
- * @param action_count   The number of actions.
- * @param actions        A list of actions.  These are pairs of
- *                       arguments.  The first of each pair is the
- *                       <tt>char *</tt> that appears on the button.  It should
- *                       have an underscore before the letter you want
- *                       to use as the accelerator key for the button.
- *                       The second of each pair is the <tt>GCallback</tt>
- *                       function to use when the button is clicked.
- *
- * @return A UI-specific handle.
+ * <tt>va_list</tt> version of purple_request_action(); see its documentation.
  */
 void *purple_request_action_varg(void *handle, const char *title,
 	const char *primary, const char *secondary, int default_action,
--- a/pidgin/gtkft.c	Tue Mar 11 22:58:36 2008 +0000
+++ b/pidgin/gtkft.c	Tue Mar 11 23:00:03 2008 +0000
@@ -1064,6 +1064,9 @@
 					   COLUMN_REMAINING, remaining_str,
 					   -1);
 
+	g_free(size_str);
+	g_free(remaining_str);
+
 	if (purple_xfer_is_completed(xfer))
 	{
 		GdkPixbuf *pixbuf;
--- a/pidgin/gtkimhtml.c	Tue Mar 11 22:58:36 2008 +0000
+++ b/pidgin/gtkimhtml.c	Tue Mar 11 23:00:03 2008 +0000
@@ -440,6 +440,10 @@
 	gtk_widget_set_app_paintable (imhtml->tip_window, TRUE);
 	gtk_window_set_resizable (GTK_WINDOW (imhtml->tip_window), FALSE);
 	gtk_widget_set_name (imhtml->tip_window, "gtk-tooltips");
+#if GTK_CHECK_VERSION(2,10,0)
+	gtk_window_set_type_hint (GTK_WINDOW (imhtml->tip_window),
+		GDK_WINDOW_TYPE_HINT_TOOLTIP);
+#endif
 	g_signal_connect_swapped (G_OBJECT (imhtml->tip_window), "expose_event",
 							  G_CALLBACK (gtk_imhtml_tip_paint), imhtml);
 
@@ -848,15 +852,15 @@
 	be = swap ? be : !be;
 
 	if (be)
-		return "UCS-2BE";
+		return "UTF-16BE";
 	else
-		return "UCS-2LE";
+		return "UTF-16LE";
 
 }
 
-/* Convert from UCS-2 to UTF-8, stripping the BOM if one is present.*/
+/* Convert from UTF-16LE to UTF-8, stripping the BOM if one is present.*/
 static gchar *
-ucs2_to_utf8_with_bom_check(gchar *data, guint len) {
+utf16_to_utf8_with_bom_check(gchar *data, guint len) {
 	char *fromcode = NULL;
 	GError *error = NULL;
 	guint16 c;
@@ -879,7 +883,7 @@
 		len -= 2;
 		break;
 	default:
-		fromcode = "UCS-2";
+		fromcode = "UTF-16";
 		break;
 	}
 
@@ -923,7 +927,7 @@
 		str = g_string_append_unichar(str, 0xfeff);
 		str = g_string_append(str, text);
 		str = g_string_append_unichar(str, 0x0000);
-		selection = g_convert(str->str, str->len, "UCS-2", "UTF-8", NULL, &len, NULL);
+		selection = g_convert(str->str, str->len, "UTF-16", "UTF-8", NULL, &len, NULL);
 		gtk_selection_data_set(selection_data, gdk_atom_intern("text/html", FALSE), 16, (const guchar *)selection, len);
 		g_string_free(str, TRUE);
 #else
@@ -1078,12 +1082,12 @@
 
 	if (selection_data->length >= 2 &&
 		(*(guint16 *)text == 0xfeff || *(guint16 *)text == 0xfffe)) {
-		/* This is UCS-2 */
-		char *utf8 = ucs2_to_utf8_with_bom_check(text, selection_data->length);
+		/* This is UTF-16 */
+		char *utf8 = utf16_to_utf8_with_bom_check(text, selection_data->length);
 		g_free(text);
 		text = utf8;
 		if (!text) {
-			purple_debug_warning("gtkimhtml", "g_convert from UCS-2 failed in paste_received_cb\n");
+			purple_debug_warning("gtkimhtml", "g_convert from UTF-16 failed in paste_received_cb\n");
 			return;
 		}
 	}
@@ -1780,10 +1784,10 @@
 			 * http://mail.gnome.org/archives/gtk-devel-list/2001-September/msg00114.html
 			 */
 			if (sd->length >= 2 && !g_utf8_validate(text, sd->length - 1, NULL)) {
-				utf8 = ucs2_to_utf8_with_bom_check(text, sd->length);
+				utf8 = utf16_to_utf8_with_bom_check(text, sd->length);
 
 				if (!utf8) {
-					purple_debug_warning("gtkimhtml", "g_convert from UCS-2 failed in drag_rcv_cb\n");
+					purple_debug_warning("gtkimhtml", "g_convert from UTF-16 failed in drag_rcv_cb\n");
 					return;
 				}
 			} else if (!(*text) || !g_utf8_validate(text, -1, NULL)) {