void sv_ev_lost_connection(void) { cons_show_error("Lost connection."); #ifdef HAVE_LIBOTR GSList *recipients = wins_get_chat_recipients(); GSList *curr = recipients; while (curr) { char *barejid = curr->data; ProfChatWin *chatwin = wins_get_chat(barejid); if (chatwin && otr_is_secure(barejid)) { chatwin_otr_unsecured(chatwin); otr_end_session(barejid); } curr = g_slist_next(curr); } if (recipients) { g_slist_free(recipients); } #endif muc_invites_clear(); chat_sessions_clear(); ui_disconnected(); roster_destroy(); #ifdef HAVE_LIBGPGME p_gpg_on_disconnect(); #endif }
void api_encryption_reset(const char *const barejid) { if (barejid == NULL) { log_warning("%s", "api_encryption_reset failed, barejid is NULL"); return; } ProfChatWin *chatwin = wins_get_chat(barejid); if (chatwin == NULL) { log_warning("%s", "api_encryption_reset failed, could not find chat window for %s", barejid); return; } #ifdef HAVE_LIBGPGME if (chatwin->pgp_send) { chatwin->pgp_send = FALSE; win_println((ProfWin*)chatwin, THEME_DEFAULT, '!', "PGP encryption disabled."); } #endif #ifdef HAVE_LIBOTR if (chatwin->is_otr) { chatwin_otr_unsecured(chatwin); otr_end_session(chatwin->barejid); } #endif }
void sv_ev_contact_offline(char *barejid, char *resource, char *status) { gboolean updated = roster_contact_offline(barejid, resource, status); if (resource && updated) { ui_contact_offline(barejid, resource, status); } #ifdef PROF_HAVE_LIBOTR ProfChatWin *chatwin = wins_get_chat(barejid); if (chatwin && otr_is_secure(barejid)) { chatwin_otr_unsecured(chatwin); otr_end_session(chatwin->barejid); } #endif rosterwin_roster(); chat_session_remove(barejid); }
void ui_close_connected_win(int index) { ProfWin *window = wins_get_by_num(index); if (window) { if (window->type == WIN_MUC) { ProfMucWin *mucwin = (ProfMucWin*) window; assert(mucwin->memcheck == PROFMUCWIN_MEMCHECK); presence_leave_chat_room(mucwin->roomjid); muc_leave(mucwin->roomjid); ui_leave_room(mucwin->roomjid); } else if (window->type == WIN_CHAT) { ProfChatWin *chatwin = (ProfChatWin*) window; assert(chatwin->memcheck == PROFCHATWIN_MEMCHECK); #ifdef HAVE_LIBOTR if (chatwin->is_otr) { otr_end_session(chatwin->barejid); } #endif chat_state_gone(chatwin->barejid, chatwin->state); chat_session_remove(chatwin->barejid); } } }