changeset 16322:6349d702bab6

merge of 'c04ec8c15e35618f8f52341ab439770d5630319d' and 'e8d870a3b6ba3c76763264ec97e2fb2cb55f1deb'
author Mark Doliner <mark@kingant.net>
date Mon, 23 Apr 2007 07:44:10 +0000
parents 3ba37836d674 (current diff) 1560f28cb854 (diff)
children cf62255b0a74
files
diffstat 6 files changed, 83 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/protocols/jabber/auth.c	Mon Apr 23 06:29:50 2007 +0000
+++ b/libpurple/protocols/jabber/auth.c	Mon Apr 23 07:44:10 2007 +0000
@@ -831,7 +831,7 @@
 {
 	const char *ns = xmlnode_get_namespace(packet);
 #ifdef HAVE_CYRUS_SASL
-	const int *x;
+	const void *x;
 #endif
 
 	if(!ns || strcmp(ns, "urn:ietf:params:xml:ns:xmpp-sasl")) {
@@ -865,9 +865,9 @@
 	}
 	/* If we've negotiated a security layer, we need to enable it */
 	sasl_getprop(js->sasl, SASL_SSF, &x);
-	if (*x > 0) {
+	if (*(int *)x > 0) {
 		sasl_getprop(js->sasl, SASL_MAXOUTBUF, &x);
-		js->sasl_maxbuf = *x;
+		js->sasl_maxbuf = *(int *)x;
 	}
 #endif
 
--- a/libpurple/protocols/oscar/family_locate.c	Mon Apr 23 06:29:50 2007 +0000
+++ b/libpurple/protocols/oscar/family_locate.c	Mon Apr 23 07:44:10 2007 +0000
@@ -294,6 +294,21 @@
 		cur->status_len = userinfo->status_len;
 	}
 
+	if (userinfo->itmsurl != NULL) {
+		free(cur->itmsurl);
+		free(cur->itmsurl_encoding);
+		if (userinfo->itmsurl_len > 0) {
+			cur->itmsurl = (char *)malloc(userinfo->itmsurl_len);
+			memcpy(cur->itmsurl, userinfo->itmsurl, userinfo->itmsurl_len);
+		} else
+			cur->itmsurl = NULL;
+		if (userinfo->itmsurl_encoding != NULL)
+			cur->itmsurl_encoding = strdup(userinfo->itmsurl_encoding);
+		else
+			cur->itmsurl_encoding = NULL;
+		cur->itmsurl_len = userinfo->itmsurl_len;
+	}
+
 	if (userinfo->away != NULL) {
 		free(cur->away);
 		free(cur->away_encoding);
@@ -577,6 +592,8 @@
 	free(info->info_encoding);
 	free(info->status);
 	free(info->status_encoding);
+	free(info->itmsurl);
+	free(info->itmsurl_encoding);
 	free(info->away);
 	free(info->away_encoding);
 }
@@ -841,6 +858,28 @@
 						}
 					} break;
 
+					case 0x0009: { /* An iTunes Music Store link */
+						free(outinfo->itmsurl);
+						free(outinfo->itmsurl_encoding);
+						if (length2 >= 4) {
+							outinfo->itmsurl_len = byte_stream_get16(bs);
+							outinfo->itmsurl = byte_stream_getstr(bs, outinfo->itmsurl_len);
+							if (byte_stream_get16(bs) == 0x0001) {
+								/* We have an encoding */
+								byte_stream_get16(bs);
+								outinfo->itmsurl_encoding = byte_stream_getstr(bs, byte_stream_get16(bs));
+							} else {
+								/* No explicit encoding, client should use UTF-8 */
+								outinfo->itmsurl_encoding = NULL;
+							}
+						} else {
+							byte_stream_advance(bs, length2);
+							outinfo->itmsurl_len = 0;
+							outinfo->itmsurl = g_strdup("");
+							outinfo->itmsurl_encoding = NULL;
+						}
+					} break;
+
 					default: {
 						byte_stream_advance(bs, length2);
 					} break;
--- a/libpurple/protocols/oscar/oscar.c	Mon Apr 23 06:29:50 2007 +0000
+++ b/libpurple/protocols/oscar/oscar.c	Mon Apr 23 07:44:10 2007 +0000
@@ -1778,8 +1778,20 @@
 
 	if (have_status_message)
 	{
-		purple_prpl_got_user_status(account, info->sn, status_id,
-								  "message", message, NULL);
+		if ((status_id == OSCAR_STATUS_ID_AVAILABLE) && (info->itmsurl != NULL))
+		{
+			char *itmsurl;
+			itmsurl = oscar_encoding_to_utf8(info->itmsurl_encoding,
+					info->itmsurl, info->itmsurl_len);
+			purple_prpl_got_user_status(account, info->sn, status_id,
+					"message", message, "itmsurl", itmsurl, NULL);
+			g_free(itmsurl);
+		}
+		else
+		{
+			purple_prpl_got_user_status(account, info->sn, status_id,
+					"message", message, NULL);
+		}
 		g_free(message);
 	}
 	else
@@ -2890,6 +2902,25 @@
 		g_free(tmp);
 	}
 
+#if 0
+	/*
+	 * TODO: This code is disabled because it's kind of stupid.  iTunes
+	 *       doesn't run in Linux.  It'd be cool if we surfaced this URL
+	 *       to Windows users, but it would be better to just linkify
+	 *       the available message, above.
+	 */
+
+	/* iTunes Music Store link */
+	if (userinfo->itmsurl != NULL)
+	{
+		if (userinfo->itmsurl[0] != '\0')
+			tmp = oscar_encoding_to_utf8(userinfo->itmsurl_encoding,
+											 userinfo->itmsurl, userinfo->itmsurl_len);
+		oscar_user_info_add_pair(user_info, _("iTunes Music Store Link"), tmp);
+		g_free(tmp);
+	}
+#endif
+
 	/* Away message */
 	if ((userinfo->flags & AIM_FLAG_AWAY) && (userinfo->away_len > 0) && (userinfo->away != NULL) && (userinfo->away_encoding != NULL)) {
 		tmp = oscar_encoding_extract(userinfo->away_encoding);
--- a/libpurple/protocols/oscar/oscar.h	Mon Apr 23 06:29:50 2007 +0000
+++ b/libpurple/protocols/oscar/oscar.h	Mon Apr 23 07:44:10 2007 +0000
@@ -1001,6 +1001,10 @@
 	char *status_encoding;
 	guint16 status_len;
 
+	char *itmsurl;
+	char *itmsurl_encoding;
+	guint16 itmsurl_len;
+
 	char *away;
 	char *away_encoding;
 	guint16 away_len;
--- a/libpurple/protocols/silc/wb.c	Mon Apr 23 06:29:50 2007 +0000
+++ b/libpurple/protocols/silc/wb.c	Mon Apr 23 07:44:10 2007 +0000
@@ -433,7 +433,7 @@
 	wb->proto_data = NULL;
 }
 
-void silcpurple_wb_get_dimensions(PurpleWhiteboard *wb, int *width, int *height)
+void silcpurple_wb_get_dimensions(const PurpleWhiteboard *wb, int *width, int *height)
 {
 	SilcPurpleWb wbs = wb->proto_data;
 	*width = wbs->width;
@@ -452,7 +452,7 @@
 	purple_whiteboard_set_dimensions(wb, wbs->width, wbs->height);
 }
 
-void silcpurple_wb_get_brush(PurpleWhiteboard *wb, int *size, int *color)
+void silcpurple_wb_get_brush(const PurpleWhiteboard *wb, int *size, int *color)
 {
 	SilcPurpleWb wbs = wb->proto_data;
 	*size = wbs->brush_size;
--- a/libpurple/protocols/silc/wb.h	Mon Apr 23 06:29:50 2007 +0000
+++ b/libpurple/protocols/silc/wb.h	Mon Apr 23 07:44:10 2007 +0000
@@ -39,9 +39,9 @@
 			    SilcUInt32 message_len);
 void silcpurple_wb_start(PurpleWhiteboard *wb);
 void silcpurple_wb_end(PurpleWhiteboard *wb);
-void silcpurple_wb_get_dimensions(PurpleWhiteboard *wb, int *width, int *height);
+void silcpurple_wb_get_dimensions(const PurpleWhiteboard *wb, int *width, int *height);
 void silcpurple_wb_set_dimensions(PurpleWhiteboard *wb, int width, int height);
-void silcpurple_wb_get_brush(PurpleWhiteboard *wb, int *size, int *color);
+void silcpurple_wb_get_brush(const PurpleWhiteboard *wb, int *size, int *color);
 void silcpurple_wb_set_brush(PurpleWhiteboard *wb, int size, int color);
 void silcpurple_wb_send(PurpleWhiteboard *wb, GList *draw_list);
 void silcpurple_wb_clear(PurpleWhiteboard *wb);