| 103 jabber_bosh_http_connection_connect(conn->conn_a); |
103 jabber_bosh_http_connection_connect(conn->conn_a); |
| 104 } |
104 } |
| 105 |
105 |
| 106 static void jabber_bosh_http_connection_receive(gpointer data, gint source, PurpleInputCondition condition) { |
106 static void jabber_bosh_http_connection_receive(gpointer data, gint source, PurpleInputCondition condition) { |
| 107 PurpleHTTPConnection *conn = data; |
107 PurpleHTTPConnection *conn = data; |
| |
108 PurpleHTTPResponse *response = conn->current_response; |
| |
109 |
| 108 purple_debug_info("jabber", "jabber_bosh_http_connection_receive\n"); |
110 purple_debug_info("jabber", "jabber_bosh_http_connection_receive\n"); |
| |
111 if (response) { |
| |
112 // data for current response |
| |
113 |
| |
114 } else { |
| |
115 // new response |
| |
116 response = conn->current_response = g_new0(PurpleHTTPResponse, 1); |
| |
117 } |
| 109 } |
118 } |
| 110 |
119 |
| 111 void jabber_bosh_http_connection_init(PurpleHTTPConnection *conn, PurpleAccount *account, char *host, int port) { |
120 void jabber_bosh_http_connection_init(PurpleHTTPConnection *conn, PurpleAccount *account, char *host, int port) { |
| 112 conn->account = account; |
121 conn->account = account; |
| 113 conn->host = host; |
122 conn->host = host; |
| 114 conn->port = port; |
123 conn->port = port; |
| 115 conn->connect_cb = NULL; |
124 conn->connect_cb = NULL; |
| |
125 conn->current_response = NULL; |
| 116 conn->requests = g_queue_new(); |
126 conn->requests = g_queue_new(); |
| 117 } |
127 } |
| 118 |
128 |
| 119 void jabber_bosh_http_connection_clean(PurpleHTTPConnection *conn) { |
129 void jabber_bosh_http_connection_clean(PurpleHTTPConnection *conn) { |
| 120 g_queue_free(conn->requests); |
130 g_queue_free(conn->requests); |