about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorJames Booth <boothj5@gmail.com>2015-05-07 23:21:48 +0100
committerJames Booth <boothj5@gmail.com>2015-05-07 23:21:48 +0100
commitd853284f92fb93067b724446f256cefcccd4b67c (patch)
treef07aa61cbb37b2b4ec7d7d2628fc0839fe9db5d4
parent56cbce2ff3d1d1de4f3cd1661a719773c0c915f0 (diff)
downloadprofani-tty-d853284f92fb93067b724446f256cefcccd4b67c.tar.gz
Added cl_ev_presence_send
-rw-r--r--src/command/commands.c6
-rw-r--r--src/event/client_events.c6
-rw-r--r--src/event/client_events.h2
-rw-r--r--src/profanity.c9
-rw-r--r--src/xmpp/roster.c3
5 files changed, 18 insertions, 8 deletions
diff --git a/src/command/commands.c b/src/command/commands.c
index 4608b7de..0c341880 100644
--- a/src/command/commands.c
+++ b/src/command/commands.c
@@ -507,7 +507,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);
@@ -3808,7 +3808,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);
@@ -4330,7 +4330,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
@@ -61,6 +61,12 @@ cl_ev_connect_account(ProfAccount *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)
 {
     chat_state_active(chatwin->state);
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 2472006c..55a73430 100644
--- a/src/profanity.c
+++ b/src/profanity.c
@@ -63,6 +63,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);
@@ -172,12 +173,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);
@@ -191,10 +192,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;
 }