comparison libpurple/dnssrv.c @ 27294:862b8208a546

Strip trailing whitespace and spaces to tab
author Mark Doliner <mark@kingant.net>
date Mon, 29 Jun 2009 05:02:24 +0000
parents c162a088489f
children 3e516701dd33
comparison
equal deleted inserted replaced
27293:bd85e78518b7 27294:862b8208a546
64 static void (WINAPI *MyDnsRecordListFree) (PDNS_RECORD pRecordList, 64 static void (WINAPI *MyDnsRecordListFree) (PDNS_RECORD pRecordList,
65 DNS_FREE_TYPE FreeType) = NULL; 65 DNS_FREE_TYPE FreeType) = NULL;
66 #endif 66 #endif
67 67
68 struct _PurpleTxtResponse { 68 struct _PurpleTxtResponse {
69 char *content; 69 char *content;
70 }; 70 };
71 71
72 struct _PurpleSrvQueryData { 72 struct _PurpleSrvQueryData {
73 union { 73 union {
74 PurpleSrvCallback srv; 74 PurpleSrvCallback srv;
333 } 333 }
334 334
335 query_data->results = NULL; 335 query_data->results = NULL;
336 336
337 purple_debug_info("dnssrv", "found %d SRV entries\n", size); 337 purple_debug_info("dnssrv", "found %d SRV entries\n", size);
338 338
339 if(query_data->cb.srv) query_data->cb.srv(srvres, size, query_data->extradata); 339 if(query_data->cb.srv) query_data->cb.srv(srvres, size, query_data->extradata);
340 } else if (query_data->type == DNS_TYPE_TXT) { 340 } else if (query_data->type == DNS_TYPE_TXT) {
341 GSList *lst = query_data->results; 341 GSList *lst = query_data->results;
342 342
343 purple_debug_info("dnssrv", "found %d TXT entries\n", g_slist_length(lst)); 343 purple_debug_info("dnssrv", "found %d TXT entries\n", g_slist_length(lst));
344 344
345 if (query_data->cb.txt) { 345 if (query_data->cb.txt) {
346 query_data->results = NULL; 346 query_data->results = NULL;
347 query_data->cb.txt(lst, query_data->extradata); 347 query_data->cb.txt(lst, query_data->extradata);
348 } 348 }
349 } else { 349 } else {
380 if (type == DNS_TYPE_SRV) { 380 if (type == DNS_TYPE_SRV) {
381 PDNS_RECORD dr_tmp; 381 PDNS_RECORD dr_tmp;
382 GSList *lst = NULL; 382 GSList *lst = NULL;
383 DNS_SRV_DATA *srv_data; 383 DNS_SRV_DATA *srv_data;
384 PurpleSrvResponse *srvres; 384 PurpleSrvResponse *srvres;
385 385
386 for (dr_tmp = dr; dr_tmp != NULL; dr_tmp = dr_tmp->pNext) { 386 for (dr_tmp = dr; dr_tmp != NULL; dr_tmp = dr_tmp->pNext) {
387 /* Discard any incorrect entries. I'm not sure if this is necessary */ 387 /* Discard any incorrect entries. I'm not sure if this is necessary */
388 if (dr_tmp->wType != type || strcmp(dr_tmp->pName, query_data->query) != 0) { 388 if (dr_tmp->wType != type || strcmp(dr_tmp->pName, query_data->query) != 0) {
389 continue; 389 continue;
390 } 390 }
394 strncpy(srvres->hostname, srv_data->pNameTarget, 255); 394 strncpy(srvres->hostname, srv_data->pNameTarget, 255);
395 srvres->hostname[255] = '\0'; 395 srvres->hostname[255] = '\0';
396 srvres->pref = srv_data->wPriority; 396 srvres->pref = srv_data->wPriority;
397 srvres->port = srv_data->wPort; 397 srvres->port = srv_data->wPort;
398 srvres->weight = srv_data->wWeight; 398 srvres->weight = srv_data->wWeight;
399 399
400 lst = g_slist_insert_sorted(lst, srvres, responsecompare); 400 lst = g_slist_insert_sorted(lst, srvres, responsecompare);
401 } 401 }
402 402
403 MyDnsRecordListFree(dr, DnsFreeRecordList); 403 MyDnsRecordListFree(dr, DnsFreeRecordList);
404 query_data->results = lst; 404 query_data->results = lst;
429 } 429 }
430 430
431 MyDnsRecordListFree(dr, DnsFreeRecordList); 431 MyDnsRecordListFree(dr, DnsFreeRecordList);
432 query_data->results = lst; 432 query_data->results = lst;
433 } else { 433 } else {
434 434
435 } 435 }
436 } 436 }
437 437
438 /* back to main thread */ 438 /* back to main thread */
439 /* Note: this should *not* be attached to query_data->handle - it will cause leakage */ 439 /* Note: this should *not* be attached to query_data->handle - it will cause leakage */
498 close(out[1]); 498 close(out[1]);
499 close(in[0]); 499 close(in[0]);
500 500
501 internal_query.type = T_SRV; 501 internal_query.type = T_SRV;
502 strncpy(internal_query.query, query, 255); 502 strncpy(internal_query.query, query, 255);
503 503
504 if (write(in[1], &internal_query, sizeof(internal_query)) < 0) 504 if (write(in[1], &internal_query, sizeof(internal_query)) < 0)
505 purple_debug_error("dnssrv", "Could not write to SRV resolver\n"); 505 purple_debug_error("dnssrv", "Could not write to SRV resolver\n");
506
507 506
508 query_data = g_new0(PurpleSrvQueryData, 1); 507 query_data = g_new0(PurpleSrvQueryData, 1);
509 query_data->type = T_SRV; 508 query_data->type = T_SRV;
510 query_data->cb.srv = cb; 509 query_data->cb.srv = cb;
511 query_data->extradata = extradata; 510 query_data->extradata = extradata;
594 /* resolve() does not return */ 593 /* resolve() does not return */
595 } 594 }
596 595
597 close(out[1]); 596 close(out[1]);
598 close(in[0]); 597 close(in[0]);
599 598
600 internal_query.type = T_TXT; 599 internal_query.type = T_TXT;
601 strncpy(internal_query.query, query, 255); 600 strncpy(internal_query.query, query, 255);
602 601
603 if (write(in[1], &internal_query, sizeof(internal_query)) < 0) 602 if (write(in[1], &internal_query, sizeof(internal_query)) < 0)
604 purple_debug_error("dnssrv", "Could not write to TXT resolver\n"); 603 purple_debug_error("dnssrv", "Could not write to TXT resolver\n");
605 604
606 query_data = g_new0(PurpleSrvQueryData, 1); 605 query_data = g_new0(PurpleSrvQueryData, 1);
607 query_data->type = T_TXT; 606 query_data->type = T_TXT;