1 /* 2 * SkypeWeb Plugin for libpurple/Pidgin 3 * Copyright (c) 2014-2020 Eion Robb 4 * 5 * This program is free software: you can redistribute it and/or modify 6 * it under the terms of the GNU General Public License as published by 7 * the Free Software Foundation, either version 3 of the License, or 8 * (at your option) any later version. 9 * 10 * This program is distributed in the hope that it will be useful, 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 * GNU General Public License for more details. 14 * 15 * You should have received a copy of the GNU General Public License 16 * along with this program. If not, see <http://www.gnu.org/licenses/>. 17 */ 18 19 #ifndef SKYPEWEB_CONNECTION_H 20 #define SKYPEWEB_CONNECTION_H 21 22 #include "libskypeweb.h" 23 24 typedef void (*SkypeWebProxyCallbackFunc)(SkypeWebAccount *sa, JsonNode *node, gpointer user_data); 25 typedef void (*SkypeWebProxyCallbackErrorFunc)(SkypeWebAccount *sa, const gchar *data, gssize data_len, gpointer user_data); 26 27 /* 28 * This is a bitmask. 29 */ 30 typedef enum 31 { 32 SKYPEWEB_METHOD_GET = 0x0001, 33 SKYPEWEB_METHOD_POST = 0x0002, 34 SKYPEWEB_METHOD_PUT = 0x0004, 35 SKYPEWEB_METHOD_DELETE = 0x0008, 36 SKYPEWEB_METHOD_SSL = 0x1000, 37 } SkypeWebMethod; 38 39 typedef struct _SkypeWebConnection SkypeWebConnection; 40 struct _SkypeWebConnection { 41 SkypeWebAccount *sa; 42 gchar *url; 43 SkypeWebProxyCallbackFunc callback; 44 gpointer user_data; 45 PurpleHttpConnection *http_conn; 46 SkypeWebProxyCallbackErrorFunc error_callback; 47 }; 48 49 SkypeWebConnection *skypeweb_post_or_get(SkypeWebAccount *sa, SkypeWebMethod method, 50 const gchar *host, const gchar *url, const gchar *postdata, 51 SkypeWebProxyCallbackFunc callback_func, gpointer user_data, 52 gboolean keepalive); 53 54 void skypeweb_update_cookies(SkypeWebAccount *sa, const gchar *headers); 55 gchar *skypeweb_cookies_to_string(SkypeWebAccount *sa); 56 57 //SkypeWebConnection *skypeweb_fetch_url_request(); 58 59 #endif /* SKYPEWEB_CONNECTION_H */ 60