diff libpurple/dnssrv.c @ 15822:32c366eeeb99

sed -ie 's/gaim/purple/g'
author Sean Egan <seanegan@gmail.com>
date Mon, 19 Mar 2007 07:01:17 +0000
parents 4530f15fe5af
children 2edbd4fede72
line wrap: on
line diff
--- a/libpurple/dnssrv.c	Mon Mar 19 06:11:46 2007 +0000
+++ b/libpurple/dnssrv.c	Mon Mar 19 07:01:17 2007 +0000
@@ -1,7 +1,7 @@
 /**
  * @file dnssrv.c
  *
- * gaim
+ * purple
  *
  * Copyright (C) 2005 Thomas Butter <butter@uni-mannheim.de>
  *
@@ -58,8 +58,8 @@
 	DNS_FREE_TYPE FreeType) = NULL;
 #endif
 
-struct _GaimSrvQueryData {
-	GaimSrvCallback cb;
+struct _PurpleSrvQueryData {
+	PurpleSrvCallback cb;
 	gpointer extradata;
 	guint handle;
 #ifdef _WIN32
@@ -75,8 +75,8 @@
 static gint
 responsecompare(gconstpointer ar, gconstpointer br)
 {
-	GaimSrvResponse *a = (GaimSrvResponse*)ar;
-	GaimSrvResponse *b = (GaimSrvResponse*)br;
+	PurpleSrvResponse *a = (PurpleSrvResponse*)ar;
+	PurpleSrvResponse *b = (PurpleSrvResponse*)br;
 
 	if(a->pref == b->pref) {
 		if(a->weight == b->weight)
@@ -96,7 +96,7 @@
 resolve(int in, int out)
 {
 	GList *ret = NULL;
-	GaimSrvResponse *srvres;
+	PurpleSrvResponse *srvres;
 	queryans answer;
 	int size;
 	int qdcount;
@@ -108,7 +108,7 @@
 	gchar query[256];
 
 #ifdef HAVE_SIGNAL_H
-	gaim_restore_default_signal_handlers();
+	purple_restore_default_signal_handlers();
 #endif
 	
 	if (read(in, query, 256) <= 0)
@@ -156,7 +156,7 @@
 
 			cp += size;
 
-			srvres = g_new0(GaimSrvResponse, 1);
+			srvres = g_new0(PurpleSrvResponse, 1);
 			strcpy(srvres->hostname, name);
 			srvres->pref = pref;
 			srvres->port = port;
@@ -173,7 +173,7 @@
 	write(out, &size, sizeof(int));
 	while (ret != NULL)
 	{
-		write(out, ret->data, sizeof(GaimSrvResponse));
+		write(out, ret->data, sizeof(PurpleSrvResponse));
 		g_free(ret->data);
 		ret = g_list_remove(ret, ret->data);
 	}
@@ -182,27 +182,27 @@
 }
 
 static void
-resolved(gpointer data, gint source, GaimInputCondition cond)
+resolved(gpointer data, gint source, PurpleInputCondition cond)
 {
 	int size;
-	GaimSrvQueryData *query_data = (GaimSrvQueryData*)data;
-	GaimSrvResponse *res;
-	GaimSrvResponse *tmp;
+	PurpleSrvQueryData *query_data = (PurpleSrvQueryData*)data;
+	PurpleSrvResponse *res;
+	PurpleSrvResponse *tmp;
 	int i;
-	GaimSrvCallback cb = query_data->cb;
+	PurpleSrvCallback cb = query_data->cb;
 	int status;
 
 	read(source, &size, sizeof(int));
-	gaim_debug_info("dnssrv","found %d SRV entries\n", size);
-	tmp = res = g_new0(GaimSrvResponse, size);
+	purple_debug_info("dnssrv","found %d SRV entries\n", size);
+	tmp = res = g_new0(PurpleSrvResponse, size);
 	for (i = 0; i < size; i++) {
-		read(source, tmp++, sizeof(GaimSrvResponse));
+		read(source, tmp++, sizeof(PurpleSrvResponse));
 	}
 
 	cb(res, size, query_data->extradata);
 	waitpid(query_data->pid, &status, 0);
 
-	gaim_srv_cancel(query_data);
+	purple_srv_cancel(query_data);
 }
 
 #else /* _WIN32 */
@@ -212,23 +212,23 @@
 static gboolean
 res_main_thread_cb(gpointer data)
 {
-	GaimSrvResponse *srvres = NULL;
+	PurpleSrvResponse *srvres = NULL;
 	int size = 0;
-	GaimSrvQueryData *query_data = data;
+	PurpleSrvQueryData *query_data = data;
 
 	if(query_data->error_message != NULL)
-		gaim_debug_error("dnssrv", query_data->error_message);
+		purple_debug_error("dnssrv", query_data->error_message);
 	else {
-		GaimSrvResponse *srvres_tmp = NULL;
+		PurpleSrvResponse *srvres_tmp = NULL;
 		GSList *lst = query_data->results;
 
 		size = g_slist_length(query_data->results);
 
 		if(query_data->cb)
-			srvres_tmp = srvres = g_new0(GaimSrvResponse, size);
+			srvres_tmp = srvres = g_new0(PurpleSrvResponse, size);
 		while (lst) {
 			if(query_data->cb)
-				memcpy(srvres_tmp++, lst->data, sizeof(GaimSrvResponse));
+				memcpy(srvres_tmp++, lst->data, sizeof(PurpleSrvResponse));
 			g_free(lst->data);
 			lst = g_slist_remove(lst, lst->data);
 		}
@@ -236,7 +236,7 @@
 		query_data->results = NULL;
 	}
 
-	gaim_debug_info("dnssrv", "found %d SRV entries\n", size);
+	purple_debug_info("dnssrv", "found %d SRV entries\n", size);
 
 	if(query_data->cb)
 		query_data->cb(srvres, size, query_data->extradata);
@@ -244,7 +244,7 @@
 	query_data->resolver = NULL;
 	query_data->handle = 0;
 
-	gaim_srv_cancel(query_data);
+	purple_srv_cancel(query_data);
 
 	return FALSE;
 }
@@ -255,7 +255,7 @@
 	PDNS_RECORD dr = NULL;
 	int type = DNS_TYPE_SRV;
 	DNS_STATUS ds;
-	GaimSrvQueryData *query_data = data;
+	PurpleSrvQueryData *query_data = data;
 
 	ds = MyDnsQuery_UTF8(query_data->query, type, DNS_QUERY_STANDARD, NULL, &dr, NULL);
 	if (ds != ERROR_SUCCESS) {
@@ -266,7 +266,7 @@
 		PDNS_RECORD dr_tmp;
 		GSList *lst = NULL;
 		DNS_SRV_DATA *srv_data;
-		GaimSrvResponse *srvres;
+		PurpleSrvResponse *srvres;
 
 		for (dr_tmp = dr; dr_tmp != NULL; dr_tmp = dr_tmp->pNext) {
 			/* Discard any incorrect entries. I'm not sure if this is necessary */
@@ -275,7 +275,7 @@
 			}
 
 			srv_data = &dr_tmp->Data.SRV;
-			srvres = g_new0(GaimSrvResponse, 1);
+			srvres = g_new0(PurpleSrvResponse, 1);
 			strncpy(srvres->hostname, srv_data->pNameTarget, 255);
 			srvres->hostname[255] = '\0';
 			srvres->pref = srv_data->wPriority;
@@ -299,11 +299,11 @@
 
 #endif
 
-GaimSrvQueryData *
-gaim_srv_resolve(const char *protocol, const char *transport, const char *domain, GaimSrvCallback cb, gpointer extradata)
+PurpleSrvQueryData *
+purple_srv_resolve(const char *protocol, const char *transport, const char *domain, PurpleSrvCallback cb, gpointer extradata)
 {
 	char *query;
-	GaimSrvQueryData *query_data;
+	PurpleSrvQueryData *query_data;
 #ifndef _WIN32
 	int in[2], out[2];
 	int pid;
@@ -313,11 +313,11 @@
 #endif
 
 	query = g_strdup_printf("_%s._%s.%s", protocol, transport, domain);
-	gaim_debug_info("dnssrv","querying SRV record for %s\n", query);
+	purple_debug_info("dnssrv","querying SRV record for %s\n", query);
 
 #ifndef _WIN32
 	if(pipe(in) || pipe(out)) {
-		gaim_debug_error("dnssrv", "Could not create pipe\n");
+		purple_debug_error("dnssrv", "Could not create pipe\n");
 		g_free(query);
 		cb(NULL, 0, extradata);
 		return NULL;
@@ -325,7 +325,7 @@
 
 	pid = fork();
 	if (pid == -1) {
-		gaim_debug_error("dnssrv", "Could not create process!\n");
+		purple_debug_error("dnssrv", "Could not create process!\n");
 		cb(NULL, 0, extradata);
 		g_free(query);
 		return NULL;
@@ -343,26 +343,26 @@
 	close(in[0]);
 
 	if (write(in[1], query, strlen(query)+1) < 0)
-		gaim_debug_error("dnssrv", "Could not write to SRV resolver\n");
+		purple_debug_error("dnssrv", "Could not write to SRV resolver\n");
 
-	query_data = g_new0(GaimSrvQueryData, 1);
+	query_data = g_new0(PurpleSrvQueryData, 1);
 	query_data->cb = cb;
 	query_data->extradata = extradata;
 	query_data->pid = pid;
-	query_data->handle = gaim_input_add(out[0], GAIM_INPUT_READ, resolved, query_data);
+	query_data->handle = purple_input_add(out[0], PURPLE_INPUT_READ, resolved, query_data);
 
 	g_free(query);
 
 	return query_data;
 #else
 	if (!initialized) {
-		MyDnsQuery_UTF8 = (void*) wgaim_find_and_loadproc("dnsapi.dll", "DnsQuery_UTF8");
-		MyDnsRecordListFree = (void*) wgaim_find_and_loadproc(
+		MyDnsQuery_UTF8 = (void*) wpurple_find_and_loadproc("dnsapi.dll", "DnsQuery_UTF8");
+		MyDnsRecordListFree = (void*) wpurple_find_and_loadproc(
 			"dnsapi.dll", "DnsRecordListFree");
 		initialized = TRUE;
 	}
 
-	query_data = g_new0(GaimSrvQueryData, 1);
+	query_data = g_new0(PurpleSrvQueryData, 1);
 	query_data->cb = cb;
 	query_data->query = query;
 	query_data->extradata = extradata;
@@ -395,10 +395,10 @@
 }
 
 void
-gaim_srv_cancel(GaimSrvQueryData *query_data)
+purple_srv_cancel(PurpleSrvQueryData *query_data)
 {
 	if (query_data->handle > 0)
-		gaim_input_remove(query_data->handle);
+		purple_input_remove(query_data->handle);
 #ifdef _WIN32
 	if (query_data->resolver != NULL)
 	{