void _free_alias(ProfAlias *alias) { FREE_SET_NULL(alias->name); FREE_SET_NULL(alias->value); FREE_SET_NULL(alias); }
void connection_set_disconnected(void) { FREE_SET_NULL(conn.presence_message); FREE_SET_NULL(conn.domain); conn.conn_status = JABBER_DISCONNECTED; }
void jabber_disconnect(void) { // if connected, send end stream and wait for response if (jabber_conn.conn_status == JABBER_CONNECTED) { char *account_name = jabber_get_account_name(); const char *fulljid = jabber_get_fulljid(); plugins_on_disconnect(account_name, fulljid); log_info("Closing connection"); accounts_set_last_activity(jabber_get_account_name()); jabber_conn.conn_status = JABBER_DISCONNECTING; xmpp_disconnect(jabber_conn.conn); while (jabber_get_connection_status() == JABBER_DISCONNECTING) { jabber_process_events(10); } _connection_free_saved_account(); _connection_free_saved_details(); _connection_free_session_data(); if (jabber_conn.conn) { xmpp_conn_release(jabber_conn.conn); jabber_conn.conn = NULL; } if (jabber_conn.ctx) { xmpp_ctx_free(jabber_conn.ctx); jabber_conn.ctx = NULL; } } jabber_conn.conn_status = JABBER_STARTED; FREE_SET_NULL(jabber_conn.presence_message); FREE_SET_NULL(jabber_conn.domain); }
static void _jabber_disconnect(void) { // if connected, send end stream and wait for response if (jabber_conn.conn_status == JABBER_CONNECTED) { log_info("Closing connection"); jabber_conn.conn_status = JABBER_DISCONNECTING; xmpp_disconnect(jabber_conn.conn); while (jabber_get_connection_status() == JABBER_DISCONNECTING) { jabber_process_events(); } _connection_free_saved_account(); _connection_free_saved_details(); _connection_free_session_data(); if (jabber_conn.conn != NULL) { xmpp_conn_release(jabber_conn.conn); jabber_conn.conn = NULL; } if (jabber_conn.ctx != NULL) { xmpp_ctx_free(jabber_conn.ctx); jabber_conn.ctx = NULL; } } jabber_conn.conn_status = JABBER_STARTED; FREE_SET_NULL(jabber_conn.presence_message); FREE_SET_NULL(jabber_conn.domain); }
void jabber_autoping_fail(void) { if (jabber_conn.conn_status == JABBER_CONNECTED) { log_info("Closing connection"); char *account_name = jabber_get_account_name(); const char *fulljid = jabber_get_fulljid(); plugins_on_disconnect(account_name, fulljid); accounts_set_last_activity(jabber_get_account_name()); jabber_conn.conn_status = JABBER_DISCONNECTING; xmpp_disconnect(jabber_conn.conn); while (jabber_get_connection_status() == JABBER_DISCONNECTING) { jabber_process_events(10); } if (jabber_conn.conn) { xmpp_conn_release(jabber_conn.conn); jabber_conn.conn = NULL; } if (jabber_conn.ctx) { xmpp_ctx_free(jabber_conn.ctx); jabber_conn.ctx = NULL; } } FREE_SET_NULL(jabber_conn.presence_message); FREE_SET_NULL(jabber_conn.domain); jabber_conn.conn_status = JABBER_DISCONNECTED; _jabber_lost_connection(); }
void _connection_free_saved_details(void) { FREE_SET_NULL(saved_details.name); FREE_SET_NULL(saved_details.jid); FREE_SET_NULL(saved_details.passwd); FREE_SET_NULL(saved_details.altdomain); }
void p_contact_set_name(const PContact contact, const char *const name) { FREE_SET_NULL(contact->name); FREE_SET_NULL(contact->name_collate_key); if (name) { contact->name = strdup(name); contact->name_collate_key = g_utf8_collate_key(contact->name, -1); } }
void p_contact_set_name(const PContact contact, const char * const name) { if (contact->name != NULL) { FREE_SET_NULL(contact->name); } if (name != NULL) { contact->name = strdup(name); } else { FREE_SET_NULL(contact->name); } }
void prof_run(const int disable_tls, char *log_level, char *account_name) { _init(disable_tls, log_level); _connect_default(account_name); ui_update(); char *line = NULL; gboolean cmd_result = TRUE; log_info("Starting main event loop"); while(cmd_result) { while(!line) { _check_autoaway(); line = ui_readline(); #ifdef HAVE_LIBOTR otr_poll(); #endif notify_remind(); jabber_process_events(); ui_update(); } cmd_result = cmd_process_input(line); ui_input_clear(); FREE_SET_NULL(line); } }
void connection_set_presence_msg(const char *const message) { FREE_SET_NULL(conn.presence_message); if (message) { conn.presence_message = strdup(message); } }
void p_contact_set_subscription(const PContact contact, const char * const subscription) { FREE_SET_NULL(contact->subscription); if (subscription != NULL) { contact->subscription = strdup(subscription); } }
void connection_set_presence_message(const char * const message) { FREE_SET_NULL(jabber_conn.presence_message); if (message != NULL) { jabber_conn.presence_message = strdup(message); } }
void p_contact_free(PContact contact) { FREE_SET_NULL(contact->barejid); FREE_SET_NULL(contact->name); FREE_SET_NULL(contact->subscription); FREE_SET_NULL(contact->offline_message); if (contact->groups != NULL) { g_slist_free_full(contact->groups, g_free); } if (contact->last_activity != NULL) { g_date_time_unref(contact->last_activity); } g_hash_table_destroy(contact->available_resources); FREE_SET_NULL(contact); }
void jid_destroy(Jid *jid) { FREE_SET_NULL(jid->localpart); FREE_SET_NULL(jid->domainpart); FREE_SET_NULL(jid->resourcepart); FREE_SET_NULL(jid->barejid); FREE_SET_NULL(jid->fulljid); FREE_SET_NULL(jid); }
void ui_contact_offline(char *barejid, char *resource, char *status) { char *show_console = prefs_get_string(PREF_STATUSES_CONSOLE); char *show_chat_win = prefs_get_string(PREF_STATUSES_CHAT); Jid *jid = jid_create_from_bare_and_resource(barejid, resource); PContact contact = roster_get_contact(barejid); if (p_contact_subscription(contact)) { if (strcmp(p_contact_subscription(contact), "none") != 0) { // show in console if "all" if (g_strcmp0(show_console, "all") == 0) { cons_show_contact_offline(contact, resource, status); // show in console of "online" } else if (g_strcmp0(show_console, "online") == 0) { cons_show_contact_offline(contact, resource, status); } // show in chat win if "all" if (g_strcmp0(show_chat_win, "all") == 0) { ProfChatWin *chatwin = wins_get_chat(barejid); if (chatwin) { chatwin_contact_offline(chatwin, resource, status); } // show in chat win if "online" and presence online } else if (g_strcmp0(show_chat_win, "online") == 0) { ProfChatWin *chatwin = wins_get_chat(barejid); if (chatwin) { chatwin_contact_offline(chatwin, resource, status); } } } } ProfChatWin *chatwin = wins_get_chat(barejid); if (chatwin && chatwin->resource_override && (g_strcmp0(resource, chatwin->resource_override) == 0)) { FREE_SET_NULL(chatwin->resource_override); } prefs_free_string(show_console); prefs_free_string(show_chat_win); jid_destroy(jid); }
void _connection_free_saved_account(void) { FREE_SET_NULL(saved_account.name); FREE_SET_NULL(saved_account.passwd); }