Mercurial > pidgin
comparison src/dnssrv.c @ 12451:933fda51587e
[gaim-migrate @ 14760]
This works for me. KingAnt, can you see if this works on w2k.
committer: Tailor Script <tailor@pidgin.im>
author | Daniel Atallah <daniel.atallah@gmail.com> |
---|---|
date | Sun, 11 Dec 2005 21:06:15 +0000 |
parents | 97167ff86683 |
children | 17a85606bcc8 |
comparison
equal
deleted
inserted
replaced
12450:a25babbba950 | 12451:933fda51587e |
---|---|
223 | 223 |
224 return FALSE; | 224 return FALSE; |
225 } | 225 } |
226 | 226 |
227 static gpointer res_thread(gpointer data) { | 227 static gpointer res_thread(gpointer data) { |
228 PDNS_RECORD *dr = NULL; | 228 PDNS_RECORD dr = NULL; |
229 GSList *lst = NULL; | |
230 struct srv_response *srvres; | |
231 DNS_SRV_DATA *srv_data; | |
232 int type = DNS_TYPE_SRV; | 229 int type = DNS_TYPE_SRV; |
233 DNS_STATUS ds; | 230 DNS_STATUS ds; |
234 struct resdata *rdata = data; | 231 struct resdata *rdata = data; |
235 | 232 |
236 ds = MyDnsQuery_UTF8(rdata->query, type, DNS_QUERY_STANDARD, NULL, dr, NULL); | 233 ds = MyDnsQuery_UTF8(rdata->query, type, DNS_QUERY_STANDARD, NULL, &dr, NULL); |
237 if (ds != ERROR_SUCCESS) { | 234 if (ds != ERROR_SUCCESS) { |
238 rdata->errmsg = g_strdup_printf("Couldn't look up SRV record. Error = %d\n", (int) ds); | 235 rdata->errmsg = g_strdup_printf("Couldn't look up SRV record. Error = %d\n", (int) ds); |
239 } else { | 236 } else { |
240 DNS_RECORD *dr_tmp = *dr; | 237 PDNS_RECORD dr_tmp; |
241 while (dr_tmp != NULL) { | 238 GSList *lst = NULL; |
239 DNS_SRV_DATA *srv_data; | |
240 struct srv_response *srvres; | |
241 | |
242 for (dr_tmp = dr; dr_tmp != NULL; dr_tmp = dr_tmp->pNext) { | |
242 /* Discard any incorrect entries. I'm not sure if this is necessary */ | 243 /* Discard any incorrect entries. I'm not sure if this is necessary */ |
243 if (dr_tmp->wType != type || strcmp(dr_tmp->pName, rdata->query) != 0) { | 244 if (dr_tmp->wType != type || strcmp(dr_tmp->pName, rdata->query) != 0) { |
244 dr_tmp = dr_tmp->pNext; | |
245 continue; | 245 continue; |
246 } | 246 } |
247 | 247 |
248 srv_data = &dr_tmp->Data.SRV; | 248 srv_data = &dr_tmp->Data.SRV; |
249 srvres = g_new0(struct srv_response, 1); | 249 srvres = g_new0(struct srv_response, 1); |
252 srvres->pref = srv_data->wPriority; | 252 srvres->pref = srv_data->wPriority; |
253 srvres->port = srv_data->wPort; | 253 srvres->port = srv_data->wPort; |
254 srvres->weight = srv_data->wWeight; | 254 srvres->weight = srv_data->wWeight; |
255 | 255 |
256 lst = g_slist_insert_sorted(lst, srvres, responsecompare); | 256 lst = g_slist_insert_sorted(lst, srvres, responsecompare); |
257 | |
258 dr_tmp = dr_tmp->pNext; | |
259 } | 257 } |
260 | 258 |
261 MyDnsRecordListFree(*dr, DnsFreeRecordList); | 259 MyDnsRecordListFree(dr, DnsFreeRecordList); |
262 rdata->results = lst; | 260 rdata->results = lst; |
263 } | 261 } |
264 | 262 |
265 /* back to main thread */ | 263 /* back to main thread */ |
266 g_idle_add(res_main_thread_cb, rdata); | 264 g_idle_add(res_main_thread_cb, rdata); |