1
0
mirror of https://github.com/profanity-im/profanity.git synced 2024-09-29 19:56:07 -04:00

Merge branch 'master' into plugins

Conflicts:
	src/command/commands.c
	src/event/client_events.c
This commit is contained in:
James Booth 2016-01-03 17:26:48 +00:00
commit 4b70f9e43f
4 changed files with 27 additions and 15 deletions

View File

@ -992,24 +992,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 PROF_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 PROF_HAVE_LIBOTR
#include "otr/otr.h"
#endif
@ -66,6 +68,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 PROF_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

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