Mercurial > pidgin
changeset 32224:9d5b87e1a4d0
merge of '246ce23ba85b41bf89269edfa8ec16583ad89fb3'
and '7b2b39f29c663a3b1ad776bae1361dcfe6c4db16'
author | andrew.victor@mxit.com |
---|---|
date | Sat, 24 Sep 2011 22:21:48 +0000 |
parents | 459ffa11348e (current diff) 4c64383f05cc (diff) |
children | 02a2e8183b1d |
files | |
diffstat | 39 files changed, 130 insertions(+), 214 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog.API Sat Sep 24 21:19:26 2011 +0000 +++ b/ChangeLog.API Sat Sep 24 22:21:48 2011 +0000 @@ -53,27 +53,32 @@ * xmlnode_strip_prefixes Changed: + * purple_account_add_buddy now takes an invite message as the last + parameter + * purple_account_add_buddies now takes an invite message as the last + parameter * purple_certificate_check_signature_chain_with_failing renamed to purple_certificate_check_signature_chain * purple_connection_error now takes a PurpleConnectionError as the second parameter + * purple_dnsquery_a now takes a PurpleAccount as the first parameter + * purple_network_listen_family renamed to purple_network_listen + * purple_network_listen_range_family renamed to + purple_network_listen_range * purple_notify_user_info_add_pair renamed to purple_notify_user_info_add_pair_html * purple_notify_user_info_get_entries returns a GQueue instead of a GList * purple_notify_user_info_prepend_pair renamed to purple_notify_user_info_prepend_pair_html + * purple_srv_resolve now takes a PurpleAccount as the first parameter + * purple_txt_resolve now takes a PurpleAccount as the first parameter * purple_util_fetch_url_request_len now takes a PurpleAccount as the first parameter + * purple_util_fetch_url_request_len renamed to purple_util_fetch_url_request + * purple_util_fetch_url_len renamed to purple_util_fetch_url * 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 - * purple_account_add_buddy now takes an invite message as the last - parameter - * purple_account_add_buddies now takes an invite message as the last - parameter Removed: * _GntFileType @@ -125,6 +130,7 @@ * purple_conv_chat_set_users * purple_core_migrate * purple_dnsquery_a_account + * purple_network_listen_map_external * purple_notify_searchresults_column_get_title * purple_notify_searchresults_get_columns_count * purple_notify_searchresults_get_rows_count
--- a/finch/plugins/gnttinyurl.c Sat Sep 24 21:19:26 2011 +0000 +++ b/finch/plugins/gnttinyurl.c Sat Sep 24 22:21:48 2011 +0000 @@ -319,7 +319,7 @@ url = g_strdup_printf("%s%s", purple_prefs_get_string(PREF_URL), purple_url_encode(tmp)); } g_free(tmp); - purple_util_fetch_url(url, TRUE, "finch", FALSE, url_fetched, cbdata); + purple_util_fetch_url(url, TRUE, "finch", FALSE, -1, url_fetched, cbdata); i = gnt_text_view_get_lines_below(tv); str = g_strdup_printf(_("\nFetching TinyURL...")); gnt_text_view_append_text_with_tag((tv), str, GNT_TEXT_FLAG_DIM, cbdata->tag); @@ -383,7 +383,7 @@ /* Store the return value of _fetch_url and destroy that when win is destroyed, so that the callback for _fetch_url does not try to molest a non-existent window */ - urlcb = purple_util_fetch_url(fullurl, TRUE, "finch", FALSE, tinyurl_notify_fetch_cb, win); + urlcb = purple_util_fetch_url(fullurl, TRUE, "finch", FALSE, -1, tinyurl_notify_fetch_cb, win); g_free(fullurl); g_signal_connect_swapped(G_OBJECT(win), "destroy", G_CALLBACK(purple_util_fetch_url_cancel), urlcb);
--- a/libpurple/network.c Sat Sep 24 21:19:26 2011 +0000 +++ b/libpurple/network.c Sat Sep 24 22:21:48 2011 +0000 @@ -391,14 +391,9 @@ return FALSE; } -static gboolean listen_map_external = TRUE; -void purple_network_listen_map_external(gboolean map_external) -{ - listen_map_external = map_external; -} - static PurpleNetworkListenData * -purple_network_do_listen(unsigned short port, int socket_family, int socket_type, PurpleNetworkListenCallback cb, gpointer cb_data) +purple_network_do_listen(unsigned short port, int socket_family, int socket_type, gboolean map_external, + PurpleNetworkListenCallback cb, gpointer cb_data) { int listenfd = -1; int flags; @@ -503,7 +498,7 @@ listen_data->cb_data = cb_data; listen_data->socket_type = socket_type; - if (!purple_socket_speaks_ipv4(listenfd) || !listen_map_external || + if (!purple_socket_speaks_ipv4(listenfd) || !map_external || !purple_prefs_get_bool("/purple/network/map_ports")) { purple_debug_info("network", "Skipping external port mapping.\n"); @@ -531,27 +526,19 @@ } PurpleNetworkListenData * -purple_network_listen_family(unsigned short port, int socket_family, - int socket_type, PurpleNetworkListenCallback cb, +purple_network_listen(unsigned short port, int socket_family, int socket_type, + gboolean map_external, PurpleNetworkListenCallback cb, gpointer cb_data) { g_return_val_if_fail(port != 0, NULL); - return purple_network_do_listen(port, socket_family, socket_type, + return purple_network_do_listen(port, socket_family, socket_type, map_external, cb, cb_data); } PurpleNetworkListenData * -purple_network_listen(unsigned short port, int socket_type, - PurpleNetworkListenCallback cb, gpointer cb_data) -{ - return purple_network_listen_family(port, AF_UNSPEC, socket_type, - cb, cb_data); -} - -PurpleNetworkListenData * -purple_network_listen_range_family(unsigned short start, unsigned short end, - int socket_family, int socket_type, +purple_network_listen_range(unsigned short start, unsigned short end, + int socket_family, int socket_type, gboolean map_external, PurpleNetworkListenCallback cb, gpointer cb_data) { @@ -566,7 +553,7 @@ } for (; start <= end; start++) { - ret = purple_network_do_listen(start, AF_UNSPEC, socket_type, cb, cb_data); + ret = purple_network_do_listen(start, AF_UNSPEC, socket_type, map_external, cb, cb_data); if (ret != NULL) break; } @@ -574,15 +561,6 @@ return ret; } -PurpleNetworkListenData * -purple_network_listen_range(unsigned short start, unsigned short end, - int socket_type, PurpleNetworkListenCallback cb, - gpointer cb_data) -{ - return purple_network_listen_range_family(start, end, AF_UNSPEC, - socket_type, cb, cb_data); -} - void purple_network_listen_cancel(PurpleNetworkListenData *listen_data) { if (listen_data->mapping_data != NULL)
--- a/libpurple/network.h Sat Sep 24 21:19:26 2011 +0000 +++ b/libpurple/network.h Sat Sep 24 22:21:48 2011 +0000 @@ -118,18 +118,6 @@ const char *purple_network_get_my_ip(int fd); /** - * Should calls to purple_network_listen() and purple_network_listen_range() - * map the port externally using NAT-PMP or UPnP? - * The default value is TRUE - * - * @param map_external Should the open port be mapped externally? - * @deprecated In 3.0.0 a boolean will be added to the functions mentioned - * above to perform the same function. - * @since 2.3.0 - */ -void purple_network_listen_map_external(gboolean map_external); - -/** * Attempts to open a listening port ONLY on the specified port number. * You probably want to use purple_network_listen_range() instead of this. * This function is useful, for example, if you wanted to write a telnet @@ -142,9 +130,22 @@ * close the listening socket, and add a new watcher on the new socket accept * returned. * + * Libpurple does not currently do any port mapping (stateful firewall hole + * poking) for IPv6-only listeners (if an IPv6 socket supports v4-mapped + * addresses, a mapping is done). + * * @param port The port number to bind to. Must be greater than 0. + * @param socket_family The protocol family of the socket. This should be + * AF_INET for IPv4 or AF_INET6 for IPv6. IPv6 sockets + * may or may not be able to accept IPv4 connections + * based on the system configuration (use + * purple_socket_speaks_ipv4 to check). If an IPv6 + * socket doesn't accept V4-mapped addresses, you will + * need a second listener to support both v4 and v6. * @param socket_type The type of socket to open for listening. * This will be either SOCK_STREAM for TCP or SOCK_DGRAM for UDP. + * @param map_external Should the open port be mapped externally using + * NAT-PNP or UPnP? (default should be TRUE) * @param cb The callback to be invoked when the port to listen on is available. * The file descriptor of the listening socket will be specified in * this callback, or -1 if no socket could be established. @@ -155,28 +156,8 @@ * socket to listen on. */ PurpleNetworkListenData *purple_network_listen(unsigned short port, - int socket_type, PurpleNetworkListenCallback cb, gpointer cb_data); - -/** - * \copydoc purple_network_listen - * - * Libpurple does not currently do any port mapping (stateful firewall hole - * poking) for IPv6-only listeners (if an IPv6 socket supports v4-mapped - * addresses, a mapping is done). - * - * @param socket_family The protocol family of the socket. This should be - * AF_INET for IPv4 or AF_INET6 for IPv6. IPv6 sockets - * may or may not be able to accept IPv4 connections - * based on the system configuration (use - * purple_socket_speaks_ipv4 to check). If an IPv6 - * socket doesn't accept V4-mapped addresses, you will - * need a second listener to support both v4 and v6. - * @since 2.7.0 - * @deprecated This function will be renamed to purple_network_listen in 3.0.0. - */ -PurpleNetworkListenData *purple_network_listen_family(unsigned short port, - int socket_family, int socket_type, PurpleNetworkListenCallback cb, - gpointer cb_data); + int socket_family, int socket_type, gboolean map_external, + PurpleNetworkListenCallback cb, gpointer cb_data); /** * Opens a listening port selected from a range of ports. The range of @@ -192,13 +173,26 @@ * the listening socket, and add a new watcher on the new socket accept * returned. * + * Libpurple does not currently do any port mapping (stateful firewall hole + * poking) for IPv6-only listeners (if an IPv6 socket supports v4-mapped + * addresses, a mapping is done). + * * @param start The port number to bind to, or 0 to pick a random port. * Users are allowed to override this arg in prefs. * @param end The highest possible port in the range of ports to listen on, * or 0 to pick a random port. Users are allowed to override this * arg in prefs. + * @param socket_family The protocol family of the socket. This should be + * AF_INET for IPv4 or AF_INET6 for IPv6. IPv6 sockets + * may or may not be able to accept IPv4 connections + * based on the system configuration (use + * purple_socket_speaks_ipv4 to check). If an IPv6 + * socket doesn't accept V4-mapped addresses, you will + * need a second listener to support both v4 and v6. * @param socket_type The type of socket to open for listening. * This will be either SOCK_STREAM for TCP or SOCK_DGRAM for UDP. + * @param map_external Should the open port be mapped externally using + * NAT-PNP or UPnP? (default should be TRUE) * @param cb The callback to be invoked when the port to listen on is available. * The file descriptor of the listening socket will be specified in * this callback, or -1 if no socket could be established. @@ -208,31 +202,10 @@ * the pending listener, or NULL if unable to obtain a local * socket to listen on. */ -PurpleNetworkListenData *purple_network_listen_range(unsigned short start, - unsigned short end, int socket_type, - PurpleNetworkListenCallback cb, gpointer cb_data); - -/** - * \copydoc purple_network_listen_range - * - * Libpurple does not currently do any port mapping (stateful firewall hole - * poking) for IPv6-only listeners (if an IPv6 socket supports v4-mapped - * addresses, a mapping is done). - * - * @param socket_family The protocol family of the socket. This should be - * AF_INET for IPv4 or AF_INET6 for IPv6. IPv6 sockets - * may or may not be able to accept IPv4 connections - * based on the system configuration (use - * purple_socket_speaks_ipv4 to check). If an IPv6 - * socket doesn't accept V4-mapped addresses, you will - * need a second listener to support both v4 and v6. - * @since 2.7.0 - * @deprecated This function will be renamed to purple_network_listen_range - * in 3.0.0. - */ -PurpleNetworkListenData *purple_network_listen_range_family( +PurpleNetworkListenData *purple_network_listen_range( unsigned short start, unsigned short end, int socket_family, - int socket_type, PurpleNetworkListenCallback cb, gpointer cb_data); + int socket_type, gboolean map_external, + PurpleNetworkListenCallback cb, gpointer cb_data); /** * This can be used to cancel any in-progress listener connection
--- a/libpurple/plugins/perl/common/Network.xs Sat Sep 24 21:19:26 2011 +0000 +++ b/libpurple/plugins/perl/common/Network.xs Sat Sep 24 22:21:48 2011 +0000 @@ -23,17 +23,21 @@ const char *ip Purple::NetworkListenData -purple_network_listen(port, socket_type, cb, cb_data) +purple_network_listen(port, socket_family, socket_type, map_external, cb, cb_data) unsigned short port + int socket_family int socket_type + gboolean map_external Purple::NetworkListenCallback cb gpointer cb_data Purple::NetworkListenData -purple_network_listen_range(start, end, socket_type, cb, cb_data) +purple_network_listen_range(start, end, socket_family, socket_type, map_external, cb, cb_data) unsigned short start unsigned short end + int socket_family int socket_type + gboolean map_external Purple::NetworkListenCallback cb gpointer cb_data
--- a/libpurple/plugins/perl/common/Util.xs Sat Sep 24 21:19:26 2011 +0000 +++ b/libpurple/plugins/perl/common/Util.xs Sat Sep 24 22:21:48 2011 +0000 @@ -202,6 +202,14 @@ purple_ip_address_is_valid(ip) const char* ip +gboolean +purple_ipv4_address_is_valid(ip) + const char* ip + +gboolean +purple_ipv6_address_is_valid(ip) + const char* ip + const char* purple_normalize_nocase(account, str) Purple::Account account
--- a/libpurple/protocols/bonjour/bonjour_ft.c Sat Sep 24 21:19:26 2011 +0000 +++ b/libpurple/protocols/bonjour/bonjour_ft.c Sat Sep 24 22:21:48 2011 +0000 @@ -792,10 +792,8 @@ purple_debug_info("bonjour", "Bonjour-bytestreams-init.\n"); xf = purple_xfer_get_protocol_data(xfer); - purple_network_listen_map_external(FALSE); - xf->listen_data = purple_network_listen_range(0, 0, SOCK_STREAM, + xf->listen_data = purple_network_listen_range(0, 0, AF_UNSPEC, SOCK_STREAM, FALSE, bonjour_bytestreams_listen, xfer); - purple_network_listen_map_external(TRUE); if (xf->listen_data == NULL) purple_xfer_cancel_local(xfer);
--- a/libpurple/protocols/bonjour/jabber.c Sat Sep 24 21:19:26 2011 +0000 +++ b/libpurple/protocols/bonjour/jabber.c Sat Sep 24 22:21:48 2011 +0000 @@ -744,7 +744,7 @@ #if 0 /* TODO: Why isn't this being used? */ - data->socket = purple_network_listen(jdata->port, SOCK_STREAM); + data->socket = purple_network_listen(jdata->port, AF_UNSPEC, SOCK_STREAM, TRUE); if (jdata->socket == -1) {
--- a/libpurple/protocols/gg/gg.c Sat Sep 24 21:19:26 2011 +0000 +++ b/libpurple/protocols/gg/gg.c Sat Sep 24 22:21:48 2011 +0000 @@ -1024,7 +1024,7 @@ purple_debug_info("gg", "gg_get_avatar_url_cb: " "requesting avatar for %s\n", uin); - url_data = purple_util_fetch_url_request_len(account, + url_data = purple_util_fetch_url_request(account, bigavatar, TRUE, "Mozilla/4.0 (compatible; MSIE 5.0)", FALSE, NULL, FALSE, -1, gg_fetch_avatar_cb, data); } @@ -1052,7 +1052,7 @@ avatarurl = g_strdup_printf("http://api.gadu-gadu.pl/avatars/%u/0.xml", uin); - url_data = purple_util_fetch_url_request_len( + url_data = purple_util_fetch_url_request( purple_connection_get_account(gc), avatarurl, TRUE, "Mozilla/4.0 (compatible; MSIE 5.5)", FALSE, NULL, FALSE, -1, gg_get_avatar_url_cb, gc);
--- a/libpurple/protocols/irc/dcc_send.c Sat Sep 24 21:19:26 2011 +0000 +++ b/libpurple/protocols/irc/dcc_send.c Sat Sep 24 22:21:48 2011 +0000 @@ -339,7 +339,7 @@ purple_xfer_ref(xfer); /* Create a listening socket */ - xd->listen_data = purple_network_listen_range(0, 0, SOCK_STREAM, + xd->listen_data = purple_network_listen_range(0, 0, AF_UNSPEC, SOCK_STREAM, TRUE, irc_dccsend_network_listen_cb, xfer); if (xd->listen_data == NULL) { purple_xfer_unref(xfer);
--- a/libpurple/protocols/jabber/google/relay.c Sat Sep 24 21:19:26 2011 +0000 +++ b/libpurple/protocols/jabber/google/relay.c Sat Sep 24 22:21:48 2011 +0000 @@ -137,7 +137,7 @@ purple_debug_info("jabber", "sending Google relay request %s to %s\n", request, url); url_data = - purple_util_fetch_url_request(url, FALSE, NULL, FALSE, request, FALSE, + purple_util_fetch_url_request(NULL, url, FALSE, NULL, FALSE, request, FALSE, -1, jabber_google_relay_fetch_cb, data); if (url_data) { js->google_relay_requests =
--- a/libpurple/protocols/jabber/presence.c Sat Sep 24 21:19:26 2011 +0000 +++ b/libpurple/protocols/jabber/presence.c Sat Sep 24 22:21:48 2011 +0000 @@ -299,11 +299,6 @@ jabber_presence_fake_to_self(js, status); } -xmlnode *jabber_presence_create(JabberBuddyState state, const char *msg, int priority) -{ - return jabber_presence_create_js(NULL, state, msg, priority); -} - xmlnode *jabber_presence_create_js(JabberStream *js, JabberBuddyState state, const char *msg, int priority) { xmlnode *show, *status, *presence, *pri, *c;
--- a/libpurple/protocols/jabber/presence.h Sat Sep 24 21:19:26 2011 +0000 +++ b/libpurple/protocols/jabber/presence.h Sat Sep 24 22:21:48 2011 +0000 @@ -92,7 +92,6 @@ */ void jabber_presence_send(JabberStream *js, gboolean force); -xmlnode *jabber_presence_create(JabberBuddyState state, const char *msg, int priority); /* DEPRECATED */ xmlnode *jabber_presence_create_js(JabberStream *js, JabberBuddyState state, const char *msg, int priority); void jabber_presence_parse(JabberStream *js, xmlnode *packet); void jabber_presence_subscription_set(JabberStream *js, const char *who,
--- a/libpurple/protocols/jabber/si.c Sat Sep 24 21:19:26 2011 +0000 +++ b/libpurple/protocols/jabber/si.c Sat Sep 24 22:21:48 2011 +0000 @@ -959,7 +959,7 @@ purple_debug_info("jabber", "Skipping attempting local streamhost.\n"); jsx->listen_data = NULL; } else - jsx->listen_data = purple_network_listen_range(0, 0, SOCK_STREAM, + jsx->listen_data = purple_network_listen_range(0, 0, AF_UNSPEC, SOCK_STREAM, TRUE, jabber_si_xfer_bytestreams_listen_cb, xfer); if (jsx->listen_data == NULL) {
--- a/libpurple/protocols/jabber/useravatar.c Sat Sep 24 21:19:26 2011 +0000 +++ b/libpurple/protocols/jabber/useravatar.c Sat Sep 24 22:21:48 2011 +0000 @@ -377,7 +377,7 @@ JabberBuddyAvatarUpdateURLInfo *info = g_new0(JabberBuddyAvatarUpdateURLInfo, 1); info->js = js; - url_data = purple_util_fetch_url_len(url, TRUE, NULL, TRUE, + url_data = purple_util_fetch_url(url, TRUE, NULL, TRUE, MAX_HTTP_BUDDYICON_BYTES, do_buddy_avatar_update_fromurl, info); if (url_data) {
--- a/libpurple/protocols/msn/msn.c Sat Sep 24 21:19:26 2011 +0000 +++ b/libpurple/protocols/msn/msn.c Sat Sep 24 22:21:48 2011 +0000 @@ -2742,7 +2742,7 @@ /* Try to put the photo in there too, if there's one */ if (photo_url_text) { - url_data = purple_util_fetch_url_len(photo_url_text, FALSE, NULL, FALSE, + url_data = purple_util_fetch_url(photo_url_text, FALSE, NULL, FALSE, MAX_HTTP_BUDDYICON_BYTES, msn_got_photo, info2_data); session->url_datas = g_slist_prepend(session->url_datas, url_data); @@ -2841,7 +2841,7 @@ url_data = purple_util_fetch_url(url, FALSE, "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)", - TRUE, msn_got_info, data); + TRUE, -1, msn_got_info, data); session->url_datas = g_slist_prepend(session->url_datas, url_data); g_free(url);
--- a/libpurple/protocols/msn/slp.c Sat Sep 24 21:19:26 2011 +0000 +++ b/libpurple/protocols/msn/slp.c Sat Sep 24 22:21:48 2011 +0000 @@ -253,7 +253,7 @@ data->session = session; data->remote_user = user->passport; data->sha1 = info; - url_data = purple_util_fetch_url_len(url, TRUE, NULL, TRUE, 200*1024, + url_data = purple_util_fetch_url(url, TRUE, NULL, TRUE, 200*1024, fetched_user_display, data); session->url_datas = g_slist_prepend(session->url_datas, url_data); } else {
--- a/libpurple/protocols/msn/slpcall.c Sat Sep 24 21:19:26 2011 +0000 +++ b/libpurple/protocols/msn/slpcall.c Sat Sep 24 22:21:48 2011 +0000 @@ -731,7 +731,9 @@ dc->listen_data = purple_network_listen_range( 0, 0, + AF_UNSPEC, SOCK_STREAM, + TRUE, msn_dc_listen_socket_created_cb, dc ); @@ -832,7 +834,9 @@ dc->listen_data = purple_network_listen_range( 0, 0, + AF_UNSPEC, SOCK_STREAM, + TRUE, msn_dc_listen_socket_created_cb, dc );
--- a/libpurple/protocols/mxit/formcmds.c Sat Sep 24 21:19:26 2011 +0000 +++ b/libpurple/protocols/mxit/formcmds.c Sat Sep 24 22:21:48 2011 +0000 @@ -362,7 +362,7 @@ purple_debug_info(MXIT_PLUGIN_ID, "sending request for inline image '%s'\n", iireq->url); /* request the image (reference: "libpurple/util.h") */ - purple_util_fetch_url_request(iireq->url, TRUE, NULL, TRUE, NULL, FALSE, mxit_cb_ii_returned, iireq); + purple_util_fetch_url(iireq->url, TRUE, NULL, TRUE, -1, mxit_cb_ii_returned, iireq); mx->img_count++; } }
--- a/libpurple/protocols/mxit/login.c Sat Sep 24 21:19:26 2011 +0000 +++ b/libpurple/protocols/mxit/login.c Sat Sep 24 22:21:48 2011 +0000 @@ -549,7 +549,7 @@ session->logindata->wapserver, session->logindata->sessionid, purple_url_encode( session->acc->username ), PURPLE_MAJOR_VERSION, PURPLE_MINOR_VERSION, PURPLE_MICRO_VERSION, MXIT_CLIENT_ID, MXIT_CP_ARCH, captcha_resp, session->logindata->cc, session->logindata->locale, ( state == MXIT_STATE_REGISTER1 ) ? 0 : 1, MXIT_CP_PLATFORM, MXIT_CP_OS, MXIT_CAPTCHA_HEIGHT, MXIT_CAPTCHA_WIDTH, time( NULL ) ); - url_data = purple_util_fetch_url_request( url, TRUE, MXIT_HTTP_USERAGENT, TRUE, NULL, FALSE, mxit_cb_clientinfo2, session ); + url_data = purple_util_fetch_url_request( session->acc, url, TRUE, MXIT_HTTP_USERAGENT, TRUE, NULL, FALSE, -1, mxit_cb_clientinfo2, session ); #ifdef DEBUG_PROTOCOL purple_debug_info( MXIT_PLUGIN_ID, "HTTP REQUEST: '%s'\n", url ); @@ -713,7 +713,7 @@ /* reference: "libpurple/util.h" */ url = g_strdup_printf( "%s/res/?type=challenge&getcountries=true&getlanguage=true&getimage=true&h=%i&w=%i&ts=%li", wapserver, MXIT_CAPTCHA_HEIGHT, MXIT_CAPTCHA_WIDTH, time( NULL ) ); - url_data = purple_util_fetch_url_request( url, TRUE, MXIT_HTTP_USERAGENT, TRUE, NULL, FALSE, mxit_cb_clientinfo1, session ); + url_data = purple_util_fetch_url_request( session->acc, url, TRUE, MXIT_HTTP_USERAGENT, TRUE, NULL, FALSE, -1, mxit_cb_clientinfo1, session ); #ifdef DEBUG_PROTOCOL purple_debug_info( MXIT_PLUGIN_ID, "HTTP REQUEST: '%s'\n", url );
--- a/libpurple/protocols/mxit/markup.c Sat Sep 24 21:19:26 2011 +0000 +++ b/libpurple/protocols/mxit/markup.c Sat Sep 24 22:21:48 2011 +0000 @@ -628,7 +628,7 @@ /* reference: "libpurple/util.h" */ url = g_strdup_printf( "%s/res/?type=emo&mlh=%i&sc=%s&ts=%li", wapserver, MXIT_EMOTICON_SIZE, id, time( NULL ) ); - url_data = purple_util_fetch_url_request( url, TRUE, NULL, TRUE, NULL, FALSE, emoticon_returned, mx ); + url_data = purple_util_fetch_url( url, TRUE, NULL, TRUE, -1, emoticon_returned, mx ); g_free( url ); }
--- a/libpurple/protocols/mxit/protocol.c Sat Sep 24 21:19:26 2011 +0000 +++ b/libpurple/protocols/mxit/protocol.c Sat Sep 24 22:21:48 2011 +0000 @@ -311,7 +311,7 @@ #endif /* send the HTTP request */ - session->http_out_req = purple_util_fetch_url_request( url, TRUE, MXIT_HTTP_USERAGENT, TRUE, NULL, FALSE, mxit_cb_http_rx, session ); + session->http_out_req = purple_util_fetch_url_request( session->acc, url, TRUE, MXIT_HTTP_USERAGENT, TRUE, NULL, FALSE, -1, mxit_cb_http_rx, session ); g_free( url ); if ( part )
--- a/libpurple/protocols/myspace/user.c Sat Sep 24 21:19:26 2011 +0000 +++ b/libpurple/protocols/myspace/user.c Sat Sep 24 22:21:48 2011 +0000 @@ -384,7 +384,7 @@ if (!previous_url || !g_str_equal(previous_url, user->image_url)) { if (user->url_data != NULL) purple_util_fetch_url_cancel(user->url_data); - user->url_data = purple_util_fetch_url(user->image_url, TRUE, NULL, TRUE, msim_downloaded_buddy_icon, (gpointer)user); + user->url_data = purple_util_fetch_url(user->image_url, TRUE, NULL, TRUE, -1, msim_downloaded_buddy_icon, (gpointer)user); } } else if (g_str_equal(key_str, "LastImageUpdated")) { /* TODO: use somewhere */
--- a/libpurple/protocols/oscar/clientlogin.c Sat Sep 24 21:19:26 2011 +0000 +++ b/libpurple/protocols/oscar/clientlogin.c Sat Sep 24 22:21:48 2011 +0000 @@ -384,7 +384,7 @@ g_free(signature); /* Make the request */ - od->url_data = purple_util_fetch_url_request_len(account, + od->url_data = purple_util_fetch_url_request(account, url, TRUE, NULL, FALSE, NULL, FALSE, -1, start_oscar_session_cb, od); g_free(url); @@ -646,7 +646,7 @@ g_string_free(body, TRUE); /* Send the POST request */ - od->url_data = purple_util_fetch_url_request_len( + od->url_data = purple_util_fetch_url_request( purple_connection_get_account(gc), get_client_login_url(od), TRUE, NULL, FALSE, request->str, FALSE, -1, client_login_cb, od);
--- a/libpurple/protocols/oscar/peer.c Sat Sep 24 21:19:26 2011 +0000 +++ b/libpurple/protocols/oscar/peer.c Sat Sep 24 22:21:48 2011 +0000 @@ -842,7 +842,7 @@ */ conn->flags |= PEER_CONNECTION_FLAG_IS_INCOMING; - conn->listen_data = purple_network_listen_range(5190, 5290, SOCK_STREAM, + conn->listen_data = purple_network_listen_range(5190, 5290, AF_UNSPEC, SOCK_STREAM, TRUE, peer_connection_establish_listener_cb, conn); if (conn->listen_data != NULL) {
--- a/libpurple/protocols/simple/simple.c Sat Sep 24 21:19:26 2011 +0000 +++ b/libpurple/protocols/simple/simple.c Sat Sep 24 22:21:48 2011 +0000 @@ -1823,7 +1823,7 @@ } /* create socket for incoming connections */ - sip->listen_data = purple_network_listen_range(5060, 5160, SOCK_DGRAM, + sip->listen_data = purple_network_listen_range(5060, 5160, AF_UNSPEC, SOCK_DGRAM, TRUE, simple_udp_host_resolved_listen_cb, sip); if (sip->listen_data == NULL) { purple_connection_error(sip->gc, @@ -1893,7 +1893,7 @@ /* TCP case */ if(!sip->udp) { /* create socket for incoming connections */ - sip->listen_data = purple_network_listen_range(5060, 5160, SOCK_STREAM, + sip->listen_data = purple_network_listen_range(5060, 5160, AF_UNSPEC, SOCK_STREAM, TRUE, simple_tcp_connect_listen_cb, sip); if (sip->listen_data == NULL) { purple_connection_error(sip->gc,
--- a/libpurple/protocols/yahoo/libymsg.c Sat Sep 24 21:19:26 2011 +0000 +++ b/libpurple/protocols/yahoo/libymsg.c Sat Sep 24 22:21:48 2011 +0000 @@ -2014,7 +2014,7 @@ gboolean proxy_ssl = purple_account_get_bool(account, "proxy_ssl", FALSE); url = g_strdup_printf(yahoojp ? YAHOOJP_LOGIN_URL : YAHOO_LOGIN_URL, token); - url_data = purple_util_fetch_url_request_len( + url_data = purple_util_fetch_url_request( proxy_ssl ? account : NULL, url, TRUE, YAHOO_CLIENT_USERAGENT, TRUE, NULL, TRUE, -1, yahoo_auth16_stage2, auth_data); if (url_data) @@ -2055,7 +2055,7 @@ g_free(encoded_password); g_free(encoded_username); - url_data = purple_util_fetch_url_request_len( + url_data = purple_util_fetch_url_request( proxy_ssl ? account : NULL, url, TRUE, YAHOO_CLIENT_USERAGENT, TRUE, NULL, FALSE, -1, yahoo_auth16_stage1_cb, auth_data); @@ -2247,7 +2247,7 @@ if (gc->inpa) purple_input_remove(gc->inpa); url_data = purple_util_fetch_url(WEBMESSENGER_URL, TRUE, - "Purple/" VERSION, FALSE, yahoo_login_page_cb, gc); + "Purple/" VERSION, FALSE, -1, yahoo_login_page_cb, gc); if (url_data != NULL) yd->url_datas = g_slist_prepend(yd->url_datas, url_data); return; @@ -2770,7 +2770,7 @@ if (yd->listen_data) purple_debug_warning("yahoo","p2p: Failed to create p2p server - server already exists\n"); else { - yd->listen_data = purple_network_listen(YAHOO_PAGER_PORT_P2P, SOCK_STREAM, yahoo_p2p_server_listen_cb, p2p_data); + yd->listen_data = purple_network_listen(YAHOO_PAGER_PORT_P2P, AF_UNSPEC, SOCK_STREAM, TRUE, yahoo_p2p_server_listen_cb, p2p_data); if (yd->listen_data == NULL) purple_debug_warning("yahoo","p2p: Failed to created p2p server\n"); } @@ -3709,7 +3709,7 @@ /* Get the pager server. Actually start connecting in the callback since we * must have the contents of the HTTP response to proceed. */ - url_data = purple_util_fetch_url_request_len( + url_data = purple_util_fetch_url_request( proxy_ssl ? purple_connection_get_account(gc) : NULL, yd->jp ? YAHOOJP_PAGER_HOST_REQ_URL : YAHOO_PAGER_HOST_REQ_URL, use_whole_url ? TRUE : FALSE, @@ -4287,7 +4287,7 @@ use_whole_url ? base_url : "", yd->cookie_t, yd->cookie_y); - url_data = purple_util_fetch_url_request_len( + url_data = purple_util_fetch_url_request( purple_connection_get_account(gc), base_url, use_whole_url, YAHOO_CLIENT_USERAGENT, TRUE, request, FALSE, -1, yahoo_get_inbox_token_cb, gc); @@ -4479,7 +4479,7 @@ if ((gc->account->proxy_info) && (purple_proxy_info_get_type(gc->account->proxy_info) == PURPLE_PROXY_HTTP)) use_whole_url = TRUE; - url_data = purple_util_fetch_url_request_len( + url_data = purple_util_fetch_url_request( purple_connection_get_account(gc), YAHOO_SMS_CARRIER_URL, use_whole_url, YAHOO_CLIENT_USERAGENT, TRUE, request, FALSE, -1, yahoo_get_sms_carrier_cb, data);
--- a/libpurple/protocols/yahoo/yahoo_aliases.c Sat Sep 24 21:19:26 2011 +0000 +++ b/libpurple/protocols/yahoo/yahoo_aliases.c Sat Sep 24 22:21:48 2011 +0000 @@ -207,7 +207,7 @@ webaddress); /* We have a URL and some header information, let's connect and get some aliases */ - url_data = purple_util_fetch_url_request_len(purple_connection_get_account(gc), + url_data = purple_util_fetch_url_request(purple_connection_get_account(gc), url, use_whole_url, NULL, TRUE, request, FALSE, -1, yahoo_fetch_aliases_cb, gc); if (url_data != NULL) @@ -379,7 +379,7 @@ content); /* We have a URL and some header information, let's connect and update the alias */ - url_data = purple_util_fetch_url_request_len( + url_data = purple_util_fetch_url_request( purple_connection_get_account(gc), url, use_whole_url, NULL, TRUE, request, FALSE, -1, yahoo_update_alias_cb, cb); if (url_data != NULL) @@ -517,7 +517,7 @@ } #endif - url_data = purple_util_fetch_url_request_len(account, webaddress, FALSE, + url_data = purple_util_fetch_url_request(account, webaddress, FALSE, YAHOO_CLIENT_USERAGENT, TRUE, request, FALSE, -1, yahoo_fetch_aliases_cb, gc); if (url_data != NULL)
--- a/libpurple/protocols/yahoo/yahoo_filexfer.c Sat Sep 24 21:19:26 2011 +0000 +++ b/libpurple/protocols/yahoo/yahoo_filexfer.c Sat Sep 24 22:21:48 2011 +0000 @@ -1216,7 +1216,7 @@ close(source); xfer->fd = -1; /* start local server, listen for connections */ - purple_network_listen(xd->yahoo_local_p2p_ft_server_port, SOCK_STREAM, yahoo_p2p_ft_server_listen_cb, xfer); + purple_network_listen(xd->yahoo_local_p2p_ft_server_port, AF_UNSPEC, SOCK_STREAM, TRUE, yahoo_p2p_ft_server_listen_cb, xfer); } else { @@ -1570,7 +1570,7 @@ p2p_data = g_hash_table_lookup(yd->peers, purple_xfer_get_remote_user(xfer)); if( p2p_data->connection_type == YAHOO_P2P_WE_ARE_SERVER ) - if(purple_network_listen_range(0, 0, SOCK_STREAM, yahoo_p2p_ft_server_listen_cb, xfer)) + if(purple_network_listen_range(0, 0, AF_UNSPEC, SOCK_STREAM, TRUE, yahoo_p2p_ft_server_listen_cb, xfer)) return; pkt = yahoo_packet_new(YAHOO_SERVICE_FILETRANS_INFO_15, YAHOO_STATUS_AVAILABLE, yd->session_id); @@ -1871,7 +1871,7 @@ purple_xfer_cancel_remote(xfer); return; } - if(!purple_network_listen_range(0, 0, SOCK_STREAM, yahoo_p2p_ft_server_listen_cb, xfer)) { + if(!purple_network_listen_range(0, 0, AF_UNSPEC, SOCK_STREAM, TRUE, yahoo_p2p_ft_server_listen_cb, xfer)) { purple_xfer_cancel_remote(xfer); return; }
--- a/libpurple/protocols/yahoo/yahoo_picture.c Sat Sep 24 21:19:26 2011 +0000 +++ b/libpurple/protocols/yahoo/yahoo_picture.c Sat Sep 24 22:21:48 2011 +0000 @@ -132,7 +132,7 @@ data->checksum = checksum; /* TODO: Does this need to be MSIE 5.0? */ url_data = purple_util_fetch_url(url, use_whole_url, - "Mozilla/4.0 (compatible; MSIE 5.5)", FALSE, + "Mozilla/4.0 (compatible; MSIE 5.5)", FALSE, -1, yahoo_fetch_picture_cb, data); if (url_data != NULL) { yd = purple_connection_get_protocol_data(gc);
--- a/libpurple/protocols/yahoo/yahoo_profile.c Sat Sep 24 21:19:26 2011 +0000 +++ b/libpurple/protocols/yahoo/yahoo_profile.c Sat Sep 24 22:21:48 2011 +0000 @@ -940,7 +940,7 @@ * we specify HTTP 1.1. So we have to specify 1.0 & fix purple_util_fetch_url */ url_data = purple_util_fetch_url(photo_url_text, use_whole_url, NULL, - FALSE, yahoo_got_photo, info2_data); + FALSE, -1, yahoo_got_photo, info2_data); if (url_data != NULL) yd->url_datas = g_slist_prepend(yd->url_datas, url_data); } else { @@ -1274,7 +1274,7 @@ url = g_strdup_printf("%s%s", (yd->jp ? YAHOOJP_PROFILE_URL : YAHOO_PROFILE_URL), name); - url_data = purple_util_fetch_url(url, TRUE, NULL, FALSE, yahoo_got_info, data); + url_data = purple_util_fetch_url(url, TRUE, NULL, FALSE, -1, yahoo_got_info, data); if (url_data != NULL) yd->url_datas = g_slist_prepend(yd->url_datas, url_data); else {
--- a/libpurple/stun.c Sat Sep 24 21:19:26 2011 +0000 +++ b/libpurple/stun.c Sat Sep 24 22:21:48 2011 +0000 @@ -338,7 +338,7 @@ return; } - if (!purple_network_listen_range(12108, 12208, SOCK_DGRAM, hbn_listen_cb, hosts)) { + if (!purple_network_listen_range(12108, 12208, AF_UNSPEC, SOCK_DGRAM, TRUE, hbn_listen_cb, hosts)) { while (hosts) { hosts = g_slist_delete_link(hosts, hosts); g_free(hosts->data);
--- a/libpurple/upnp.c Sat Sep 24 21:19:26 2011 +0000 +++ b/libpurple/upnp.c Sat Sep 24 22:21:48 2011 +0000 @@ -464,7 +464,7 @@ purple_timeout_remove(dd->tima); dd->tima = 0; - purple_util_fetch_url_request_len(NULL, descriptionURL, TRUE, NULL, TRUE, httpRequest, + purple_util_fetch_url_request(NULL, descriptionURL, TRUE, NULL, TRUE, httpRequest, TRUE, MAX_UPNP_DOWNLOAD, upnp_parse_description_cb, dd); g_free(httpRequest); @@ -730,7 +730,7 @@ g_free(pathOfControl); g_free(soapMessage); - gfud = purple_util_fetch_url_request_len(NULL, control_info.control_url, FALSE, NULL, TRUE, + gfud = purple_util_fetch_url_request(NULL, control_info.control_url, FALSE, NULL, TRUE, totalSendMessage, TRUE, MAX_UPNP_DOWNLOAD, cb, cb_data); g_free(totalSendMessage);
--- a/libpurple/util.c Sat Sep 24 21:19:26 2011 +0000 +++ b/libpurple/util.c Sat Sep 24 22:21:48 2011 +0000 @@ -4167,19 +4167,7 @@ } PurpleUtilFetchUrlData * -purple_util_fetch_url_request(const char *url, gboolean full, - const char *user_agent, gboolean http11, - const char *request, gboolean include_headers, - PurpleUtilFetchUrlCallback callback, void *user_data) -{ - return purple_util_fetch_url_request_len(NULL, url, full, - user_agent, http11, - request, include_headers, -1, - callback, user_data); -} - -PurpleUtilFetchUrlData * -purple_util_fetch_url_request_len(PurpleAccount *account, +purple_util_fetch_url_request(PurpleAccount *account, const char *url, gboolean full, const char *user_agent, gboolean http11, const char *request, gboolean include_headers, gssize max_len, PurpleUtilFetchUrlCallback callback, void *user_data) @@ -4466,11 +4454,10 @@ return (double_colon && chunks < 8) || (!double_colon && chunks == 8); } -/* TODO 3.0.0: Add ipv6 check, too */ gboolean purple_ip_address_is_valid(const char *ip) { - return purple_ipv4_address_is_valid(ip); + return (purple_ipv4_address_is_valid(ip) || purple_ipv6_address_is_valid(ip)); } /* Stolen from gnome_uri_list_extract_uris */
--- a/libpurple/util.h Sat Sep 24 21:19:26 2011 +0000 +++ b/libpurple/util.h Sat Sep 24 22:21:48 2011 +0000 @@ -1167,53 +1167,17 @@ * partial URL. * @param user_agent The user agent field to use, or NULL. * @param http11 TRUE if HTTP/1.1 should be used to download the file. - * @param cb The callback function. - * @param data The user data to pass to the callback function. - */ -#define purple_util_fetch_url(url, full, user_agent, http11, cb, data) \ - purple_util_fetch_url_request(url, full, user_agent, http11, NULL, \ - FALSE, cb, data); - -/** - * Fetches the data from a URL, and passes it to a callback function. - * - * @param url The URL. - * @param full TRUE if this is the full URL, or FALSE if it's a - * partial URL. - * @param user_agent The user agent field to use, or NULL. - * @param http11 TRUE if HTTP/1.1 should be used to download the file. * @param max_len The maximum number of bytes to retrieve (-1 for unlimited) * @param cb The callback function. * @param data The user data to pass to the callback function. - * @deprecated In 3.0.0, we'll rename this to "purple_util_fetch_url" and get rid of the old one */ -#define purple_util_fetch_url_len(url, full, user_agent, http11, max_len, cb, data) \ - purple_util_fetch_url_request_len(NULL, url, full, user_agent, http11, NULL, \ +#define purple_util_fetch_url(url, full, user_agent, http11, max_len, cb, data) \ + purple_util_fetch_url_request(NULL, url, full, user_agent, http11, NULL, \ FALSE, max_len, cb, data); /** * Fetches the data from a URL, and passes it to a callback function. * - * @param url The URL. - * @param full TRUE if this is the full URL, or FALSE if it's a - * partial URL. - * @param user_agent The user agent field to use, or NULL. - * @param http11 TRUE if HTTP/1.1 should be used to download the file. - * @param request A HTTP request to send to the server instead of the - * standard GET - * @param include_headers - * If TRUE, include the HTTP headers in the response. - * @param callback The callback function. - * @param data The user data to pass to the callback function. - */ -PurpleUtilFetchUrlData *purple_util_fetch_url_request(const gchar *url, - gboolean full, const gchar *user_agent, gboolean http11, - const gchar *request, gboolean include_headers, - PurpleUtilFetchUrlCallback callback, gpointer data); - -/** - * Fetches the data from a URL, and passes it to a callback function. - * * @param account The account for which the request is needed, or NULL. * @param url The URL. * @param full TRUE if this is the full URL, or FALSE if it's a @@ -1227,9 +1191,8 @@ * @param max_len The maximum number of bytes to retrieve (-1 for unlimited) * @param callback The callback function. * @param data The user data to pass to the callback function. - * @deprecated In 3.0.0, we'll rename this to "purple_util_fetch_url_request" and get rid of the old one */ -PurpleUtilFetchUrlData *purple_util_fetch_url_request_len( +PurpleUtilFetchUrlData *purple_util_fetch_url_request( PurpleAccount *account, const gchar *url, gboolean full, const gchar *user_agent, gboolean http11, const gchar *request, gboolean include_headers, gssize max_len, @@ -1275,14 +1238,15 @@ gboolean purple_email_is_valid(const char *address); /** - * Checks if the given IP address is a syntactically valid IPv4 address. + * Checks if the given IP address is a syntactically valid IPv4 or + * IPv6 address. + * If you specifically want to check for an IPv4 address use + * purple_ipv4_address_is_valid(), or for an IPv6 address use + * purple_ipv6_address_is_valid(). * * @param ip The IP address to validate. * * @return True if the IP address is syntactically correct. - * @deprecated This function will be replaced with one that validates - * as either IPv4 or IPv6 in 3.0.0. If you don't want this, - * behavior, use one of the more specific functions. */ gboolean purple_ip_address_is_valid(const char *ip);
--- a/pidgin/gtkprefs.c Sat Sep 24 21:19:26 2011 +0000 +++ b/pidgin/gtkprefs.c Sat Sep 24 22:21:48 2011 +0000 @@ -891,7 +891,7 @@ } else if (!g_ascii_strncasecmp(name, "http://", 7)) { /* Oo, a web drag and drop. This is where things * will start to get interesting */ - purple_util_fetch_url(name, TRUE, NULL, FALSE, theme_got_url, info); + purple_util_fetch_url(name, TRUE, NULL, FALSE, -1, theme_got_url, info); } else if (!g_ascii_strncasecmp(name, "https://", 8)) { /* purple_util_fetch_url() doesn't support HTTPS, but we want users * to be able to drag and drop links from the SF trackers, so @@ -902,7 +902,7 @@ tmp[2] = 't'; tmp[3] = 'p'; - purple_util_fetch_url(tmp, TRUE, NULL, FALSE, theme_got_url, info); + purple_util_fetch_url(tmp, TRUE, NULL, FALSE, -1, theme_got_url, info); g_free(tmp); } else free_theme_info(info);
--- a/pidgin/gtksmiley.c Sat Sep 24 21:19:26 2011 +0000 +++ b/pidgin/gtksmiley.c Sat Sep 24 22:21:48 2011 +0000 @@ -750,7 +750,7 @@ } else if (!g_ascii_strncasecmp(name, "http://", 7)) { /* Oo, a web drag and drop. This is where things * will start to get interesting */ - purple_util_fetch_url(name, TRUE, NULL, FALSE, smiley_got_url, dialog); + purple_util_fetch_url(name, TRUE, NULL, FALSE, -1, smiley_got_url, dialog); } else if (!g_ascii_strncasecmp(name, "https://", 8)) { /* purple_util_fetch_url() doesn't support HTTPS */ char *tmp = g_strdup(name + 1); @@ -759,7 +759,7 @@ tmp[2] = 't'; tmp[3] = 'p'; - purple_util_fetch_url(tmp, TRUE, NULL, FALSE, smiley_got_url, dialog); + purple_util_fetch_url(tmp, TRUE, NULL, FALSE, -1, smiley_got_url, dialog); g_free(tmp); }
--- a/pidgin/gtkstatusbox.c Sat Sep 24 21:19:26 2011 +0000 +++ b/pidgin/gtkstatusbox.c Sat Sep 24 22:21:48 2011 +0000 @@ -412,7 +412,7 @@ if (src == NULL) return FALSE; - purple_util_fetch_url(src, TRUE, NULL, FALSE, statusbox_got_url, data); + purple_util_fetch_url(src, TRUE, NULL, FALSE, -1, statusbox_got_url, data); return TRUE; }
--- a/pidgin/plugins/relnot.c Sat Sep 24 21:19:26 2011 +0000 +++ b/pidgin/plugins/relnot.c Sat Sep 24 22:21:48 2011 +0000 @@ -152,7 +152,7 @@ url, host); - purple_util_fetch_url_request_len(NULL, url, TRUE, NULL, FALSE, + purple_util_fetch_url_request(NULL, url, TRUE, NULL, FALSE, request, TRUE, -1, version_fetch_cb, NULL); g_free(request);