/pidgin/main: d3ef04981ee5: dnssrv: Link against dnsapi and call...
Daniel Atallah
datallah at pidgin.im
Sat Apr 13 12:25:01 EDT 2013
Changeset: d3ef04981ee563a2afd0d6e6c328b259ed71b923
Author: Daniel Atallah <datallah at pidgin.im>
Date: 2013-04-13 12:22 -0400
Branch: release-2.x.y
URL: https://hg.pidgin.im/pidgin/main/rev/d3ef04981ee5
Description:
dnssrv: Link against dnsapi and call DnsQuery_UTF8 and DnsRecordListFree
directly on windows now that all OSes we support have those functions
diffstat:
libpurple/Makefile.mingw | 1 +
libpurple/dnssrv.c | 53 +++++++++--------------------------------------
2 files changed, 12 insertions(+), 42 deletions(-)
diffs (123 lines):
diff --git a/libpurple/Makefile.mingw b/libpurple/Makefile.mingw
--- a/libpurple/Makefile.mingw
+++ b/libpurple/Makefile.mingw
@@ -117,6 +117,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 {
@@ -747,7 +740,6 @@ purple_srv_resolve_account(PurpleAccount
int pid;
#else
GError* err = NULL;
- static gboolean initialized = FALSE;
#endif
if (!protocol || !*protocol || !transport || !*transport || !domain || !*domain) {
@@ -836,21 +828,10 @@ purple_srv_resolve_account(PurpleAccount
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.
@@ -883,7 +864,6 @@ PurpleSrvTxtQueryData *purple_txt_resolv
int pid;
#else
GError* err = NULL;
- static gboolean initialized = FALSE;
#endif
proxy_type = purple_proxy_info_get_type(
@@ -967,21 +947,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.
More information about the Commits
mailing list