pidgin/android/libpurple

Merge with release-2.x.y

2013-04-13, Daniel Atallah
2f2dd47bf56b
Merge with release-2.x.y
--- a/libpurple/Makefile.mingw Fri Apr 12 02:03:13 2013 -0400
+++ b/libpurple/Makefile.mingw Sat Apr 13 12:24:43 2013 -0400
@@ -119,6 +119,7 @@
## LIBRARIES
##
LIBS = \
+ -ldnsapi \
-lglib-2.0 \
-lgthread-2.0 \
-lgobject-2.0 \
--- a/libpurple/dnssrv.c Fri Apr 12 02:03:13 2013 -0400
+++ b/libpurple/dnssrv.c Sat Apr 13 12:24:43 2013 -0400
@@ -61,13 +61,6 @@
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 @@
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 @@
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 @@
lst = g_list_append(lst, txtres);
}
- MyDnsRecordListFree(dr, DnsFreeRecordList);
+ DnsRecordListFree(dr, DnsFreeRecordList);
query_data->results = lst;
} else {
@@ -739,7 +732,6 @@
int pid;
#else
GError* err = NULL;
- static gboolean initialized = FALSE;
#endif
if (!protocol || !*protocol || !transport || !*transport || !domain || !*domain) {
@@ -834,21 +826,10 @@
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 @@
int pid;
#else
GError* err = NULL;
- static gboolean initialized = FALSE;
#endif
proxy_type = purple_proxy_info_get_type(
@@ -965,21 +945,10 @@
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.
--- a/libpurple/protocols/mxit/markup.c Fri Apr 12 02:03:13 2013 -0400
+++ b/libpurple/protocols/mxit/markup.c Sat Apr 13 12:24:43 2013 -0400
@@ -134,27 +134,26 @@
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
--- a/libpurple/prpl.h Fri Apr 12 02:03:13 2013 -0400
+++ b/libpurple/prpl.h Sat Apr 13 12:24:43 2013 -0400
@@ -434,14 +434,13 @@
* 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);