/pidgin/main: 2f2dd47bf56b: Merge with release-2.x.y

Daniel Atallah datallah at pidgin.im
Sat Apr 13 12:25:01 EDT 2013


Changeset: 2f2dd47bf56b1d3fe655a1e57f3f772337e88500
Author:	 Daniel Atallah <datallah at pidgin.im>
Date:	 2013-04-13 12:24 -0400
Branch:	 default
URL: https://hg.pidgin.im/pidgin/main/rev/2f2dd47bf56b

Description:

Merge with release-2.x.y

diffstat:

 libpurple/Makefile.mingw          |   1 +
 libpurple/dnssrv.c                |  53 ++++++++------------------------------
 libpurple/protocols/mxit/markup.c |  17 +++++------
 libpurple/prpl.h                  |   5 +--
 4 files changed, 22 insertions(+), 54 deletions(-)

diffs (182 lines):

diff --git a/libpurple/Makefile.mingw b/libpurple/Makefile.mingw
--- a/libpurple/Makefile.mingw
+++ b/libpurple/Makefile.mingw
@@ -119,6 +119,7 @@ OBJECTS = $(C_SRC:%.c=%.o) $(RC_SRC:%.rc
 ## LIBRARIES
 ##
 LIBS =	\
+		-ldnsapi \
 		-lglib-2.0 \
 		-lgthread-2.0 \
 		-lgobject-2.0 \
diff --git a/libpurple/dnssrv.c b/libpurple/dnssrv.c
--- a/libpurple/dnssrv.c
+++ b/libpurple/dnssrv.c
@@ -61,13 +61,6 @@ typedef union {
 	HEADER hdr;
 	u_char buf[1024];
 } queryans;
-#else
-static DNS_STATUS (WINAPI *MyDnsQuery_UTF8) (
-	PCSTR lpstrName, WORD wType, DWORD fOptions,
-	PIP4_ARRAY aipServers, PDNS_RECORD* ppQueryResultsSet,
-	PVOID* pReserved) = NULL;
-static void (WINAPI *MyDnsRecordListFree) (PDNS_RECORD pRecordList,
-	DNS_FREE_TYPE FreeType) = NULL;
 #endif
 
 struct _PurpleSrvTxtQueryData {
@@ -646,7 +639,7 @@ res_thread(gpointer data)
 	DNS_STATUS ds;
 	PurpleSrvTxtQueryData *query_data = data;
 	type = query_data->type;
-	ds = MyDnsQuery_UTF8(query_data->query, type, DNS_QUERY_STANDARD, NULL, &dr, NULL);
+	ds = DnsQuery_UTF8(query_data->query, type, DNS_QUERY_STANDARD, NULL, &dr, NULL);
 	if (ds != ERROR_SUCCESS) {
 		gchar *msg = g_win32_error_message(ds);
 		if (type == DNS_TYPE_SRV) {
@@ -679,7 +672,7 @@ res_thread(gpointer data)
 				lst = g_list_prepend(lst, srvres);
 			}
 
-			MyDnsRecordListFree(dr, DnsFreeRecordList);
+			DnsRecordListFree(dr, DnsFreeRecordList);
 			query_data->results = purple_srv_sort(lst);
 		} else if (type == DNS_TYPE_TXT) {
 			PDNS_RECORD dr_tmp;
@@ -707,7 +700,7 @@ res_thread(gpointer data)
 				lst = g_list_append(lst, txtres);
 			}
 
-			MyDnsRecordListFree(dr, DnsFreeRecordList);
+			DnsRecordListFree(dr, DnsFreeRecordList);
 			query_data->results = lst;
 		} else {
 
@@ -739,7 +732,6 @@ purple_srv_resolve(PurpleAccount *accoun
 	int pid;
 #else
 	GError* err = NULL;
-	static gboolean initialized = FALSE;
 #endif
 
 	if (!protocol || !*protocol || !transport || !*transport || !domain || !*domain) {
@@ -834,21 +826,10 @@ purple_srv_resolve(PurpleAccount *accoun
 
 	return query_data;
 #else
-	if (!initialized) {
-		MyDnsQuery_UTF8 = (void*) wpurple_find_and_loadproc("dnsapi.dll", "DnsQuery_UTF8");
-		MyDnsRecordListFree = (void*) wpurple_find_and_loadproc(
-			"dnsapi.dll", "DnsRecordListFree");
-		initialized = TRUE;
-	}
-
-	if (!MyDnsQuery_UTF8 || !MyDnsRecordListFree)
-		query_data->error_message = g_strdup("System missing DNS API (Requires W2K+)\n");
-	else {
-		query_data->resolver = g_thread_create(res_thread, query_data, FALSE, &err);
-		if (query_data->resolver == NULL) {
-			query_data->error_message = g_strdup_printf("SRV thread create failure: %s\n", (err && err->message) ? err->message : "");
-			g_error_free(err);
-		}
+	query_data->resolver = g_thread_create(res_thread, query_data, FALSE, &err);
+	if (query_data->resolver == NULL) {
+		query_data->error_message = g_strdup_printf("SRV thread create failure: %s\n", (err && err->message) ? err->message : "");
+		g_error_free(err);
 	}
 
 	/* The query isn't going to happen, so finish the SRV lookup now.
@@ -875,7 +856,6 @@ PurpleSrvTxtQueryData *purple_txt_resolv
 	int pid;
 #else
 	GError* err = NULL;
-	static gboolean initialized = FALSE;
 #endif
 
 	proxy_type = purple_proxy_info_get_type(
@@ -965,21 +945,10 @@ PurpleSrvTxtQueryData *purple_txt_resolv
 
 	return query_data;
 #else
-	if (!initialized) {
-		MyDnsQuery_UTF8 = (void*) wpurple_find_and_loadproc("dnsapi.dll", "DnsQuery_UTF8");
-		MyDnsRecordListFree = (void*) wpurple_find_and_loadproc(
-			"dnsapi.dll", "DnsRecordListFree");
-		initialized = TRUE;
-	}
-
-	if (!MyDnsQuery_UTF8 || !MyDnsRecordListFree)
-		query_data->error_message = g_strdup("System missing DNS API (Requires W2K+)\n");
-	else {
-		query_data->resolver = g_thread_create(res_thread, query_data, FALSE, &err);
-		if (query_data->resolver == NULL) {
-			query_data->error_message = g_strdup_printf("TXT thread create failure: %s\n", (err && err->message) ? err->message : "");
-			g_error_free(err);
-		}
+	query_data->resolver = g_thread_create(res_thread, query_data, FALSE, &err);
+	if (query_data->resolver == NULL) {
+		query_data->error_message = g_strdup_printf("TXT thread create failure: %s\n", (err && err->message) ? err->message : "");
+		g_error_free(err);
 	}
 
 	/* The query isn't going to happen, so finish the TXT lookup now.
diff --git a/libpurple/protocols/mxit/markup.c b/libpurple/protocols/mxit/markup.c
--- a/libpurple/protocols/mxit/markup.c
+++ b/libpurple/protocols/mxit/markup.c
@@ -134,27 +134,26 @@ static void hex_dump( const char* buf, i
 void mxit_add_html_link( struct RXMsgData* mx, const char* replydata, gboolean isStructured, const char* displaytext )
 {
 #ifdef	MXIT_LINK_CLICK
-	char	retstr[256];
-	gchar*	retstr64;
-	char	link[256];
-	int		len;
+	gchar*	link	= NULL;
+	gchar*	link64	= NULL;
 
 	/*
 	 * The link content is encoded as follows:
 	 *  MXIT_LINK_KEY | ACCOUNT_USER | ACCOUNT_PROTO | REPLY_TO | REPLY_FORMAT | REPLY_DATA
 	 */
-	len = g_snprintf( retstr, sizeof( retstr ), "%s|%s|%s|%s|%i|%s",
+	link = g_strdup_printf( "%s|%s|%s|%s|%i|%s",
 			MXIT_LINK_KEY,
 			purple_account_get_username( mx->session->acc ),
 			purple_account_get_protocol_id( mx->session->acc ),
 			mx->from,
 			isStructured ? 1 : 0,
 			replydata );
-	retstr64 = purple_base64_encode( (const unsigned char*) retstr, len );
-	g_snprintf( link, sizeof( link ), "%s%s", MXIT_LINK_PREFIX, retstr64 );
-	g_free( retstr64 );
+	link64 = purple_base64_encode( (const unsigned char*) link, strlen( link ) );
 
-	g_string_append_printf( mx->msg, "<a href=\"%s\">%s</a>", link, displaytext );
+	g_string_append_printf( mx->msg, "<a href=\"%s%s\">%s</a>", MXIT_LINK_PREFIX, link64, displaytext );
+
+	g_free( link64 );
+	g_free( link );
 #else
 	g_string_append_printf( mx->msg, "<b>%s</b>", replydata );
 #endif
diff --git a/libpurple/prpl.h b/libpurple/prpl.h
--- a/libpurple/prpl.h
+++ b/libpurple/prpl.h
@@ -434,14 +434,13 @@ struct _PurplePluginProtocolInfo
 	 * the account is not connected, return -ENOTCONN.  If the
 	 * PRPL is unable to send the message for another reason, return
 	 * some other negative value.  You can use one of the valid
-	 * errno values, or just big something.  If the message should
-	 * not be echoed to the conversation window, return 0.
+	 * errno values, or just big something.
 	 *
 	 * @param id      The id of the chat to send the message to.
 	 * @param message The message to send to the chat.
 	 * @param flags   A bitwise OR of #PurpleMessageFlags representing
 	 *                message flags.
-	 * @return 	  A positive number or 0 in case of succes,
+	 * @return 	  A positive number or 0 in case of success,
 	 *                a negative error number in case of failure.
 	 */
 	int  (*chat_send)(PurpleConnection *, int id, const char *message, PurpleMessageFlags flags);



More information about the Commits mailing list