about summary refs log tree commit diff stats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/command/command.c52
-rw-r--r--src/command/commands.c13
-rw-r--r--src/command/commands.h2
-rw-r--r--src/config/accounts.c170
-rw-r--r--src/config/accounts.h68
-rw-r--r--src/main.c25
-rw-r--r--src/ui/console.c314
-rw-r--r--src/ui/core.c353
-rw-r--r--src/ui/inputwin.c50
-rw-r--r--src/ui/notifier.c46
-rw-r--r--src/ui/statusbar.c65
-rw-r--r--src/ui/titlebar.c50
-rw-r--r--src/ui/ui.h348
-rw-r--r--src/xmpp/bookmark.c30
-rw-r--r--src/xmpp/capabilities.c15
-rw-r--r--src/xmpp/connection.c69
-rw-r--r--src/xmpp/iq.c25
-rw-r--r--src/xmpp/message.c45
-rw-r--r--src/xmpp/presence.c59
-rw-r--r--src/xmpp/roster.c33
-rw-r--r--src/xmpp/xmpp.h106
21 files changed, 1146 insertions, 792 deletions
diff --git a/src/command/command.c b/src/command/command.c
index 45381b99..1788e25e 100644
--- a/src/command/command.c
+++ b/src/command/command.c
@@ -75,7 +75,7 @@ static struct cmd_t command_defs[] =
 {
     { "/help",
         cmd_help, parse_args, 0, 1, NULL,
-        { "/help [area|command]", "Get help on using Profanity",
+        { "/help [area|command]", "Get help on using Profanity.",
         { "/help [area|command]",
           "-------------------------",
           "Use with no arguments to get a help summary.",
@@ -91,7 +91,7 @@ static struct cmd_t command_defs[] =
 
     { "/about",
         cmd_about, parse_args, 0, 0, NULL,
-        { "/about", "About Profanity",
+        { "/about", "About Profanity.",
         { "/about",
           "------",
           "Show versioning and license information.",
@@ -436,7 +436,7 @@ static struct cmd_t command_defs[] =
           NULL } } },
 
     { "/beep",
-        cmd_beep, parse_args, 1, 1, cons_beep_setting,
+        cmd_beep, parse_args, 1, 1, &cons_beep_setting,
         { "/beep on|off", "Terminal beep on new messages.",
         { "/beep on|off",
           "------------",
@@ -446,7 +446,7 @@ static struct cmd_t command_defs[] =
           NULL } } },
 
     { "/notify",
-        cmd_notify, parse_args, 2, 2, cons_notify_setting,
+        cmd_notify, parse_args, 2, 2, &cons_notify_setting,
         { "/notify type value", "Control various desktop noficiations.",
         { "/notify type value",
           "------------------",
@@ -471,7 +471,7 @@ static struct cmd_t command_defs[] =
           NULL } } },
 
     { "/flash",
-        cmd_flash, parse_args, 1, 1, cons_flash_setting,
+        cmd_flash, parse_args, 1, 1, &cons_flash_setting,
         { "/flash on|off", "Terminal flash on new messages.",
         { "/flash on|off",
           "-------------",
@@ -481,7 +481,7 @@ static struct cmd_t command_defs[] =
           NULL } } },
 
     { "/intype",
-        cmd_intype, parse_args, 1, 1, cons_intype_setting,
+        cmd_intype, parse_args, 1, 1, &cons_intype_setting,
         { "/intype on|off", "Show when contact is typing.",
         { "/intype on|off",
           "--------------",
@@ -489,7 +489,7 @@ static struct cmd_t command_defs[] =
           NULL } } },
 
     { "/splash",
-        cmd_splash, parse_args, 1, 1, cons_splash_setting,
+        cmd_splash, parse_args, 1, 1, &cons_splash_setting,
         { "/splash on|off", "Splash logo on startup and /about command.",
         { "/splash on|off",
           "--------------",
@@ -497,7 +497,7 @@ static struct cmd_t command_defs[] =
           NULL } } },
 
     { "/autoconnect",
-        cmd_autoconnect, parse_args, 1, 2, cons_autoconnect_setting,
+        cmd_autoconnect, parse_args, 1, 2, &cons_autoconnect_setting,
         { "/autoconnect set|off [account]", "Set account to autoconnect with.",
         { "/autoconnect set|off [account]",
           "------------------------------",
@@ -518,7 +518,7 @@ static struct cmd_t command_defs[] =
           NULL  } } },
 
     { "/titlebar",
-        cmd_titlebar, parse_args, 2, 2, cons_titlebar_setting,
+        cmd_titlebar, parse_args, 2, 2, &cons_titlebar_setting,
         { "/titlebar property on|off", "Show various properties in the window title bar.",
         { "/titlebar property on|off",
           "-------------------------",
@@ -527,7 +527,7 @@ static struct cmd_t command_defs[] =
           NULL  } } },
 
     { "/mouse",
-        cmd_mouse, parse_args, 1, 1, cons_mouse_setting,
+        cmd_mouse, parse_args, 1, 1, &cons_mouse_setting,
         { "/mouse on|off", "Use profanity mouse handling.",
         { "/mouse on|off",
           "-------------",
@@ -540,8 +540,8 @@ static struct cmd_t command_defs[] =
           NULL } } },
 
     { "/chlog",
-        cmd_chlog, parse_args, 1, 1, cons_chlog_setting,
-        { "/chlog on|off", "Chat logging to file",
+        cmd_chlog, parse_args, 1, 1, &cons_chlog_setting,
+        { "/chlog on|off", "Chat logging to file.",
         { "/chlog on|off",
           "-------------",
           "Switch chat logging on or off.",
@@ -551,8 +551,8 @@ static struct cmd_t command_defs[] =
           NULL } } },
 
     { "/grlog",
-        cmd_grlog, parse_args, 1, 1, cons_grlog_setting,
-        { "/grlog on|off", "Chat logging of chat rooms to file",
+        cmd_grlog, parse_args, 1, 1, &cons_grlog_setting,
+        { "/grlog on|off", "Chat logging of chat rooms to file.",
         { "/grlog on|off",
           "-------------",
           "Switch chat room logging on or off.",
@@ -560,7 +560,7 @@ static struct cmd_t command_defs[] =
           NULL } } },
 
     { "/states",
-        cmd_states, parse_args, 1, 1, cons_states_setting,
+        cmd_states, parse_args, 1, 1, &cons_states_setting,
         { "/states on|off", "Send chat states during a chat session.",
         { "/states on|off",
           "--------------",
@@ -577,7 +577,7 @@ static struct cmd_t command_defs[] =
           NULL } } },
 
     { "/outtype",
-        cmd_outtype, parse_args, 1, 1, cons_outtype_setting,
+        cmd_outtype, parse_args, 1, 1, &cons_outtype_setting,
         { "/outtype on|off", "Send typing notification to recipient.",
         { "/outtype on|off",
           "---------------",
@@ -586,7 +586,7 @@ static struct cmd_t command_defs[] =
           NULL } } },
 
     { "/gone",
-        cmd_gone, parse_args, 1, 1, cons_gone_setting,
+        cmd_gone, parse_args, 1, 1, &cons_gone_setting,
         { "/gone minutes", "Send 'gone' state to recipient after a period.",
         { "/gone minutes",
           "-------------",
@@ -597,7 +597,7 @@ static struct cmd_t command_defs[] =
           NULL } } },
 
     { "/history",
-        cmd_history, parse_args, 1, 1, cons_history_setting,
+        cmd_history, parse_args, 1, 1, &cons_history_setting,
         { "/history on|off", "Chat history in message windows.",
         { "/history on|off",
           "---------------",
@@ -606,7 +606,7 @@ static struct cmd_t command_defs[] =
           NULL } } },
 
     { "/log",
-        cmd_log, parse_args, 2, 2, cons_log_setting,
+        cmd_log, parse_args, 2, 2, &cons_log_setting,
         { "/log maxsize value", "Manage system logging settings.",
         { "/log maxsize value",
           "------------------",
@@ -615,7 +615,7 @@ static struct cmd_t command_defs[] =
           NULL } } },
 
     { "/reconnect",
-        cmd_reconnect, parse_args, 1, 1, cons_reconnect_setting,
+        cmd_reconnect, parse_args, 1, 1, &cons_reconnect_setting,
         { "/reconnect seconds", "Set reconnect interval.",
         { "/reconnect seconds",
           "------------------",
@@ -624,7 +624,7 @@ static struct cmd_t command_defs[] =
           NULL } } },
 
     { "/autoping",
-        cmd_autoping, parse_args, 1, 1, cons_autoping_setting,
+        cmd_autoping, parse_args, 1, 1, &cons_autoping_setting,
         { "/autoping seconds", "Server ping interval.",
         { "/autoping seconds",
           "-----------------",
@@ -633,7 +633,7 @@ static struct cmd_t command_defs[] =
           NULL } } },
 
     { "/autoaway",
-        cmd_autoaway, parse_args_with_freetext, 2, 2, cons_autoaway_setting,
+        cmd_autoaway, parse_args_with_freetext, 2, 2, &cons_autoaway_setting,
         { "/autoaway setting value", "Set auto idle/away properties.",
         { "/autoaway setting value",
           "-----------------------",
@@ -654,7 +654,7 @@ static struct cmd_t command_defs[] =
           NULL } } },
 
     { "/priority",
-        cmd_priority, parse_args, 1, 1, cons_priority_setting,
+        cmd_priority, parse_args, 1, 1, &cons_priority_setting,
         { "/priority value", "Set priority for the current account.",
         { "/priority value",
           "---------------",
@@ -723,7 +723,7 @@ static struct cmd_t command_defs[] =
           NULL } } },
 
     { "/theme",
-        cmd_theme, parse_args, 1, 2, cons_theme_setting,
+        cmd_theme, parse_args, 1, 2, &cons_theme_setting,
         { "/theme command [theme-name]", "Change colour theme.",
         { "/theme command [theme-name]",
           "---------------------------",
@@ -739,7 +739,7 @@ static struct cmd_t command_defs[] =
 
 
     { "/statuses",
-        cmd_statuses, parse_args, 1, 1, cons_statuses_setting,
+        cmd_statuses, parse_args, 1, 1, &cons_statuses_setting,
         { "/statuses on|off", "Set notifications for status messages.",
         { "/statuses on|off",
           "----------------",
@@ -1095,7 +1095,7 @@ cmd_execute(const char * const command, const char * const inp)
         gchar **args = cmd->parser(inp, cmd->min_args, cmd->max_args);
         if ((args == NULL) && (cmd->setting_func != NULL)) {
             cons_show("");
-            cmd->setting_func();
+            (*cmd->setting_func)();
             cons_show("Usage: %s", cmd->help.usage);
             return TRUE;
         } else if (args == NULL) {
diff --git a/src/command/commands.c b/src/command/commands.c
index d962ce6d..87cf7996 100644
--- a/src/command/commands.c
+++ b/src/command/commands.c
@@ -267,7 +267,8 @@ cmd_account(gchar **args, struct cmd_help_t help)
                                 resource_presence_t last_presence = accounts_get_last_presence(connected_account);
 
                                 if (presence_type == last_presence) {
-                                    presence_update(last_presence, jabber_get_presence_message(), 0);
+                                    char *message = jabber_get_presence_message();
+                                    presence_update(last_presence, message, 0);
                                 }
                             }
                             cons_show("Updated %s priority for account %s: %s", property, account_name, value);
@@ -311,7 +312,6 @@ gboolean
 cmd_sub(gchar **args, struct cmd_help_t help)
 {
     jabber_conn_status_t conn_status = jabber_get_connection_status();
-    win_type_t win_type = ui_current_win_type();
 
     if (conn_status != JABBER_CONNECTED) {
         cons_show("You are currently not connected.");
@@ -337,6 +337,7 @@ cmd_sub(gchar **args, struct cmd_help_t help)
         return TRUE;
     }
 
+    win_type_t win_type = ui_current_win_type();
     if ((win_type != WIN_CHAT) && (jid == NULL)) {
         cons_show("You must specify a contact.");
         return TRUE;
@@ -2334,11 +2335,11 @@ _strtoi(char *str, int *saveptr, int min, int max)
 
     errno = 0;
     val = (int)strtol(str, &ptr, 0);
-    if (*str == '\0' || *ptr != '\0') {
-        cons_show("Illegal character. Must be a number.");
+    if (errno != 0 || *str == '\0' || *ptr != '\0') {
+        cons_show("Could not convert \"%s\" to a number.", str);
         return -1;
-    } else if (errno == ERANGE || val < min || val > max) {
-        cons_show("Value out of range. Must be in %d..%d.", min, max);
+    } else if (val < min || val > max) {
+        cons_show("Value %s out of range. Must be in %d..%d.", str, min, max);
         return -1;
     }
 
diff --git a/src/command/commands.h b/src/command/commands.h
index 3caa3085..741ab638 100644
--- a/src/command/commands.h
+++ b/src/command/commands.h
@@ -46,7 +46,7 @@ typedef struct cmd_t {
     gchar** (*parser)(const char * const inp, int min, int max);
     int min_args;
     int max_args;
-    void (*setting_func)(void);
+    void (**setting_func)(void);
     CommandHelp help;
 } Command;
 
diff --git a/src/config/accounts.c b/src/config/accounts.c
index 6431cd9e..2270e874 100644
--- a/src/config/accounts.c
+++ b/src/config/accounts.c
@@ -55,8 +55,8 @@ static void _fix_legacy_accounts(const char * const account_name);
 static void _save_accounts(void);
 static gchar * _get_accounts_file(void);
 
-void
-accounts_load(void)
+static void
+_accounts_load(void)
 {
     log_info("Loading accounts");
     all_ac = autocomplete_new();
@@ -85,40 +85,40 @@ accounts_load(void)
     g_strfreev(account_names);
 }
 
-void
-accounts_close(void)
+static void
+_accounts_close(void)
 {
     autocomplete_free(all_ac);
     autocomplete_free(enabled_ac);
     g_key_file_free(accounts);
 }
 
-char *
-accounts_find_enabled(char *prefix)
+static char *
+_accounts_find_enabled(char *prefix)
 {
     return autocomplete_complete(enabled_ac, prefix);
 }
 
-char *
-accounts_find_all(char *prefix)
+static char *
+_accounts_find_all(char *prefix)
 {
     return autocomplete_complete(all_ac, prefix);
 }
 
-void
-accounts_reset_all_search(void)
+static void
+_accounts_reset_all_search(void)
 {
     autocomplete_reset(all_ac);
 }
 
-void
-accounts_reset_enabled_search(void)
+static void
+_accounts_reset_enabled_search(void)
 {
     autocomplete_reset(enabled_ac);
 }
 
-void
-accounts_add(const char *account_name, const char *altdomain)
+static void
+_accounts_add(const char *account_name, const char *altdomain)
 {
     // set account name and resource
     const char *barejid = account_name;
@@ -168,14 +168,14 @@ accounts_add(const char *account_name, const char *altdomain)
     jid_destroy(jid);
 }
 
-gchar**
-accounts_get_list(void)
+static gchar**
+_accounts_get_list(void)
 {
     return g_key_file_get_groups(accounts, NULL);
 }
 
-ProfAccount*
-accounts_get_account(const char * const name)
+static ProfAccount*
+_accounts_get_account(const char * const name)
 {
     if (!g_key_file_has_group(accounts, name)) {
         return NULL;
@@ -292,8 +292,8 @@ accounts_get_account(const char * const name)
     }
 }
 
-char *
-accounts_create_full_jid(ProfAccount *account)
+static char *
+_accounts_create_full_jid(ProfAccount *account)
 {
     if (account->resource != NULL) {
         return create_fulljid(account->jid, account->resource);
@@ -302,8 +302,8 @@ accounts_create_full_jid(ProfAccount *account)
     }
 }
 
-void
-accounts_free_account(ProfAccount *account)
+static void
+_accounts_free_account(ProfAccount *account)
 {
     if (account != NULL) {
         free(account->name);
@@ -319,8 +319,8 @@ accounts_free_account(ProfAccount *account)
     }
 }
 
-gboolean
-accounts_enable(const char * const name)
+static gboolean
+_accounts_enable(const char * const name)
 {
     if (g_key_file_has_group(accounts, name)) {
         g_key_file_set_boolean(accounts, name, "enabled", TRUE);
@@ -332,8 +332,8 @@ accounts_enable(const char * const name)
     }
 }
 
-gboolean
-accounts_disable(const char * const name)
+static gboolean
+_accounts_disable(const char * const name)
 {
     if (g_key_file_has_group(accounts, name)) {
         g_key_file_set_boolean(accounts, name, "enabled", FALSE);
@@ -345,8 +345,8 @@ accounts_disable(const char * const name)
     }
 }
 
-gboolean
-accounts_rename(const char * const account_name, const char * const new_name)
+static gboolean
+_accounts_rename(const char * const account_name, const char * const new_name)
 {
     if (g_key_file_has_group(accounts, new_name)) {
         return FALSE;
@@ -393,15 +393,15 @@ accounts_rename(const char * const account_name, const char * const new_name)
     return TRUE;
 }
 
-gboolean
-accounts_account_exists(const char * const account_name)
+static gboolean
+_accounts_account_exists(const char * const account_name)
 {
     return g_key_file_has_group(accounts, account_name);
 
 }
 
-void
-accounts_set_jid(const char * const account_name, const char * const value)
+static void
+_accounts_set_jid(const char * const account_name, const char * const value)
 {
     Jid *jid = jid_create(value);
     if (jid != NULL) {
@@ -426,8 +426,8 @@ accounts_set_jid(const char * const account_name, const char * const value)
     }
 }
 
-void
-accounts_set_server(const char * const account_name, const char * const value)
+static void
+_accounts_set_server(const char * const account_name, const char * const value)
 {
     if (accounts_account_exists(account_name)) {
         g_key_file_set_string(accounts, account_name, "server", value);
@@ -435,8 +435,8 @@ accounts_set_server(const char * const account_name, const char * const value)
     }
 }
 
-void
-accounts_set_resource(const char * const account_name, const char * const value)
+static void
+_accounts_set_resource(const char * const account_name, const char * const value)
 {
     if (accounts_account_exists(account_name)) {
         g_key_file_set_string(accounts, account_name, "resource", value);
@@ -444,8 +444,8 @@ accounts_set_resource(const char * const account_name, const char * const value)
     }
 }
 
-void
-accounts_set_password(const char * const account_name, const char * const value)
+static void
+_accounts_set_password(const char * const account_name, const char * const value)
 {
     if (accounts_account_exists(account_name)) {
         g_key_file_set_string(accounts, account_name, "password", value);
@@ -453,8 +453,8 @@ accounts_set_password(const char * const account_name, const char * const value)
     }
 }
 
-void
-accounts_clear_password(const char * const account_name)
+static void
+_accounts_clear_password(const char * const account_name)
 {
     if (accounts_account_exists(account_name)) {
         g_key_file_remove_key(accounts, account_name, "password", NULL);
@@ -462,8 +462,8 @@ accounts_clear_password(const char * const account_name)
     }
 }
 
-void
-accounts_set_muc_service(const char * const account_name, const char * const value)
+static void
+_accounts_set_muc_service(const char * const account_name, const char * const value)
 {
     if (accounts_account_exists(account_name)) {
         g_key_file_set_string(accounts, account_name, "muc.service", value);
@@ -471,8 +471,8 @@ accounts_set_muc_service(const char * const account_name, const char * const val
     }
 }
 
-void
-accounts_set_muc_nick(const char * const account_name, const char * const value)
+static void
+_accounts_set_muc_nick(const char * const account_name, const char * const value)
 {
     if (accounts_account_exists(account_name)) {
         g_key_file_set_string(accounts, account_name, "muc.nick", value);
@@ -480,8 +480,8 @@ accounts_set_muc_nick(const char * const account_name, const char * const value)
     }
 }
 
-void
-accounts_set_priority_online(const char * const account_name, const gint value)
+static void
+_accounts_set_priority_online(const char * const account_name, const gint value)
 {
     if (accounts_account_exists(account_name)) {
         g_key_file_set_integer(accounts, account_name, "priority.online", value);
@@ -489,8 +489,8 @@ accounts_set_priority_online(const char * const account_name, const gint value)
     }
 }
 
-void
-accounts_set_priority_chat(const char * const account_name, const gint value)
+static void
+_accounts_set_priority_chat(const char * const account_name, const gint value)
 {
     if (accounts_account_exists(account_name)) {
         g_key_file_set_integer(accounts, account_name, "priority.chat", value);
@@ -498,8 +498,8 @@ accounts_set_priority_chat(const char * const account_name, const gint value)
     }
 }
 
-void
-accounts_set_priority_away(const char * const account_name, const gint value)
+static void
+_accounts_set_priority_away(const char * const account_name, const gint value)
 {
     if (accounts_account_exists(account_name)) {
         g_key_file_set_integer(accounts, account_name, "priority.away", value);
@@ -507,8 +507,8 @@ accounts_set_priority_away(const char * const account_name, const gint value)
     }
 }
 
-void
-accounts_set_priority_xa(const char * const account_name, const gint value)
+static void
+_accounts_set_priority_xa(const char * const account_name, const gint value)
 {
     if (accounts_account_exists(account_name)) {
         g_key_file_set_integer(accounts, account_name, "priority.xa", value);
@@ -516,8 +516,8 @@ accounts_set_priority_xa(const char * const account_name, const gint value)
     }
 }
 
-void
-accounts_set_priority_dnd(const char * const account_name, const gint value)
+static void
+_accounts_set_priority_dnd(const char * const account_name, const gint value)
 {
     if (accounts_account_exists(account_name)) {
         g_key_file_set_integer(accounts, account_name, "priority.dnd", value);
@@ -525,8 +525,8 @@ accounts_set_priority_dnd(const char * const account_name, const gint value)
     }
 }
 
-void
-accounts_set_priority_all(const char * const account_name, const gint value)
+static void
+_accounts_set_priority_all(const char * const account_name, const gint value)
 {
     if (accounts_account_exists(account_name)) {
         accounts_set_priority_online(account_name, value);
@@ -538,8 +538,8 @@ accounts_set_priority_all(const char * const account_name, const gint value)
     }
 }
 
-gint
-accounts_get_priority_for_presence_type(const char * const account_name,
+static gint
+_accounts_get_priority_for_presence_type(const char * const account_name,
     resource_presence_t presence_type)
 {
     gint result;
@@ -569,8 +569,8 @@ accounts_get_priority_for_presence_type(const char * const account_name,
     return result;
 }
 
-void
-accounts_set_last_presence(const char * const account_name, const char * const value)
+static void
+_accounts_set_last_presence(const char * const account_name, const char * const value)
 {
     if (accounts_account_exists(account_name)) {
         g_key_file_set_string(accounts, account_name, "presence.last", value);
@@ -578,8 +578,8 @@ accounts_set_last_presence(const char * const account_name, const char * const v
     }
 }
 
-void
-accounts_set_login_presence(const char * const account_name, const char * const value)
+static void
+_accounts_set_login_presence(const char * const account_name, const char * const value)
 {
     if (accounts_account_exists(account_name)) {
         g_key_file_set_string(accounts, account_name, "presence.login", value);
@@ -587,8 +587,8 @@ accounts_set_login_presence(const char * const account_name, const char * const
     }
 }
 
-resource_presence_t
-accounts_get_last_presence(const char * const account_name)
+static resource_presence_t
+_accounts_get_last_presence(const char * const account_name)
 {
     resource_presence_t result;
     gchar *setting = g_key_file_get_string(accounts, account_name, "presence.last", NULL);
@@ -615,8 +615,8 @@ accounts_get_last_presence(const char * const account_name)
     return result;
 }
 
-resource_presence_t
-accounts_get_login_presence(const char * const account_name)
+static resource_presence_t
+_accounts_get_login_presence(const char * const account_name)
 {
     resource_presence_t result;
     gchar *setting = g_key_file_get_string(accounts, account_name, "presence.login", NULL);
@@ -717,3 +717,41 @@ _get_accounts_file(void)
     return result;
 }
 
+void
+accounts_init_module(void)
+{
+    accounts_load = _accounts_load;
+    accounts_close = _accounts_close;
+    accounts_find_all = _accounts_find_all;
+    accounts_find_enabled = _accounts_find_enabled;
+    accounts_reset_all_search = _accounts_reset_all_search;
+    accounts_reset_enabled_search = _accounts_reset_enabled_search;
+    accounts_add = _accounts_add;
+    accounts_get_list = _accounts_get_list;
+    accounts_get_account = _accounts_get_account;
+    accounts_free_account = _accounts_free_account;
+    accounts_enable = _accounts_enable;
+    accounts_disable = _accounts_disable;
+    accounts_rename = _accounts_rename;
+    accounts_account_exists = _accounts_account_exists;
+    accounts_set_jid = _accounts_set_jid;
+    accounts_set_server = _accounts_set_server;
+    accounts_set_resource = _accounts_set_resource;
+    accounts_set_password = _accounts_set_password;
+    accounts_set_muc_service = _accounts_set_muc_service;
+    accounts_set_muc_nick = _accounts_set_muc_nick;
+    accounts_set_last_presence = _accounts_set_last_presence;
+    accounts_set_login_presence = _accounts_set_login_presence;
+    accounts_get_last_presence = _accounts_get_last_presence;
+    accounts_get_login_presence = _accounts_get_login_presence;
+    accounts_set_priority_online = _accounts_set_priority_online;
+    accounts_set_priority_chat = _accounts_set_priority_chat;
+    accounts_set_priority_away = _accounts_set_priority_away;
+    accounts_set_priority_xa = _accounts_set_priority_xa;
+    accounts_set_priority_dnd = _accounts_set_priority_dnd;
+    accounts_set_priority_all = _accounts_set_priority_all;
+    accounts_get_priority_for_presence_type = _accounts_get_priority_for_presence_type;
+    accounts_clear_password = _accounts_clear_password;
+    accounts_create_full_jid = _accounts_create_full_jid;
+}
+
diff --git a/src/config/accounts.h b/src/config/accounts.h
index caa8e84c..ccccefdf 100644
--- a/src/config/accounts.h
+++ b/src/config/accounts.h
@@ -46,41 +46,43 @@ typedef struct prof_account_t {
     GSList *room_history;
 } ProfAccount;
 
-void accounts_load(void);
-void accounts_close(void);
+void accounts_init_module(void);
 
-char * accounts_find_all(char *prefix);
-char * accounts_find_enabled(char *prefix);
-void accounts_reset_all_search(void);
-void accounts_reset_enabled_search(void);
-void accounts_add(const char *jid, const char *altdomain);
-gchar** accounts_get_list(void);
-ProfAccount* accounts_get_account(const char * const name);
-void accounts_free_account(ProfAccount *account);
-gboolean accounts_enable(const char * const name);
-gboolean accounts_disable(const char * const name);
-gboolean accounts_rename(const char * const account_name,
+void (*accounts_load)(void);
+void (*accounts_close)(void);
+
+char * (*accounts_find_all)(char *prefix);
+char * (*accounts_find_enabled)(char *prefix);
+void (*accounts_reset_all_search)(void);
+void (*accounts_reset_enabled_search)(void);
+void (*accounts_add)(const char *jid, const char *altdomain);
+gchar** (*accounts_get_list)(void);
+ProfAccount* (*accounts_get_account)(const char * const name);
+void (*accounts_free_account)(ProfAccount *account);
+gboolean (*accounts_enable)(const char * const name);
+gboolean (*accounts_disable)(const char * const name);
+gboolean (*accounts_rename)(const char * const account_name,
     const char * const new_name);
-gboolean accounts_account_exists(const char * const account_name);
-void accounts_set_jid(const char * const account_name, const char * const value);
-void accounts_set_server(const char * const account_name, const char * const value);
-void accounts_set_resource(const char * const account_name, const char * const value);
-void accounts_set_password(const char * const account_name, const char * const value);
-void accounts_set_muc_service(const char * const account_name, const char * const value);
-void accounts_set_muc_nick(const char * const account_name, const char * const value);
-void accounts_set_last_presence(const char * const account_name, const char * const value);
-void accounts_set_login_presence(const char * const account_name, const char * const value);
-resource_presence_t accounts_get_login_presence(const char * const account_name);
-resource_presence_t accounts_get_last_presence(const char * const account_name);
-void accounts_set_priority_online(const char * const account_name, const gint value);
-void accounts_set_priority_chat(const char * const account_name, const gint value);
-void accounts_set_priority_away(const char * const account_name, const gint value);
-void accounts_set_priority_xa(const char * const account_name, const gint value);
-void accounts_set_priority_dnd(const char * const account_name, const gint value);
-void accounts_set_priority_all(const char * const account_name, const gint value);
-gint accounts_get_priority_for_presence_type(const char * const account_name,
+gboolean (*accounts_account_exists)(const char * const account_name);
+void (*accounts_set_jid)(const char * const account_name, const char * const value);
+void (*accounts_set_server)(const char * const account_name, const char * const value);
+void (*accounts_set_resource)(const char * const account_name, const char * const value);
+void (*accounts_set_password)(const char * const account_name, const char * const value);
+void (*accounts_set_muc_service)(const char * const account_name, const char * const value);
+void (*accounts_set_muc_nick)(const char * const account_name, const char * const value);
+void (*accounts_set_last_presence)(const char * const account_name, const char * const value);
+void (*accounts_set_login_presence)(const char * const account_name, const char * const value);
+resource_presence_t (*accounts_get_login_presence)(const char * const account_name);
+resource_presence_t (*accounts_get_last_presence)(const char * const account_name);
+void (*accounts_set_priority_online)(const char * const account_name, const gint value);
+void (*accounts_set_priority_chat)(const char * const account_name, const gint value);
+void (*accounts_set_priority_away)(const char * const account_name, const gint value);
+void (*accounts_set_priority_xa)(const char * const account_name, const gint value);
+void (*accounts_set_priority_dnd)(const char * const account_name, const gint value);
+void (*accounts_set_priority_all)(const char * const account_name, const gint value);
+gint (*accounts_get_priority_for_presence_type)(const char * const account_name,
     resource_presence_t presence_type);
-void accounts_clear_password(const char * const account_name);
-char * accounts_create_full_jid(ProfAccount *account);
+void (*accounts_clear_password)(const char * const account_name);
+char * (*accounts_create_full_jid)(ProfAccount *account);
 
 #endif
diff --git a/src/main.c b/src/main.c
index c3065bd3..a87b9280 100644
--- a/src/main.c
+++ b/src/main.c
@@ -29,11 +29,35 @@
 
 #include "profanity.h"
 
+#include "xmpp/xmpp.h"
+#include "ui/ui.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();
+    bookmark_init_module();
+    capabilities_init_module();
+    iq_init_module();
+    message_init_module();
+    presence_init_module();
+    roster_init_module();
+
+    ui_init_module();
+    console_init_module();
+    inputwin_init_module();
+    notifier_init_module();
+    statusbar_init_module();
+    titlebar_init_module();
+
+    accounts_init_module();
+}
+
 int
 main(int argc, char **argv)
 {
@@ -79,6 +103,7 @@ main(int argc, char **argv)
         return 0;
     }
 
+    _init_modules();
     prof_run(disable_tls, log, account_name);
 
     return 0;
diff --git a/src/ui/console.c b/src/ui/console.c
index 00e891db..83a2b82e 100644
--- a/src/ui/console.c
+++ b/src/ui/console.c
@@ -47,24 +47,24 @@
 static void _cons_splash_logo(void);
 void _show_roster_contacts(GSList *list, gboolean show_groups);
 
-void
-cons_show_time(void)
+static void
+_cons_show_time(void)
 {
     ProfWin *console = wins_get_console();
     win_print_time(console, '-');
     wins_refresh_console();
 }
 
-void
-cons_show_word(const char * const word)
+static void
+_cons_show_word(const char * const word)
 {
     ProfWin *console = wins_get_console();
     wprintw(console->win, "%s", word);
     wins_refresh_console();
 }
 
-void
-cons_debug(const char * const msg, ...)
+static void
+_cons_debug(const char * const msg, ...)
 {
     ProfWin *console = wins_get_console();
     if (strcmp(PACKAGE_STATUS, "development") == 0) {
@@ -85,8 +85,8 @@ cons_debug(const char * const msg, ...)
     }
 }
 
-void
-cons_show(const char * const msg, ...)
+static void
+_cons_show(const char * const msg, ...)
 {
     ProfWin *console = wins_get_console();
     va_list arg;
@@ -100,8 +100,8 @@ cons_show(const char * const msg, ...)
     wins_refresh_console();
 }
 
-void
-cons_show_error(const char * const msg, ...)
+static void
+_cons_show_error(const char * const msg, ...)
 {
     ProfWin *console = wins_get_console();
     va_list arg;
@@ -119,8 +119,8 @@ cons_show_error(const char * const msg, ...)
     cons_alert();
 }
 
-void
-cons_show_typing(const char * const barejid)
+static void
+_cons_show_typing(const char * const barejid)
 {
     ProfWin *console = wins_get_console();
     PContact contact = roster_get_contact(barejid);
@@ -137,8 +137,8 @@ cons_show_typing(const char * const barejid)
     cons_alert();
 }
 
-void
-cons_show_incoming_message(const char * const short_from, const int win_index)
+static void
+_cons_show_incoming_message(const char * const short_from, const int win_index)
 {
     ProfWin *console = wins_get_console();
 
@@ -155,8 +155,8 @@ cons_show_incoming_message(const char * const short_from, const int win_index)
     cons_alert();
 }
 
-void
-cons_about(void)
+static void
+_cons_about(void)
 {
     ProfWin *console = wins_get_console();
     int rows, cols;
@@ -207,8 +207,8 @@ cons_about(void)
     cons_alert();
 }
 
-void
-cons_check_version(gboolean not_available_msg)
+static void
+_cons_check_version(gboolean not_available_msg)
 {
     ProfWin *console = wins_get_console();
     char *latest_release = release_get_latest();
@@ -238,8 +238,8 @@ cons_check_version(gboolean not_available_msg)
     }
 }
 
-void
-cons_show_login_success(ProfAccount *account)
+static void
+_cons_show_login_success(ProfAccount *account)
 {
     ProfWin *console = wins_get_console();
     win_print_time(console, '-');
@@ -258,8 +258,8 @@ cons_show_login_success(ProfAccount *account)
     cons_alert();
 }
 
-void
-cons_show_wins(void)
+static void
+_cons_show_wins(void)
 {
     ProfWin *console = wins_get_console();
     cons_show("");
@@ -279,8 +279,8 @@ cons_show_wins(void)
     cons_alert();
 }
 
-void
-cons_show_room_invites(GSList *invites)
+static void
+_cons_show_room_invites(GSList *invites)
 {
     cons_show("");
     if (invites == NULL) {
@@ -297,8 +297,8 @@ cons_show_room_invites(GSList *invites)
     cons_alert();
 }
 
-void
-cons_show_info(PContact pcontact)
+static void
+_cons_show_info(PContact pcontact)
 {
     ProfWin *console = wins_get_console();
     const char *barejid = p_contact_barejid(pcontact);
@@ -430,8 +430,8 @@ cons_show_info(PContact pcontact)
     cons_alert();
 }
 
-void
-cons_show_caps(const char * const contact, Resource *resource)
+static void
+_cons_show_caps(const char * const contact, Resource *resource)
 {
     ProfWin *console = wins_get_console();
     WINDOW *win = console->win;
@@ -505,8 +505,8 @@ cons_show_caps(const char * const contact, Resource *resource)
     cons_alert();
 }
 
-void
-cons_show_software_version(const char * const jid, const char * const  presence,
+static void
+_cons_show_software_version(const char * const jid, const char * const  presence,
     const char * const name, const char * const version, const char * const os)
 {
     ProfWin *console = wins_get_console();
@@ -532,8 +532,8 @@ cons_show_software_version(const char * const jid, const char * const  presence,
     cons_alert();
 }
 
-void
-cons_show_received_subs(void)
+static void
+_cons_show_received_subs(void)
 {
     GSList *received = presence_get_subscription_requests();
     if (received == NULL) {
@@ -548,12 +548,11 @@ cons_show_received_subs(void)
         g_slist_free_full(received, g_free);
     }
 
-    wins_refresh_console();
     cons_alert();
 }
 
-void
-cons_show_sent_subs(void)
+static void
+_cons_show_sent_subs(void)
 {
    if (roster_has_pending_subscriptions()) {
         GSList *contacts = roster_get_contacts();
@@ -570,12 +569,11 @@ cons_show_sent_subs(void)
         cons_show("No pending requests sent.");
     }
 
-    wins_refresh_console();
     cons_alert();
 }
 
-void
-cons_show_room_list(GSList *rooms, const char * const conference_node)
+static void
+_cons_show_room_list(GSList *rooms, const char * const conference_node)
 {
     ProfWin *console = wins_get_console();
     if ((rooms != NULL) && (g_slist_length(rooms) > 0)) {
@@ -598,8 +596,8 @@ cons_show_room_list(GSList *rooms, const char * const conference_node)
     cons_alert();
 }
 
-void
-cons_show_bookmarks(const GList *list)
+static void
+_cons_show_bookmarks(const GList *list)
 {
     Bookmark *item;
 
@@ -628,8 +626,8 @@ cons_show_bookmarks(const GList *list)
     cons_alert();
 }
 
-void
-cons_show_disco_info(const char *jid, GSList *identities, GSList *features)
+static void
+_cons_show_disco_info(const char *jid, GSList *identities, GSList *features)
 {
     if (((identities != NULL) && (g_slist_length(identities) > 0)) ||
         ((features != NULL) && (g_slist_length(features) > 0))) {
@@ -671,8 +669,8 @@ cons_show_disco_info(const char *jid, GSList *identities, GSList *features)
     }
 }
 
-void
-cons_show_disco_items(GSList *items, const char * const jid)
+static void
+_cons_show_disco_items(GSList *items, const char * const jid)
 {
     ProfWin *console = wins_get_console();
     if ((items != NULL) && (g_slist_length(items) > 0)) {
@@ -696,8 +694,8 @@ cons_show_disco_items(GSList *items, const char * const jid)
     cons_alert();
 }
 
-void
-cons_show_status(const char * const barejid)
+static void
+_cons_show_status(const char * const barejid)
 {
     ProfWin *console = wins_get_console();
     PContact pcontact = roster_get_contact(barejid);
@@ -711,8 +709,8 @@ cons_show_status(const char * const barejid)
     cons_alert();
 }
 
-void
-cons_show_room_invite(const char * const invitor, const char * const room,
+static void
+_cons_show_room_invite(const char * const invitor, const char * const room,
     const char * const reason)
 {
     char *display_from = NULL;
@@ -748,8 +746,8 @@ cons_show_room_invite(const char * const invitor, const char * const room,
     cons_alert();
 }
 
-void
-cons_show_account_list(gchar **accounts)
+static void
+_cons_show_account_list(gchar **accounts)
 {
     ProfWin *console = wins_get_console();
     int size = g_strv_length(accounts);
@@ -778,8 +776,8 @@ cons_show_account_list(gchar **accounts)
     cons_alert();
 }
 
-void
-cons_show_account(ProfAccount *account)
+static void
+_cons_show_account(ProfAccount *account)
 {
     ProfWin *console = wins_get_console();
     cons_show("");
@@ -901,8 +899,8 @@ cons_show_account(ProfAccount *account)
     cons_alert();
 }
 
-void
-cons_theme_setting(void)
+static void
+_cons_theme_setting(void)
 {
     gchar *theme = prefs_get_string(PREF_THEME);
     if (theme == NULL) {
@@ -912,8 +910,8 @@ cons_theme_setting(void)
     }
 }
 
-void
-cons_beep_setting(void)
+static void
+_cons_beep_setting(void)
 {
     if (prefs_get_boolean(PREF_BEEP))
         cons_show("Terminal beep (/beep)        : ON");
@@ -921,8 +919,8 @@ cons_beep_setting(void)
         cons_show("Terminal beep (/beep)        : OFF");
 }
 
-void
-cons_flash_setting(void)
+static void
+_cons_flash_setting(void)
 {
     if (prefs_get_boolean(PREF_FLASH))
         cons_show("Terminal flash (/flash)      : ON");
@@ -930,8 +928,8 @@ cons_flash_setting(void)
         cons_show("Terminal flash (/flash)      : OFF");
 }
 
-void
-cons_splash_setting(void)
+static void
+_cons_splash_setting(void)
 {
     if (prefs_get_boolean(PREF_SPLASH))
         cons_show("Splash screen (/splash)      : ON");
@@ -939,8 +937,8 @@ cons_splash_setting(void)
         cons_show("Splash screen (/splash)      : OFF");
 }
 
-void
-cons_autoconnect_setting(void)
+static void
+_cons_autoconnect_setting(void)
 {
     if (prefs_get_string(PREF_CONNECT_ACCOUNT) != NULL)
         cons_show("Autoconnect (/autoconnect)      : %s", prefs_get_string(PREF_CONNECT_ACCOUNT));
@@ -948,8 +946,8 @@ cons_autoconnect_setting(void)
         cons_show("Autoconnect (/autoconnect)      : OFF");
 }
 
-void
-cons_vercheck_setting(void)
+static void
+_cons_vercheck_setting(void)
 {
     if (prefs_get_boolean(PREF_VERCHECK))
         cons_show("Version checking (/vercheck) : ON");
@@ -957,8 +955,8 @@ cons_vercheck_setting(void)
         cons_show("Version checking (/vercheck) : OFF");
 }
 
-void
-cons_mouse_setting(void)
+static void
+_cons_mouse_setting(void)
 {
     if (prefs_get_boolean(PREF_MOUSE))
         cons_show("Mouse handling (/mouse)      : ON");
@@ -966,8 +964,8 @@ cons_mouse_setting(void)
         cons_show("Mouse handling (/mouse)      : OFF");
 }
 
-void
-cons_statuses_setting(void)
+static void
+_cons_statuses_setting(void)
 {
     if (prefs_get_boolean(PREF_STATUSES))
         cons_show("Status (/statuses)           : ON");
@@ -975,8 +973,8 @@ cons_statuses_setting(void)
         cons_show("Status (/statuses)           : OFF");
 }
 
-void
-cons_titlebar_setting(void)
+static void
+_cons_titlebar_setting(void)
 {
     if (prefs_get_boolean(PREF_TITLEBARVERSION)) {
         cons_show("Titlebar display (/titlebar) : version");
@@ -985,8 +983,8 @@ cons_titlebar_setting(void)
     }
 }
 
-void
-cons_show_ui_prefs(void)
+static void
+_cons_show_ui_prefs(void)
 {
     cons_show("UI preferences:");
     cons_show("");
@@ -1003,8 +1001,8 @@ cons_show_ui_prefs(void)
     cons_alert();
 }
 
-void
-cons_notify_setting(void)
+static void
+_cons_notify_setting(void)
 {
     if (prefs_get_boolean(PREF_NOTIFY_MESSAGE))
         cons_show("Messages (/notify message)          : ON");
@@ -1036,8 +1034,8 @@ cons_notify_setting(void)
     }
 }
 
-void
-cons_show_desktop_prefs(void)
+static void
+_cons_show_desktop_prefs(void)
 {
     cons_show("Desktop notification preferences:");
     cons_show("");
@@ -1047,8 +1045,8 @@ cons_show_desktop_prefs(void)
     cons_alert();
 }
 
-void
-cons_states_setting(void)
+static void
+_cons_states_setting(void)
 {
     if (prefs_get_boolean(PREF_STATES))
         cons_show("Send chat states (/states) : ON");
@@ -1056,8 +1054,8 @@ cons_states_setting(void)
         cons_show("Send chat states (/states) : OFF");
 }
 
-void
-cons_outtype_setting(void)
+static void
+_cons_outtype_setting(void)
 {
     if (prefs_get_boolean(PREF_OUTTYPE))
         cons_show("Send composing (/outtype)  : ON");
@@ -1065,8 +1063,8 @@ cons_outtype_setting(void)
         cons_show("Send composing (/outtype)  : OFF");
 }
 
-void
-cons_intype_setting(void)
+static void
+_cons_intype_setting(void)
 {
     if (prefs_get_boolean(PREF_INTYPE))
         cons_show("Show typing (/intype)      : ON");
@@ -1074,8 +1072,8 @@ cons_intype_setting(void)
         cons_show("Show typing (/intype)      : OFF");
 }
 
-void
-cons_gone_setting(void)
+static void
+_cons_gone_setting(void)
 {
     gint gone_time = prefs_get_gone();
     if (gone_time == 0) {
@@ -1087,8 +1085,8 @@ cons_gone_setting(void)
     }
 }
 
-void
-cons_history_setting(void)
+static void
+_cons_history_setting(void)
 {
     if (prefs_get_boolean(PREF_HISTORY))
         cons_show("Chat history (/history)    : ON");
@@ -1096,8 +1094,8 @@ cons_history_setting(void)
         cons_show("Chat history (/history)    : OFF");
 }
 
-void
-cons_show_chat_prefs(void)
+static void
+_cons_show_chat_prefs(void)
 {
     cons_show("Chat preferences:");
     cons_show("");
@@ -1111,14 +1109,14 @@ cons_show_chat_prefs(void)
     cons_alert();
 }
 
-void
-cons_log_setting(void)
+static void
+_cons_log_setting(void)
 {
     cons_show("Max log size (/log maxsize) : %d bytes", prefs_get_max_log_size());
 }
 
-void
-cons_chlog_setting(void)
+static void
+_cons_chlog_setting(void)
 {
     if (prefs_get_boolean(PREF_CHLOG))
         cons_show("Chat logging (/chlog)       : ON");
@@ -1126,8 +1124,8 @@ cons_chlog_setting(void)
         cons_show("Chat logging (/chlog)       : OFF");
 }
 
-void
-cons_grlog_setting(void)
+static void
+_cons_grlog_setting(void)
 {
     if (prefs_get_boolean(PREF_GRLOG))
         cons_show("Groupchat logging (/grlog)  : ON");
@@ -1135,8 +1133,8 @@ cons_grlog_setting(void)
         cons_show("Groupchat logging (/grlog)  : OFF");
 }
 
-void
-cons_show_log_prefs(void)
+static void
+_cons_show_log_prefs(void)
 {
     cons_show("Logging preferences:");
     cons_show("");
@@ -1148,8 +1146,8 @@ cons_show_log_prefs(void)
     cons_alert();
 }
 
-void
-cons_autoaway_setting(void)
+static void
+_cons_autoaway_setting(void)
 {
     if (strcmp(prefs_get_string(PREF_AUTOAWAY_MODE), "off") == 0) {
         cons_show("Autoaway (/autoaway mode)            : OFF");
@@ -1173,8 +1171,8 @@ cons_autoaway_setting(void)
     }
 }
 
-void
-cons_show_presence_prefs(void)
+static void
+_cons_show_presence_prefs(void)
 {
     cons_show("Presence preferences:");
     cons_show("");
@@ -1184,8 +1182,8 @@ cons_show_presence_prefs(void)
     cons_alert();
 }
 
-void
-cons_reconnect_setting(void)
+static void
+_cons_reconnect_setting(void)
 {
     gint reconnect_interval = prefs_get_reconnect();
     if (reconnect_interval == 0) {
@@ -1197,8 +1195,8 @@ cons_reconnect_setting(void)
     }
 }
 
-void
-cons_autoping_setting(void)
+static void
+_cons_autoping_setting(void)
 {
     gint autoping_interval = prefs_get_autoping();
     if (autoping_interval == 0) {
@@ -1210,15 +1208,15 @@ cons_autoping_setting(void)
     }
 }
 
-void
-cons_priority_setting(void)
+static void
+_cons_priority_setting(void)
 {
     gint priority = prefs_get_priority();
     cons_show("Priority (/priority) : %d", priority);
 }
 
-void
-cons_show_connection_prefs(void)
+static void
+_cons_show_connection_prefs(void)
 {
     cons_show("Connection preferences:");
     cons_show("");
@@ -1230,8 +1228,8 @@ cons_show_connection_prefs(void)
     cons_alert();
 }
 
-void
-cons_show_themes(GSList *themes)
+static void
+_cons_show_themes(GSList *themes)
 {
     cons_show("");
 
@@ -1249,8 +1247,8 @@ cons_show_themes(GSList *themes)
     cons_alert();
 }
 
-void
-cons_prefs(void)
+static void
+_cons_prefs(void)
 {
     cons_show("");
     cons_show_ui_prefs();
@@ -1270,8 +1268,8 @@ cons_prefs(void)
     cons_alert();
 }
 
-void
-cons_help(void)
+static void
+_cons_help(void)
 {
     cons_show("");
     cons_show("Choose a help option:");
@@ -1282,7 +1280,7 @@ cons_help(void)
     cons_show("/help groupchat  - List groupchat commands.");
     cons_show("/help presence   - List commands to change presence.");
     cons_show("/help roster     - List commands for manipulating your roster.");
-    cons_show("/help service    - List service discovery commands");
+    cons_show("/help service    - List service discovery commands.");
     cons_show("/help settings   - List commands for changing settings.");
     cons_show("/help other      - Other commands.");
     cons_show("/help navigation - How to navigate around Profanity.");
@@ -1293,8 +1291,8 @@ cons_help(void)
     cons_alert();
 }
 
-void
-cons_navigation_help(void)
+static void
+_cons_navigation_help(void)
 {
     cons_show("");
     cons_show("Navigation:");
@@ -1317,8 +1315,8 @@ cons_navigation_help(void)
     cons_alert();
 }
 
-void
-cons_show_roster_group(const char * const group, GSList *list)
+static void
+_cons_show_roster_group(const char * const group, GSList *list)
 {
     cons_show("");
 
@@ -1333,8 +1331,8 @@ cons_show_roster_group(const char * const group, GSList *list)
     cons_alert();
 }
 
-void
-cons_show_roster(GSList *list)
+static void
+_cons_show_roster(GSList *list)
 {
     cons_show("");
     cons_show("Roster:");
@@ -1344,8 +1342,8 @@ cons_show_roster(GSList *list)
     cons_alert();
 }
 
-void
-cons_show_contacts(GSList *list)
+static void
+_cons_show_contacts(GSList *list)
 {
     ProfWin *console = wins_get_console();
     GSList *curr = list;
@@ -1363,8 +1361,8 @@ cons_show_contacts(GSList *list)
     cons_alert();
 }
 
-void
-cons_alert(void)
+static void
+_cons_alert(void)
 {
     if (ui_current_win_type() != WIN_CONSOLE) {
         status_bar_new(1);
@@ -1502,3 +1500,69 @@ _show_roster_contacts(GSList *list, gboolean show_groups)
     }
 
 }
+
+void
+console_init_module(void)
+{
+    cons_show_time = _cons_show_time;
+    cons_show_word = _cons_show_word;
+    cons_debug = _cons_debug;
+    cons_show = _cons_show;
+    cons_show_error = _cons_show_error;
+    cons_show_typing = _cons_show_typing;
+    cons_show_incoming_message = _cons_show_incoming_message;
+    cons_about = _cons_about;
+    cons_check_version = _cons_check_version;
+    cons_show_login_success = _cons_show_login_success;
+    cons_show_wins = _cons_show_wins;
+    cons_show_room_invites = _cons_show_room_invites;
+    cons_show_info = _cons_show_info;
+    cons_show_caps = _cons_show_caps;
+    cons_show_software_version = _cons_show_software_version;
+    cons_show_received_subs = _cons_show_received_subs;
+    cons_show_sent_subs = _cons_show_sent_subs;
+    cons_show_room_list = _cons_show_room_list;
+    cons_show_bookmarks = _cons_show_bookmarks;
+    cons_show_disco_info = _cons_show_disco_info;
+    cons_show_disco_items = _cons_show_disco_items;
+    cons_show_status = _cons_show_status;
+    cons_show_room_invite = _cons_show_room_invite;
+    cons_show_account_list = _cons_show_account_list;
+    cons_show_account = _cons_show_account;
+    cons_theme_setting = _cons_theme_setting;
+    cons_beep_setting = _cons_beep_setting;
+    cons_flash_setting = _cons_flash_setting;
+    cons_splash_setting = _cons_splash_setting;
+    cons_autoconnect_setting = _cons_autoconnect_setting;
+    cons_vercheck_setting = _cons_vercheck_setting;
+    cons_mouse_setting = _cons_mouse_setting;
+    cons_statuses_setting = _cons_statuses_setting;
+    cons_titlebar_setting = _cons_titlebar_setting;
+    cons_show_ui_prefs = _cons_show_ui_prefs;
+    cons_notify_setting = _cons_notify_setting;
+    cons_show_desktop_prefs = _cons_show_desktop_prefs;
+    cons_states_setting = _cons_states_setting;
+    cons_outtype_setting = _cons_outtype_setting;
+    cons_intype_setting = _cons_intype_setting;
+    cons_gone_setting = _cons_gone_setting;
+    cons_history_setting = _cons_history_setting;
+    cons_show_chat_prefs = _cons_show_chat_prefs;
+    cons_log_setting = _cons_log_setting;
+    cons_chlog_setting = _cons_chlog_setting;
+    cons_grlog_setting = _cons_grlog_setting;
+    cons_show_log_prefs = _cons_show_log_prefs;
+    cons_autoaway_setting = _cons_autoaway_setting;
+    cons_show_presence_prefs = _cons_show_presence_prefs;
+    cons_reconnect_setting = _cons_reconnect_setting;
+    cons_autoping_setting = _cons_autoping_setting;
+    cons_priority_setting = _cons_priority_setting;
+    cons_show_connection_prefs = _cons_show_connection_prefs;
+    cons_show_themes = _cons_show_themes;
+    cons_prefs = _cons_prefs;
+    cons_help = _cons_help;
+    cons_navigation_help = _cons_navigation_help;
+    cons_show_roster_group = _cons_show_roster_group;
+    cons_show_roster = _cons_show_roster;
+    cons_show_contacts = _cons_show_contacts;
+    cons_alert = _cons_alert;
+}
diff --git a/src/ui/core.c b/src/ui/core.c
index 1ff41b7d..c06f025e 100644
--- a/src/ui/core.c
+++ b/src/ui/core.c
@@ -69,8 +69,8 @@ static void _win_show_history(WINDOW *win, int win_index,
     const char * const contact);
 static void _ui_draw_win_title(void);
 
-void
-ui_init(void)
+static void
+_ui_init(void)
 {
     log_info("Initialising UI");
     initscr();
@@ -96,8 +96,8 @@ ui_init(void)
     wins_refresh_current();
 }
 
-void
-ui_refresh(void)
+static void
+_ui_refresh(void)
 {
     _ui_draw_win_title();
     title_bar_refresh();
@@ -105,8 +105,8 @@ ui_refresh(void)
     inp_put_back();
 }
 
-unsigned long
-ui_get_idle_time(void)
+static unsigned long
+_ui_get_idle_time(void)
 {
 // if compiled with libxss, get the x sessions idle time
 #ifdef HAVE_LIBXSS
@@ -124,22 +124,22 @@ ui_get_idle_time(void)
     return ms_elapsed;
 }
 
-void
-ui_reset_idle_time(void)
+static void
+_ui_reset_idle_time(void)
 {
     g_timer_start(ui_idle_time);
 }
 
-void
-ui_close(void)
+static void
+_ui_close(void)
 {
     notifier_uninit();
     wins_destroy();
     endwin();
 }
 
-void
-ui_resize(const int ch, const char * const input, const int size)
+static void
+_ui_resize(const int ch, const char * const input, const int size)
 {
     log_info("Resizing UI");
     title_bar_resize();
@@ -149,8 +149,8 @@ ui_resize(const int ch, const char * const input, const int size)
     wins_refresh_current();
 }
 
-void
-ui_load_colours(void)
+static void
+_ui_load_colours(void)
 {
     if (has_colors()) {
         use_default_colors();
@@ -159,21 +159,21 @@ ui_load_colours(void)
     }
 }
 
-gboolean
-ui_win_exists(int index)
+static gboolean
+_ui_win_exists(int index)
 {
     ProfWin *window = wins_get_by_num(index);
     return (window != NULL);
 }
 
-gboolean
-ui_duck_exists(void)
+static gboolean
+_ui_duck_exists(void)
 {
     return wins_duck_exists();
 }
 
-void
-ui_contact_typing(const char * const barejid)
+static void
+_ui_contact_typing(const char * const barejid)
 {
     ProfWin *window = wins_get_by_recipient(barejid);
 
@@ -210,15 +210,15 @@ ui_contact_typing(const char * const barejid)
     }
 }
 
-GSList *
-ui_get_recipients(void)
+static GSList *
+_ui_get_recipients(void)
 {
     GSList *recipients = wins_get_chat_recipients();
     return recipients;
 }
 
-void
-ui_incoming_msg(const char * const from, const char * const message,
+static void
+_ui_incoming_msg(const char * const from, const char * const message,
     GTimeVal *tv_stamp, gboolean priv)
 {
     gboolean win_created = FALSE;
@@ -294,8 +294,8 @@ ui_incoming_msg(const char * const from, const char * const message,
     free(display_from);
 }
 
-void
-ui_roster_add(const char * const barejid, const char * const name)
+static void
+_ui_roster_add(const char * const barejid, const char * const name)
 {
     if (name != NULL) {
         cons_show("Roster item added: %s (%s)", barejid, name);
@@ -304,38 +304,38 @@ ui_roster_add(const char * const barejid, const char * const name)
     }
 }
 
-void
-ui_roster_remove(const char * const barejid)
+static void
+_ui_roster_remove(const char * const barejid)
 {
     cons_show("Roster item removed: %s", barejid);
 }
 
-void
-ui_contact_already_in_group(const char * const contact, const char * const group)
+static void
+_ui_contact_already_in_group(const char * const contact, const char * const group)
 {
     cons_show("%s already in group %s", contact, group);
 }
 
-void
-ui_contact_not_in_group(const char * const contact, const char * const group)
+static void
+_ui_contact_not_in_group(const char * const contact, const char * const group)
 {
     cons_show("%s is not currently in group %s", contact, group);
 }
 
-void
-ui_group_added(const char * const contact, const char * const group)
+static void
+_ui_group_added(const char * const contact, const char * const group)
 {
     cons_show("%s added to group %s", contact, group);
 }
 
-void
-ui_group_removed(const char * const contact, const char * const group)
+static void
+_ui_group_removed(const char * const contact, const char * const group)
 {
     cons_show("%s removed from group %s", contact, group);
 }
 
-void
-ui_handle_error_message(const char * const from, const char * const err_msg)
+static void
+_ui_handle_error_message(const char * const from, const char * const err_msg)
 {
     if (err_msg == NULL) {
         cons_show_error("Unknown error received from service.");
@@ -350,8 +350,8 @@ ui_handle_error_message(const char * const from, const char * const err_msg)
     ui_print_error_from_recipient(from, err_msg);
 }
 
-void
-ui_contact_online(const char * const barejid, const char * const resource,
+static void
+_ui_contact_online(const char * const barejid, const char * const resource,
     const char * const show, const char * const status, GDateTime *last_activity)
 {
     PContact contact = roster_get_contact(barejid);
@@ -376,8 +376,8 @@ ui_contact_online(const char * const barejid, const char * const resource,
     }
 }
 
-void
-ui_contact_offline(const char * const from, const char * const show,
+static void
+_ui_contact_offline(const char * const from, const char * const show,
     const char * const status)
 {
     Jid *jidp = jid_create(from);
@@ -404,8 +404,8 @@ ui_contact_offline(const char * const from, const char * const show,
     }
 }
 
-void
-ui_disconnected(void)
+static void
+_ui_disconnected(void)
 {
     wins_lost_connection();
     title_bar_set_status(CONTACT_OFFLINE);
@@ -413,8 +413,8 @@ ui_disconnected(void)
     status_bar_refresh();
 }
 
-void
-ui_handle_special_keys(const wint_t * const ch, const char * const inp,
+static void
+_ui_handle_special_keys(const wint_t * const ch, const char * const inp,
     const int size)
 {
     _win_handle_switch(ch);
@@ -425,8 +425,8 @@ ui_handle_special_keys(const wint_t * const ch, const char * const inp,
 
 }
 
-void
-ui_close_connected_win(int index)
+static void
+_ui_close_connected_win(int index)
 {
     win_type_t win_type = ui_win_type(index);
     if (win_type == WIN_MUC) {
@@ -447,8 +447,8 @@ ui_close_connected_win(int index)
     }
 }
 
-int
-ui_close_all_wins(void)
+static int
+_ui_close_all_wins(void)
 {
     int count = 0;
     jabber_conn_status_t conn_status = jabber_get_connection_status();
@@ -474,8 +474,8 @@ ui_close_all_wins(void)
     return count;
 }
 
-int
-ui_close_read_wins(void)
+static int
+_ui_close_read_wins(void)
 {
     int count = 0;
     jabber_conn_status_t conn_status = jabber_get_connection_status();
@@ -501,8 +501,8 @@ ui_close_read_wins(void)
     return count;
 }
 
-void
-ui_switch_win(const int i)
+static void
+_ui_switch_win(const int i)
 {
     ui_current_page_off();
     ProfWin *new_current = wins_get_by_num(i);
@@ -535,8 +535,8 @@ ui_switch_win(const int i)
     }
 }
 
-void
-ui_next_win(void)
+static void
+_ui_next_win(void)
 {
     ui_current_page_off();
     ProfWin *new_current = wins_get_next();
@@ -568,8 +568,8 @@ ui_next_win(void)
     wins_refresh_current();
 }
 
-void
-ui_previous_win(void)
+static void
+_ui_previous_win(void)
 {
     ui_current_page_off();
     ProfWin *new_current = wins_get_previous();
@@ -601,14 +601,14 @@ ui_previous_win(void)
     wins_refresh_current();
 }
 
-void
-ui_clear_current(void)
+static void
+_ui_clear_current(void)
 {
     wins_clear_current();
 }
 
-void
-ui_close_current(void)
+static void
+_ui_close_current(void)
 {
     int current_index = wins_get_current_num();
     status_bar_inactive(current_index);
@@ -618,8 +618,8 @@ ui_close_current(void)
     title_bar_title();
 }
 
-void
-ui_close_win(int index)
+static void
+_ui_close_win(int index)
 {
     wins_close_by_num(index);
     status_bar_current(1);
@@ -629,8 +629,8 @@ ui_close_win(int index)
     wins_refresh_current();
 }
 
-void
-ui_tidy_wins(void)
+static void
+_ui_tidy_wins(void)
 {
     gboolean tidied = wins_tidy();
 
@@ -641,8 +641,8 @@ ui_tidy_wins(void)
     }
 }
 
-void
-ui_prune_wins(void)
+static void
+_ui_prune_wins(void)
 {
     jabber_conn_status_t conn_status = jabber_get_connection_status();
     gboolean pruned = FALSE;
@@ -686,42 +686,42 @@ ui_prune_wins(void)
     }
 }
 
-win_type_t
-ui_current_win_type(void)
+static win_type_t
+_ui_current_win_type(void)
 {
     ProfWin *current = wins_get_current();
     return current->type;
 }
 
-int
-ui_current_win_index(void)
+static int
+_ui_current_win_index(void)
 {
     return wins_get_current_num();
 }
 
-win_type_t
-ui_win_type(int index)
+static win_type_t
+_ui_win_type(int index)
 {
     ProfWin *window = wins_get_by_num(index);
     return window->type;
 }
 
-char *
-ui_recipient(int index)
+static char *
+_ui_recipient(int index)
 {
     ProfWin *window = wins_get_by_num(index);
     return window->from;
 }
 
-char *
-ui_current_recipient(void)
+static char *
+_ui_current_recipient(void)
 {
     ProfWin *current = wins_get_current();
     return current->from;
 }
 
-void
-ui_current_print_line(const char * const msg, ...)
+static void
+_ui_current_print_line(const char * const msg, ...)
 {
     ProfWin *current = wins_get_current();
     va_list arg;
@@ -731,24 +731,24 @@ ui_current_print_line(const char * const msg, ...)
     win_refresh(current);
 }
 
-void
-ui_current_error_line(const char * const msg)
+static void
+_ui_current_error_line(const char * const msg)
 {
     ProfWin *current = wins_get_current();
     win_print_line(current, '-', COLOUR_ERROR, msg);
     win_refresh(current);
 }
 
-void
-ui_current_page_off(void)
+static void
+_ui_current_page_off(void)
 {
     ProfWin *current = wins_get_current();
     win_page_off(current);
     win_refresh(current);
 }
 
-void
-ui_print_error_from_recipient(const char * const from, const char *err_msg)
+static void
+_ui_print_error_from_recipient(const char * const from, const char *err_msg)
 {
     if (from == NULL || err_msg == NULL)
         return;
@@ -762,8 +762,8 @@ ui_print_error_from_recipient(const char * const from, const char *err_msg)
     }
 }
 
-void
-ui_print_system_msg_from_recipient(const char * const from, const char *message)
+static void
+_ui_print_system_msg_from_recipient(const char * const from, const char *message)
 {
     int num = 0;
     char from_cpy[strlen(from) + 1];
@@ -797,8 +797,8 @@ ui_print_system_msg_from_recipient(const char * const from, const char *message)
     }
 }
 
-void
-ui_recipient_gone(const char * const barejid)
+static void
+_ui_recipient_gone(const char * const barejid)
 {
     if (barejid == NULL)
         return;
@@ -820,8 +820,8 @@ ui_recipient_gone(const char * const barejid)
     }
 }
 
-void
-ui_new_chat_win(const char * const to)
+static void
+_ui_new_chat_win(const char * const to)
 {
     // if the contact is offline, show a message
     PContact contact = roster_get_contact(to);
@@ -859,8 +859,8 @@ ui_new_chat_win(const char * const to)
     ui_switch_win(num);
 }
 
-void
-ui_create_duck_win(void)
+static void
+_ui_create_duck_win(void)
 {
     ProfWin *window = wins_new("DuckDuckGo search", WIN_DUCK);
     int num = wins_get_num(window);
@@ -868,8 +868,8 @@ ui_create_duck_win(void)
     win_print_line(window, '-', 0, "Type ':help' to find out more.");
 }
 
-void
-ui_open_duck_win(void)
+static void
+_ui_open_duck_win(void)
 {
     ProfWin *window = wins_get_by_recipient("DuckDuckGo search");
     if (window != NULL) {
@@ -878,8 +878,8 @@ ui_open_duck_win(void)
     }
 }
 
-void
-ui_duck(const char * const query)
+static void
+_ui_duck(const char * const query)
 {
     ProfWin *window = wins_get_by_recipient("DuckDuckGo search");
     if (window != NULL) {
@@ -894,8 +894,8 @@ ui_duck(const char * const query)
     }
 }
 
-void
-ui_duck_result(const char * const result)
+static void
+_ui_duck_result(const char * const result)
 {
     ProfWin *window = wins_get_by_recipient("DuckDuckGo search");
 
@@ -927,8 +927,8 @@ ui_duck_result(const char * const result)
     }
 }
 
-void
-ui_outgoing_msg(const char * const from, const char * const to,
+static void
+_ui_outgoing_msg(const char * const from, const char * const to,
     const char * const message)
 {
     PContact contact = roster_get_contact(to);
@@ -954,8 +954,8 @@ ui_outgoing_msg(const char * const from, const char * const to,
 
         if (contact != NULL) {
             if (strcmp(p_contact_presence(contact), "offline") == 0) {
-                const char const *show = p_contact_presence(contact);
-                const char const *status = p_contact_status(contact);
+                const char *show = p_contact_presence(contact);
+                const char *status = p_contact_status(contact);
                 win_show_status_string(window, to, show, status, NULL, "--", "offline");
             }
         }
@@ -979,8 +979,8 @@ ui_outgoing_msg(const char * const from, const char * const to,
     ui_switch_win(num);
 }
 
-void
-ui_room_join(Jid *jid)
+static void
+_ui_room_join(Jid *jid)
 {
     ProfWin *window = wins_get_by_recipient(jid->barejid);
     int num = 0;
@@ -994,8 +994,8 @@ ui_room_join(Jid *jid)
     ui_switch_win(num);
 }
 
-void
-ui_room_roster(const char * const room, GList *roster, const char * const presence)
+static void
+_ui_room_roster(const char * const room, GList *roster, const char * const presence)
 {
     ProfWin *window = wins_get_by_recipient(room);
 
@@ -1026,8 +1026,8 @@ ui_room_roster(const char * const room, GList *roster, const char * const presen
 
         while (roster != NULL) {
             PContact member = roster->data;
-            const char const *nick = p_contact_barejid(member);
-            const char const *show = p_contact_presence(member);
+            const char *nick = p_contact_barejid(member);
+            const char *show = p_contact_presence(member);
 
             win_presence_colour_on(window, show);
             wprintw(window->win, "%s", nick);
@@ -1049,8 +1049,8 @@ ui_room_roster(const char * const room, GList *roster, const char * const presen
     }
 }
 
-void
-ui_room_member_offline(const char * const room, const char * const nick)
+static void
+_ui_room_member_offline(const char * const room, const char * const nick)
 {
     ProfWin *window = wins_get_by_recipient(room);
 
@@ -1064,8 +1064,8 @@ ui_room_member_offline(const char * const room, const char * const nick)
     }
 }
 
-void
-ui_room_member_online(const char * const room, const char * const nick,
+static void
+_ui_room_member_online(const char * const room, const char * const nick,
     const char * const show, const char * const status)
 {
     ProfWin *window = wins_get_by_recipient(room);
@@ -1080,8 +1080,8 @@ ui_room_member_online(const char * const room, const char * const nick,
     }
 }
 
-void
-ui_room_member_presence(const char * const room, const char * const nick,
+static void
+_ui_room_member_presence(const char * const room, const char * const nick,
     const char * const show, const char * const status)
 {
     ProfWin *window = wins_get_by_recipient(room);
@@ -1095,8 +1095,8 @@ ui_room_member_presence(const char * const room, const char * const nick,
     }
 }
 
-void
-ui_room_member_nick_change(const char * const room,
+static void
+_ui_room_member_nick_change(const char * const room,
     const char * const old_nick, const char * const nick)
 {
     ProfWin *window = wins_get_by_recipient(room);
@@ -1111,8 +1111,8 @@ ui_room_member_nick_change(const char * const room,
     }
 }
 
-void
-ui_room_nick_change(const char * const room, const char * const nick)
+static void
+_ui_room_nick_change(const char * const room, const char * const nick)
 {
     ProfWin *window = wins_get_by_recipient(room);
 
@@ -1126,8 +1126,8 @@ ui_room_nick_change(const char * const room, const char * const nick)
     }
 }
 
-void
-ui_room_history(const char * const room_jid, const char * const nick,
+static void
+_ui_room_history(const char * const room_jid, const char * const nick,
     GTimeVal tv_stamp, const char * const message)
 {
     ProfWin *window = wins_get_by_recipient(room_jid);
@@ -1152,8 +1152,8 @@ ui_room_history(const char * const room_jid, const char * const nick,
     }
 }
 
-void
-ui_room_message(const char * const room_jid, const char * const nick,
+static void
+_ui_room_message(const char * const room_jid, const char * const nick,
     const char * const message)
 {
     ProfWin *window = wins_get_by_recipient(room_jid);
@@ -1224,8 +1224,8 @@ ui_room_message(const char * const room_jid, const char * const nick,
     }
 }
 
-void
-ui_room_subject(const char * const room_jid, const char * const subject)
+static void
+_ui_room_subject(const char * const room_jid, const char * const subject)
 {
     ProfWin *window = wins_get_by_recipient(room_jid);
     int num = wins_get_num(window);
@@ -1247,8 +1247,8 @@ ui_room_subject(const char * const room_jid, const char * const subject)
     }
 }
 
-void
-ui_room_broadcast(const char * const room_jid, const char * const message)
+static void
+_ui_room_broadcast(const char * const room_jid, const char * const message)
 {
     ProfWin *window = wins_get_by_recipient(room_jid);
     int num = wins_get_num(window);
@@ -1270,8 +1270,8 @@ ui_room_broadcast(const char * const room_jid, const char * const message)
     }
 }
 
-void
-ui_status(void)
+static void
+_ui_status(void)
 {
     char *recipient = ui_current_recipient();
     PContact pcontact = roster_get_contact(recipient);
@@ -1284,8 +1284,8 @@ ui_status(void)
     }
 }
 
-void
-ui_status_private(void)
+static void
+_ui_status_private(void)
 {
     Jid *jid = jid_create(ui_current_recipient());
     PContact pcontact = muc_get_participant(jid->barejid, jid->resourcepart);
@@ -1300,8 +1300,8 @@ ui_status_private(void)
     jid_destroy(jid);
 }
 
-void
-ui_status_room(const char * const contact)
+static void
+_ui_status_room(const char * const contact)
 {
     PContact pcontact = muc_get_participant(ui_current_recipient(), contact);
     ProfWin *current = wins_get_current();
@@ -1313,14 +1313,14 @@ ui_status_room(const char * const contact)
     }
 }
 
-gint
-ui_unread(void)
+static gint
+_ui_unread(void)
 {
     return wins_get_total_unread();
 }
 
-int
-ui_win_unread(int index)
+static int
+_ui_win_unread(int index)
 {
     ProfWin *window = wins_get_by_num(index);
     if (window != NULL) {
@@ -1330,8 +1330,8 @@ ui_win_unread(int index)
     }
 }
 
-char *
-ui_ask_password(void)
+static char *
+_ui_ask_password(void)
 {
   char *passwd = malloc(sizeof(char) * (MAX_PASSWORD_SIZE + 1));
   status_bar_get_password();
@@ -1537,3 +1537,76 @@ _win_show_history(WINDOW *win, int win_index, const char * const contact)
         g_slist_free_full(history, free);
     }
 }
+
+void
+ui_init_module(void)
+{
+    ui_init = _ui_init;
+    ui_refresh = _ui_refresh;
+    ui_get_idle_time = _ui_get_idle_time;
+    ui_reset_idle_time = _ui_reset_idle_time;
+    ui_close = _ui_close;
+    ui_resize = _ui_resize;
+    ui_load_colours = _ui_load_colours;
+    ui_win_exists = _ui_win_exists;
+    ui_duck_exists = _ui_duck_exists;
+    ui_contact_typing = _ui_contact_typing;
+    ui_get_recipients = _ui_get_recipients;
+    ui_incoming_msg = _ui_incoming_msg;
+    ui_roster_add = _ui_roster_add;
+    ui_roster_remove = _ui_roster_remove;
+    ui_contact_already_in_group = _ui_contact_already_in_group;
+    ui_contact_not_in_group = _ui_contact_not_in_group;
+    ui_group_added = _ui_group_added;
+    ui_group_removed = _ui_group_removed;
+    ui_handle_error_message = _ui_handle_error_message;
+    ui_contact_online = _ui_contact_online;
+    ui_contact_offline = _ui_contact_offline;
+    ui_disconnected = _ui_disconnected;
+    ui_handle_special_keys = _ui_handle_special_keys;
+    ui_close_connected_win = _ui_close_connected_win;
+    ui_close_all_wins = _ui_close_all_wins;
+    ui_close_read_wins = _ui_close_read_wins;
+    ui_switch_win = _ui_switch_win;
+    ui_next_win = _ui_next_win;
+    ui_previous_win = _ui_previous_win;
+    ui_clear_current = _ui_clear_current;
+    ui_close_current = _ui_close_current;
+    ui_close_win = _ui_close_win;
+    ui_tidy_wins = _ui_tidy_wins;
+    ui_prune_wins = _ui_prune_wins;
+    ui_current_win_type = _ui_current_win_type;
+    ui_current_win_index = _ui_current_win_index;
+    ui_win_type = _ui_win_type;
+    ui_recipient = _ui_recipient;
+    ui_current_recipient = _ui_current_recipient;
+    ui_current_print_line = _ui_current_print_line;
+    ui_current_error_line = _ui_current_error_line;
+    ui_current_page_off = _ui_current_page_off;
+    ui_print_error_from_recipient = _ui_print_error_from_recipient;
+    ui_print_system_msg_from_recipient = _ui_print_system_msg_from_recipient;
+    ui_recipient_gone = _ui_recipient_gone;
+    ui_new_chat_win = _ui_new_chat_win;
+    ui_create_duck_win = _ui_create_duck_win;
+    ui_open_duck_win = _ui_open_duck_win;
+    ui_duck = _ui_duck;
+    ui_duck_result = _ui_duck_result;
+    ui_outgoing_msg = _ui_outgoing_msg;
+    ui_room_join = _ui_room_join;
+    ui_room_roster = _ui_room_roster;
+    ui_room_member_offline = _ui_room_member_offline;
+    ui_room_member_online = _ui_room_member_online;
+    ui_room_member_presence = _ui_room_member_presence;
+    ui_room_member_nick_change = _ui_room_member_nick_change;
+    ui_room_nick_change = _ui_room_nick_change;
+    ui_room_history = _ui_room_history;
+    ui_room_message = _ui_room_message;
+    ui_room_subject = _ui_room_subject;
+    ui_room_broadcast = _ui_room_broadcast;
+    ui_status = _ui_status;
+    ui_status_private = _ui_status_private;
+    ui_status_room = _ui_status_room;
+    ui_unread = _ui_unread;
+    ui_win_unread = _ui_win_unread;
+    ui_ask_password = _ui_ask_password;
+}
diff --git a/src/ui/inputwin.c b/src/ui/inputwin.c
index 3306a246..dd02ed70 100644
--- a/src/ui/inputwin.c
+++ b/src/ui/inputwin.c
@@ -58,8 +58,8 @@ static int _printable(const wint_t ch);
 static void _clear_input(void);
 static void _go_to_end(int display_size);
 
-void
-create_input_window(void)
+static void
+_create_input_window(void)
 {
 #ifdef NCURSES_REENTRANT
     set_escdelay(25);
@@ -74,8 +74,8 @@ create_input_window(void)
     _inp_win_refresh();
 }
 
-void
-inp_win_resize(const char * const input, const int size)
+static void
+_inp_win_resize(const char * const input, const int size)
 {
     int inp_x;
     getmaxyx(stdscr, rows, cols);
@@ -92,20 +92,20 @@ inp_win_resize(const char * const input, const int size)
     _inp_win_refresh();
 }
 
-void
-inp_non_block(void)
+static void
+_inp_non_block(void)
 {
     wtimeout(inp_win, 20);
 }
 
-void
-inp_block(void)
+static void
+_inp_block(void)
 {
     wtimeout(inp_win, -1);
 }
 
-wint_t
-inp_get_char(char *input, int *size)
+static wint_t
+_inp_get_char(char *input, int *size)
 {
     int inp_x = 0;
     int i;
@@ -203,8 +203,8 @@ inp_get_char(char *input, int *size)
     return ch;
 }
 
-void
-inp_get_password(char *passwd)
+static void
+_inp_get_password(char *passwd)
 {
     _clear_input();
     _inp_win_refresh();
@@ -215,14 +215,14 @@ inp_get_password(char *passwd)
     status_bar_clear();
 }
 
-void
-inp_put_back(void)
+static void
+_inp_put_back(void)
 {
     _inp_win_refresh();
 }
 
-void
-inp_replace_input(char *input, const char * const new_input, int *size)
+static void
+_inp_replace_input(char *input, const char * const new_input, int *size)
 {
     int display_size;
     strcpy(input, new_input);
@@ -234,8 +234,8 @@ inp_replace_input(char *input, const char * const new_input, int *size)
     _go_to_end(display_size);
 }
 
-void
-inp_win_reset(void)
+static void
+_inp_win_reset(void)
 {
     _clear_input();
     pad_start = 0;
@@ -703,3 +703,17 @@ _printable(const wint_t ch)
     gunichar unichar = g_utf8_get_char(bytes);
     return g_unichar_isprint(unichar) && (ch != KEY_MOUSE);
 }
+
+void
+inputwin_init_module(void)
+{
+    create_input_window = _create_input_window;
+    inp_win_resize = _inp_win_resize;
+    inp_non_block = _inp_non_block;
+    inp_block = _inp_block;
+    inp_get_char = _inp_get_char;
+    inp_get_password = _inp_get_password;
+    inp_put_back = _inp_put_back;
+    inp_replace_input = _inp_replace_input;
+    inp_win_reset = _inp_win_reset;
+}
diff --git a/src/ui/notifier.c b/src/ui/notifier.c
index 403c215e..ebc61e0d 100644
--- a/src/ui/notifier.c
+++ b/src/ui/notifier.c
@@ -39,16 +39,16 @@
 static void _notify(const char * const message, int timeout,
     const char * const category);
 
-void
-notifier_init(void)
+static void
+_notifier_init(void)
 {
 #ifdef HAVE_LIBNOTIFY
     notify_init("Profanity");
 #endif
 }
 
-void
-notifier_uninit(void)
+static void
+_notifier_uninit(void)
 {
 #ifdef HAVE_LIBNOTIFY
     if (notify_is_initted()) {
@@ -57,8 +57,8 @@ notifier_uninit(void)
 #endif
 }
 
-void
-notify_typing(const char * const handle)
+static void
+_notify_typing(const char * const handle)
 {
     char message[strlen(handle) + 1 + 11];
     sprintf(message, "%s: typing...", handle);
@@ -66,8 +66,8 @@ notify_typing(const char * const handle)
     _notify(message, 10000, "Incoming message");
 }
 
-void
-notify_invite(const char * const from, const char * const room,
+static void
+_notify_invite(const char * const from, const char * const room,
     const char * const reason)
 {
     GString *message = g_string_new("Room invite\nfrom: ");
@@ -83,8 +83,8 @@ notify_invite(const char * const from, const char * const room,
     g_string_free(message, TRUE);
 }
 
-void
-notify_message(const char * const handle, int win)
+static void
+_notify_message(const char * const handle, int win)
 {
     char message[strlen(handle) + 1 + 14];
     sprintf(message, "%s: message (%d).", handle, win);
@@ -92,8 +92,8 @@ notify_message(const char * const handle, int win)
     _notify(message, 10000, "incoming message");
 }
 
-void
-notify_room_message(const char * const handle, const char * const room, int win)
+static void
+_notify_room_message(const char * const handle, const char * const room, int win)
 {
     GString *text = g_string_new("");
 
@@ -105,8 +105,8 @@ notify_room_message(const char * const handle, const char * const room, int win)
     g_string_free(text, TRUE);
 }
 
-void
-notify_subscription(const char * const from)
+static void
+_notify_subscription(const char * const from)
 {
     GString *message = g_string_new("Subscription request: \n");
     g_string_append(message, from);
@@ -114,8 +114,8 @@ notify_subscription(const char * const from)
     g_string_free(message, TRUE);
 }
 
-void
-notify_remind(void)
+static void
+_notify_remind(void)
 {
     gint unread = ui_unread();
     gint open = muc_invite_count();
@@ -206,3 +206,17 @@ _notify(const char * const message, int timeout,
     Shell_NotifyIcon(NIM_MODIFY, &nid);
 #endif
 }
+
+void
+notifier_init_module(void)
+{
+    notifier_init = _notifier_init;
+    notifier_uninit = _notifier_uninit;
+    notify_typing = _notify_typing;
+    notify_invite = _notify_invite;
+    notify_message = _notify_message;
+    notify_room_message =  _notify_room_message;
+    notify_subscription = _notify_subscription;
+    notify_remind = _notify_remind;
+}
+
diff --git a/src/ui/statusbar.c b/src/ui/statusbar.c
index 16bd31c9..4d0ab7ef 100644
--- a/src/ui/statusbar.c
+++ b/src/ui/statusbar.c
@@ -54,8 +54,8 @@ static void _mark_new(int num);
 static void _mark_active(int num);
 static void _mark_inactive(int num);
 
-void
-create_status_bar(void)
+static void
+_create_status_bar(void)
 {
     int rows, cols, i;
     getmaxyx(stdscr, rows, cols);
@@ -84,8 +84,8 @@ create_status_bar(void)
     dirty = TRUE;
 }
 
-void
-status_bar_refresh(void)
+static void
+_status_bar_refresh(void)
 {
     GDateTime *now_time = g_date_time_new_now_local();
     GTimeSpan elapsed = g_date_time_difference(now_time, last_time);
@@ -108,8 +108,8 @@ status_bar_refresh(void)
     g_date_time_unref(now_time);
 }
 
-void
-status_bar_resize(void)
+static void
+_status_bar_resize(void)
 {
     int rows, cols;
     getmaxyx(stdscr, rows, cols);
@@ -134,8 +134,8 @@ status_bar_resize(void)
     dirty = TRUE;
 }
 
-void
-status_bar_set_all_inactive(void)
+static void
+_status_bar_set_all_inactive(void)
 {
     int i = 0;
     for (i = 0; i < 12; i++) {
@@ -148,8 +148,8 @@ status_bar_set_all_inactive(void)
     g_hash_table_remove_all(remaining_new);
 }
 
-void
-status_bar_current(int i)
+static void
+_status_bar_current(int i)
 {
     if (i == 0) {
         current = 10;
@@ -165,8 +165,8 @@ status_bar_current(int i)
     wattroff(status_bar, COLOUR_STATUS_BRACKET);
 }
 
-void
-status_bar_inactive(const int win)
+static void
+_status_bar_inactive(const int win)
 {
     int true_win = win;
     if (true_win == 0) {
@@ -205,8 +205,8 @@ status_bar_inactive(const int win)
     }
 }
 
-void
-status_bar_active(const int win)
+static void
+_status_bar_active(const int win)
 {
     int true_win = win;
     if (true_win == 0) {
@@ -239,8 +239,8 @@ status_bar_active(const int win)
     }
 }
 
-void
-status_bar_new(const int win)
+static void
+_status_bar_new(const int win)
 {
     int true_win = win;
     if (true_win == 0) {
@@ -262,15 +262,15 @@ status_bar_new(const int win)
     }
 }
 
-void
-status_bar_get_password(void)
+static void
+_status_bar_get_password(void)
 {
     status_bar_print_message("Enter password:");
     dirty = TRUE;
 }
 
-void
-status_bar_print_message(const char * const msg)
+static void
+_status_bar_print_message(const char * const msg)
 {
     werase(status_bar);
 
@@ -292,8 +292,8 @@ status_bar_print_message(const char * const msg)
     dirty = TRUE;
 }
 
-void
-status_bar_clear(void)
+static void
+_status_bar_clear(void)
 {
     if (message != NULL) {
         free(message);
@@ -320,8 +320,8 @@ status_bar_clear(void)
     dirty = TRUE;
 }
 
-void
-status_bar_clear_message(void)
+static void
+_status_bar_clear_message(void)
 {
     if (message != NULL) {
         free(message);
@@ -421,3 +421,20 @@ _mark_inactive(int num)
     mvwaddch(status_bar, 0, cols - 34 + active_pos, ' ');
     dirty = TRUE;
 }
+
+void
+statusbar_init_module(void)
+{
+    create_status_bar = _create_status_bar;
+    status_bar_refresh = _status_bar_refresh;
+    status_bar_resize = _status_bar_resize;
+    status_bar_set_all_inactive = _status_bar_set_all_inactive;
+    status_bar_current = _status_bar_current;
+    status_bar_inactive = _status_bar_inactive;
+    status_bar_active = _status_bar_active;
+    status_bar_new = _status_bar_new;
+    status_bar_get_password = _status_bar_get_password;
+    status_bar_print_message = _status_bar_print_message;
+    status_bar_clear = _status_bar_clear;
+    status_bar_clear_message = _status_bar_clear_message;
+}
diff --git a/src/ui/titlebar.c b/src/ui/titlebar.c
index 791a5fbe..04492b62 100644
--- a/src/ui/titlebar.c
+++ b/src/ui/titlebar.c
@@ -37,8 +37,8 @@ static contact_presence_t current_status;
 static void _title_bar_draw_title(void);
 static void _title_bar_draw_status(void);
 
-void
-create_title_bar(void)
+static void
+_create_title_bar(void)
 {
     int cols = getmaxx(stdscr);
 
@@ -49,8 +49,8 @@ create_title_bar(void)
     dirty = TRUE;
 }
 
-void
-title_bar_title(void)
+static void
+_title_bar_title(void)
 {
     werase(title_bar);
     recipient = NULL;
@@ -60,8 +60,8 @@ title_bar_title(void)
     dirty = TRUE;
 }
 
-void
-title_bar_resize(void)
+static void
+_title_bar_resize(void)
 {
     int cols = getmaxx(stdscr);
 
@@ -73,8 +73,8 @@ title_bar_resize(void)
     dirty = TRUE;
 }
 
-void
-title_bar_refresh(void)
+static void
+_title_bar_refresh(void)
 {
     if (recipient != NULL) {
 
@@ -107,8 +107,8 @@ title_bar_refresh(void)
     }
 }
 
-void
-title_bar_show(const char * const title)
+static void
+_title_bar_show(const char * const title)
 {
     if (current_title != NULL)
         free(current_title);
@@ -118,15 +118,15 @@ title_bar_show(const char * const title)
     _title_bar_draw_title();
 }
 
-void
-title_bar_set_status(contact_presence_t status)
+static void
+_title_bar_set_status(contact_presence_t status)
 {
     current_status = status;
     _title_bar_draw_status();
 }
 
-void
-title_bar_set_recipient(const char * const from)
+static void
+_title_bar_set_recipient(const char * const from)
 {
     if (typing_elapsed != NULL) {
         g_timer_destroy(typing_elapsed);
@@ -144,8 +144,8 @@ title_bar_set_recipient(const char * const from)
     dirty = TRUE;
 }
 
-void
-title_bar_set_typing(gboolean is_typing)
+static void
+_title_bar_set_typing(gboolean is_typing)
 {
     if (is_typing) {
         if (typing_elapsed != NULL) {
@@ -170,8 +170,8 @@ title_bar_set_typing(gboolean is_typing)
     dirty = TRUE;
 }
 
-void
-title_bar_draw(void)
+static void
+_title_bar_draw(void)
 {
     werase(title_bar);
     _title_bar_draw_status();
@@ -227,3 +227,17 @@ _title_bar_draw_title(void)
 
     dirty = TRUE;
 }
+
+void
+titlebar_init_module(void)
+{
+    create_title_bar = _create_title_bar;
+    title_bar_title = _title_bar_title;
+    title_bar_resize = _title_bar_resize;
+    title_bar_refresh = _title_bar_refresh;
+    title_bar_show = _title_bar_show;
+    title_bar_set_status = _title_bar_set_status;
+    title_bar_set_recipient = _title_bar_set_recipient;
+    title_bar_set_typing = _title_bar_set_typing;
+    title_bar_draw = _title_bar_draw;
+}
diff --git a/src/ui/ui.h b/src/ui/ui.h
index f6bb98ac..e5d4118d 100644
--- a/src/ui/ui.h
+++ b/src/ui/ui.h
@@ -41,219 +41,221 @@
 
 #define INP_WIN_MAX 1000
 
+void ui_init_module(void);
+void console_init_module(void);
+void inputwin_init_module(void);
+void notifier_init_module(void);
+void statusbar_init_module(void);
+void titlebar_init_module(void);
+
 // ui startup and control
-void ui_init(void);
-void ui_load_colours(void);
-void ui_refresh(void);
-void ui_close(void);
-void ui_resize(const int ch, const char * const input,
+void (*ui_init)(void);
+void (*ui_load_colours)(void);
+void (*ui_refresh)(void);
+void (*ui_close)(void);
+void (*ui_resize)(const int ch, const char * const input,
     const int size);
-GSList* ui_get_recipients(void);
-void ui_handle_special_keys(const wint_t * const ch, const char * const inp,
+GSList* (*ui_get_recipients)(void);
+void (*ui_handle_special_keys)(const wint_t * const ch, const char * const inp,
     const int size);
-void ui_switch_win(const int i);
-void ui_next_win(void);
-void ui_previous_win(void);
-unsigned long ui_get_idle_time(void);
-void ui_reset_idle_time(void);
-void ui_new_chat_win(const char * const to);
-void ui_print_error_from_recipient(const char * const from, const char *err_msg);
-void ui_print_system_msg_from_recipient(const char * const from, const char *message);
-void ui_handle_error_message(const char * const from, const char * const err_msg);
-gint ui_unread(void);
-void ui_close_connected_win(int index);
-int ui_close_all_wins(void);
-int ui_close_read_wins(void);
+void (*ui_switch_win)(const int i);
+void (*ui_next_win)(void);
+void (*ui_previous_win)(void);
+unsigned long (*ui_get_idle_time)(void);
+void (*ui_reset_idle_time)(void);
+void (*ui_new_chat_win)(const char * const to);
+void (*ui_print_error_from_recipient)(const char * const from, const char *err_msg);
+void (*ui_print_system_msg_from_recipient)(const char * const from, const char *message);
+void (*ui_handle_error_message)(const char * const from, const char * const err_msg);
+gint (*ui_unread)(void);
+void (*ui_close_connected_win)(int index);
+int (*ui_close_all_wins)(void);
+int (*ui_close_read_wins)(void);
 
 // current window actions
-void ui_close_current(void);
-void ui_clear_current(void);
-win_type_t ui_current_win_type(void);
-int ui_current_win_index(void);
-char* ui_current_recipient(void);
-void ui_current_print_line(const char * const msg, ...);
-void ui_current_error_line(const char * const msg);
-void ui_current_page_off(void);
+void (*ui_close_current)(void);
+void (*ui_clear_current)(void);
+win_type_t (*ui_current_win_type)(void);
+int (*ui_current_win_index)(void);
+char* (*ui_current_recipient)(void);
+void (*ui_current_print_line)(const char * const msg, ...);
+void (*ui_current_error_line)(const char * const msg);
+void (*ui_current_page_off)(void);
 
-win_type_t ui_win_type(int index);
-char * ui_recipient(int index);
-void ui_close_win(int index);
-gboolean ui_win_exists(int index);
-int ui_win_unread(int index);
-char * ui_ask_password(void);
+win_type_t (*ui_win_type)(int index);
+char * (*ui_recipient)(int index);
+void (*ui_close_win)(int index);
+gboolean (*ui_win_exists)(int index);
+int (*ui_win_unread)(int index);
+char * (*ui_ask_password)(void);
 
 // ui events
-void ui_contact_typing(const char * const from);
-void ui_incoming_msg(const char * const from, const char * const message,
+void (*ui_contact_typing)(const char * const from);
+void (*ui_incoming_msg)(const char * const from, const char * const message,
     GTimeVal *tv_stamp, gboolean priv);
-void ui_contact_online(const char * const barejid, const char * const resource,
+void (*ui_contact_online)(const char * const barejid, const char * const resource,
     const char * const show, const char * const status, GDateTime *last_activity);
-void ui_contact_offline(const char * const from, const char * const show,
+void (*ui_contact_offline)(const char * const from, const char * const show,
     const char * const status);
-void ui_disconnected(void);
-void ui_recipient_gone(const char * const barejid);
-void ui_outgoing_msg(const char * const from, const char * const to,
+void (*ui_disconnected)(void);
+void (*ui_recipient_gone)(const char * const barejid);
+void (*ui_outgoing_msg)(const char * const from, const char * const to,
     const char * const message);
-void ui_room_join(Jid *jid);
-void ui_room_roster(const char * const room, GList *roster, const char * const presence);
-void ui_room_history(const char * const room_jid, const char * const nick,
+void (*ui_room_join)(Jid *jid);
+void (*ui_room_roster)(const char * const room, GList *roster, const char * const presence);
+void (*ui_room_history)(const char * const room_jid, const char * const nick,
     GTimeVal tv_stamp, const char * const message);
-void ui_room_message(const char * const room_jid, const char * const nick,
+void (*ui_room_message)(const char * const room_jid, const char * const nick,
     const char * const message);
-void ui_room_subject(const char * const room_jid,
+void (*ui_room_subject)(const char * const room_jid,
     const char * const subject);
-void ui_room_broadcast(const char * const room_jid,
+void (*ui_room_broadcast)(const char * const room_jid,
     const char * const message);
-void ui_room_member_offline(const char * const room, const char * const nick);
-void ui_room_member_online(const char * const room,
+void (*ui_room_member_offline)(const char * const room, const char * const nick);
+void (*ui_room_member_online)(const char * const room,
     const char * const nick, const char * const show, const char * const status);
-void ui_room_member_nick_change(const char * const room,
+void (*ui_room_member_nick_change)(const char * const room,
     const char * const old_nick, const char * const nick);
-void ui_room_nick_change(const char * const room, const char * const nick);
-void ui_room_member_presence(const char * const room,
+void (*ui_room_nick_change)(const char * const room, const char * const nick);
+void (*ui_room_member_presence)(const char * const room,
     const char * const nick, const char * const show, const char * const status);
-void ui_roster_add(const char * const barejid, const char * const name);
-void ui_roster_remove(const char * const barejid);
-void ui_contact_already_in_group(const char * const contact, const char * const group);
-void ui_contact_not_in_group(const char * const contact, const char * const group);
-void ui_group_added(const char * const contact, const char * const group);
-void ui_group_removed(const char * const contact, const char * const group);
+void (*ui_roster_add)(const char * const barejid, const char * const name);
+void (*ui_roster_remove)(const char * const barejid);
+void (*ui_contact_already_in_group)(const char * const contact, const char * const group);
+void (*ui_contact_not_in_group)(const char * const contact, const char * const group);
+void (*ui_group_added)(const char * const contact, const char * const group);
+void (*ui_group_removed)(const char * const contact, const char * const group);
 
 // contact status functions
-void ui_status_room(const char * const contact);
-void ui_status(void);
-void ui_status_private(void);
+void (*ui_status_room)(const char * const contact);
+void (*ui_status)(void);
+void (*ui_status_private)(void);
 
-void ui_create_duck_win(void);
-void ui_open_duck_win(void);
-void ui_duck(const char * const query);
-void ui_duck_result(const char * const result);
-gboolean ui_duck_exists(void);
+void (*ui_create_duck_win)(void);
+void (*ui_open_duck_win)(void);
+void (*ui_duck)(const char * const query);
+void (*ui_duck_result)(const char * const result);
+gboolean (*ui_duck_exists)(void);
 
-void ui_tidy_wins(void);
-void ui_prune_wins(void);
+void (*ui_tidy_wins)(void);
+void (*ui_prune_wins)(void);
 
 // create windows
-void create_title_bar(void);
-void create_status_bar(void);
-void create_input_window(void);
+void (*create_title_bar)(void);
+void (*create_status_bar)(void);
+void (*create_input_window)(void);
 
 // title bar actions
-void title_bar_refresh(void);
-void title_bar_resize(void);
-void title_bar_show(const char * const title);
-void title_bar_title(void);
-void title_bar_set_status(contact_presence_t status);
-void title_bar_set_recipient(const char * const from);
-void title_bar_set_typing(gboolean is_typing);
-void title_bar_draw(void);
+void (*title_bar_refresh)(void);
+void (*title_bar_resize)(void);
+void (*title_bar_show)(const char * const title);
+void (*title_bar_title)(void);
+void (*title_bar_set_status)(contact_presence_t status);
+void (*title_bar_set_recipient)(const char * const from);
+void (*title_bar_set_typing)(gboolean is_typing);
+void (*title_bar_draw)(void);
 
 // console window actions
-void cons_show(const char * const msg, ...);
-void cons_about(void);
-void cons_help(void);
-void cons_basic_help(void);
-void cons_settings_help(void);
-void cons_presence_help(void);
-void cons_navigation_help(void);
-void cons_prefs(void);
-void cons_show_ui_prefs(void);
-void cons_show_desktop_prefs(void);
-void cons_show_chat_prefs(void);
-void cons_show_log_prefs(void);
-void cons_show_presence_prefs(void);
-void cons_show_connection_prefs(void);
-void cons_show_account(ProfAccount *account);
-void cons_debug(const char * const msg, ...);
-void cons_show_time(void);
-void cons_show_word(const char * const word);
-void cons_show_error(const char * const cmd, ...);
-void cons_highlight_show(const char * const cmd);
-void cons_show_contacts(GSList * list);
-void cons_show_roster(GSList * list);
-void cons_show_roster_group(const char * const group, GSList * list);
-void cons_show_wins(void);
-void cons_show_status(const char * const barejid);
-void cons_show_info(PContact pcontact);
-void cons_show_caps(const char * const contact, Resource *resource);
-void cons_show_themes(GSList *themes);
-void cons_show_login_success(ProfAccount *account);
-void cons_show_software_version(const char * const jid,
+void (*cons_show)(const char * const msg, ...);
+void (*cons_about)(void);
+void (*cons_help)(void);
+void (*cons_navigation_help)(void);
+void (*cons_prefs)(void);
+void (*cons_show_ui_prefs)(void);
+void (*cons_show_desktop_prefs)(void);
+void (*cons_show_chat_prefs)(void);
+void (*cons_show_log_prefs)(void);
+void (*cons_show_presence_prefs)(void);
+void (*cons_show_connection_prefs)(void);
+void (*cons_show_account)(ProfAccount *account);
+void (*cons_debug)(const char * const msg, ...);
+void (*cons_show_time)(void);
+void (*cons_show_word)(const char * const word);
+void (*cons_show_error)(const char * const cmd, ...);
+void (*cons_show_contacts)(GSList * list);
+void (*cons_show_roster)(GSList * list);
+void (*cons_show_roster_group)(const char * const group, GSList * list);
+void (*cons_show_wins)(void);
+void (*cons_show_status)(const char * const barejid);
+void (*cons_show_info)(PContact pcontact);
+void (*cons_show_caps)(const char * const contact, Resource *resource);
+void (*cons_show_themes)(GSList *themes);
+void (*cons_show_login_success)(ProfAccount *account);
+void (*cons_show_software_version)(const char * const jid,
     const char * const presence, const char * const name,
     const char * const version, const char * const os);
-void cons_show_account_list(gchar **accounts);
-void cons_show_room_list(GSList *room, const char * const conference_node);
-void cons_show_bookmarks(const GList *list);
-void cons_show_disco_items(GSList *items, const char * const jid);
-void cons_show_disco_info(const char *from, GSList *identities, GSList *features);
-void cons_show_room_invite(const char * const invitor, const char * const room,
+void (*cons_show_account_list)(gchar **accounts);
+void (*cons_show_room_list)(GSList *room, const char * const conference_node);
+void (*cons_show_bookmarks)(const GList *list);
+void (*cons_show_disco_items)(GSList *items, const char * const jid);
+void (*cons_show_disco_info)(const char *from, GSList *identities, GSList *features);
+void (*cons_show_room_invite)(const char * const invitor, const char * const room,
     const char * const reason);
-void cons_check_version(gboolean not_available_msg);
-void cons_show_typing(const char * const barejid);
-void cons_show_incoming_message(const char * const short_from, const int win_index);
-void cons_show_room_invites(GSList *invites);
-void cons_show_received_subs(void);
-void cons_show_sent_subs(void);
-void cons_alert(void);
-void cons_theme_setting(void);
-void cons_beep_setting(void);
-void cons_flash_setting(void);
-void cons_splash_setting(void);
-void cons_vercheck_setting(void);
-void cons_mouse_setting(void);
-void cons_statuses_setting(void);
-void cons_titlebar_setting(void);
-void cons_notify_setting(void);
-void cons_show_desktop_prefs(void);
-void cons_states_setting(void);
-void cons_outtype_setting(void);
-void cons_intype_setting(void);
-void cons_gone_setting(void);
-void cons_history_setting(void);
-void cons_log_setting(void);
-void cons_chlog_setting(void);
-void cons_grlog_setting(void);
-void cons_autoaway_setting(void);
-void cons_reconnect_setting(void);
-void cons_autoping_setting(void);
-void cons_priority_setting(void);
-void cons_autoconnect_setting(void);
+void (*cons_check_version)(gboolean not_available_msg);
+void (*cons_show_typing)(const char * const barejid);
+void (*cons_show_incoming_message)(const char * const short_from, const int win_index);
+void (*cons_show_room_invites)(GSList *invites);
+void (*cons_show_received_subs)(void);
+void (*cons_show_sent_subs)(void);
+void (*cons_alert)(void);
+void (*cons_theme_setting)(void);
+void (*cons_beep_setting)(void);
+void (*cons_flash_setting)(void);
+void (*cons_splash_setting)(void);
+void (*cons_vercheck_setting)(void);
+void (*cons_mouse_setting)(void);
+void (*cons_statuses_setting)(void);
+void (*cons_titlebar_setting)(void);
+void (*cons_notify_setting)(void);
+void (*cons_show_desktop_prefs)(void);
+void (*cons_states_setting)(void);
+void (*cons_outtype_setting)(void);
+void (*cons_intype_setting)(void);
+void (*cons_gone_setting)(void);
+void (*cons_history_setting)(void);
+void (*cons_log_setting)(void);
+void (*cons_chlog_setting)(void);
+void (*cons_grlog_setting)(void);
+void (*cons_autoaway_setting)(void);
+void (*cons_reconnect_setting)(void);
+void (*cons_autoping_setting)(void);
+void (*cons_priority_setting)(void);
+void (*cons_autoconnect_setting)(void);
 
 // status bar actions
-void status_bar_refresh(void);
-void status_bar_resize(void);
-void status_bar_clear(void);
-void status_bar_clear_message(void);
-void status_bar_get_password(void);
-void status_bar_print_message(const char * const msg);
-void status_bar_inactive(const int win);
-void status_bar_active(const int win);
-void status_bar_new(const int win);
-void status_bar_update_time(void);
-void status_bar_set_all_inactive(void);
-void status_bar_current(int i);
+void (*status_bar_refresh)(void);
+void (*status_bar_resize)(void);
+void (*status_bar_clear)(void);
+void (*status_bar_clear_message)(void);
+void (*status_bar_get_password)(void);
+void (*status_bar_print_message)(const char * const msg);
+void (*status_bar_inactive)(const int win);
+void (*status_bar_active)(const int win);
+void (*status_bar_new)(const int win);
+void (*status_bar_set_all_inactive)(void);
+void (*status_bar_current)(int i);
 
 // input window actions
-wint_t inp_get_char(char *input, int *size);
-void inp_win_reset(void);
-void inp_win_resize(const char * input, const int size);
-void inp_put_back(void);
-void inp_non_block(void);
-void inp_block(void);
-void inp_get_password(char *passwd);
-void inp_replace_input(char *input, const char * const new_input, int *size);
+wint_t (*inp_get_char)(char *input, int *size);
+void (*inp_win_reset)(void);
+void (*inp_win_resize)(const char * input, const int size);
+void (*inp_put_back)(void);
+void (*inp_non_block)(void);
+void (*inp_block)(void);
+void (*inp_get_password)(char *passwd);
+void (*inp_replace_input)(char *input, const char * const new_input, int *size);
 
 // desktop notifier actions
-void notifier_init(void);
-void notifier_uninit(void);
+void (*notifier_init)(void);
+void (*notifier_uninit)(void);
 
-void notify_typing(const char * const handle);
-void notify_message(const char * const handle, int win);
-void notify_room_message(const char * const handle, const char * const room,
+void (*notify_typing)(const char * const handle);
+void (*notify_message)(const char * const handle, int win);
+void (*notify_room_message)(const char * const handle, const char * const room,
     int win);
-void notify_remind(void);
-void notify_invite(const char * const from, const char * const room,
+void (*notify_remind)(void);
+void (*notify_invite)(const char * const from, const char * const room,
     const char * const reason);
-void notify_subscription(const char * const from);
+void (*notify_subscription)(const char * const from);
 
 #endif
diff --git a/src/xmpp/bookmark.c b/src/xmpp/bookmark.c
index 0818f9ee..4516454f 100644
--- a/src/xmpp/bookmark.c
+++ b/src/xmpp/bookmark.c
@@ -61,8 +61,8 @@ bookmark_request(void)
     xmpp_stanza_release(iq);
 }
 
-void
-bookmark_add(const char *jid, const char *nick, gboolean autojoin)
+static void
+_bookmark_add(const char *jid, const char *nick, gboolean autojoin)
 {
     /* TODO: send request */
     /* TODO: manage bookmark_list */
@@ -72,8 +72,8 @@ bookmark_add(const char *jid, const char *nick, gboolean autojoin)
     autocomplete_add(bookmark_ac, jid);
 }
 
-void
-bookmark_remove(const char *jid, gboolean autojoin)
+static void
+_bookmark_remove(const char *jid, gboolean autojoin)
 {
     /* TODO: manage bookmark_list */
     if (autojoin) {
@@ -84,20 +84,20 @@ bookmark_remove(const char *jid, gboolean autojoin)
     }
 }
 
-const GList *
-bookmark_get_list(void)
+static const GList *
+_bookmark_get_list(void)
 {
     return bookmark_list;
 }
 
-char *
-bookmark_find(char *search_str)
+static char *
+_bookmark_find(char *search_str)
 {
     return autocomplete_complete(bookmark_ac, search_str);
 }
 
-void
-bookmark_autocomplete_reset(void)
+static void
+_bookmark_autocomplete_reset(void)
 {
     if (bookmark_ac != NULL) {
         autocomplete_reset(bookmark_ac);
@@ -243,3 +243,13 @@ _bookmark_item_destroy(gpointer item)
     free(p->nick);
     free(p);
 }
+
+void
+bookmark_init_module(void)
+{
+    bookmark_add = _bookmark_add;
+    bookmark_remove = _bookmark_remove;
+    bookmark_get_list = _bookmark_get_list;
+    bookmark_find = _bookmark_find;
+    bookmark_autocomplete_reset = _bookmark_autocomplete_reset;
+}
diff --git a/src/xmpp/capabilities.c b/src/xmpp/capabilities.c
index 658be124..fc71ae54 100644
--- a/src/xmpp/capabilities.c
+++ b/src/xmpp/capabilities.c
@@ -107,8 +107,8 @@ caps_contains(const char * const caps_str)
     return (g_hash_table_lookup(capabilities, caps_str) != NULL);
 }
 
-Capabilities *
-caps_get(const char * const caps_str)
+static Capabilities *
+_caps_get(const char * const caps_str)
 {
     return g_hash_table_lookup(capabilities, caps_str);
 }
@@ -303,8 +303,8 @@ caps_create_query_response_stanza(xmpp_ctx_t * const ctx)
     return query;
 }
 
-void
-caps_close(void)
+static void
+_caps_close(void)
 {
     g_hash_table_destroy(capabilities);
 }
@@ -326,3 +326,10 @@ _caps_destroy(Capabilities *caps)
         free(caps);
     }
 }
+
+void
+capabilities_init_module(void)
+{
+    caps_get = _caps_get;
+    caps_close = _caps_close;
+}
diff --git a/src/xmpp/connection.c b/src/xmpp/connection.c
index a1cb31c4..f38da800 100644
--- a/src/xmpp/connection.c
+++ b/src/xmpp/connection.c
@@ -91,8 +91,8 @@ void _connection_free_saved_account(void);
 void _connection_free_saved_details(void);
 void _connection_free_session_data(void);
 
-void
-jabber_init(const int disable_tls)
+static void
+_jabber_init(const int disable_tls)
 {
     log_info("Initialising XMPP");
     jabber_conn.conn_status = JABBER_STARTED;
@@ -108,8 +108,8 @@ jabber_init(const int disable_tls)
     xmpp_initialize();
 }
 
-jabber_conn_status_t
-jabber_connect_with_account(const ProfAccount * const account)
+static jabber_conn_status_t
+_jabber_connect_with_account(const ProfAccount * const account)
 {
     assert(account != NULL);
 
@@ -128,8 +128,8 @@ jabber_connect_with_account(const ProfAccount * const account)
     return result;
 }
 
-jabber_conn_status_t
-jabber_connect_with_details(const char * const jid,
+static jabber_conn_status_t
+_jabber_connect_with_details(const char * const jid,
     const char * const passwd, const char * const altdomain)
 {
     assert(jid != NULL);
@@ -160,8 +160,8 @@ jabber_connect_with_details(const char * const jid,
     return _jabber_connect(saved_details.jid, passwd, saved_details.altdomain);
 }
 
-void
-jabber_disconnect(void)
+static void
+_jabber_disconnect(void)
 {
     // if connected, send end stream and wait for response
     if (jabber_conn.conn_status == JABBER_CONNECTED) {
@@ -190,14 +190,14 @@ jabber_disconnect(void)
     FREE_SET_NULL(jabber_conn.domain);
 }
 
-void
-jabber_shutdown(void)
+static void
+_jabber_shutdown(void)
 {
     xmpp_shutdown();
 }
 
-void
-jabber_process_events(void)
+static void
+_jabber_process_events(void)
 {
     // run xmpp event loop if connected, connecting or disconnecting
     if (jabber_conn.conn_status == JABBER_CONNECTED
@@ -217,8 +217,8 @@ jabber_process_events(void)
 
 }
 
-void
-jabber_set_autoping(const int seconds)
+static void
+_jabber_set_autoping(const int seconds)
 {
     if (jabber_conn.conn_status == JABBER_CONNECTED) {
         xmpp_timed_handler_delete(jabber_conn.conn, _ping_timed_handler);
@@ -231,14 +231,14 @@ jabber_set_autoping(const int seconds)
     }
 }
 
-GList *
-jabber_get_available_resources(void)
+static GList *
+_jabber_get_available_resources(void)
 {
     return g_hash_table_get_values(available_resources);
 }
 
-jabber_conn_status_t
-jabber_get_connection_status(void)
+static jabber_conn_status_t
+_jabber_get_connection_status(void)
 {
     return (jabber_conn.conn_status);
 }
@@ -255,26 +255,26 @@ connection_get_ctx(void)
     return jabber_conn.ctx;
 }
 
-const char *
-jabber_get_fulljid(void)
+static const char *
+_jabber_get_fulljid(void)
 {
     return xmpp_conn_get_jid(jabber_conn.conn);
 }
 
-const char *
-jabber_get_domain(void)
+static const char *
+_jabber_get_domain(void)
 {
     return jabber_conn.domain;
 }
 
-char *
-jabber_get_presence_message(void)
+static char *
+_jabber_get_presence_message(void)
 {
     return jabber_conn.presence_message;
 }
 
-char *
-jabber_get_account_name(void)
+static char *
+_jabber_get_account_name(void)
 {
     return saved_account.name;
 }
@@ -615,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/iq.c b/src/xmpp/iq.c
index fdabe771..369d7f7e 100644
--- a/src/xmpp/iq.c
+++ b/src/xmpp/iq.c
@@ -75,8 +75,8 @@ iq_add_handlers(void)
     HANDLE(STANZA_NS_PING,      STANZA_TYPE_GET,    _iq_handle_ping_get);
 }
 
-void
-iq_room_list_request(gchar *conferencejid)
+static void
+_iq_room_list_request(gchar *conferencejid)
 {
     xmpp_conn_t * const conn = connection_get_conn();
     xmpp_ctx_t * const ctx = connection_get_ctx();
@@ -85,8 +85,8 @@ iq_room_list_request(gchar *conferencejid)
     xmpp_stanza_release(iq);
 }
 
-void
-iq_disco_info_request(gchar *jid)
+static void
+_iq_disco_info_request(gchar *jid)
 {
     xmpp_conn_t * const conn = connection_get_conn();
     xmpp_ctx_t * const ctx = connection_get_ctx();
@@ -95,8 +95,8 @@ iq_disco_info_request(gchar *jid)
     xmpp_stanza_release(iq);
 }
 
-void
-iq_disco_items_request(gchar *jid)
+static void
+_iq_disco_items_request(gchar *jid)
 {
     xmpp_conn_t * const conn = connection_get_conn();
     xmpp_ctx_t * const ctx = connection_get_ctx();
@@ -105,8 +105,8 @@ iq_disco_items_request(gchar *jid)
     xmpp_stanza_release(iq);
 }
 
-void
-iq_send_software_version(const char * const fulljid)
+static void
+_iq_send_software_version(const char * const fulljid)
 {
     xmpp_conn_t * const conn = connection_get_conn();
     xmpp_ctx_t * const ctx = connection_get_ctx();
@@ -567,3 +567,12 @@ _iq_handle_discoitems_result(xmpp_conn_t * const conn, xmpp_stanza_t * const sta
 
     return 1;
 }
+
+void
+iq_init_module(void)
+{
+    iq_room_list_request = _iq_room_list_request;
+    iq_disco_info_request = _iq_disco_info_request;
+    iq_disco_items_request = _iq_disco_items_request;
+    iq_send_software_version = _iq_send_software_version;
+}
diff --git a/src/xmpp/message.c b/src/xmpp/message.c
index a1644587..482a3965 100644
--- a/src/xmpp/message.c
+++ b/src/xmpp/message.c
@@ -57,8 +57,8 @@ message_add_handlers(void)
     HANDLE(NULL, NULL,                   _conference_message_handler);
 }
 
-void
-message_send(const char * const msg, const char * const recipient)
+static void
+_message_send(const char * const msg, const char * const recipient)
 {
     const char * jid = NULL;
 
@@ -90,8 +90,8 @@ message_send(const char * const msg, const char * const recipient)
     xmpp_stanza_release(message);
 }
 
-void
-message_send_groupchat(const char * const msg, const char * const recipient)
+static void
+_message_send_groupchat(const char * const msg, const char * const recipient)
 {
     xmpp_conn_t * const conn = connection_get_conn();
     xmpp_ctx_t * const ctx = connection_get_ctx();
@@ -102,8 +102,8 @@ message_send_groupchat(const char * const msg, const char * const recipient)
     xmpp_stanza_release(message);
 }
 
-void
-message_send_duck(const char * const query)
+static void
+_message_send_duck(const char * const query)
 {
     xmpp_conn_t * const conn = connection_get_conn();
     xmpp_ctx_t * const ctx = connection_get_ctx();
@@ -114,8 +114,8 @@ message_send_duck(const char * const query)
     xmpp_stanza_release(message);
 }
 
-void
-message_send_invite(const char * const room, const char * const contact,
+static void
+_message_send_invite(const char * const room, const char * const contact,
     const char * const reason)
 {
     xmpp_conn_t * const conn = connection_get_conn();
@@ -126,8 +126,8 @@ message_send_invite(const char * const room, const char * const contact,
     xmpp_stanza_release(stanza);
 }
 
-void
-message_send_composing(const char * const recipient)
+static void
+_message_send_composing(const char * const recipient)
 {
     xmpp_conn_t * const conn = connection_get_conn();
     xmpp_ctx_t * const ctx = connection_get_ctx();
@@ -139,8 +139,8 @@ message_send_composing(const char * const recipient)
     chat_session_set_sent(recipient);
 }
 
-void
-message_send_paused(const char * const recipient)
+static void
+_message_send_paused(const char * const recipient)
 {
     xmpp_conn_t * const conn = connection_get_conn();
     xmpp_ctx_t * const ctx = connection_get_ctx();
@@ -152,8 +152,8 @@ message_send_paused(const char * const recipient)
     chat_session_set_sent(recipient);
 }
 
-void
-message_send_inactive(const char * const recipient)
+static void
+_message_send_inactive(const char * const recipient)
 {
     xmpp_conn_t * const conn = connection_get_conn();
     xmpp_ctx_t * const ctx = connection_get_ctx();
@@ -165,8 +165,8 @@ message_send_inactive(const char * const recipient)
     chat_session_set_sent(recipient);
 }
 
-void
-message_send_gone(const char * const recipient)
+static void
+_message_send_gone(const char * const recipient)
 {
     xmpp_conn_t * const conn = connection_get_conn();
     xmpp_ctx_t * const ctx = connection_get_ctx();
@@ -439,3 +439,16 @@ _chat_message_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza,
     }
 }
 
+void
+message_init_module(void)
+{
+    message_send = _message_send;
+    message_send_groupchat = _message_send_groupchat;
+    message_send_duck = _message_send_duck;
+    message_send_invite = _message_send_invite;
+    message_send_composing = _message_send_composing;
+    message_send_paused = _message_send_paused;
+    message_send_inactive = _message_send_inactive;
+    message_send_gone = _message_send_gone;
+}
+
diff --git a/src/xmpp/presence.c b/src/xmpp/presence.c
index ba9c6c02..3ca2f63e 100644
--- a/src/xmpp/presence.c
+++ b/src/xmpp/presence.c
@@ -80,8 +80,8 @@ presence_add_handlers(void)
     HANDLE(NULL,               NULL,                     _available_handler);
 }
 
-void
-presence_subscription(const char * const jid, const jabber_subscr_t action)
+static void
+_presence_subscription(const char * const jid, const jabber_subscr_t action)
 {
     assert(jid != NULL);
 
@@ -122,14 +122,14 @@ presence_subscription(const char * const jid, const jabber_subscr_t action)
     jid_destroy(jidp);
 }
 
-GSList *
-presence_get_subscription_requests(void)
+static GSList *
+_presence_get_subscription_requests(void)
 {
     return autocomplete_get_list(sub_requests_ac);
 }
 
-gint
-presence_sub_request_count(void)
+static gint
+_presence_sub_request_count(void)
 {
     return autocomplete_length(sub_requests_ac);
 }
@@ -146,14 +146,14 @@ presence_clear_sub_requests(void)
     autocomplete_clear(sub_requests_ac);
 }
 
-char *
-presence_sub_request_find(char * search_str)
+static char *
+_presence_sub_request_find(char * search_str)
 {
     return autocomplete_complete(sub_requests_ac, search_str);
 }
 
-gboolean
-presence_sub_request_exists(const char * const bare_jid)
+static gboolean
+_presence_sub_request_exists(const char * const bare_jid)
 {
     gboolean result = FALSE;
     GSList *requests_p = autocomplete_get_list(sub_requests_ac);
@@ -174,14 +174,14 @@ presence_sub_request_exists(const char * const bare_jid)
     return result;
 }
 
-void
-presence_reset_sub_request_search(void)
+static void
+_presence_reset_sub_request_search(void)
 {
     autocomplete_reset(sub_requests_ac);
 }
 
-void
-presence_update(const resource_presence_t presence_type, const char * const msg,
+static void
+_presence_update(const resource_presence_t presence_type, const char * const msg,
     const int idle)
 {
     if (jabber_get_connection_status() != JABBER_CONNECTED) {
@@ -252,8 +252,8 @@ _send_room_presence(xmpp_conn_t *conn, xmpp_stanza_t *presence)
     }
 }
 
-void
-presence_join_room(Jid *jid)
+static void
+_presence_join_room(Jid *jid)
 {
     assert(jid != NULL);
     assert(jid->fulljid != NULL);
@@ -261,7 +261,7 @@ presence_join_room(Jid *jid)
     log_debug("Sending room join presence to: %s", jid->fulljid);
     xmpp_ctx_t *ctx = connection_get_ctx();
     xmpp_conn_t *conn = connection_get_conn();
-    contact_presence_t presence_type =
+    resource_presence_t presence_type =
         accounts_get_last_presence(jabber_get_account_name());
     const char *show = stanza_get_presence_string_from_type(presence_type);
     char *status = jabber_get_presence_message();
@@ -280,8 +280,8 @@ presence_join_room(Jid *jid)
     muc_join_room(jid->barejid, jid->resourcepart);
 }
 
-void
-presence_change_room_nick(const char * const room, const char * const nick)
+static void
+_presence_change_room_nick(const char * const room, const char * const nick)
 {
     assert(room != NULL);
     assert(nick != NULL);
@@ -289,7 +289,7 @@ presence_change_room_nick(const char * const room, const char * const nick)
     log_debug("Sending room nickname change to: %s, nick: %s", room, nick);
     xmpp_ctx_t *ctx = connection_get_ctx();
     xmpp_conn_t *conn = connection_get_conn();
-    contact_presence_t presence_type =
+    resource_presence_t presence_type =
         accounts_get_last_presence(jabber_get_account_name());
     const char *show = stanza_get_presence_string_from_type(presence_type);
     char *status = jabber_get_presence_message();
@@ -310,8 +310,8 @@ presence_change_room_nick(const char * const room, const char * const nick)
     free(full_room_jid);
 }
 
-void
-presence_leave_chat_room(const char * const room_jid)
+static void
+_presence_leave_chat_room(const char * const room_jid)
 {
     assert(room_jid != NULL);
 
@@ -686,3 +686,18 @@ _room_presence_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza,
 
     return 1;
 }
+
+void
+presence_init_module(void)
+{
+    presence_subscription = _presence_subscription;
+    presence_get_subscription_requests = _presence_get_subscription_requests;
+    presence_sub_request_count = _presence_sub_request_count;
+    presence_sub_request_find = _presence_sub_request_find;
+    presence_sub_request_exists = _presence_sub_request_exists;
+    presence_reset_sub_request_search = _presence_reset_sub_request_search;
+    presence_update = _presence_update;
+    presence_join_room = _presence_join_room;
+    presence_change_room_nick = _presence_change_room_nick;
+    presence_leave_chat_room = _presence_leave_chat_room;
+}
diff --git a/src/xmpp/roster.c b/src/xmpp/roster.c
index 51c34ea1..e84de155 100644
--- a/src/xmpp/roster.c
+++ b/src/xmpp/roster.c
@@ -81,8 +81,8 @@ roster_request(void)
     xmpp_stanza_release(iq);
 }
 
-void
-roster_add_new(const char * const barejid, const char * const name)
+static void
+_roster_add_new(const char * const barejid, const char * const name)
 {
     xmpp_conn_t * const conn = connection_get_conn();
     xmpp_ctx_t * const ctx = connection_get_ctx();
@@ -91,8 +91,8 @@ roster_add_new(const char * const barejid, const char * const name)
     xmpp_stanza_release(iq);
 }
 
-void
-roster_send_remove(const char * const barejid)
+static void
+_roster_send_remove(const char * const barejid)
 {
     xmpp_conn_t * const conn = connection_get_conn();
     xmpp_ctx_t * const ctx = connection_get_ctx();
@@ -101,8 +101,8 @@ roster_send_remove(const char * const barejid)
     xmpp_stanza_release(iq);
 }
 
-void
-roster_send_name_change(const char * const barejid, const char * const new_name, GSList *groups)
+static void
+_roster_send_name_change(const char * const barejid, const char * const new_name, GSList *groups)
 {
     xmpp_conn_t * const conn = connection_get_conn();
     xmpp_ctx_t * const ctx = connection_get_ctx();
@@ -112,8 +112,8 @@ roster_send_name_change(const char * const barejid, const char * const new_name,
     xmpp_stanza_release(iq);
 }
 
-void
-roster_send_add_to_group(const char * const group, PContact contact)
+static void
+_roster_send_add_to_group(const char * const group, PContact contact)
 {
     GSList *groups = p_contact_groups(contact);
     GSList *new_groups = NULL;
@@ -157,8 +157,8 @@ _group_add_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza,
     return 0;
 }
 
-void
-roster_send_remove_from_group(const char * const group, PContact contact)
+static void
+_roster_send_remove_from_group(const char * const group, PContact contact)
 {
     GSList *groups = p_contact_groups(contact);
     GSList *new_groups = NULL;
@@ -297,7 +297,7 @@ _roster_handle_result(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza,
             item = xmpp_stanza_get_next(item);
         }
 
-        contact_presence_t conn_presence =
+        resource_presence_t conn_presence =
             accounts_get_login_presence(jabber_get_account_name());
         presence_update(conn_presence, NULL, 0);
     }
@@ -323,3 +323,14 @@ _get_groups_from_item(xmpp_stanza_t *item)
 
     return groups;
 }
+
+void
+roster_init_module(void)
+{
+    roster_add_new = _roster_add_new;
+    roster_send_remove = _roster_send_remove;
+    roster_send_name_change = _roster_send_name_change;
+    roster_send_add_to_group = _roster_send_add_to_group;
+    roster_send_remove_from_group = _roster_send_remove_from_group;
+
+}
diff --git a/src/xmpp/xmpp.h b/src/xmpp/xmpp.h
index 21c25aa4..90b17e59 100644
--- a/src/xmpp/xmpp.h
+++ b/src/xmpp/xmpp.h
@@ -74,66 +74,74 @@ typedef struct disco_identity_t {
     char *category;
 } DiscoIdentity;
 
+void jabber_init_module(void);
+void bookmark_init_module(void);
+void capabilities_init_module(void);
+void iq_init_module(void);
+void message_init_module(void);
+void presence_init_module(void);
+void roster_init_module(void);
+
 // connection functions
-void jabber_init(const int disable_tls);
-jabber_conn_status_t jabber_connect_with_details(const char * const jid,
+void (*jabber_init)(const int disable_tls);
+jabber_conn_status_t (*jabber_connect_with_details)(const char * const jid,
     const char * const passwd, const char * const altdomain);
-jabber_conn_status_t jabber_connect_with_account(const ProfAccount * const account);
-void jabber_disconnect(void);
-void jabber_shutdown(void);
-void jabber_process_events(void);
-const char * jabber_get_fulljid(void);
-const char * jabber_get_domain(void);
-jabber_conn_status_t jabber_get_connection_status(void);
-char * jabber_get_presence_message(void);
-void jabber_set_autoping(int seconds);
-char* jabber_get_account_name(void);
-GList * jabber_get_available_resources(void);
+jabber_conn_status_t (*jabber_connect_with_account)(const ProfAccount * const account);
+void (*jabber_disconnect)(void);
+void (*jabber_shutdown)(void);
+void (*jabber_process_events)(void);
+const char * (*jabber_get_fulljid)(void);
+const char * (*jabber_get_domain)(void);
+jabber_conn_status_t (*jabber_get_connection_status)(void);
+char * (*jabber_get_presence_message)(void);
+void (*jabber_set_autoping)(int seconds);
+char* (*jabber_get_account_name)(void);
+GList * (*jabber_get_available_resources)(void);
 
 // message functions
-void message_send(const char * const msg, const char * const recipient);
-void message_send_groupchat(const char * const msg, const char * const recipient);
-void message_send_inactive(const char * const recipient);
-void message_send_composing(const char * const recipient);
-void message_send_paused(const char * const recipient);
-void message_send_gone(const char * const recipient);
-void message_send_invite(const char * const room, const char * const contact,
+void (*message_send)(const char * const msg, const char * const recipient);
+void (*message_send_groupchat)(const char * const msg, const char * const recipient);
+void (*message_send_inactive)(const char * const recipient);
+void (*message_send_composing)(const char * const recipient);
+void (*message_send_paused)(const char * const recipient);
+void (*message_send_gone)(const char * const recipient);
+void (*message_send_invite)(const char * const room, const char * const contact,
     const char * const reason);
-void message_send_duck(const char * const query);
+void (*message_send_duck)(const char * const query);
 
 // presence functions
-void presence_subscription(const char * const jid, const jabber_subscr_t action);
-GSList* presence_get_subscription_requests(void);
-gint presence_sub_request_count(void);
-void presence_reset_sub_request_search(void);
-char * presence_sub_request_find(char * search_str);
-void presence_join_room(Jid *jid);
-void presence_change_room_nick(const char * const room, const char * const nick);
-void presence_leave_chat_room(const char * const room_jid);
-void presence_update(resource_presence_t status, const char * const msg,
+void (*presence_subscription)(const char * const jid, const jabber_subscr_t action);
+GSList* (*presence_get_subscription_requests)(void);
+gint (*presence_sub_request_count)(void);
+void (*presence_reset_sub_request_search)(void);
+char * (*presence_sub_request_find)(char * search_str);
+void (*presence_join_room)(Jid *jid);
+void (*presence_change_room_nick)(const char * const room, const char * const nick);
+void (*presence_leave_chat_room)(const char * const room_jid);
+void (*presence_update)(resource_presence_t status, const char * const msg,
     int idle);
-gboolean presence_sub_request_exists(const char * const bare_jid);
+gboolean (*presence_sub_request_exists)(const char * const bare_jid);
 
 // iq functions
-void iq_send_software_version(const char * const fulljid);
-void iq_room_list_request(gchar *conferencejid);
-void iq_disco_info_request(gchar *jid);
-void iq_disco_items_request(gchar *jid);
+void (*iq_send_software_version)(const char * const fulljid);
+void (*iq_room_list_request)(gchar *conferencejid);
+void (*iq_disco_info_request)(gchar *jid);
+void (*iq_disco_items_request)(gchar *jid);
 
 // caps functions
-Capabilities* caps_get(const char * const caps_str);
-void caps_close(void);
-
-void bookmark_add(const char *jid, const char *nick, gboolean autojoin);
-void bookmark_remove(const char *jid, gboolean autojoin);
-const GList *bookmark_get_list(void);
-char *bookmark_find(char *search_str);
-void bookmark_autocomplete_reset(void);
-
-void roster_send_name_change(const char * const barejid, const char * const new_name, GSList *groups);
-void roster_send_add_to_group(const char * const group, PContact contact);
-void roster_send_remove_from_group(const char * const group, PContact contact);
-void roster_add_new(const char * const barejid, const char * const name);
-void roster_send_remove(const char * const barejid);
+Capabilities* (*caps_get)(const char * const caps_str);
+void (*caps_close)(void);
+
+void (*bookmark_add)(const char *jid, const char *nick, gboolean autojoin);
+void (*bookmark_remove)(const char *jid, gboolean autojoin);
+const GList * (*bookmark_get_list)(void);
+char * (*bookmark_find)(char *search_str);
+void (*bookmark_autocomplete_reset)(void);
+
+void (*roster_send_name_change)(const char * const barejid, const char * const new_name, GSList *groups);
+void (*roster_send_add_to_group)(const char * const group, PContact contact);
+void (*roster_send_remove_from_group)(const char * const group, PContact contact);
+void (*roster_add_new)(const char * const barejid, const char * const name);
+void (*roster_send_remove)(const char * const barejid);
 
 #endif