about summary refs log tree commit diff stats
path: root/src/config
diff options
context:
space:
mode:
authorJames Booth <boothj5@gmail.com>2014-12-22 22:13:42 +0000
committerJames Booth <boothj5@gmail.com>2014-12-22 22:13:42 +0000
commit9d94ac5c6302ebf90aca9e17f5df59dfdd37c14c (patch)
tree1bde5fefd491d9fef2dc0d9e220b75ac0c15b5d4 /src/config
parent3cbeb7b483a7a12c6fc90f3ba15aa2f881e03cf2 (diff)
downloadprofani-tty-9d94ac5c6302ebf90aca9e17f5df59dfdd37c14c.tar.gz
Removed function pointers
Diffstat (limited to 'src/config')
-rw-r--r--src/config/accounts.c198
-rw-r--r--src/config/accounts.h78
2 files changed, 115 insertions, 161 deletions
diff --git a/src/config/accounts.c b/src/config/accounts.c
index 36007ddc..efbaccb9 100644
--- a/src/config/accounts.c
+++ b/src/config/accounts.c
@@ -73,8 +73,8 @@ static gchar * _get_accounts_file(void);
 static void _remove_from_list(GKeyFile *accounts, const char * const account_name, const char * const key, const char * const contact_jid);
 
 
-static void
-_accounts_load(void)
+void
+accounts_load(void)
 {
     log_info("Loading accounts");
     all_ac = autocomplete_new();
@@ -107,40 +107,40 @@ _accounts_load(void)
     g_strfreev(account_names);
 }
 
-static void
-_accounts_close(void)
+void
+accounts_close(void)
 {
     autocomplete_free(all_ac);
     autocomplete_free(enabled_ac);
     g_key_file_free(accounts);
 }
 
-static char *
-_accounts_find_enabled(char *prefix)
+char *
+accounts_find_enabled(char *prefix)
 {
     return autocomplete_complete(enabled_ac, prefix, TRUE);
 }
 
-static char *
-_accounts_find_all(char *prefix)
+char *
+accounts_find_all(char *prefix)
 {
     return autocomplete_complete(all_ac, prefix, TRUE);
 }
 
-static void
-_accounts_reset_all_search(void)
+void
+accounts_reset_all_search(void)
 {
     autocomplete_reset(all_ac);
 }
 
-static void
-_accounts_reset_enabled_search(void)
+void
+accounts_reset_enabled_search(void)
 {
     autocomplete_reset(enabled_ac);
 }
 
-static void
-_accounts_add(const char *account_name, const char *altdomain, const int port)
+void
+accounts_add(const char *account_name, const char *altdomain, const int port)
 {
     // set account name and resource
     const char *barejid = account_name;
@@ -193,8 +193,8 @@ _accounts_add(const char *account_name, const char *altdomain, const int port)
     jid_destroy(jid);
 }
 
-static int
-_accounts_remove(const char *account_name)
+int
+accounts_remove(const char *account_name)
 {
     int r = g_key_file_remove_group(accounts, account_name, NULL);
     _save_accounts();
@@ -203,14 +203,14 @@ _accounts_remove(const char *account_name)
     return r;
 }
 
-static gchar**
-_accounts_get_list(void)
+gchar**
+accounts_get_list(void)
 {
     return g_key_file_get_groups(accounts, NULL);
 }
 
-static ProfAccount*
-_accounts_get_account(const char * const name)
+ProfAccount*
+accounts_get_account(const char * const name)
 {
     if (!g_key_file_has_group(accounts, name)) {
         return NULL;
@@ -298,8 +298,8 @@ _accounts_get_account(const char * const name)
     }
 }
 
-static gboolean
-_accounts_enable(const char * const name)
+gboolean
+accounts_enable(const char * const name)
 {
     if (g_key_file_has_group(accounts, name)) {
         g_key_file_set_boolean(accounts, name, "enabled", TRUE);
@@ -311,8 +311,8 @@ _accounts_enable(const char * const name)
     }
 }
 
-static gboolean
-_accounts_disable(const char * const name)
+gboolean
+accounts_disable(const char * const name)
 {
     if (g_key_file_has_group(accounts, name)) {
         g_key_file_set_boolean(accounts, name, "enabled", FALSE);
@@ -324,8 +324,8 @@ _accounts_disable(const char * const name)
     }
 }
 
-static gboolean
-_accounts_rename(const char * const account_name, const char * const new_name)
+gboolean
+accounts_rename(const char * const account_name, const char * const new_name)
 {
     if (g_key_file_has_group(accounts, new_name)) {
         return FALSE;
@@ -372,15 +372,15 @@ _accounts_rename(const char * const account_name, const char * const new_name)
     return TRUE;
 }
 
-static gboolean
-_accounts_account_exists(const char * const account_name)
+gboolean
+accounts_account_exists(const char * const account_name)
 {
     return g_key_file_has_group(accounts, account_name);
 
 }
 
-static void
-_accounts_set_jid(const char * const account_name, const char * const value)
+void
+accounts_set_jid(const char * const account_name, const char * const value)
 {
     Jid *jid = jid_create(value);
     if (jid != NULL) {
@@ -405,8 +405,8 @@ _accounts_set_jid(const char * const account_name, const char * const value)
     }
 }
 
-static void
-_accounts_set_server(const char * const account_name, const char * const value)
+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);
@@ -414,8 +414,8 @@ _accounts_set_server(const char * const account_name, const char * const value)
     }
 }
 
-static void
-_accounts_set_port(const char * const account_name, const int value)
+void
+accounts_set_port(const char * const account_name, const int value)
 {
     if (value != 0) {
         g_key_file_set_integer(accounts, account_name, "port", value);
@@ -423,8 +423,8 @@ _accounts_set_port(const char * const account_name, const int value)
     }
 }
 
-static void
-_accounts_set_resource(const char * const account_name, const char * const value)
+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);
@@ -432,8 +432,8 @@ _accounts_set_resource(const char * const account_name, const char * const value
     }
 }
 
-static void
-_accounts_set_password(const char * const account_name, const char * const value)
+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);
@@ -441,8 +441,8 @@ _accounts_set_password(const char * const account_name, const char * const value
     }
 }
 
-static void
-_accounts_clear_password(const char * const account_name)
+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);
@@ -450,8 +450,8 @@ _accounts_clear_password(const char * const account_name)
     }
 }
 
-static void
-_accounts_clear_server(const char * const account_name)
+void
+accounts_clear_server(const char * const account_name)
 {
     if (accounts_account_exists(account_name)) {
         g_key_file_remove_key(accounts, account_name, "server", NULL);
@@ -459,8 +459,8 @@ _accounts_clear_server(const char * const account_name)
     }
 }
 
-static void
-_accounts_clear_port(const char * const account_name)
+void
+accounts_clear_port(const char * const account_name)
 {
     if (accounts_account_exists(account_name)) {
         g_key_file_remove_key(accounts, account_name, "port", NULL);
@@ -468,8 +468,8 @@ _accounts_clear_port(const char * const account_name)
     }
 }
 
-static void
-_accounts_clear_otr(const char * const account_name)
+void
+accounts_clear_otr(const char * const account_name)
 {
     if (accounts_account_exists(account_name)) {
         g_key_file_remove_key(accounts, account_name, "otr.policy", NULL);
@@ -477,8 +477,8 @@ _accounts_clear_otr(const char * const account_name)
     }
 }
 
-static void
-_accounts_add_otr_policy(const char * const account_name, const char * const contact_jid, const char * const policy)
+void
+accounts_add_otr_policy(const char * const account_name, const char * const contact_jid, const char * const policy)
 {
     if (accounts_account_exists(account_name)) {
         GString *key = g_string_new("otr.");
@@ -589,8 +589,8 @@ _remove_from_list(GKeyFile *accounts, const char * const account_name, const cha
     g_strfreev(list);
 }
 
-static void
-_accounts_set_muc_service(const char * const account_name, const char * const value)
+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);
@@ -598,8 +598,8 @@ _accounts_set_muc_service(const char * const account_name, const char * const va
     }
 }
 
-static void
-_accounts_set_muc_nick(const char * const account_name, const char * const value)
+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);
@@ -607,8 +607,8 @@ _accounts_set_muc_nick(const char * const account_name, const char * const value
     }
 }
 
-static void
-_accounts_set_otr_policy(const char * const account_name, const char * const value)
+void
+accounts_set_otr_policy(const char * const account_name, const char * const value)
 {
     if (accounts_account_exists(account_name)) {
         g_key_file_set_string(accounts, account_name, "otr.policy", value);
@@ -616,8 +616,8 @@ _accounts_set_otr_policy(const char * const account_name, const char * const val
     }
 }
 
-static void
-_accounts_set_priority_online(const char * const account_name, const gint value)
+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);
@@ -625,8 +625,8 @@ _accounts_set_priority_online(const char * const account_name, const gint value)
     }
 }
 
-static void
-_accounts_set_priority_chat(const char * const account_name, const gint value)
+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);
@@ -634,8 +634,8 @@ _accounts_set_priority_chat(const char * const account_name, const gint value)
     }
 }
 
-static void
-_accounts_set_priority_away(const char * const account_name, const gint value)
+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);
@@ -643,8 +643,8 @@ _accounts_set_priority_away(const char * const account_name, const gint value)
     }
 }
 
-static void
-_accounts_set_priority_xa(const char * const account_name, const gint value)
+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);
@@ -652,8 +652,8 @@ _accounts_set_priority_xa(const char * const account_name, const gint value)
     }
 }
 
-static void
-_accounts_set_priority_dnd(const char * const account_name, const gint value)
+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);
@@ -661,8 +661,8 @@ _accounts_set_priority_dnd(const char * const account_name, const gint value)
     }
 }
 
-static void
-_accounts_set_priority_all(const char * const account_name, const gint value)
+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);
@@ -674,8 +674,8 @@ _accounts_set_priority_all(const char * const account_name, const gint value)
     }
 }
 
-static gint
-_accounts_get_priority_for_presence_type(const char * const account_name,
+gint
+accounts_get_priority_for_presence_type(const char * const account_name,
     resource_presence_t presence_type)
 {
     gint result;
@@ -705,8 +705,8 @@ _accounts_get_priority_for_presence_type(const char * const account_name,
     return result;
 }
 
-static void
-_accounts_set_last_presence(const char * const account_name, const char * const value)
+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);
@@ -714,8 +714,8 @@ _accounts_set_last_presence(const char * const account_name, const char * const
     }
 }
 
-static void
-_accounts_set_login_presence(const char * const account_name, const char * const value)
+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);
@@ -723,8 +723,8 @@ _accounts_set_login_presence(const char * const account_name, const char * const
     }
 }
 
-static resource_presence_t
-_accounts_get_last_presence(const char * const account_name)
+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);
@@ -751,8 +751,8 @@ _accounts_get_last_presence(const char * const account_name)
     return result;
 }
 
-static resource_presence_t
-_accounts_get_login_presence(const char * const account_name)
+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);
@@ -859,48 +859,4 @@ _get_accounts_file(void)
     g_string_free(logfile, TRUE);
 
     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_remove = _accounts_remove;
-    accounts_get_list = _accounts_get_list;
-    accounts_get_account = _accounts_get_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_port = _accounts_set_port;
-    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_otr_policy = _accounts_set_otr_policy;
-    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_clear_server = _accounts_clear_server;
-    accounts_clear_port = _accounts_clear_port;
-    accounts_clear_otr = _accounts_clear_otr;
-    accounts_add_otr_policy = _accounts_add_otr_policy;
-}
-
+}
\ No newline at end of file
diff --git a/src/config/accounts.h b/src/config/accounts.h
index 0ca0d82c..78b186b4 100644
--- a/src/config/accounts.h
+++ b/src/config/accounts.h
@@ -40,48 +40,46 @@
 #include "common.h"
 #include "config/account.h"
 
-void accounts_init_module(void);
+void accounts_load(void);
+void accounts_close(void);
 
-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, const int port);
-int  (*accounts_remove)(const char *jid);
-gchar** (*accounts_get_list)(void);
-ProfAccount* (*accounts_get_account)(const char * const name);
-gboolean (*accounts_enable)(const char * const name);
-gboolean (*accounts_disable)(const char * const name);
-gboolean (*accounts_rename)(const char * const account_name,
+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, const int port);
+int  accounts_remove(const char *jid);
+gchar** accounts_get_list(void);
+ProfAccount* accounts_get_account(const char * const name);
+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_port)(const char * const account_name, const int 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_otr_policy)(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_port(const char * const account_name, const int 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_otr_policy(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);
-void (*accounts_clear_server)(const char * const account_name);
-void (*accounts_clear_port)(const char * const account_name);
-void (*accounts_clear_otr)(const char * const account_name);
-void (*accounts_add_otr_policy)(const char * const account_name, const char * const contact_jid, const char * const policy);
+void accounts_clear_password(const char * const account_name);
+void accounts_clear_server(const char * const account_name);
+void accounts_clear_port(const char * const account_name);
+void accounts_clear_otr(const char * const account_name);
+void accounts_add_otr_policy(const char * const account_name, const char * const contact_jid, const char * const policy);
 
 #endif