1
0
mirror of https://github.com/profanity-im/profanity.git synced 2024-12-04 14:46:46 -05:00

Applied coding style to accounts.c

This commit is contained in:
James Booth 2015-10-25 00:46:12 +01:00
parent 19e71f05f8
commit 5f74c2044c

View File

@ -54,8 +54,8 @@ static Autocomplete all_ac;
static Autocomplete enabled_ac;
static void _save_accounts(void);
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 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);
void
accounts_load(void)
@ -95,14 +95,14 @@ accounts_close(void)
g_key_file_free(accounts);
}
char *
accounts_find_enabled(const char * const prefix)
char*
accounts_find_enabled(const char *const prefix)
{
return autocomplete_complete(enabled_ac, prefix, TRUE);
}
char *
accounts_find_all(const char * const prefix)
char*
accounts_find_all(const char *const prefix)
{
return autocomplete_complete(all_ac, prefix, TRUE);
}
@ -193,7 +193,7 @@ accounts_get_list(void)
}
ProfAccount*
accounts_get_account(const char * const name)
accounts_get_account(const char *const name)
{
if (!g_key_file_has_group(accounts, name)) {
return NULL;
@ -305,7 +305,7 @@ accounts_get_account(const char * const name)
}
gboolean
accounts_enable(const char * const name)
accounts_enable(const char *const name)
{
if (g_key_file_has_group(accounts, name)) {
g_key_file_set_boolean(accounts, name, "enabled", TRUE);
@ -318,7 +318,7 @@ accounts_enable(const char * const name)
}
gboolean
accounts_disable(const char * const name)
accounts_disable(const char *const name)
{
if (g_key_file_has_group(accounts, name)) {
g_key_file_set_boolean(accounts, name, "enabled", FALSE);
@ -331,7 +331,7 @@ accounts_disable(const char * const name)
}
gboolean
accounts_rename(const char * const account_name, const char * const new_name)
accounts_rename(const char *const account_name, const char *const new_name)
{
if (g_key_file_has_group(accounts, new_name)) {
return FALSE;
@ -393,14 +393,14 @@ accounts_rename(const char * const account_name, const char * const new_name)
}
gboolean
accounts_account_exists(const char * const account_name)
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)
accounts_set_jid(const char *const account_name, const char *const value)
{
Jid *jid = jid_create(value);
if (jid) {
@ -428,7 +428,7 @@ 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)
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);
@ -437,7 +437,7 @@ accounts_set_server(const char * const account_name, const char * const value)
}
void
accounts_set_port(const char * const account_name, const int value)
accounts_set_port(const char *const account_name, const int value)
{
if (value != 0) {
g_key_file_set_integer(accounts, account_name, "port", value);
@ -446,7 +446,7 @@ accounts_set_port(const char * const account_name, const int value)
}
void
accounts_set_resource(const char * const account_name, const char * const value)
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);
@ -455,7 +455,7 @@ 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)
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);
@ -464,7 +464,7 @@ accounts_set_password(const char * const account_name, const char * const value)
}
void
accounts_set_eval_password(const char * const account_name, const char * const value)
accounts_set_eval_password(const char *const account_name, const char *const value)
{
if (accounts_account_exists(account_name)) {
g_key_file_set_string(accounts, account_name, "eval_password", value);
@ -473,7 +473,7 @@ accounts_set_eval_password(const char * const account_name, const char * const v
}
void
accounts_set_pgp_keyid(const char * const account_name, const char * const value)
accounts_set_pgp_keyid(const char *const account_name, const char *const value)
{
if (accounts_account_exists(account_name)) {
g_key_file_set_string(accounts, account_name, "pgp.keyid", value);
@ -482,7 +482,7 @@ accounts_set_pgp_keyid(const char * const account_name, const char * const value
}
void
accounts_set_script_start(const char * const account_name, const char * const value)
accounts_set_script_start(const char *const account_name, const char *const value)
{
if (accounts_account_exists(account_name)) {
g_key_file_set_string(accounts, account_name, "script.start", value);
@ -491,7 +491,7 @@ accounts_set_script_start(const char * const account_name, const char * const va
}
void
accounts_clear_password(const char * const account_name)
accounts_clear_password(const char *const account_name)
{
if (accounts_account_exists(account_name)) {
g_key_file_remove_key(accounts, account_name, "password", NULL);
@ -500,7 +500,7 @@ accounts_clear_password(const char * const account_name)
}
void
accounts_clear_eval_password(const char * const account_name)
accounts_clear_eval_password(const char *const account_name)
{
if (accounts_account_exists(account_name)) {
g_key_file_remove_key(accounts, account_name, "eval_password", NULL);
@ -509,7 +509,7 @@ accounts_clear_eval_password(const char * const account_name)
}
void
accounts_clear_server(const char * const account_name)
accounts_clear_server(const char *const account_name)
{
if (accounts_account_exists(account_name)) {
g_key_file_remove_key(accounts, account_name, "server", NULL);
@ -518,7 +518,7 @@ accounts_clear_server(const char * const account_name)
}
void
accounts_clear_port(const char * const account_name)
accounts_clear_port(const char *const account_name)
{
if (accounts_account_exists(account_name)) {
g_key_file_remove_key(accounts, account_name, "port", NULL);
@ -527,7 +527,7 @@ accounts_clear_port(const char * const account_name)
}
void
accounts_clear_pgp_keyid(const char * const account_name)
accounts_clear_pgp_keyid(const char *const account_name)
{
if (accounts_account_exists(account_name)) {
g_key_file_remove_key(accounts, account_name, "pgp.keyid", NULL);
@ -536,7 +536,7 @@ accounts_clear_pgp_keyid(const char * const account_name)
}
void
accounts_clear_script_start(const char * const account_name)
accounts_clear_script_start(const char *const account_name)
{
if (accounts_account_exists(account_name)) {
g_key_file_remove_key(accounts, account_name, "script.start", NULL);
@ -544,7 +544,7 @@ accounts_clear_script_start(const char * const account_name)
}
}
void
accounts_clear_otr(const char * const account_name)
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);
@ -553,7 +553,7 @@ 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)
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.");
@ -621,7 +621,7 @@ accounts_add_otr_policy(const char * const account_name, const char * const cont
}
static void
_remove_from_list(GKeyFile *accounts, const char * const account_name, const char * const key, const char * const contact_jid)
_remove_from_list(GKeyFile *accounts, const char *const account_name, const char *const key, const char *const contact_jid)
{
gsize length;
gchar **list = g_key_file_get_string_list(accounts, account_name, key, &length, NULL);
@ -665,7 +665,7 @@ _remove_from_list(GKeyFile *accounts, const char * const account_name, const cha
}
void
accounts_set_muc_service(const char * const account_name, const char * const value)
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);
@ -674,7 +674,7 @@ 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)
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);
@ -683,7 +683,7 @@ 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)
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);
@ -692,7 +692,7 @@ accounts_set_otr_policy(const char * const account_name, const char * const valu
}
void
accounts_set_tls_policy(const char * const account_name, const char * const value)
accounts_set_tls_policy(const char *const account_name, const char *const value)
{
if (accounts_account_exists(account_name)) {
g_key_file_set_string(accounts, account_name, "tls.policy", value);
@ -701,7 +701,7 @@ accounts_set_tls_policy(const char * const account_name, const char * const valu
}
void
accounts_set_priority_online(const char * const account_name, const gint value)
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);
@ -710,7 +710,7 @@ 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)
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);
@ -719,7 +719,7 @@ 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)
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);
@ -728,7 +728,7 @@ 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)
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);
@ -737,7 +737,7 @@ 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)
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);
@ -746,7 +746,7 @@ 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)
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);
@ -759,7 +759,7 @@ accounts_set_priority_all(const char * const account_name, const gint value)
}
gint
accounts_get_priority_for_presence_type(const char * const account_name,
accounts_get_priority_for_presence_type(const char *const account_name,
resource_presence_t presence_type)
{
gint result;
@ -790,7 +790,7 @@ accounts_get_priority_for_presence_type(const char * const account_name,
}
void
accounts_set_last_presence(const char * const account_name, const char * const value)
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);
@ -799,7 +799,7 @@ accounts_set_last_presence(const char * const account_name, const char * const v
}
void
accounts_set_last_status(const char * const account_name, const char * const value)
accounts_set_last_status(const char *const account_name, const char *const value)
{
if (accounts_account_exists(account_name)) {
if (value) {
@ -812,7 +812,7 @@ accounts_set_last_status(const char * const account_name, const char * const val
}
void
accounts_set_last_activity(const char * const account_name)
accounts_set_last_activity(const char *const account_name)
{
if (accounts_account_exists(account_name)) {
GDateTime *nowdt = g_date_time_new_now_utc();
@ -829,8 +829,8 @@ accounts_set_last_activity(const char * const account_name)
}
}
char *
accounts_get_last_activity(const char * const account_name)
char*
accounts_get_last_activity(const char *const account_name)
{
if (accounts_account_exists(account_name)) {
return g_key_file_get_string(accounts, account_name, "last.activity", NULL);
@ -840,7 +840,7 @@ accounts_get_last_activity(const char * const account_name)
}
void
accounts_set_login_presence(const char * const account_name, const char * const value)
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);
@ -849,7 +849,7 @@ accounts_set_login_presence(const char * const account_name, const char * const
}
resource_presence_t
accounts_get_last_presence(const char * const account_name)
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);
@ -876,14 +876,14 @@ accounts_get_last_presence(const char * const account_name)
return result;
}
char *
accounts_get_last_status(const char * const account_name)
char*
accounts_get_last_status(const char *const account_name)
{
return g_key_file_get_string(accounts, account_name, "presence.laststatus", NULL);
}
resource_presence_t
accounts_get_login_presence(const char * const account_name)
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);
@ -929,7 +929,7 @@ _save_accounts(void)
g_string_free(base_str, TRUE);
}
static gchar *
static gchar*
_get_accounts_file(void)
{
gchar *xdg_data = xdg_get_data_home();