Mercurial > pidgin.yaz
changeset 32477:efe38e6319f2
Clean up SRV/TXT query functions.
* Rename _account functions to their regular form.
* Remove the unnecessary _cancel functions.
author | Elliott Sales de Andrade <qulogic@pidgin.im> |
---|---|
date | Fri, 02 Sep 2011 03:18:15 +0000 |
parents | ba74745ff179 |
children | 91e8402106c1 |
files | ChangeLog.API libpurple/dnssrv.c libpurple/dnssrv.h libpurple/protocols/jabber/disco.c libpurple/protocols/jabber/jabber.c libpurple/protocols/simple/simple.c libpurple/stun.c |
diffstat | 7 files changed, 36 insertions(+), 102 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog.API Fri Sep 02 02:42:39 2011 +0000 +++ b/ChangeLog.API Fri Sep 02 03:18:15 2011 +0000 @@ -62,6 +62,8 @@ * PurpleConnectionUiOps.report_disconnect now passes a PurpleConnectionError as the second parameter * purple_dnsquery_a now takes a PurpleAccount as the first parameter + * purple_srv_resolve now takes a PurpleAccount as the first parameter + * purple_txt_resolve now takes a PurpleAccount as the first parameter Removed: * _GntFileType @@ -104,10 +106,14 @@ * purple_notify_searchresults_get_columns_count * purple_notify_searchresults_get_rows_count * purple_notify_searchresults_row_get + * purple_srv_cancel + * purple_srv_resolve_account * purple_status_type_get_primary_attr * purple_status_type_set_primary_attr * purple_strlcat * purple_strlcpy + * purple_txt_cancel + * purple_txt_resolve_account * purple_util_fetch_url_request_len_with_account. Use purple_util_fetch_url_request_len, instead. * PurpleConnectionUiOps.report_disconnect_reason
--- a/libpurple/dnssrv.c Fri Sep 02 02:42:39 2011 +0000 +++ b/libpurple/dnssrv.c Fri Sep 02 03:18:15 2011 +0000 @@ -725,15 +725,7 @@ #endif PurpleSrvTxtQueryData * -purple_srv_resolve(const char *protocol, const char *transport, - const char *domain, PurpleSrvCallback cb, gpointer extradata) -{ - return purple_srv_resolve_account(NULL, protocol, transport, domain, - cb, extradata); -} - -PurpleSrvTxtQueryData * -purple_srv_resolve_account(PurpleAccount *account, const char *protocol, +purple_srv_resolve(PurpleAccount *account, const char *protocol, const char *transport, const char *domain, PurpleSrvCallback cb, gpointer extradata) { @@ -869,13 +861,7 @@ #endif } -PurpleSrvTxtQueryData *purple_txt_resolve(const char *owner, - const char *domain, PurpleTxtCallback cb, gpointer extradata) -{ - return purple_txt_resolve_account(NULL, owner, domain, cb, extradata); -} - -PurpleSrvTxtQueryData *purple_txt_resolve_account(PurpleAccount *account, +PurpleSrvTxtQueryData *purple_txt_resolve(PurpleAccount *account, const char *owner, const char *domain, PurpleTxtCallback cb, gpointer extradata) { @@ -1006,18 +992,6 @@ #endif } -void -purple_txt_cancel(PurpleSrvTxtQueryData *query_data) -{ - purple_srv_txt_query_destroy(query_data); -} - -void -purple_srv_cancel(PurpleSrvTxtQueryData *query_data) -{ - purple_srv_txt_query_destroy(query_data); -} - const gchar * purple_txt_response_get_content(PurpleTxtResponse *resp) {
--- a/libpurple/dnssrv.h Fri Sep 02 02:42:39 2011 +0000 +++ b/libpurple/dnssrv.h Fri Sep 02 03:18:15 2011 +0000 @@ -99,86 +99,40 @@ /** * Queries an SRV record. * - * @param account the account that the query is being done for (or NULL) - * @param protocol Name of the protocol (e.g. "sip") + * @param account The account that the query is being done for (or NULL) + * @param protocol Name of the protocol (e.g. "sip") * @param transport Name of the transport ("tcp" or "udp") - * @param domain Domain name to query (e.g. "blubb.com") - * @param cb A callback which will be called with the results + * @param domain Domain name to query (e.g. "blubb.com") + * @param cb A callback which will be called with the results * @param extradata Extra data to be passed to the callback * - * @since 2.8.0 + * @return NULL if there was an error, otherwise return a reference to + * a data structure that can be used to cancel the pending + * DNS query, if needed. */ -PurpleSrvTxtQueryData *purple_srv_resolve_account(PurpleAccount *account, const char *protocol, const char *transport, const char *domain, PurpleSrvCallback cb, gpointer extradata); - -#if !(defined PURPLE_DISABLE_DEPRECATED) || (defined _PURPLE_DNSSRV_C_) -/** - * Queries an SRV record. - * - * @param protocol Name of the protocol (e.g. "sip") - * @param transport Name of the transport ("tcp" or "udp") - * @param domain Domain name to query (e.g. "blubb.com") - * @param cb A callback which will be called with the results - * @param extradata Extra data to be passed to the callback - * - * @deprecated Use purple_srv_resolve_account instead - */ -PurpleSrvTxtQueryData *purple_srv_resolve(const char *protocol, const char *transport, const char *domain, PurpleSrvCallback cb, gpointer extradata); -#endif - -/** - * Cancel an SRV or DNS query. - * - * @param query_data The request to cancel. - * - * @deprecated Use purple_srv_txt_query_destroy instead - */ -void purple_srv_cancel(PurpleSrvTxtQueryData *query_data); +PurpleSrvTxtQueryData *purple_srv_resolve(PurpleAccount *account, const char *protocol, const char *transport, const char *domain, PurpleSrvCallback cb, gpointer extradata); /** * Queries an TXT record. * - * @param account the account that the query is being done for (or NULL) - * @param owner Name of the protocol (e.g. "_xmppconnect") - * @param domain Domain name to query (e.g. "blubb.com") - * @param cb A callback which will be called with the results + * @param account The account that the query is being done for (or NULL) + * @param owner Name of the protocol (e.g. "_xmppconnect") + * @param domain Domain name to query (e.g. "blubb.com") + * @param cb A callback which will be called with the results * @param extradata Extra data to be passed to the callback * - * @since 2.8.0 + * @return NULL if there was an error, otherwise return a reference to + * a data structure that can be used to cancel the pending + * DNS query, if needed. */ -PurpleSrvTxtQueryData *purple_txt_resolve_account(PurpleAccount *account, const char *owner, const char *domain, PurpleTxtCallback cb, gpointer extradata); - -#if !(defined PURPLE_DISABLE_DEPRECATED) || (defined _PURPLE_DNSSRV_C_) -/** - * Queries an TXT record. - * - * @param owner Name of the protocol (e.g. "_xmppconnect") - * @param domain Domain name to query (e.g. "blubb.com") - * @param cb A callback which will be called with the results - * @param extradata Extra data to be passed to the callback - * - * @deprecated Use purple_txt_resolve_account instead - * - * @since 2.6.0 - */ -PurpleSrvTxtQueryData *purple_txt_resolve(const char *owner, const char *domain, PurpleTxtCallback cb, gpointer extradata); -#endif - -/** - * Cancel an TXT DNS query. - * - * @param query_data The request to cancel. - * @since 2.6.0 - * - * @deprecated Use purple_srv_txt_query_destroy instead - */ -void purple_txt_cancel(PurpleSrvTxtQueryData *query_data); +PurpleSrvTxtQueryData *purple_txt_resolve(PurpleAccount *account, const char *owner, const char *domain, PurpleTxtCallback cb, gpointer extradata); /** * Get the value of the current TXT record. * * @param response The TXT response record - * @returns The value of the current TXT record. - * @since 2.6.0 + * + * @return The value of the current TXT record. */ const gchar *purple_txt_response_get_content(PurpleTxtResponse *response); @@ -186,7 +140,6 @@ * Destroy a TXT DNS response object. * * @param response The PurpleTxtResponse to destroy. - * @since 2.6.0 */ void purple_txt_response_destroy(PurpleTxtResponse *response); @@ -216,7 +169,7 @@ PurpleSrvTxtQueryUiOps *purple_srv_txt_query_get_ui_ops(void); /** - * Get the query from a PurpleDnsQueryData + * Get the query from a PurpleSrvTxtQueryData * * @param query_data The SRV/TXT query * @return The query. @@ -224,7 +177,7 @@ char *purple_srv_txt_query_get_query(PurpleSrvTxtQueryData *query_data); /** - * Get the type from a PurpleDnsQueryData (TXT or SRV) + * Get the type from a PurpleSrvTxtQueryData (TXT or SRV) * * @param query_data The query * @return The query. @@ -236,3 +189,4 @@ #endif #endif /* _PURPLE_DNSSRV_H */ +
--- a/libpurple/protocols/jabber/disco.c Fri Sep 02 02:42:39 2011 +0000 +++ b/libpurple/protocols/jabber/disco.c Fri Sep 02 03:18:15 2011 +0000 @@ -550,7 +550,7 @@ } else if (purple_network_get_stun_ip() == NULL || purple_strequal(purple_network_get_stun_ip(), "")) { js->srv_query_data = - purple_srv_resolve_account( + purple_srv_resolve( purple_connection_get_account(js->gc), "stun", "udp", js->user->domain, jabber_disco_stun_srv_resolve_cb, js);
--- a/libpurple/protocols/jabber/jabber.c Fri Sep 02 02:42:39 2011 +0000 +++ b/libpurple/protocols/jabber/jabber.c Fri Sep 02 03:18:15 2011 +0000 @@ -813,7 +813,7 @@ try_srv_connect(js); } else { purple_debug_info("jabber","Couldn't connect directly to %s. Trying to find alternative connection methods, like BOSH.\n", js->user->domain); - js->srv_query_data = purple_txt_resolve_account( + js->srv_query_data = purple_txt_resolve( purple_connection_get_account(gc), "_xmppconnect", js->user->domain, txt_resolved_cb, js); } @@ -1074,7 +1074,7 @@ jabber_login_connect(js, js->user->domain, connect_server, purple_account_get_int(account, "port", 5222), TRUE); } else { - js->srv_query_data = purple_srv_resolve_account(account, "xmpp-client", + js->srv_query_data = purple_srv_resolve(account, "xmpp-client", "tcp", js->user->domain, srv_resolved_cb, js); } } @@ -1599,7 +1599,7 @@ jabber_send_raw(js, "</stream:stream>", -1); if (js->srv_query_data) - purple_srv_cancel(js->srv_query_data); + purple_srv_txt_query_destroy(js->srv_query_data); if(js->gsc) { purple_ssl_close(js->gsc);
--- a/libpurple/protocols/simple/simple.c Fri Sep 02 02:42:39 2011 +0000 +++ b/libpurple/protocols/simple/simple.c Fri Sep 02 03:18:15 2011 +0000 @@ -1970,7 +1970,7 @@ hosttoconnect = purple_account_get_string(account, "proxy", sip->servername); } - sip->srv_query_data = purple_srv_resolve_account(account, "sip", + sip->srv_query_data = purple_srv_resolve(account, "sip", sip->udp ? "udp" : "tcp", hosttoconnect, srvresolved, sip); } @@ -2007,7 +2007,7 @@ purple_dnsquery_destroy(sip->query_data); if (sip->srv_query_data != NULL) - purple_srv_cancel(sip->srv_query_data); + purple_srv_txt_query_destroy(sip->srv_query_data); if (sip->listen_data != NULL) purple_network_listen_cancel(sip->listen_data);
--- a/libpurple/stun.c Fri Sep 02 02:42:39 2011 +0000 +++ b/libpurple/stun.c Fri Sep 02 03:18:15 2011 +0000 @@ -424,7 +424,7 @@ nattype.servername = g_strdup(servername); callbacks = g_slist_append(callbacks, cb); - purple_srv_resolve_account(NULL, "stun", "udp", servername, do_test1, + purple_srv_resolve(NULL, "stun", "udp", servername, do_test1, (gpointer) servername); return &nattype;