diff --git a/src/command/commands.c b/src/command/commands.c index dfc55c15..dc7db4a3 100644 --- a/src/command/commands.c +++ b/src/command/commands.c @@ -514,7 +514,7 @@ cmd_account(gchar **args, struct cmd_help_t help) if (presence_type == last_presence) { char *message = jabber_get_presence_message(); - presence_send(last_presence, message, 0); + cl_ev_presence_send(last_presence, message, 0); } } cons_show("Updated %s priority for account %s: %s", property, account_name, value); @@ -3819,7 +3819,7 @@ cmd_priority(gchar **args, struct cmd_help_t help) if (res) { accounts_set_priority_all(jabber_get_account_name(), intval); resource_presence_t last_presence = accounts_get_last_presence(jabber_get_account_name()); - presence_send(last_presence, jabber_get_presence_message(), 0); + cl_ev_presence_send(last_presence, jabber_get_presence_message(), 0); cons_show("Priority set to %d.", intval); } else { cons_show(err_msg); @@ -4396,7 +4396,7 @@ _update_presence(const resource_presence_t resource_presence, if (conn_status != JABBER_CONNECTED) { cons_show("You are not currently connected."); } else { - presence_send(resource_presence, msg, 0); + cl_ev_presence_send(resource_presence, msg, 0); ui_update_presence(resource_presence, msg, show); } } diff --git a/src/event/client_events.c b/src/event/client_events.c index db8f6497..f0f763a6 100644 --- a/src/event/client_events.c +++ b/src/event/client_events.c @@ -60,6 +60,12 @@ cl_ev_connect_account(ProfAccount *account) return jabber_connect_with_account(account); } +void +cl_ev_presence_send(const resource_presence_t presence_type, const char * const msg, const int idle) +{ + presence_send(presence_type, msg, idle); +} + void cl_ev_send_msg(ProfChatWin *chatwin, const char * const msg) { diff --git a/src/event/client_events.h b/src/event/client_events.h index a7ecc583..207299c5 100644 --- a/src/event/client_events.h +++ b/src/event/client_events.h @@ -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); jabber_conn_status_t cl_ev_connect_account(ProfAccount *account); +void cl_ev_presence_send(const resource_presence_t presence_type, const char * const msg, const int idle); + void cl_ev_send_msg(ProfChatWin *chatwin, const char * const msg); void cl_ev_send_muc_msg(ProfMucWin *mucwin, const char * const msg); void cl_ev_send_priv_msg(ProfPrivateWin *privwin, const char * const msg); diff --git a/src/profanity.c b/src/profanity.c index 03559690..277fe4ad 100644 --- a/src/profanity.c +++ b/src/profanity.c @@ -66,6 +66,7 @@ #include "xmpp/xmpp.h" #include "ui/ui.h" #include "ui/windows.h" +#include "event/client_events.h" static void _check_autoaway(void); static void _init(const int disable_tls, char *log_level); @@ -175,12 +176,12 @@ _check_autoaway() // handle away mode if (strcmp(pref_autoaway_mode, "away") == 0) { - presence_send(RESOURCE_AWAY, pref_autoaway_message, 0); + cl_ev_presence_send(RESOURCE_AWAY, pref_autoaway_message, 0); ui_auto_away(); // handle idle mode } else if (strcmp(pref_autoaway_mode, "idle") == 0) { - presence_send(RESOURCE_ONLINE, pref_autoaway_message, idle_ms / 1000); + cl_ev_presence_send(RESOURCE_ONLINE, pref_autoaway_message, idle_ms / 1000); } prefs_free_string(pref_autoaway_message); @@ -194,10 +195,10 @@ _check_autoaway() // handle check if (prefs_get_boolean(PREF_AUTOAWAY_CHECK)) { if (strcmp(pref_autoaway_mode, "away") == 0) { - presence_send(RESOURCE_ONLINE, NULL, 0); + cl_ev_presence_send(RESOURCE_ONLINE, NULL, 0); ui_end_auto_away(); } else if (strcmp(pref_autoaway_mode, "idle") == 0) { - presence_send(RESOURCE_ONLINE, NULL, 0); + cl_ev_presence_send(RESOURCE_ONLINE, NULL, 0); ui_titlebar_presence(CONTACT_ONLINE); } } diff --git a/src/xmpp/roster.c b/src/xmpp/roster.c index 9ee4ec86..5c9fa5d4 100644 --- a/src/xmpp/roster.c +++ b/src/xmpp/roster.c @@ -43,6 +43,7 @@ #include "profanity.h" #include "ui/ui.h" #include "event/server_events.h" +#include "event/client_events.h" #include "tools/autocomplete.h" #include "xmpp/connection.h" #include "xmpp/roster.h" @@ -331,7 +332,7 @@ _roster_result_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza, v sv_ev_roster_received(); resource_presence_t conn_presence = accounts_get_login_presence(jabber_get_account_name()); - presence_send(conn_presence, NULL, 0); + cl_ev_presence_send(conn_presence, NULL, 0); return 1; }