about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorJames Booth <boothj5@gmail.com>2016-05-06 01:51:58 +0100
committerJames Booth <boothj5@gmail.com>2016-05-06 01:51:58 +0100
commit579d062063719ebd3a07f6ff0d90fa6de2bb8c1e (patch)
tree5dd85b46c8c9e485bae91973b147fb0caa5d5cbe
parentb6c4a2029ff34a8f0824c5241508fbd550044c21 (diff)
downloadprofani-tty-579d062063719ebd3a07f6ff0d90fa6de2bb8c1e.tar.gz
Move send stanza function
-rw-r--r--src/command/commands.c2
-rw-r--r--src/plugins/api.c2
-rw-r--r--src/xmpp/connection.c11
-rw-r--r--src/xmpp/session.c11
-rw-r--r--src/xmpp/xmpp.h3
-rw-r--r--tests/unittests/xmpp/stub_xmpp.c2
6 files changed, 15 insertions, 16 deletions
diff --git a/src/command/commands.c b/src/command/commands.c
index b7314871..47a3982f 100644
--- a/src/command/commands.c
+++ b/src/command/commands.c
@@ -150,7 +150,7 @@ cmd_execute_default(ProfWin *window, const char *inp)
     }
     case WIN_XML:
     {
-        session_send_stanza(inp);
+        connection_send_stanza(inp);
         break;
     }
     default:
diff --git a/src/plugins/api.c b/src/plugins/api.c
index 5ca5d6b9..0a4b04af 100644
--- a/src/plugins/api.c
+++ b/src/plugins/api.c
@@ -381,7 +381,7 @@ api_win_show_themed(const char *tag, const char *const group, const char *const
 int
 api_send_stanza(const char *const stanza)
 {
-    return session_send_stanza(stanza);
+    return connection_send_stanza(stanza);
 }
 
 gboolean
diff --git a/src/xmpp/connection.c b/src/xmpp/connection.c
index 377d5238..9f84597b 100644
--- a/src/xmpp/connection.c
+++ b/src/xmpp/connection.c
@@ -300,6 +300,17 @@ connection_conn_is_secured(void)
     }
 }
 
+gboolean
+connection_send_stanza(const char *const stanza)
+{
+    if (conn.conn_status != JABBER_CONNECTED) {
+        return FALSE;
+    } else {
+        xmpp_send_raw_string(conn.conn, "%s", stanza);
+        return TRUE;
+    }
+}
+
 static void
 _connection_handler(xmpp_conn_t *const conn, const xmpp_conn_event_t status, const int error,
     xmpp_stream_error_t *const stream_error, void *const userdata)
diff --git a/src/xmpp/session.c b/src/xmpp/session.c
index 75c5f20e..6aa27035 100644
--- a/src/xmpp/session.c
+++ b/src/xmpp/session.c
@@ -401,17 +401,6 @@ session_login_failed(void)
     }
 }
 
-gboolean
-session_send_stanza(const char *const stanza)
-{
-    if (connection_get_status() != JABBER_CONNECTED) {
-        return FALSE;
-    } else {
-        xmpp_send_raw_string(connection_get_conn(), "%s", stanza);
-        return TRUE;
-    }
-}
-
 void
 session_lost_connection(void)
 {
diff --git a/src/xmpp/xmpp.h b/src/xmpp/xmpp.h
index 391ec37d..dbea4e40 100644
--- a/src/xmpp/xmpp.h
+++ b/src/xmpp/xmpp.h
@@ -119,9 +119,7 @@ void session_shutdown(void);
 void session_process_events(int millis);
 char* session_get_account_name(void);
 GList* session_get_available_resources(void);
-gboolean session_send_stanza(const char *const stanza);
 
-gboolean session_send_stanza(const char *const stanza);
 gboolean session_service_supports(const char *const feature);
 
 jabber_conn_status_t connection_get_status(void);
@@ -133,6 +131,7 @@ void connection_free_uuid(char *uuid);
 TLSCertificate* connection_get_tls_peer_cert(void);
 #endif
 gboolean connection_conn_is_secured(void);
+gboolean connection_send_stanza(const char *const stanza);
 
 char* message_send_chat(const char *const barejid, const char *const msg, const char *const oob_url);
 char* message_send_chat_otr(const char *const barejid, const char *const msg);
diff --git a/tests/unittests/xmpp/stub_xmpp.c b/tests/unittests/xmpp/stub_xmpp.c
index a4cfe020..45fbf0ef 100644
--- a/tests/unittests/xmpp/stub_xmpp.c
+++ b/tests/unittests/xmpp/stub_xmpp.c
@@ -77,7 +77,7 @@ GList * session_get_available_resources(void)
 }
 
 gboolean
-session_send_stanza(const char *const stanza)
+connection_send_stanza(const char *const stanza)
 {
     return TRUE;
 }