libpurple/protocols/gg/gg.c

changeset 33435
ab0560aa8ca4
parent 33433
fb7ac52ed7df
child 33436
abec627c3a47
equal deleted inserted replaced
33434:ec4f343af107 33435:ab0560aa8ca4
58 #include <http.h> 58 #include <http.h>
59 59
60 static void ggp_test_http_cb(PurpleHttpConnection *http_conn, 60 static void ggp_test_http_cb(PurpleHttpConnection *http_conn,
61 PurpleHttpResponse *response, gpointer user_data) 61 PurpleHttpResponse *response, gpointer user_data)
62 { 62 {
63 const gchar *data;
64 gchar *data_front, *data_tail;
65
63 purple_debug_info("http-test", "Testing http done %s.\n", 66 purple_debug_info("http-test", "Testing http done %s.\n",
64 purple_http_response_is_successfull(response) ? 67 purple_http_response_is_successfull(response) ?
65 "successfully" : "without success"); 68 "successfully" : "without success");
66 purple_debug_info("http-test", "Returned http code: %d.\n", 69 purple_debug_info("http-test", "Returned http code: %d.\n",
67 purple_http_response_get_code(response)); 70 purple_http_response_get_code(response));
68 purple_debug_info("http-test", "Returned error: %s.\n", 71 purple_debug_info("http-test", "Returned error: %s.\n",
69 purple_http_response_get_error(response)); 72 purple_http_response_get_error(response));
70 purple_debug_info("http-test", "Returned content: [%s].\n", 73
71 purple_http_response_get_data(response)); 74 data = purple_http_response_get_data(response);
75 if (strlen(data) < 50)
76 purple_debug_info("http-test", "Returned content: [%s].\n", data);
77 else {
78 data_front = g_strndup(data, 20);
79 data_tail = g_strdup(data + strlen(data) - 20);
80 purple_debug_info("http-test", "Returned content: [%s ... %s].\n",
81 data_front, data_tail);
82 g_free(data_front);
83 g_free(data_tail);
84 }
72 } 85 }
73 86
74 static void ggp_action_test_http(PurplePluginAction *action) 87 static void ggp_action_test_http(PurplePluginAction *action)
75 { 88 {
76 PurpleConnection *gc = (PurpleConnection *)action->context; 89 PurpleConnection *gc = (PurpleConnection *)action->context;
77 90
78 purple_debug_info("http-test", "Testing http...\n"); 91 purple_debug_info("http-test", "Testing http...\n");
79 purple_http_get(gc, "http://www.wasilczyk.pl/x_ip_simple.htm", 92 // purple_http_get(gc, "http://www.wasilczyk.pl/x_ip_simple.htm",
80 ggp_test_http_cb, NULL); 93 // ggp_test_http_cb, NULL);
81 // purple_http_get(gc, "http://google.com", 94 // purple_http_get(gc, "http://google.com",
82 // ggp_test_http_cb, NULL); 95 // ggp_test_http_cb, NULL);
83 // purple_http_get(gc, "http://wp.pl", 96 purple_http_get(gc, "http://www.wp.pl",
84 // ggp_test_http_cb, NULL); 97 ggp_test_http_cb, NULL);
85 purple_debug_info("http-test", "Testing http started.\n"); 98 purple_debug_info("http-test", "Testing http started.\n");
86 } 99 }
87 100
88 /* ---------------------------------------------------------------------- */ 101 /* ---------------------------------------------------------------------- */
89 102

mercurial