mirror of
https://github.com/profanity-im/profanity.git
synced 2024-11-03 19:37:16 -05:00
Add cl_ev_disconnect
This commit is contained in:
parent
03f63a912e
commit
8e9bf08389
@ -984,24 +984,13 @@ cmd_sub(ProfWin *window, const char *const command, gchar **args)
|
||||
gboolean
|
||||
cmd_disconnect(ProfWin *window, const char *const command, gchar **args)
|
||||
{
|
||||
if (jabber_get_connection_status() == JABBER_CONNECTED) {
|
||||
char *jid = strdup(jabber_get_fulljid());
|
||||
cons_show("%s logged out successfully.", jid);
|
||||
jabber_disconnect();
|
||||
roster_clear();
|
||||
muc_invites_clear();
|
||||
chat_sessions_clear();
|
||||
tlscerts_clear_current();
|
||||
ui_disconnected();
|
||||
ui_close_all_wins();
|
||||
#ifdef HAVE_LIBGPGME
|
||||
p_gpg_on_disconnect();
|
||||
#endif
|
||||
free(jid);
|
||||
} else {
|
||||
if (jabber_get_connection_status() != JABBER_CONNECTED) {
|
||||
cons_show("You are not currently connected.");
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
cl_ev_disconnect();
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
@ -41,6 +41,8 @@
|
||||
#include "ui/ui.h"
|
||||
#include "window_list.h"
|
||||
#include "xmpp/xmpp.h"
|
||||
#include "roster_list.h"
|
||||
#include "chat_session.h"
|
||||
#ifdef HAVE_LIBOTR
|
||||
#include "otr/otr.h"
|
||||
#endif
|
||||
@ -65,6 +67,24 @@ cl_ev_connect_account(ProfAccount *account)
|
||||
return jabber_connect_with_account(account);
|
||||
}
|
||||
|
||||
void
|
||||
cl_ev_disconnect(void)
|
||||
{
|
||||
const char *jid = jabber_get_fulljid();
|
||||
cons_show("%s logged out successfully.", jid);
|
||||
|
||||
jabber_disconnect();
|
||||
roster_clear();
|
||||
muc_invites_clear();
|
||||
chat_sessions_clear();
|
||||
tlscerts_clear_current();
|
||||
ui_disconnected();
|
||||
ui_close_all_wins();
|
||||
#ifdef HAVE_LIBGPGME
|
||||
p_gpg_on_disconnect();
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
cl_ev_presence_send(const resource_presence_t presence_type, const char *const msg, const int idle_secs)
|
||||
{
|
||||
|
@ -38,6 +38,8 @@
|
||||
jabber_conn_status_t cl_ev_connect_jid(const char *const jid, const char *const passwd, const char *const altdomain, const int port, const char *const tls_policy);
|
||||
jabber_conn_status_t cl_ev_connect_account(ProfAccount *account);
|
||||
|
||||
void cl_ev_disconnect(void);
|
||||
|
||||
void cl_ev_presence_send(const resource_presence_t presence_type, const char *const msg, const int idle_secs);
|
||||
|
||||
void cl_ev_send_msg(ProfChatWin *chatwin, const char *const msg);
|
||||
|
@ -149,6 +149,7 @@ void
|
||||
sv_ev_lost_connection(void)
|
||||
{
|
||||
cons_show_error("Lost connection.");
|
||||
|
||||
roster_clear();
|
||||
muc_invites_clear();
|
||||
chat_sessions_clear();
|
||||
|
Loading…
Reference in New Issue
Block a user