changeset 23153:f26f6a854770

propagate from branch 'im.pidgin.pidgin' (head 64263ae223a317116a83aab2c6a2a36b4c308d7b) to branch 'im.pidgin.pidgin.next.minor' (head 2a44ebbfd8390776463073a4473159a6ce3a2510)
author Sadrul Habib Chowdhury <imadil@gmail.com>
date Tue, 13 May 2008 06:04:27 +0000
parents d476ab1b47b2 (current diff) abb17e7e2e98 (diff)
children caa533b62902 7dccb11c5f1d
files libpurple/blist.c libpurple/protocols/bonjour/bonjour.c pidgin/gtkimhtmltoolbar.c
diffstat 24 files changed, 131 insertions(+), 122 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/blist.c	Tue May 13 06:04:10 2008 +0000
+++ b/libpurple/blist.c	Tue May 13 06:04:27 2008 +0000
@@ -2073,9 +2073,7 @@
 
 const char *purple_chat_get_name(PurpleChat *chat)
 {
-	struct proto_chat_entry *pce;
-	GList *parts;
-	char *ret;
+	char *ret = NULL;
 	PurplePlugin *prpl;
 	PurplePluginProtocolInfo *prpl_info = NULL;
 
@@ -2087,11 +2085,14 @@
 	prpl = purple_find_prpl(purple_account_get_protocol_id(chat->account));
 	prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(prpl);
 
-	parts = prpl_info->chat_info(purple_account_get_connection(chat->account));
-	pce = parts->data;
-	ret = g_hash_table_lookup(chat->components, pce->identifier);
-	g_list_foreach(parts, (GFunc)g_free, NULL);
-	g_list_free(parts);
+	if (prpl_info->chat_info) {
+		struct proto_chat_entry *pce;
+		GList *parts = prpl_info->chat_info(purple_account_get_connection(chat->account));
+		pce = parts->data;
+		ret = g_hash_table_lookup(chat->components, pce->identifier);
+		g_list_foreach(parts, (GFunc)g_free, NULL);
+		g_list_free(parts);
+	}
 
 	return ret;
 }
--- a/libpurple/protocols/bonjour/bonjour.c	Tue May 13 06:04:10 2008 +0000
+++ b/libpurple/protocols/bonjour/bonjour.c	Tue May 13 06:04:27 2008 +0000
@@ -24,6 +24,7 @@
 #include <pwd.h>
 #else
 #define UNICODE
+#include <winsock2.h>
 #include <windows.h>
 #include <lm.h>
 #include "dns_sd_proxy.h"
--- a/libpurple/protocols/bonjour/dns_sd_proxy.h	Tue May 13 06:04:10 2008 +0000
+++ b/libpurple/protocols/bonjour/dns_sd_proxy.h	Tue May 13 06:04:27 2008 +0000
@@ -21,10 +21,13 @@
 #ifndef _DNS_SD_PROXY
 #define _DNS_SD_PROXY
 
+
+#ifndef _MSC_VER
 #include <stdint.h>
+#endif
 
 /* fixup to make pidgin compile against win32 bonjour */
-#ifdef _WIN32
+#if defined(_WIN32) && !defined(_MSC_VER)
 #define _MSL_STDINT_H
 #endif
 
--- a/libpurple/protocols/bonjour/jabber.c	Tue May 13 06:04:10 2008 +0000
+++ b/libpurple/protocols/bonjour/jabber.c	Tue May 13 06:04:27 2008 +0000
@@ -39,7 +39,9 @@
 #endif
 
 #include <glib.h>
+#ifdef HAVE_UNISTD_H
 #include <unistd.h>
+#endif
 #include <fcntl.h>
 
 #include "network.h"
--- a/libpurple/protocols/bonjour/parser.c	Tue May 13 06:04:10 2008 +0000
+++ b/libpurple/protocols/bonjour/parser.c	Tue May 13 06:04:27 2008 +0000
@@ -157,38 +157,38 @@
 }
 
 static xmlSAXHandler bonjour_parser_libxml = {
-	.internalSubset         = NULL,
-	.isStandalone           = NULL,
-	.hasInternalSubset      = NULL,
-	.hasExternalSubset      = NULL,
-	.resolveEntity          = NULL,
-	.getEntity              = NULL,
-	.entityDecl             = NULL,
-	.notationDecl           = NULL,
-	.attributeDecl          = NULL,
-	.elementDecl            = NULL,
-	.unparsedEntityDecl     = NULL,
-	.setDocumentLocator     = NULL,
-	.startDocument          = NULL,
-	.endDocument            = NULL,
-	.startElement           = NULL,
-	.endElement             = NULL,
-	.reference              = NULL,
-	.characters             = bonjour_parser_element_text_libxml,
-	.ignorableWhitespace    = NULL,
-	.processingInstruction  = NULL,
-	.comment                = NULL,
-	.warning                = NULL,
-	.error                  = NULL,
-	.fatalError             = NULL,
-	.getParameterEntity     = NULL,
-	.cdataBlock             = NULL,
-	.externalSubset         = NULL,
-	.initialized            = XML_SAX2_MAGIC,
-	._private               = NULL,
-	.startElementNs         = bonjour_parser_element_start_libxml,
-	.endElementNs           = bonjour_parser_element_end_libxml,
-	.serror                 = NULL
+	NULL,									/*internalSubset*/
+	NULL,									/*isStandalone*/
+	NULL,									/*hasInternalSubset*/
+	NULL,									/*hasExternalSubset*/
+	NULL,									/*resolveEntity*/
+	NULL,									/*getEntity*/
+	NULL,									/*entityDecl*/
+	NULL,									/*notationDecl*/
+	NULL,									/*attributeDecl*/
+	NULL,									/*elementDecl*/
+	NULL,									/*unparsedEntityDecl*/
+	NULL,									/*setDocumentLocator*/
+	NULL,									/*startDocument*/
+	NULL,									/*endDocument*/
+	NULL,									/*startElement*/
+	NULL,									/*endElement*/
+	NULL,									/*reference*/
+	bonjour_parser_element_text_libxml,		/*characters*/
+	NULL,									/*ignorableWhitespace*/
+	NULL,									/*processingInstruction*/
+	NULL,									/*comment*/
+	NULL,									/*warning*/
+	NULL,									/*error*/
+	NULL,									/*fatalError*/
+	NULL,									/*getParameterEntity*/
+	NULL,									/*cdataBlock*/
+	NULL,									/*externalSubset*/
+	XML_SAX2_MAGIC,							/*initialized*/
+	NULL,									/*_private*/
+	bonjour_parser_element_start_libxml,	/*startElementNs*/
+	bonjour_parser_element_end_libxml,		/*endElementNs*/
+	NULL									/*serror*/
 };
 
 void
--- a/libpurple/protocols/jabber/iq.c	Tue May 13 06:04:10 2008 +0000
+++ b/libpurple/protocols/jabber/iq.c	Tue May 13 06:04:27 2008 +0000
@@ -374,7 +374,7 @@
 	}
 }
 
-void jabber_iq_register_handler(const char *xmlns, JabberIqHandler handlerfunc)
+void jabber_iq_register_handler(const char *xmlns, JabberIqHandler *handlerfunc)
 {
 	g_hash_table_replace(iq_handlers, g_strdup(xmlns), handlerfunc);
 }
--- a/libpurple/protocols/jabber/parser.c	Tue May 13 06:04:10 2008 +0000
+++ b/libpurple/protocols/jabber/parser.c	Tue May 13 06:04:27 2008 +0000
@@ -133,38 +133,38 @@
 }
 
 static xmlSAXHandler jabber_parser_libxml = {
-	.internalSubset         = NULL,
-	.isStandalone           = NULL,
-	.hasInternalSubset      = NULL,
-	.hasExternalSubset      = NULL,
-	.resolveEntity          = NULL,
-	.getEntity              = NULL,
-	.entityDecl             = NULL,
-	.notationDecl           = NULL,
-	.attributeDecl          = NULL,
-	.elementDecl            = NULL,
-	.unparsedEntityDecl     = NULL,
-	.setDocumentLocator     = NULL,
-	.startDocument          = NULL,
-	.endDocument            = NULL,
-	.startElement           = NULL,
-	.endElement             = NULL,
-	.reference              = NULL,
-	.characters             = jabber_parser_element_text_libxml,
-	.ignorableWhitespace    = NULL,
-	.processingInstruction  = NULL,
-	.comment                = NULL,
-	.warning                = NULL,
-	.error                  = NULL,
-	.fatalError             = NULL,
-	.getParameterEntity     = NULL,
-	.cdataBlock             = NULL,
-	.externalSubset         = NULL,
-	.initialized            = XML_SAX2_MAGIC,
-	._private               = NULL,
-	.startElementNs         = jabber_parser_element_start_libxml,
-	.endElementNs           = jabber_parser_element_end_libxml,
-	.serror                 = NULL
+	NULL,									/*internalSubset*/
+	NULL,									/*isStandalone*/
+	NULL,									/*hasInternalSubset*/
+	NULL,									/*hasExternalSubset*/
+	NULL,									/*resolveEntity*/
+	NULL,									/*getEntity*/
+	NULL,									/*entityDecl*/
+	NULL,									/*notationDecl*/
+	NULL,									/*attributeDecl*/
+	NULL,									/*elementDecl*/
+	NULL,									/*unparsedEntityDecl*/
+	NULL,									/*setDocumentLocator*/
+	NULL,									/*startDocument*/
+	NULL,									/*endDocument*/
+	NULL,									/*startElement*/
+	NULL,									/*endElement*/
+	NULL,									/*reference*/
+	jabber_parser_element_text_libxml,		/*characters*/
+	NULL,									/*ignorableWhitespace*/
+	NULL,									/*processingInstruction*/
+	NULL,									/*comment*/
+	NULL,									/*warning*/
+	NULL,									/*error*/
+	NULL,									/*fatalError*/
+	NULL,									/*getParameterEntity*/
+	NULL,									/*cdataBlock*/
+	NULL,									/*externalSubset*/
+	XML_SAX2_MAGIC,							/*initialized*/
+	NULL,									/*_private*/
+	jabber_parser_element_start_libxml,		/*startElementNs*/
+	jabber_parser_element_end_libxml,		/*endElementNs*/
+	NULL									/*serror*/
 };
 
 void
--- a/libpurple/protocols/jabber/si.c	Tue May 13 06:04:10 2008 +0000
+++ b/libpurple/protocols/jabber/si.c	Tue May 13 06:04:27 2008 +0000
@@ -84,6 +84,21 @@
 	return NULL;
 }
 
+static void
+jabber_si_free_streamhost(gpointer data, gpointer user_data)
+{
+	JabberBytestreamsStreamhost *sh = data;
+
+	if(!data)
+		return;
+
+	g_free(sh->jid);
+	g_free(sh->host);
+	g_free(sh->zeroconf);
+	g_free(sh);
+}
+
+
 
 static void jabber_si_bytestreams_attempt_connect(PurpleXfer *xfer);
 
@@ -110,10 +125,7 @@
 				streamhost->jid, streamhost->host,
 				error_message ? error_message : "(null)");
 		jsx->streamhosts = g_list_remove(jsx->streamhosts, streamhost);
-		g_free(streamhost->jid);
-		g_free(streamhost->host);
-		g_free(streamhost->zeroconf);
-		g_free(streamhost);
+		jabber_si_free_streamhost(streamhost, NULL);
 		jabber_si_bytestreams_attempt_connect(xfer);
 		return;
 	}
@@ -245,10 +257,7 @@
 	if (jsx->connect_data == NULL)
 	{
 		jsx->streamhosts = g_list_remove(jsx->streamhosts, streamhost);
-		g_free(streamhost->jid);
-		g_free(streamhost->host);
-		g_free(streamhost->zeroconf);
-		g_free(streamhost);
+		jabber_si_free_streamhost(streamhost, NULL);
 		jabber_si_bytestreams_attempt_connect(xfer);
 	}
 }
@@ -299,6 +308,7 @@
 			sh->host = g_strdup(host);
 			sh->port = portnum;
 			sh->zeroconf = g_strdup(zeroconf);
+			/* If there were a lot of these, it'd be worthwhile to prepend and reverse. */
 			jsx->streamhosts = g_list_append(jsx->streamhosts, sh);
 		}
 	}
@@ -593,21 +603,6 @@
 	return strcmp(sh->jid, (char *)b);
 }
 
-
-static void
-jabber_si_free_streamhost(gpointer data, gpointer user_data)
-{
-	JabberBytestreamsStreamhost *sh = data;
-
-	if(!data)
-		return;
-
-	g_free(sh->jid);
-	g_free(sh->host);
-	g_free(sh->zeroconf);
-	g_free(sh);
-}
-
 static void
 jabber_si_xfer_bytestreams_send_connected_cb(gpointer data, gint source,
 		PurpleInputCondition cond)
@@ -826,7 +821,7 @@
 		sh2 = g_new0(JabberBytestreamsStreamhost, 1);
 		sh2->jid = g_strdup(sh->jid);
 		sh2->host = g_strdup(sh->host);
-		sh2->zeroconf = g_strdup(sh->zeroconf);
+		/*sh2->zeroconf = g_strdup(sh->zeroconf);*/
 		sh2->port = sh->port;
 
 		jsx->streamhosts = g_list_prepend(jsx->streamhosts, sh2);
--- a/libpurple/protocols/jabber/win32/posix.uname.c	Tue May 13 06:04:10 2008 +0000
+++ b/libpurple/protocols/jabber/win32/posix.uname.c	Tue May 13 06:04:27 2008 +0000
@@ -33,10 +33,12 @@
 /*#define _ANONYMOUS_STRUCT*/
 /*#define _ANONYMOUS_UNION*/
 #include <windows.h>
+#ifdef __MINGW32__
 #include <_mingw.h>
+#endif
 
 int
-uname( struct utsname *uts )
+jabber_win32_uname( struct utsname *uts )
 {
   DWORD sLength;
   OSVERSIONINFO OS_version;
@@ -52,7 +54,7 @@
   GetVersionEx ( &OS_version );
   GetSystemInfo ( &System_Info );
 
-  strcpy( uts->sysname, "MINGW_" );
+  strcpy( uts->sysname, "WIN32_" );
   switch( OS_version.dwPlatformId )
   {
     case VER_PLATFORM_WIN32_NT:
@@ -82,8 +84,10 @@
       break;
   }
 
+#ifdef __MINGW32__
   sprintf( uts->version, "%i", __MINGW32_MAJOR_VERSION );
   sprintf( uts->release, "%i", __MINGW32_MINOR_VERSION );
+#endif
 
   switch( System_Info.wProcessorArchitecture )
   {
--- a/libpurple/protocols/jabber/win32/utsname.h	Tue May 13 06:04:10 2008 +0000
+++ b/libpurple/protocols/jabber/win32/utsname.h	Tue May 13 06:04:27 2008 +0000
@@ -14,7 +14,8 @@
   char machine[20];
 };
 
-int uname (struct utsname *);
+int jabber_win32_uname (struct utsname *);
+#define uname(utsname) jabber_win32_uname(utsname)
 
 #ifdef __cplusplus
 }
--- a/libpurple/protocols/msn/httpconn.c	Tue May 13 06:04:10 2008 +0000
+++ b/libpurple/protocols/msn/httpconn.c	Tue May 13 06:04:27 2008 +0000
@@ -438,7 +438,7 @@
 static gboolean
 write_raw(MsnHttpConn *httpconn, const char *data, size_t data_len)
 {
-	ssize_t res; /* result of the write operation */
+	gssize res; /* result of the write operation */
 
 	if (httpconn->tx_handler == 0)
 		res = write(httpconn->fd, data, data_len);
@@ -551,7 +551,7 @@
 	return TRUE;
 }
 
-ssize_t
+gssize
 msn_httpconn_write(MsnHttpConn *httpconn, const char *body, size_t body_len)
 {
 	char *params;
--- a/libpurple/protocols/msn/httpconn.h	Tue May 13 06:04:10 2008 +0000
+++ b/libpurple/protocols/msn/httpconn.h	Tue May 13 06:04:27 2008 +0000
@@ -89,7 +89,7 @@
  *
  * @return The number of bytes written.
  */
-ssize_t msn_httpconn_write(MsnHttpConn *httpconn, const char *data, size_t data_len);
+gssize msn_httpconn_write(MsnHttpConn *httpconn, const char *data, size_t data_len);
 
 /**
  * Connects the HTTP connection object to a host.
--- a/libpurple/protocols/msn/servconn.c	Tue May 13 06:04:10 2008 +0000
+++ b/libpurple/protocols/msn/servconn.c	Tue May 13 06:04:27 2008 +0000
@@ -323,10 +323,10 @@
 	purple_circ_buffer_mark_read(servconn->tx_buf, ret);
 }
 
-ssize_t
+gssize
 msn_servconn_write(MsnServConn *servconn, const char *buf, size_t len)
 {
-	ssize_t ret = 0;
+	gssize ret = 0;
 
 	g_return_val_if_fail(servconn != NULL, 0);
 
--- a/libpurple/protocols/msn/servconn.h	Tue May 13 06:04:10 2008 +0000
+++ b/libpurple/protocols/msn/servconn.h	Tue May 13 06:04:27 2008 +0000
@@ -157,7 +157,7 @@
  * @param buf The data to write.
  * @param size The size of the data.
  */
-ssize_t msn_servconn_write(MsnServConn *servconn, const char *buf,
+gssize msn_servconn_write(MsnServConn *servconn, const char *buf,
 						  size_t size);
 
 /**
--- a/libpurple/protocols/msn/soap2.c	Tue May 13 06:04:10 2008 +0000
+++ b/libpurple/protocols/msn/soap2.c	Tue May 13 06:04:27 2008 +0000
@@ -33,7 +33,9 @@
 #include "xmlnode.h"
 
 #include <glib.h>
+#if !defined(_WIN32) || !defined(_WINERROR_)
 #include <error.h>
+#endif
 
 #define SOAP_TIMEOUT (5 * 60)
 
--- a/libpurple/protocols/oscar/flap_connection.c	Tue May 13 06:04:10 2008 +0000
+++ b/libpurple/protocols/oscar/flap_connection.c	Tue May 13 06:04:27 2008 +0000
@@ -159,7 +159,7 @@
  *        of this SNAC.  For empty SNACs this should be NULL.
  */
 void
-flap_connection_send_snac(OscarData *od, FlapConnection *conn, guint16 family, guint16 subtype, guint16 flags, aim_snacid_t snacid, ByteStream *data)
+flap_connection_send_snac(OscarData *od, FlapConnection *conn, guint16 family, const guint16 subtype, guint16 flags, aim_snacid_t snacid, ByteStream *data)
 {
 	FlapFrame *frame;
 	guint32 length;
@@ -788,7 +788,7 @@
 flap_connection_recv_cb(gpointer data, gint source, PurpleInputCondition cond)
 {
 	FlapConnection *conn;
-	ssize_t read;
+	gssize read;
 
 	conn = data;
 
--- a/libpurple/protocols/oscar/msgcookie.c	Tue May 13 06:04:10 2008 +0000
+++ b/libpurple/protocols/oscar/msgcookie.c	Tue May 13 06:04:27 2008 +0000
@@ -132,7 +132,7 @@
  *         on success; returns NULL on error/not found
  */
 
-IcbmCookie *aim_checkcookie(OscarData *od, const guint8 *cookie, int type)
+IcbmCookie *aim_checkcookie(OscarData *od, const guint8 *cookie, const int type)
 {
 	IcbmCookie *cur;
 
--- a/libpurple/protocols/oscar/odc.c	Tue May 13 06:04:10 2008 +0000
+++ b/libpurple/protocols/oscar/odc.c	Tue May 13 06:04:27 2008 +0000
@@ -430,7 +430,7 @@
 	PeerConnection *conn;
 	OdcFrame *frame;
 	ByteStream *bs;
-	ssize_t read;
+	gssize read;
 
 	conn = data;
 	frame = conn->frame;
--- a/libpurple/protocols/oscar/oscar.h	Tue May 13 06:04:10 2008 +0000
+++ b/libpurple/protocols/oscar/oscar.h	Tue May 13 06:04:27 2008 +0000
@@ -409,7 +409,7 @@
 
 	int fd;
 	guint8 header[6];
-	ssize_t header_received;
+	gssize header_received;
 	FlapFrame buffer_incoming;
 	PurpleCircBuffer *buffer_outgoing;
 	guint watcher_incoming;
@@ -1389,8 +1389,8 @@
 /* TLV handling functions */
 char *aim_tlv_getvalue_as_string(aim_tlv_t *tlv);
 
-aim_tlv_t *aim_tlv_gettlv(GSList *list, guint16 type, const int nth);
-int aim_tlv_getlength(GSList *list, guint16 type, const int nth);
+aim_tlv_t *aim_tlv_gettlv(GSList *list, const guint16 type, const int nth);
+int aim_tlv_getlength(GSList *list, const guint16 type, const int nth);
 char *aim_tlv_getstr(GSList *list, const guint16 type, const int nth);
 guint8 aim_tlv_get8(GSList *list, const guint16 type, const int nth);
 guint16 aim_tlv_get16(GSList *list, const guint16 type, const int nth);
--- a/libpurple/protocols/oscar/peer.c	Tue May 13 06:04:10 2008 +0000
+++ b/libpurple/protocols/oscar/peer.c	Tue May 13 06:04:27 2008 +0000
@@ -291,7 +291,7 @@
 peer_connection_recv_cb(gpointer data, gint source, PurpleInputCondition cond)
 {
 	PeerConnection *conn;
-	ssize_t read;
+	gssize read;
 
 	conn = data;
 
@@ -407,7 +407,7 @@
 {
 	PeerConnection *conn;
 	gsize writelen;
-	ssize_t wrotelen;
+	gssize wrotelen;
 
 	conn = data;
 	writelen = purple_circ_buffer_get_max_read(conn->buffer_outgoing);
--- a/libpurple/protocols/oscar/peer.h	Tue May 13 06:04:10 2008 +0000
+++ b/libpurple/protocols/oscar/peer.h	Tue May 13 06:04:27 2008 +0000
@@ -179,9 +179,9 @@
 
 	int fd;
 	guint8 header[6];
-	ssize_t header_received;
+	gssize header_received;
 	guint8 proxy_header[12];
-	ssize_t proxy_header_received;
+	gssize proxy_header_received;
 	ByteStream buffer_incoming;
 	PurpleCircBuffer *buffer_outgoing;
 	guint watcher_incoming;
--- a/libpurple/protocols/oscar/peer_proxy.c	Tue May 13 06:04:10 2008 +0000
+++ b/libpurple/protocols/oscar/peer_proxy.c	Tue May 13 06:04:27 2008 +0000
@@ -202,7 +202,7 @@
 peer_proxy_connection_recv_cb(gpointer data, gint source, PurpleInputCondition cond)
 {
 	PeerConnection *conn;
-	ssize_t read;
+	gssize read;
 	ProxyFrame *frame;
 
 	conn = data;
--- a/libpurple/protocols/yahoo/yahoo_picture.c	Tue May 13 06:04:10 2008 +0000
+++ b/libpurple/protocols/yahoo/yahoo_picture.c	Tue May 13 06:04:27 2008 +0000
@@ -413,7 +413,7 @@
 {
 	struct yahoo_buddy_icon_upload_data *d = data;
 	PurpleConnection *gc = d->gc;
-	ssize_t wrote;
+	gssize wrote;
 
 	if (!PURPLE_CONNECTION_IS_VALID(gc)) {
 		yahoo_buddy_icon_upload_data_free(d);
--- a/libpurple/protocols/yahoo/yahoo_profile.c	Tue May 13 06:04:10 2008 +0000
+++ b/libpurple/protocols/yahoo/yahoo_profile.c	Tue May 13 06:04:27 2008 +0000
@@ -1003,7 +1003,7 @@
 	purple_debug_misc("yahoo", "url_buffer = %p\n", url_buffer);
 
 	/* convert to utf8 */
-	if (strings && strings->charset != XX) {
+	if (strings && strings->charset) {
 		p = g_convert(stripped, -1, "utf-8", strings->charset,
 				NULL, NULL, NULL);
 		if (!p) {
@@ -1023,7 +1023,7 @@
 	p = NULL;
 
 	/* "Last updated" should also be converted to utf8 and with &nbsp; killed */
-	if (strings && strings->charset != XX) {
+	if (strings && strings->charset) {
 		last_updated_utf8_string = g_convert(last_updated_string, -1, "utf-8",
 				strings->charset, NULL, NULL, NULL);
 		yahoo_remove_nonbreaking_spaces(last_updated_utf8_string);