Mercurial > pidgin.yaz
changeset 11382:bdeace860555
[gaim-migrate @ 13609]
make SRV lookup useful for real life usage
committer: Tailor Script <tailor@pidgin.im>
author | Thomas Butter <tbutter> |
---|---|
date | Wed, 31 Aug 2005 09:14:11 +0000 |
parents | e0f42900de12 |
children | b4cf724b64f8 |
files | src/dnssrv.c src/dnssrv.h |
diffstat | 2 files changed, 10 insertions(+), 8 deletions(-) [+] |
line wrap: on
line diff
--- a/src/dnssrv.c Wed Aug 31 04:09:04 2005 +0000 +++ b/src/dnssrv.c Wed Aug 31 09:14:11 2005 +0000 @@ -52,6 +52,7 @@ struct resdata { SRVCallback cb; + gpointer extradata; #ifndef _WIN32 guint handle; #else @@ -176,7 +177,7 @@ read(source, tmp++, sizeof(struct srv_response)); size--; } - cb(res, size); + cb(res, size, rdata->extradata); gaim_input_remove(rdata->handle); g_free(rdata); } @@ -211,7 +212,7 @@ rdata->results = lst; } - rdata->cb(srvres, size); + rdata->cb(srvres, size, rdata->extradata); g_free(rdata->query); g_free(rdata); @@ -265,7 +266,7 @@ #endif -void gaim_srv_resolve(char *protocol, char *transport, char *domain, SRVCallback cb) { +void gaim_srv_resolve(char *protocol, char *transport, char *domain, SRVCallback cb, gpointer extradata) { char *query = g_strdup_printf("_%s._%s.%s",protocol, transport, domain); struct resdata *rdata; #ifndef _WIN32 @@ -275,7 +276,7 @@ if(pipe(in) || pipe(out)) { gaim_debug_error("srv", "Could not create pipe\n"); g_free(query); - cb(NULL, 0); + cb(NULL, 0, extradata); return; } @@ -283,7 +284,7 @@ if(pid == -1) { gaim_debug_error("srv","Could not create process!\n"); - cb(NULL, 0); + cb(NULL, 0, extradata); g_free(query); return; } @@ -302,6 +303,7 @@ } rdata = g_new0(struct resdata,1); rdata->cb = cb; + rdata->extradata = extradata; rdata->handle = gaim_input_add(out[0], GAIM_INPUT_READ, resolved, rdata); g_free(query); @@ -328,7 +330,7 @@ if (!MyDnsQuery_UTF || !MyDnsRecordListFree) { gaim_debug_error("srv", "System missing DNS API (Requires W2K+)\n"); g_free(query); - cb(NULL, 0); + cb(NULL, 0, extradata); return; }
--- a/src/dnssrv.h Wed Aug 31 04:09:04 2005 +0000 +++ b/src/dnssrv.h Wed Aug 31 09:14:11 2005 +0000 @@ -30,7 +30,7 @@ int pref; }; -typedef void (*SRVCallback)(struct srv_response *resp, int results); +typedef void (*SRVCallback)(struct srv_response *resp, int results, gpointer data); /** * Queries an SRV record. @@ -40,6 +40,6 @@ * @param domain Domainname to query (e.g. "blubb.com") * @cb A callback which will be called with the results */ -void gaim_srv_resolve(char *protocol, char *transport, char *domain, SRVCallback cb); +void gaim_srv_resolve(char *protocol, char *transport, char *domain, SRVCallback cb, gpointer extradata); #endif /* _GAIM_DNSSRV_H */