Mercurial > pidgin.yaz
comparison libpurple/dnssrv.c @ 25594:3c3480683075
* fixing some bugs, finishing support for TXT queries
author | Tobias Markmann <tfar@soc.pidgin.im> |
---|---|
date | Fri, 01 Aug 2008 22:37:51 +0000 |
parents | affaa4c4836e |
children | 94c8bef52c66 |
comparison
equal
deleted
inserted
replaced
25593:affaa4c4836e | 25594:3c3480683075 |
---|---|
196 } | 196 } |
197 | 197 |
198 end: | 198 end: |
199 size = g_list_length(ret); | 199 size = g_list_length(ret); |
200 write(out, &(query.type), sizeof(query.type)); | 200 write(out, &(query.type), sizeof(query.type)); |
201 write(out, &size, sizeof(int)); | 201 write(out, &size, sizeof(size)); |
202 while (ret != NULL) | 202 while (ret != NULL) |
203 { | 203 { |
204 if (query.type == T_SRV) write(out, ret->data, sizeof(PurpleSrvResponse)); | 204 if (query.type == T_SRV) write(out, ret->data, sizeof(PurpleSrvResponse)); |
205 if (query.type == T_TXT) write(out, ret->data, sizeof(PurpleTxtResponse)); | 205 if (query.type == T_TXT) write(out, ret->data, sizeof(PurpleTxtResponse)); |
206 g_free(ret->data); | 206 g_free(ret->data); |
221 PurpleSrvQueryData *query_data = (PurpleSrvQueryData*)data; | 221 PurpleSrvQueryData *query_data = (PurpleSrvQueryData*)data; |
222 int i; | 222 int i; |
223 int status; | 223 int status; |
224 | 224 |
225 if (read(source, &type, sizeof(type)) == sizeof(type)) { | 225 if (read(source, &type, sizeof(type)) == sizeof(type)) { |
226 purple_debug_info("dnssrv","type: %d\n", type); | |
227 if (type == T_SRV) { | 226 if (type == T_SRV) { |
228 PurpleSrvResponse *res; | 227 PurpleSrvResponse *res; |
229 PurpleSrvResponse *tmp; | 228 PurpleSrvResponse *tmp; |
230 PurpleSrvCallback cb = query_data->srv_cb; | 229 PurpleSrvCallback cb = query_data->srv_cb; |
231 if (read(source, &size, sizeof(int)) == sizeof(int)) { | 230 if (read(source, &size, sizeof(int)) == sizeof(int)) { |
509 | 508 |
510 PurpleSrvQueryData *purple_txt_resolve(const char *owner, const char *domain, PurpleTxtCallback cb, gpointer extradata) | 509 PurpleSrvQueryData *purple_txt_resolve(const char *owner, const char *domain, PurpleTxtCallback cb, gpointer extradata) |
511 { | 510 { |
512 char *query; | 511 char *query; |
513 PurpleSrvQueryData *query_data; | 512 PurpleSrvQueryData *query_data; |
513 PurpleSrvInternalQuery internal_query; | |
514 #ifndef _WIN32 | 514 #ifndef _WIN32 |
515 int in[2], out[2]; | 515 int in[2], out[2]; |
516 int pid; | 516 int pid; |
517 #else | 517 #else |
518 GError* err = NULL; | 518 GError* err = NULL; |
550 } | 550 } |
551 | 551 |
552 close(out[1]); | 552 close(out[1]); |
553 close(in[0]); | 553 close(in[0]); |
554 | 554 |
555 if (write(in[1], query, strlen(query)+1) < 0) | 555 internal_query.type = T_TXT; |
556 strncpy(internal_query.query, query, 255); | |
557 | |
558 if (write(in[1], &internal_query, sizeof(internal_query)) < 0) | |
556 purple_debug_error("dnssrv", "Could not write to TXT resolver\n"); | 559 purple_debug_error("dnssrv", "Could not write to TXT resolver\n"); |
557 | 560 |
558 query_data = g_new0(PurpleSrvQueryData, 1); | 561 query_data = g_new0(PurpleSrvQueryData, 1); |
559 query_data->type = T_TXT; | 562 query_data->type = T_TXT; |
560 query_data->txt_cb = cb; | 563 query_data->txt_cb = cb; |