1
0
mirror of https://github.com/profanity-im/profanity.git synced 2024-12-04 14:46:46 -05:00

Merge branch 'master' into osx-functional

This commit is contained in:
James Booth 2016-01-03 17:29:13 +00:00
commit e8e4219741
4 changed files with 27 additions and 15 deletions

View File

@ -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;
}

View File

@ -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)
{

View File

@ -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);

View File

@ -149,6 +149,7 @@ void
sv_ev_lost_connection(void)
{
cons_show_error("Lost connection.");
roster_clear();
muc_invites_clear();
chat_sessions_clear();