/* clean up the given QQ connection and free all resources */ static void qq_close(PurpleConnection *gc) { qq_data *qd; g_return_if_fail(gc != NULL && gc->proto_data); qd = gc->proto_data; if (qd->check_watcher > 0) { purple_timeout_remove(qd->check_watcher); qd->check_watcher = 0; } if (qd->connect_watcher > 0) { purple_timeout_remove(qd->connect_watcher); qd->connect_watcher = 0; } /* This is cancelled by _purple_connection_destroy */ qd->conn_data = NULL; qq_disconnect(gc); if (qd->redirect) g_free(qd->redirect); if (qd->ld.token) g_free(qd->ld.token); if (qd->ld.token_ex) g_free(qd->ld.token_ex); if (qd->captcha.token) g_free(qd->captcha.token); if (qd->captcha.data) g_free(qd->captcha.data); server_list_remove_all(qd); g_free(qd); gc->proto_data = NULL; }
static void redirect_server(PurpleConnection *gc) { qq_data *qd; qd = (qq_data *) gc->proto_data; if (qd->check_watcher > 0) { purple_timeout_remove(qd->check_watcher); qd->check_watcher = 0; } if (qd->connect_watcher > 0) purple_timeout_remove(qd->connect_watcher); qd->connect_watcher = purple_timeout_add_seconds(QQ_CONNECT_INTERVAL, qq_connect_later, gc); }
static void skypeweb_close(PurpleConnection *pc) { SkypeWebAccount *sa; g_return_if_fail(pc != NULL); sa = purple_connection_get_protocol_data(pc); g_return_if_fail(sa != NULL); purple_timeout_remove(sa->authcheck_timeout); purple_timeout_remove(sa->poll_timeout); purple_timeout_remove(sa->watchdog_timeout); skypeweb_logout(sa); purple_signal_disconnect(purple_conversations_get_handle(), "conversation-updated", pc, PURPLE_CALLBACK(skypeweb_mark_conv_seen)); purple_debug_info("skypeweb", "destroying %d waiting connections\n", g_queue_get_length(sa->waiting_conns)); while (!g_queue_is_empty(sa->waiting_conns)) skypeweb_connection_destroy(g_queue_pop_tail(sa->waiting_conns)); g_queue_free(sa->waiting_conns); purple_debug_info("skypeweb", "destroying %d incomplete connections\n", g_slist_length(sa->conns)); while (sa->conns != NULL) skypeweb_connection_destroy(sa->conns->data); while (sa->dns_queries != NULL) { PurpleDnsQueryData *dns_query = sa->dns_queries->data; purple_debug_info("skypeweb", "canceling dns query for %s\n", purple_dnsquery_get_host(dns_query)); sa->dns_queries = g_slist_remove(sa->dns_queries, dns_query); purple_dnsquery_destroy(dns_query); } g_hash_table_destroy(sa->sent_messages_hash); g_hash_table_destroy(sa->cookie_table); g_hash_table_destroy(sa->hostname_ip_cache); g_free(sa->messages_host); g_free(sa->skype_token); g_free(sa->registration_token); g_free(sa->endpoint); g_free(sa->username); g_free(sa); }
static void cancel_conversation_timeouts(gpointer key, gpointer value, gpointer user_data) { CapStatistics *stats = value; if(stats->timeout_source_id != 0) { purple_timeout_remove(stats->timeout_source_id); stats->timeout_source_id = 0; } }
void msn_session_destroy (MsnSession *session) { if (!session) return; pn_oim_session_free (session->oim_session); purple_signal_disconnect (purple_conversations_get_handle(), "conversation-created", session, PURPLE_CALLBACK (conversation_created_cb)); if (session->connected) msn_session_disconnect (session); #if defined(PECAN_CVR) g_hash_table_destroy (session->links); #endif /* defined(PECAN_CVR) */ msn_notification_destroy (session->notification); pn_dp_manager_free (session->dp_manager); g_hash_table_destroy (session->conversations); g_hash_table_destroy (session->chats); pn_contactlist_destroy (session->contactlist); g_free (session->passport_info.kv); g_free (session->passport_info.sid); g_free (session->passport_info.mspauth); g_free (session->passport_info.client_ip); g_free (session->passport_info.mail_url); g_free (session->passport_cookie.t); g_free (session->passport_cookie.p); if (session->autoupdate_tune.timer) g_source_remove (session->autoupdate_tune.timer); if (session->sync) msn_sync_destroy (session->sync); if (session->nexus) msn_nexus_destroy (session->nexus); pn_contact_free (session->user); g_hash_table_destroy (session->config); g_free (session->username); g_free (session->password); #ifdef INTERNAL_MAINLOOP purple_timeout_remove (session->g_main_loop_timer); g_main_loop_unref (session->g_main_loop); #endif g_free (session); }
void msn_servconn_destroy(MsnServConn *servconn) { g_return_if_fail(servconn != NULL); if (servconn->processing) { servconn->wasted = TRUE; return; } msn_servconn_disconnect(servconn); if (servconn->destroy_cb) servconn->destroy_cb(servconn); if (servconn->httpconn != NULL) msn_httpconn_destroy(servconn->httpconn); g_free(servconn->host); purple_circ_buffer_destroy(servconn->tx_buf); if (servconn->tx_handler > 0) purple_input_remove(servconn->tx_handler); if (servconn->timeout_handle > 0) purple_timeout_remove(servconn->timeout_handle); msn_cmdproc_destroy(servconn->cmdproc); g_free(servconn); }
void nateon_transaction_destroy(NateonTransaction *trans) { g_return_if_fail(trans != NULL); g_free(trans->command); g_free(trans->params); g_free(trans->payload); #if 0 if (trans->pendent_cmd != NULL) nateon_message_unref(trans->pendent_msg); #endif #if 0 NateonTransaction *elem; if (trans->queue != NULL) { while ((elem = g_queue_pop_head(trans->queue)) != NULL) nateon_transaction_destroy(elem); g_queue_free(trans->queue); } #endif if (trans->callbacks != NULL && trans->has_custom_callbacks) g_hash_table_destroy(trans->callbacks); if (trans->timer) purple_timeout_remove(trans->timer); g_free(trans); }
static void hide_conv(PidginConversation *gtkconv, gboolean closetimer) { GList *list; purple_signal_emit(pidgin_conversations_get_handle(), "conversation-hiding", gtkconv); for (list = g_list_copy(gtkconv->convs); list; list = g_list_delete_link(list, list)) { PurpleConversation *conv = list->data; if (closetimer) { guint timer = GPOINTER_TO_INT(purple_conversation_get_data(conv, "close-timer")); if (timer) purple_timeout_remove(timer); timer = purple_timeout_add_seconds(CLOSE_CONV_TIMEOUT_SECS, close_already, conv); purple_conversation_set_data(conv, "close-timer", GINT_TO_POINTER(timer)); } #if 0 /* I will miss you */ purple_conversation_set_ui_ops(conv, NULL); #else pidgin_conv_window_remove_gtkconv(gtkconv->win, gtkconv); pidgin_conv_window_add_gtkconv(hidden_convwin, gtkconv); #endif } }
void skypeweb_do_all_the_things(SkypeWebAccount *sa) { if (!sa->username) { skypeweb_get_self_details(sa); } else if (sa->registration_token) { skypeweb_get_self_details(sa); if (sa->authcheck_timeout) purple_timeout_remove(sa->authcheck_timeout); skypeweb_check_authrequests(sa); sa->authcheck_timeout = purple_timeout_add_seconds(120, (GSourceFunc)skypeweb_check_authrequests, sa); purple_connection_set_state(sa->pc, PURPLE_CONNECTION_CONNECTED); skypeweb_get_friend_list(sa); skypeweb_poll(sa); skype_web_get_offline_history(sa); skypeweb_set_status(sa->account, purple_account_get_active_status(sa->account)); } else { //Too soon! skypeweb_get_registration_token(sa); } }
static gint delete_win_cb(GtkWidget *w, GdkEventAny *e, gpointer d) { PidginRoomlistDialog *dialog = d; if (dialog->roomlist && purple_roomlist_get_in_progress(dialog->roomlist)) purple_roomlist_cancel_get_list(dialog->roomlist); if (dialog->pg_update_to > 0) purple_timeout_remove(dialog->pg_update_to); if (dialog->roomlist) { PidginRoomlist *rl = dialog->roomlist->ui_data; if (dialog->pg_update_to > 0) /* yes, that's right, unref it twice. */ purple_roomlist_unref(dialog->roomlist); if (rl) rl->dialog = NULL; purple_roomlist_unref(dialog->roomlist); } dialog->progress = NULL; g_free(dialog); return FALSE; }
void jabber_bosh_connection_destroy(PurpleJabberBOSHConnection *conn) { if (conn == NULL || conn->is_terminating) return; conn->is_terminating = TRUE; if (conn->sid != NULL) { purple_debug_info("jabber-bosh", "Terminating a session for %p\n", conn); jabber_bosh_connection_send_now(conn); } purple_http_connection_set_destroy(conn->payload_reqs); conn->payload_reqs = NULL; if (conn->send_timer) purple_timeout_remove(conn->send_timer); purple_http_conn_cancel(conn->sc_req); conn->sc_req = NULL; purple_http_keepalive_pool_unref(conn->kapool); conn->kapool = NULL; g_string_free(conn->send_buff, TRUE); conn->send_buff = NULL; g_free(conn->sid); conn->sid = NULL; g_free(conn->url); conn->url = NULL; g_free(conn); }
void sipe_backend_schedule_cancel(SIPE_UNUSED_PARAMETER struct sipe_core_public *sipe_public, gpointer data) { struct purple_schedule *schedule = data; purple_timeout_remove(schedule->timeout_handler); g_free(schedule); }
static void tgp_msg_send_schedule (struct tgl_state *TLS, gchar *chunk, tgl_peer_id_t to) { g_queue_push_tail (tls_get_data (TLS)->out_messages, tgp_msg_sending_init (TLS, chunk, to)); if (tls_get_data (TLS)->out_timer) { purple_timeout_remove (tls_get_data (TLS)->out_timer); } tls_get_data (TLS)->out_timer = purple_timeout_add (0, tgp_msg_send_schedule_cb, tls_get_data (TLS)); }
/** * Logoff and deallocate a session. * * @param od Session to kill */ void oscar_data_destroy(OscarData *od) { aim_cleansnacs(od, -1); /* Only used when connecting with clientLogin */ if (od->url_data != NULL) purple_util_fetch_url_cancel(od->url_data); while (od->requesticon) { g_free(od->requesticon->data); od->requesticon = g_slist_delete_link(od->requesticon, od->requesticon); } g_free(od->email); g_free(od->newp); g_free(od->oldp); if (od->getblisttimer > 0) purple_timeout_remove(od->getblisttimer); while (od->oscar_connections != NULL) flap_connection_destroy(od->oscar_connections->data, OSCAR_DISCONNECT_DONE, NULL); while (od->peer_connections != NULL) peer_connection_destroy(od->peer_connections->data, OSCAR_DISCONNECT_LOCAL_CLOSED, NULL); aim__shutdownmodules(od); g_hash_table_destroy(od->buddyinfo); g_hash_table_destroy(od->handlerlist); g_free(od); }
void sevencup_connection_close(SevenCupConnection *scon) { scon->sa->conns = g_slist_remove(scon->sa->conns, scon); if (scon->connect_data != NULL) { purple_proxy_connect_cancel(scon->connect_data); scon->connect_data = NULL; } if (scon->ssl_conn != NULL) { purple_ssl_close(scon->ssl_conn); scon->ssl_conn = NULL; } if (scon->fd >= 0) { close(scon->fd); scon->fd = -1; } if (scon->input_watcher > 0) { purple_input_remove(scon->input_watcher); scon->input_watcher = 0; } purple_timeout_remove(scon->timeout_watcher); g_free(scon->rx_buf); scon->rx_buf = NULL; scon->rx_len = 0; }
//----------------------------------------------------------------------------- //static void PurpleIMChat::timeoutRemove( PurpleIMChatCallbackData* cbData ) { int waitTime = 1; int totalWaitTime = 0; while ( cbData->getCallbackId() == 0 ) { Thread::msleep( waitTime ); totalWaitTime += waitTime; #ifdef _WIN32 char msg[200]; sprintf_s( msg, "PurpleIMChat::timeoutRemove - waiting for valid callbackId. %d ms\n", totalWaitTime ); OutputDebugString( msg ); #endif } #ifdef _WIN32 if ( totalWaitTime > 0 ) { char msg[200]; sprintf_s( msg, "\n" ); OutputDebugString( msg ); } #endif purple_timeout_remove( cbData->getCallbackId() ); }
void flist_web_request_cancel(FListWebRequestData *req_data) { g_return_if_fail(req_data != NULL); purple_util_fetch_url_cancel(req_data->url_data); g_hash_table_remove(requests, req_data); purple_timeout_remove(req_data->timer); g_free(req_data); }
void purple_upnp_cancel_port_mapping(UPnPMappingAddRemove *ar) { GSList *l; /* Remove ar from discovery_callbacks if present; it was inserted after a cb. * The same cb may be in the list multiple times, so be careful to remove * the one associated with ar. */ l = discovery_callbacks; while (l) { GSList *next = l->next; if (next && (next->data == ar)) { discovery_callbacks = g_slist_delete_link(discovery_callbacks, next); next = l->next; discovery_callbacks = g_slist_delete_link(discovery_callbacks, l); } l = next; } if (ar->tima > 0) purple_timeout_remove(ar->tima); if (ar->gfud) purple_util_fetch_url_cancel(ar->gfud); g_free(ar); }
/* received-im-msg */ static void received_im_msg(PurpleAccount *account, char *sender, char *message, PurpleConversation *conv, PurpleMessageFlags flags) { PurpleBuddy *buddy; CapStatistics *stats; /* guint words = word_count(message); */ if (flags & PURPLE_MESSAGE_AUTO_RESP) return; buddy = purple_blist_find_buddy(account, sender); if (buddy == NULL) return; stats = get_stats_for(buddy); /* insert_word_count(sender, buddy_name, words); */ /* If we are waiting for a response from a prior message * then cancel the timeout callback. */ if(stats->timeout_source_id != 0) { purple_debug_info("cap", "Cancelling timeout callback\n"); purple_timeout_remove(stats->timeout_source_id); stats->timeout_source_id = 0; } insert_cap_success(stats); /* Reset the last_message value */ stats->last_message = -1; /* Reset the last status id value */ stats->last_message_status_id = NULL; }
static void end_user_display(MsnSlpCall *slpcall, MsnSession *session) { MsnUserList *userlist; g_return_if_fail(session != NULL); if (purple_debug_is_verbose()) purple_debug_info("msn", "End User Display\n"); userlist = session->userlist; /* If the session is being destroyed we better stop doing anything. */ if (session->destroying) return; /* Delay before freeing a buddy icon window slot and requesting the next icon, if appropriate. * If we don't delay, we'll rapidly hit the MSN equivalent of AIM's rate limiting; the server will * send us an error 800 like so: * * C: NS 000: XFR 21 SB * S: NS 000: 800 21 */ if (userlist->buddy_icon_request_timer) { /* Free the window slot used by this previous request */ userlist->buddy_icon_window++; /* Clear our pending timeout */ purple_timeout_remove(userlist->buddy_icon_request_timer); } /* Wait BUDDY_ICON_DELAY s before freeing our window slot and requesting the next icon. */ userlist->buddy_icon_request_timer = purple_timeout_add_seconds(BUDDY_ICON_DELAY, msn_release_buddy_icon_request_timeout, userlist); }
static gboolean purple_upnp_discover_timeout(gpointer data) { UPnPDiscoveryData* dd = data; if (dd->inpa) purple_input_remove(dd->inpa); if (dd->tima > 0) purple_timeout_remove(dd->tima); dd->inpa = 0; dd->tima = 0; if (dd->retry_count < NUM_UDP_ATTEMPTS) { /* TODO: We probably shouldn't be incrementing retry_count in two places */ dd->retry_count++; purple_upnp_discover_send_broadcast(dd); } else { if (dd->fd != -1) close(dd->fd); control_info.status = PURPLE_UPNP_STATUS_UNABLE_TO_DISCOVER; control_info.lookup_time = time(NULL); control_info.service_type[0] = '\0'; g_free(control_info.control_url); control_info.control_url = NULL; fire_discovery_callbacks(FALSE); g_free(dd); } return FALSE; }
/* * This callback will be called when we're the server * and somebody has connected to us in DC_INCOMING_TIMEOUT seconds. */ static void msn_dc_incoming_connection_cb(gpointer data, gint listenfd, PurpleInputCondition cond) { MsnDirectConn *dc = data; if (purple_debug_is_verbose()) purple_debug_info("msn", "msn_dc_incoming_connection_cb %p\n", dc); g_return_if_fail(dc != NULL); if (dc->connect_timeout_handle != 0) { purple_timeout_remove(dc->connect_timeout_handle); dc->connect_timeout_handle = 0; } if (dc->listenfd_handle != 0) { purple_input_remove(dc->listenfd_handle); dc->listenfd_handle = 0; } dc->fd = accept(listenfd, NULL, 0); purple_network_remove_port_mapping(dc->listenfd); close(dc->listenfd); dc->listenfd = -1; if (dc->fd != -1) { msn_dc_init(dc); dc->state = DC_STATE_FOO; } }
static void msn_soap_connection_sanitize(MsnSoapConnection *conn, gboolean disconnect) { if (conn->event_handle) { purple_input_remove(conn->event_handle); conn->event_handle = 0; } if (conn->run_timer) { purple_timeout_remove(conn->run_timer); conn->run_timer = 0; } if (conn->message) { msn_soap_message_destroy(conn->message); conn->message = NULL; } if (conn->buf) { g_string_free(conn->buf, TRUE); conn->buf = NULL; } if (conn->ssl && (disconnect || conn->close_when_done)) { purple_ssl_close(conn->ssl); conn->ssl = NULL; } if (conn->current_request) { msn_soap_request_destroy(conn->current_request, FALSE); conn->current_request = NULL; } }
void msn_userlist_destroy(MsnUserList *userlist) { GList *l; for (l = userlist->users; l != NULL; l = l->next) { msn_user_destroy(l->data); } g_list_free(userlist->users); for (l = userlist->groups; l != NULL; l = l->next) { msn_group_destroy(l->data); } g_list_free(userlist->groups); g_queue_free(userlist->buddy_icon_requests); if (userlist->buddy_icon_request_timer) purple_timeout_remove(userlist->buddy_icon_request_timer); g_free(userlist); }
void msn_session_destroy (MsnSession *session) { if (!session) return; pn_oim_session_free (session->oim_session); pn_service_session_free (session->service_session); pn_roaming_session_free (session->roaming_session); g_free (session->cid); g_free (session->machineguid); if (session->connected) msn_session_disconnect (session); #if defined(PECAN_CVR) g_hash_table_destroy (session->links); #endif /* defined(PECAN_CVR) */ msn_notification_destroy (session->notification); pn_dp_manager_free (session->dp_manager); g_hash_table_destroy (session->conversations); g_hash_table_destroy (session->chats); pn_contactlist_destroy (session->contactlist); g_free (session->passport_info.kv); g_free (session->passport_info.sid); g_free (session->passport_info.mspauth); g_free (session->passport_info.client_ip); g_free (session->passport_info.mail_url); g_free (session->passport_cookie.t); g_free (session->passport_cookie.p); if (session->autoupdate_tune.timer) g_source_remove (session->autoupdate_tune.timer); if (session->auth) pn_auth_free (session->auth); pn_contact_free (session->user); g_hash_table_destroy (session->config); g_free (session->username); g_free (session->password); #ifdef INTERNAL_MAINLOOP purple_timeout_remove (session->g_main_loop_timer); g_main_loop_unref (session->g_main_loop); #endif g_free (session); }
static gboolean plugin_unload (PurplePlugin * plugin) { purple_timeout_remove(spotify_handle); spotify_free(spot); purple_util_set_current_song (NULL, NULL, NULL); return TRUE; }
static void destroy_toaster(GntToast *toast) { toasters = g_list_remove(toasters, toast); gnt_widget_destroy(toast->window); purple_timeout_remove(toast->timer); g_free(toast); }
/* * We mute sounds for the 10 seconds after you log in so that * you don't get flooded with sounds when the blist shows all * your buddies logging in. */ static void account_signon_cb(PurpleConnection *gc, gpointer data) { if (mute_login_sounds_timeout != 0) purple_timeout_remove(mute_login_sounds_timeout); mute_login_sounds = TRUE; mute_login_sounds_timeout = purple_timeout_add_seconds(10, unmute_login_sounds_cb, NULL); }
/* the callback function after socket is built * we setup the qq protocol related configuration here */ static void connect_cb(gpointer data, gint source, const gchar *error_message) { PurpleConnection *gc; qq_data *qd; qq_connection *conn; gc = (PurpleConnection *) data; g_return_if_fail(gc != NULL && gc->proto_data != NULL); qd = (qq_data *) gc->proto_data; /* conn_data will be destoryed */ qd->conn_data = NULL; if (!PURPLE_CONNECTION_IS_VALID(gc)) { purple_debug_info("QQ_CONN", "Invalid connection\n"); close(source); return; } if (source < 0) { /* socket returns -1 */ purple_debug_info("QQ_CONN", "Could not establish a connection with the server:\n%s\n", error_message); if (qd->connect_watcher > 0) purple_timeout_remove(qd->connect_watcher); qd->connect_watcher = purple_timeout_add_seconds(QQ_CONNECT_INTERVAL, qq_connect_later, gc); return; } /* _qq_show_socket("Got login socket", source); */ /* ok, already connected to the server */ qd->fd = source; conn = connection_create(qd, source); g_return_if_fail( conn != NULL ); if (qd->use_tcp) { /* events which match "PURPLE_INPUT_READ" of * "source" would trigger the callback function */ conn->input_handler = purple_input_add(source, PURPLE_INPUT_READ, tcp_pending, gc); } else { conn->input_handler = purple_input_add(source, PURPLE_INPUT_READ, udp_pending, gc); } g_return_if_fail(qd->network_watcher == 0); qd->network_watcher = purple_timeout_add_seconds(qd->itv_config.resend, network_timeout, gc); set_all_keys( gc ); if (qd->client_version >= 2007) { purple_connection_update_progress(gc, _("Getting server"), 2, QQ_CONNECT_STEPS); /* touch required */ qq_request_get_server(gc); return; } purple_connection_update_progress(gc, _("Requesting token"), 2, QQ_CONNECT_STEPS); qq_request_token(gc); }
/* clean up the given QQ connection and free all resources */ static void qq_close(PurpleConnection *gc) { qq_data *qd; guint8 i; g_return_if_fail(gc != NULL && gc->proto_data); qd = gc->proto_data; if (qd->check_watcher > 0) { purple_timeout_remove(qd->check_watcher); qd->check_watcher = 0; } if (qd->connect_watcher > 0) { purple_timeout_remove(qd->connect_watcher); qd->connect_watcher = 0; } /* This is cancelled by _purple_connection_destroy */ qd->conn_data = NULL; qq_disconnect(gc); if (qd->redirect) g_free(qd->redirect); if (qd->ld.token_touch) g_free(qd->ld.token_touch); if (qd->ld.token_captcha) g_free(qd->ld.token_captcha); if (qd->captcha.token) g_free(qd->captcha.token); if (qd->captcha.data) g_free(qd->captcha.data); if (qd->ld.token_auth) { for (i=0; i<4; ++i) if (qd->ld.token_auth[i]) g_free(qd->ld.token_auth[i]); g_free(qd->ld.token_auth); } if (qd->ld.token_verify) { for (i=0; i<3; ++i) if (qd->ld.token_verify[i]) g_free(qd->ld.token_verify[i]); if (qd->ld.token_verify) g_free(qd->ld.token_verify); } if (qd->ld.token_login) g_free(qd->ld.token_login); if (qd->ld.token_verify_de) g_free(qd->ld.token_verify_de); server_list_remove_all(qd); g_free(qd); gc->proto_data = NULL; }