comparison src/util.h @ 12887:4229503f1cd9

[gaim-migrate @ 15240] Added gaim_url_fetch_request(), which is an enhancement to the gaim_url_fetch() functionality that allows you to specify the request that gets submitted to the server and whether or not the headers are also returned. I'm going to use this for the UPnP stuff (watch this space). Also fixed a tyop in the xmlnode docs. Remove the status documentation from the API Changelog. committer: Tailor Script <tailor@pidgin.im>
author Daniel Atallah <daniel.atallah@gmail.com>
date Sun, 15 Jan 2006 22:58:52 +0000
parents 547c199072c8
children 4f2b96f23700
comparison
equal deleted inserted replaced
12886:d8e8feac6cce 12887:4229503f1cd9
745 * @param ret_passwd The returned password. 745 * @param ret_passwd The returned password.
746 */ 746 */
747 gboolean gaim_url_parse(const char *url, char **ret_host, int *ret_port, 747 gboolean gaim_url_parse(const char *url, char **ret_host, int *ret_port,
748 char **ret_path, char **ret_user, char **ret_passwd); 748 char **ret_path, char **ret_user, char **ret_passwd);
749 749
750 typedef void (*GaimURLFetchCallback) (gpointer data, const char *buf, gsize len);
751
750 /** 752 /**
751 * Fetches the data from a URL, and passes it to a callback function. 753 * Fetches the data from a URL, and passes it to a callback function.
752 * 754 *
753 * @param url The URL. 755 * @param url The URL.
754 * @param full TRUE if this is the full URL, or FALSE if it's a 756 * @param full TRUE if this is the full URL, or FALSE if it's a
756 * @param user_agent The user agent field to use, or NULL. 758 * @param user_agent The user agent field to use, or NULL.
757 * @param http11 TRUE if HTTP/1.1 should be used to download the file. 759 * @param http11 TRUE if HTTP/1.1 should be used to download the file.
758 * @param cb The callback function. 760 * @param cb The callback function.
759 * @param data The user data to pass to the callback function. 761 * @param data The user data to pass to the callback function.
760 */ 762 */
761 void gaim_url_fetch(const char *url, gboolean full, 763 #define gaim_url_fetch(url, full, user_agent, http11, cb, data) \
762 const char *user_agent, gboolean http11, 764 gaim_url_fetch_request(url, full, user_agent, http11, NULL, \
763 void (*cb)(void *, const char *, size_t), 765 FALSE, cb, data);
764 void *data); 766
767 /**
768 * Fetches the data from a URL, and passes it to a callback function.
769 *
770 * @param url The URL.
771 * @param full TRUE if this is the full URL, or FALSE if it's a
772 * partial URL.
773 * @param user_agent The user agent field to use, or NULL.
774 * @param http11 TRUE if HTTP/1.1 should be used to download the file.
775 * @param request A HTTP request to send to the server instead of the
776 * standard GET
777 * @param include_headers if TRUE, include the HTTP headers in the
778 * response
779 * @param cb The callback function.
780 * @param data The user data to pass to the callback function.
781 */
782 void gaim_url_fetch_request(const char *url, gboolean full,
783 const char *user_agent, gboolean http11,
784 const char *request, gboolean include_headers,
785 GaimURLFetchCallback cb, void *data);
786
765 /** 787 /**
766 * Decodes a URL into a plain string. 788 * Decodes a URL into a plain string.
767 * 789 *
768 * This will change hex codes and such to their ascii equivalents. 790 * This will change hex codes and such to their ascii equivalents.
769 * 791 *