| 164 |
163 |
| 165 if (conn->send_timer) |
164 if (conn->send_timer) |
| 166 g_source_remove(conn->send_timer); |
165 g_source_remove(conn->send_timer); |
| 167 |
166 |
| 168 soup_session_abort(conn->payload_reqs); |
167 soup_session_abort(conn->payload_reqs); |
| 169 conn->is_creating = FALSE; |
|
| 170 |
168 |
| 171 g_clear_object(&conn->payload_reqs); |
169 g_clear_object(&conn->payload_reqs); |
| 172 g_string_free(conn->send_buff, TRUE); |
170 g_string_free(conn->send_buff, TRUE); |
| 173 conn->send_buff = NULL; |
171 conn->send_buff = NULL; |
| 174 |
172 |
| 391 PurpleJabberBOSHConnection *bosh_conn = user_data; |
389 PurpleJabberBOSHConnection *bosh_conn = user_data; |
| 392 PurpleXmlNode *node, *features; |
390 PurpleXmlNode *node, *features; |
| 393 const gchar *sid, *ver, *inactivity_str; |
391 const gchar *sid, *ver, *inactivity_str; |
| 394 int inactivity = 0; |
392 int inactivity = 0; |
| 395 |
393 |
| 396 bosh_conn->is_creating = FALSE; |
|
| 397 |
|
| 398 if (purple_debug_is_verbose() && purple_debug_is_unsafe()) { |
394 if (purple_debug_is_verbose() && purple_debug_is_unsafe()) { |
| 399 purple_debug_misc("jabber-bosh", "received (session creation): %s\n", |
395 purple_debug_misc("jabber-bosh", "received (session creation): %s\n", |
| 400 msg->response_body->data); |
396 msg->response_body->data); |
| 401 } |
397 } |
| 402 |
398 |
| 467 static void |
463 static void |
| 468 jabber_bosh_connection_session_create(PurpleJabberBOSHConnection *conn) |
464 jabber_bosh_connection_session_create(PurpleJabberBOSHConnection *conn) |
| 469 { |
465 { |
| 470 SoupMessage *req; |
466 SoupMessage *req; |
| 471 GString *data; |
467 GString *data; |
| 472 |
|
| 473 g_return_if_fail(conn != NULL); |
|
| 474 |
|
| 475 if (conn->sid || conn->is_creating) { |
|
| 476 return; |
|
| 477 } |
|
| 478 |
468 |
| 479 purple_debug_misc("jabber-bosh", "Requesting Session Create for %p\n", |
469 purple_debug_misc("jabber-bosh", "Requesting Session Create for %p\n", |
| 480 conn); |
470 conn); |
| 481 |
471 |
| 482 data = g_string_new(NULL); |
472 data = g_string_new(NULL); |
| 496 ++conn->rid, conn->js->user->domain, JABBER_BOSH_TIMEOUT); |
486 ++conn->rid, conn->js->user->domain, JABBER_BOSH_TIMEOUT); |
| 497 |
487 |
| 498 req = jabber_bosh_connection_http_request_new(conn, data); |
488 req = jabber_bosh_connection_http_request_new(conn, data); |
| 499 g_string_free(data, FALSE); |
489 g_string_free(data, FALSE); |
| 500 |
490 |
| 501 conn->is_creating = TRUE; |
|
| 502 soup_session_queue_message(conn->payload_reqs, req, |
491 soup_session_queue_message(conn->payload_reqs, req, |
| 503 jabber_bosh_connection_session_created, conn); |
492 jabber_bosh_connection_session_created, conn); |
| 504 } |
493 } |
| 505 |
494 |
| 506 static SoupMessage * |
495 static SoupMessage * |