about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorJames Booth <boothj5@gmail.com>2013-12-22 23:07:41 +0000
committerJames Booth <boothj5@gmail.com>2013-12-22 23:13:05 +0000
commit581f58e47f0b52b60b0aa7ec6746c7bd1d24e6ee (patch)
treedc3f8fb77295cd7433f41bbcc7ac9dfa91924d09
parent5a5b1340aa799ee1d56961123a4770ebadb287bc (diff)
downloadprofani-tty-581f58e47f0b52b60b0aa7ec6746c7bd1d24e6ee.tar.gz
Bind jabber functions in main.c
-rw-r--r--src/main.c9
-rw-r--r--src/ui/core.c1
-rw-r--r--src/xmpp/connection.c31
-rw-r--r--src/xmpp/xmpp.h2
4 files changed, 29 insertions, 14 deletions
diff --git a/src/main.c b/src/main.c
index c3065bd3..4c733daf 100644
--- a/src/main.c
+++ b/src/main.c
@@ -29,11 +29,19 @@
 
 #include "profanity.h"
 
+#include "xmpp/xmpp.h"
+
 static gboolean disable_tls = FALSE;
 static gboolean version = FALSE;
 static char *log = "INFO";
 static char *account_name = NULL;
 
+static void
+_init_modules(void)
+{
+    jabber_init_module();
+}
+
 int
 main(int argc, char **argv)
 {
@@ -79,6 +87,7 @@ main(int argc, char **argv)
         return 0;
     }
 
+    _init_modules();
     prof_run(disable_tls, log, account_name);
 
     return 0;
diff --git a/src/ui/core.c b/src/ui/core.c
index b68d2edc..241814bd 100644
--- a/src/ui/core.c
+++ b/src/ui/core.c
@@ -125,6 +125,7 @@ _ui_get_idle_time(void)
     unsigned long ms_elapsed = seconds_elapsed * 1000.0;
     return ms_elapsed;
 }
+//unsigned long (*ui_get_idle_time)(void) = _ui_get_idle_time;
 unsigned long (*ui_get_idle_time)(void) = _ui_get_idle_time;
 
 static void
diff --git a/src/xmpp/connection.c b/src/xmpp/connection.c
index 10fb0dc6..f38da800 100644
--- a/src/xmpp/connection.c
+++ b/src/xmpp/connection.c
@@ -107,7 +107,6 @@ _jabber_init(const int disable_tls)
         (GDestroyNotify)resource_destroy);
     xmpp_initialize();
 }
-void (*jabber_init)(const int) = _jabber_init;
 
 static jabber_conn_status_t
 _jabber_connect_with_account(const ProfAccount * const account)
@@ -128,7 +127,6 @@ _jabber_connect_with_account(const ProfAccount * const account)
 
     return result;
 }
-jabber_conn_status_t (*jabber_connect_with_account)(const ProfAccount * const) = _jabber_connect_with_account;
 
 static jabber_conn_status_t
 _jabber_connect_with_details(const char * const jid,
@@ -161,8 +159,6 @@ _jabber_connect_with_details(const char * const jid,
     log_info("Connecting without account, JID: %s", saved_details.jid);
     return _jabber_connect(saved_details.jid, passwd, saved_details.altdomain);
 }
-jabber_conn_status_t (*jabber_connect_with_details)(const char * const,
-    const char * const, const char * const) = _jabber_connect_with_details;
 
 static void
 _jabber_disconnect(void)
@@ -193,14 +189,12 @@ _jabber_disconnect(void)
     FREE_SET_NULL(jabber_conn.presence_message);
     FREE_SET_NULL(jabber_conn.domain);
 }
-void (*jabber_disconnect)(void) = _jabber_disconnect;
 
 static void
 _jabber_shutdown(void)
 {
     xmpp_shutdown();
 }
-void (*jabber_shutdown)(void) = _jabber_shutdown;
 
 static void
 _jabber_process_events(void)
@@ -222,7 +216,6 @@ _jabber_process_events(void)
     }
 
 }
-void (*jabber_process_events)(void) = _jabber_process_events;
 
 static void
 _jabber_set_autoping(const int seconds)
@@ -237,21 +230,18 @@ _jabber_set_autoping(const int seconds)
         }
     }
 }
-void (*jabber_set_autoping)(const int) = _jabber_set_autoping;
 
 static GList *
 _jabber_get_available_resources(void)
 {
     return g_hash_table_get_values(available_resources);
 }
-GList * (*jabber_get_available_resources)(void) = _jabber_get_available_resources;
 
 static jabber_conn_status_t
 _jabber_get_connection_status(void)
 {
     return (jabber_conn.conn_status);
 }
-jabber_conn_status_t (*jabber_get_connection_status)(void) = _jabber_get_connection_status;
 
 xmpp_conn_t *
 connection_get_conn(void)
@@ -270,28 +260,24 @@ _jabber_get_fulljid(void)
 {
     return xmpp_conn_get_jid(jabber_conn.conn);
 }
-const char * (*jabber_get_fulljid)(void) = _jabber_get_fulljid;
 
 static const char *
 _jabber_get_domain(void)
 {
     return jabber_conn.domain;
 }
-const char * (*jabber_get_domain)(void) = _jabber_get_domain;
 
 static char *
 _jabber_get_presence_message(void)
 {
     return jabber_conn.presence_message;
 }
-char * (*jabber_get_presence_message)(void) = _jabber_get_presence_message;
 
 static char *
 _jabber_get_account_name(void)
 {
     return saved_account.name;
 }
-char * (*jabber_get_account_name)(void) = _jabber_get_account_name;
 
 void
 connection_set_presence_message(const char * const message)
@@ -629,3 +615,20 @@ _xmpp_get_file_logger()
     return file_log;
 }
 
+void
+jabber_init_module(void)
+{
+    jabber_init = _jabber_init;
+    jabber_connect_with_account = _jabber_connect_with_account;
+    jabber_connect_with_details = _jabber_connect_with_details;
+    jabber_disconnect = _jabber_disconnect;
+    jabber_shutdown = _jabber_shutdown;
+    jabber_process_events = _jabber_process_events;
+    jabber_set_autoping = _jabber_set_autoping;
+    jabber_get_available_resources = _jabber_get_available_resources;
+    jabber_get_connection_status = _jabber_get_connection_status;
+    jabber_get_fulljid = _jabber_get_fulljid;
+    jabber_get_domain = _jabber_get_domain;
+    jabber_get_presence_message = _jabber_get_presence_message;
+    jabber_get_account_name = _jabber_get_account_name;
+}
diff --git a/src/xmpp/xmpp.h b/src/xmpp/xmpp.h
index fe7abda8..c4dd9cf4 100644
--- a/src/xmpp/xmpp.h
+++ b/src/xmpp/xmpp.h
@@ -74,6 +74,8 @@ typedef struct disco_identity_t {
     char *category;
 } DiscoIdentity;
 
+void jabber_init_module(void);
+
 // connection functions
 void (*jabber_init)(const int disable_tls);
 jabber_conn_status_t (*jabber_connect_with_details)(const char * const jid,