about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorMichael Vetter <jubalh@iodoru.org>2023-04-09 18:24:23 +0200
committerGitHub <noreply@github.com>2023-04-09 18:24:23 +0200
commite52ca2fbaa02acec3b2b757369ef5740e7a103da (patch)
treee80a507290c46f82b8a5394c30ec24e8e879f270
parent19921f61c14095cadc55b329dd7c8f02bdc79d31 (diff)
parent5d3c8ce7c164f74f606ff06d1adf849821591a51 (diff)
downloadprofani-tty-e52ca2fbaa02acec3b2b757369ef5740e7a103da.tar.gz
Merge pull request #1815 from H3rnand3zzz/feature/the-client-switcher
Feature: Allow setting client identification name/version manually
-rw-r--r--src/command/cmd_ac.c2
-rw-r--r--src/command/cmd_defs.c5
-rw-r--r--src/command/cmd_funcs.c26
-rw-r--r--src/config/account.c6
-rw-r--r--src/config/account.h4
-rw-r--r--src/config/accounts.c19
-rw-r--r--src/config/accounts.h2
-rw-r--r--src/ui/console.c3
-rw-r--r--src/xmpp/iq.c102
-rw-r--r--src/xmpp/stanza.c24
-rw-r--r--tests/unittests/config/stub_accounts.c8
-rw-r--r--tests/unittests/test_cmd_account.c14
-rw-r--r--tests/unittests/test_cmd_connect.c8
-rw-r--r--tests/unittests/test_cmd_join.c8
-rw-r--r--tests/unittests/test_cmd_otr.c2
-rw-r--r--tests/unittests/test_cmd_rooms.c4
16 files changed, 151 insertions, 86 deletions
diff --git a/src/command/cmd_ac.c b/src/command/cmd_ac.c
index bb204935..3561449e 100644
--- a/src/command/cmd_ac.c
+++ b/src/command/cmd_ac.c
@@ -481,6 +481,7 @@ cmd_ac_init(void)
     autocomplete_add(account_set_ac, "otr");
     autocomplete_add(account_set_ac, "pgpkeyid");
     autocomplete_add(account_set_ac, "startscript");
+    autocomplete_add(account_set_ac, "clientid");
     autocomplete_add(account_set_ac, "tls");
     autocomplete_add(account_set_ac, "auth");
     autocomplete_add(account_set_ac, "theme");
@@ -493,6 +494,7 @@ cmd_ac_init(void)
     autocomplete_add(account_clear_ac, "otr");
     autocomplete_add(account_clear_ac, "pgpkeyid");
     autocomplete_add(account_clear_ac, "startscript");
+    autocomplete_add(account_clear_ac, "clientid");
     autocomplete_add(account_clear_ac, "theme");
     autocomplete_add(account_clear_ac, "muc");
     autocomplete_add(account_clear_ac, "resource");
diff --git a/src/command/cmd_defs.c b/src/command/cmd_defs.c
index fd90fdca..6f30652b 100644
--- a/src/command/cmd_defs.c
+++ b/src/command/cmd_defs.c
@@ -2066,6 +2066,7 @@ static const struct cmd_t command_defs[] = {
               "/account set <account> otr <policy>",
               "/account set <account> pgpkeyid <pgpkeyid>",
               "/account set <account> startscript <script>",
+              "/account set <account> clientid \"<name> <version>\"",
               "/account set <account> tls force|allow|trust|legacy|disable",
               "/account set <account> auth default|legacy",
               "/account set <account> theme <theme>",
@@ -2076,6 +2077,7 @@ static const struct cmd_t command_defs[] = {
               "/account clear <account> otr",
               "/account clear <account> pgpkeyid",
               "/account clear <account> startscript",
+              "/account clear <account> clientid",
               "/account clear <account> muc",
               "/account clear <account> resource")
       CMD_DESC(
@@ -2105,6 +2107,7 @@ static const struct cmd_t command_defs[] = {
               { "set <account> otr <policy>", "Override global OTR policy for this account, see /otr." },
               { "set <account> pgpkeyid <pgpkeyid>", "Set the ID of the PGP key for this account, see /pgp." },
               { "set <account> startscript <script>", "Set the script to execute after connecting." },
+              { "set <account> clientid \"<name> <version>\"", "[EXPERIMENTAL] Set XMPP client name according for discovery according to XEP-0092. Use with caution." },
               { "set <account> tls force", "Force TLS connection, and fail if one cannot be established, this is default behaviour." },
               { "set <account> tls allow", "Use TLS for the connection if it is available." },
               { "set <account> tls trust", "Force TLS connection and trust server's certificate." },
@@ -2120,6 +2123,7 @@ static const struct cmd_t command_defs[] = {
               { "clear <account> otr", "Remove the OTR policy setting for this account." },
               { "clear <account> pgpkeyid", "Remove pgpkeyid associated with this account." },
               { "clear <account> startscript", "Remove startscript associated with this account." },
+              { "clear <account> clientid", "Reset client's name to default." },
               { "clear <account> theme", "Clear the theme setting for the account, the global theme will be used." },
               { "clear <account> resource", "Remove the resource setting for this account." },
               { "clear <account> muc", "Remove the default MUC service setting." })
@@ -2132,6 +2136,7 @@ static const struct cmd_t command_defs[] = {
               "/account set me nick dennis",
               "/account set me status dnd",
               "/account set me dnd -1",
+              "/account set me clientid \"Profanity 0.42 (Dev)\"",
               "/account rename me chattyme",
               "/account clear me pgpkeyid")
     },
diff --git a/src/command/cmd_funcs.c b/src/command/cmd_funcs.c
index c0506793..f6736156 100644
--- a/src/command/cmd_funcs.c
+++ b/src/command/cmd_funcs.c
@@ -841,6 +841,14 @@ _account_set_startscript(char* account_name, char* script)
 }
 
 gboolean
+_account_set_client(char* account_name, char* new_client)
+{
+    accounts_set_client(account_name, new_client);
+    cons_show("Client name for account %s has been set to %s", account_name, new_client);
+    return TRUE;
+}
+
+gboolean
 _account_set_theme(char* account_name, char* theme)
 {
     if (!theme_exists(theme)) {
@@ -981,6 +989,8 @@ cmd_account_set(ProfWin* window, const char* const command, gchar** args)
         return _account_set_pgpkeyid(account_name, value);
     if (strcmp(property, "startscript") == 0)
         return _account_set_startscript(account_name, value);
+    if (strcmp(property, "clientid") == 0)
+        return _account_set_client(account_name, value);
     if (strcmp(property, "theme") == 0)
         return _account_set_theme(account_name, value);
     if (strcmp(property, "tls") == 0)
@@ -1017,48 +1027,40 @@ cmd_account_clear(ProfWin* window, const char* const command, gchar** args)
     if (strcmp(property, "password") == 0) {
         accounts_clear_password(account_name);
         cons_show("Removed password for account %s", account_name);
-        cons_show("");
     } else if (strcmp(property, "eval_password") == 0) {
         accounts_clear_eval_password(account_name);
         cons_show("Removed eval password for account %s", account_name);
-        cons_show("");
     } else if (strcmp(property, "server") == 0) {
         accounts_clear_server(account_name);
         cons_show("Removed server for account %s", account_name);
-        cons_show("");
     } else if (strcmp(property, "port") == 0) {
         accounts_clear_port(account_name);
         cons_show("Removed port for account %s", account_name);
-        cons_show("");
     } else if (strcmp(property, "otr") == 0) {
         accounts_clear_otr(account_name);
         cons_show("OTR policy removed for account %s", account_name);
-        cons_show("");
     } else if (strcmp(property, "pgpkeyid") == 0) {
         accounts_clear_pgp_keyid(account_name);
         cons_show("Removed PGP key ID for account %s", account_name);
-        cons_show("");
     } else if (strcmp(property, "startscript") == 0) {
         accounts_clear_script_start(account_name);
         cons_show("Removed start script for account %s", account_name);
-        cons_show("");
+    } else if (strcmp(property, "clientid") == 0) {
+        accounts_clear_client(account_name);
+        cons_show("Reset client name for account %s", account_name);
     } else if (strcmp(property, "theme") == 0) {
         accounts_clear_theme(account_name);
         cons_show("Removed theme for account %s", account_name);
-        cons_show("");
     } else if (strcmp(property, "muc") == 0) {
         accounts_clear_muc(account_name);
         cons_show("Removed MUC service for account %s", account_name);
-        cons_show("");
     } else if (strcmp(property, "resource") == 0) {
         accounts_clear_resource(account_name);
         cons_show("Removed resource for account %s", account_name);
-        cons_show("");
     } else {
         cons_show("Invalid property: %s", property);
-        cons_show("");
     }
-
+    cons_show("");
     return TRUE;
 }
 
diff --git a/src/config/account.c b/src/config/account.c
index 89436f9a..73740b3a 100644
--- a/src/config/account.c
+++ b/src/config/account.c
@@ -56,7 +56,8 @@ account_new(gchar* name, gchar* jid, gchar* password, gchar* eval_password, gboo
             gchar* otr_policy, GList* otr_manual, GList* otr_opportunistic, GList* otr_always,
             gchar* omemo_policy, GList* omemo_enabled, GList* omemo_disabled,
             GList* ox_enabled, GList* pgp_enabled, gchar* pgp_keyid,
-            gchar* startscript, gchar* theme, gchar* tls_policy, gchar* auth_policy)
+            gchar* startscript, gchar* theme, gchar* tls_policy, gchar* auth_policy,
+            gchar* client)
 {
     ProfAccount* new_account = calloc(1, sizeof(ProfAccount));
 
@@ -131,6 +132,8 @@ account_new(gchar* name, gchar* jid, gchar* password, gchar* eval_password, gboo
 
     new_account->startscript = startscript;
 
+    new_account->client = client;
+
     new_account->theme = theme;
 
     new_account->tls_policy = tls_policy;
@@ -226,6 +229,7 @@ account_free(ProfAccount* account)
     free(account->omemo_policy);
     free(account->pgp_keyid);
     free(account->startscript);
+    free(account->client);
     free(account->theme);
     free(account->tls_policy);
     free(account->auth_policy);
diff --git a/src/config/account.h b/src/config/account.h
index a469e068..f82a3e11 100644
--- a/src/config/account.h
+++ b/src/config/account.h
@@ -71,6 +71,7 @@ typedef struct prof_account_t
     gchar* theme;
     gchar* tls_policy;
     gchar* auth_policy;
+    gchar* client;
 } ProfAccount;
 
 ProfAccount* account_new(gchar* name, gchar* jid, gchar* password, gchar* eval_password, gboolean enabled,
@@ -80,7 +81,8 @@ ProfAccount* account_new(gchar* name, gchar* jid, gchar* password, gchar* eval_p
                          gchar* otr_policy, GList* otr_manual, GList* otr_opportunistic, GList* otr_always,
                          gchar* omemo_policy, GList* omemo_enabled, GList* omemo_disabled,
                          GList* ox_enabled, GList* pgp_enabled, gchar* pgp_keyid,
-                         gchar* startscript, gchar* theme, gchar* tls_policy, gchar* auth_policy);
+                         gchar* startscript, gchar* theme, gchar* tls_policy, gchar* auth_policy,
+                         gchar* client);
 char* account_create_connect_jid(ProfAccount* account);
 gboolean account_eval_password(ProfAccount* account);
 void account_free(ProfAccount* account);
diff --git a/src/config/accounts.c b/src/config/accounts.c
index 9c7eddf9..f7e6e456 100644
--- a/src/config/accounts.c
+++ b/src/config/accounts.c
@@ -329,6 +329,11 @@ accounts_get_account(const char* const name)
             startscript = g_key_file_get_string(accounts, name, "script.start", NULL);
         }
 
+        gchar* client = NULL;
+        if (g_key_file_has_key(accounts, name, "client.name", NULL)) {
+            client = g_key_file_get_string(accounts, name, "client.name", NULL);
+        }
+
         gchar* theme = NULL;
         if (g_key_file_has_key(accounts, name, "theme", NULL)) {
             theme = g_key_file_get_string(accounts, name, "theme", NULL);
@@ -348,7 +353,7 @@ accounts_get_account(const char* const name)
                                                priority_dnd, muc_service, muc_nick, otr_policy, otr_manual,
                                                otr_opportunistic, otr_always, omemo_policy, omemo_enabled,
                                                omemo_disabled, ox_enabled, pgp_enabled, pgp_keyid,
-                                               startscript, theme, tls_policy, auth_policy);
+                                               startscript, theme, tls_policy, auth_policy, client);
 
         return new_account;
     }
@@ -552,6 +557,12 @@ accounts_set_script_start(const char* const account_name, const char* const valu
 }
 
 void
+accounts_set_client(const char* const account_name, const char* const value)
+{
+    _accounts_set_string_option(account_name, "client.name", value);
+}
+
+void
 accounts_set_theme(const char* const account_name, const char* const value)
 {
     _accounts_set_string_option(account_name, "theme", value);
@@ -594,6 +605,12 @@ accounts_clear_script_start(const char* const account_name)
 }
 
 void
+accounts_clear_client(const char* const account_name)
+{
+    _accounts_clear_string_option(account_name, "client.name");
+}
+
+void
 accounts_clear_theme(const char* const account_name)
 {
     _accounts_clear_string_option(account_name, "theme");
diff --git a/src/config/accounts.h b/src/config/accounts.h
index 2f594a2f..c5b829c0 100644
--- a/src/config/accounts.h
+++ b/src/config/accounts.h
@@ -87,6 +87,7 @@ gint accounts_get_priority_for_presence_type(const char* const account_name,
                                              resource_presence_t presence_type);
 void 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);
+void accounts_set_client(const char* const account_name, const char* const value);
 void accounts_set_theme(const char* const account_name, const char* const value);
 void accounts_clear_password(const char* const account_name);
 void accounts_clear_eval_password(const char* const account_name);
@@ -95,6 +96,7 @@ void accounts_clear_port(const char* const account_name);
 void accounts_clear_otr(const char* const account_name);
 void accounts_clear_pgp_keyid(const char* const account_name);
 void accounts_clear_script_start(const char* const account_name);
+void accounts_clear_client(const char* const account_name);
 void accounts_clear_theme(const char* const account_name);
 void accounts_clear_muc(const char* const account_name);
 void accounts_clear_resource(const char* const account_name);
diff --git a/src/ui/console.c b/src/ui/console.c
index 72aad7b6..d26e559f 100644
--- a/src/ui/console.c
+++ b/src/ui/console.c
@@ -1064,6 +1064,9 @@ cons_show_account(ProfAccount* account)
     if (account->startscript) {
         cons_show("Start script      : %s", account->startscript);
     }
+    if (account->client) {
+        cons_show("Client name       : %s", account->client);
+    }
     if (account->theme) {
         cons_show("Theme             : %s", account->theme);
     }
diff --git a/src/xmpp/iq.c b/src/xmpp/iq.c
index b7beafaf..e48d187a 100644
--- a/src/xmpp/iq.c
+++ b/src/xmpp/iq.c
@@ -1612,6 +1612,17 @@ _version_get_handler(xmpp_stanza_t* const stanza)
     xmpp_ctx_t* const ctx = connection_get_ctx();
     const char* id = xmpp_stanza_get_id(stanza);
     const char* from = xmpp_stanza_get_from(stanza);
+    ProfAccount* account = accounts_get_account(session_get_account_name());
+    auto_char char* client = account->client != NULL ? strdup(account->client) : NULL;
+    bool is_custom_client = client != NULL;
+    gchar* custom_version_str = NULL;
+    if (is_custom_client) {
+        custom_version_str = strstr(client, " ");
+        if (custom_version_str != NULL) {
+            *custom_version_str = '\0'; // Split string on name and version
+            custom_version_str++;
+        }
+    }
 
     if (id) {
         log_debug("IQ version get handler fired, id: %s.", id);
@@ -1619,28 +1630,35 @@ _version_get_handler(xmpp_stanza_t* const stanza)
         log_debug("IQ version get handler fired.");
     }
 
-    if (from) {
-        if (prefs_get_boolean(PREF_ADV_NOTIFY_DISCO_OR_VERSION)) {
-            cons_show("Received IQ version request (XEP-0092) from %s", from);
-        }
+    if (!from)
+        return;
 
-        xmpp_stanza_t* response = xmpp_iq_new(ctx, STANZA_TYPE_RESULT, id);
-        xmpp_stanza_set_to(response, from);
+    if (prefs_get_boolean(PREF_ADV_NOTIFY_DISCO_OR_VERSION)) {
+        cons_show("Received IQ version request (XEP-0092) from %s", from);
+    }
 
-        xmpp_stanza_t* query = xmpp_stanza_new(ctx);
-        xmpp_stanza_set_name(query, STANZA_NAME_QUERY);
-        xmpp_stanza_set_ns(query, STANZA_NS_VERSION);
-
-        xmpp_stanza_t* name = xmpp_stanza_new(ctx);
-        xmpp_stanza_set_name(name, "name");
-        xmpp_stanza_t* name_txt = xmpp_stanza_new(ctx);
-        xmpp_stanza_set_text(name_txt, "Profanity");
-        xmpp_stanza_add_child(name, name_txt);
-
-        xmpp_stanza_t* version = xmpp_stanza_new(ctx);
-        xmpp_stanza_set_name(version, "version");
-        xmpp_stanza_t* version_txt = xmpp_stanza_new(ctx);
-        GString* version_str = g_string_new(PACKAGE_VERSION);
+    xmpp_stanza_t* response = xmpp_iq_new(ctx, STANZA_TYPE_RESULT, id);
+    xmpp_stanza_set_to(response, from);
+
+    xmpp_stanza_t* query = xmpp_stanza_new(ctx);
+    xmpp_stanza_set_name(query, STANZA_NAME_QUERY);
+    xmpp_stanza_set_ns(query, STANZA_NS_VERSION);
+
+    xmpp_stanza_t* name = xmpp_stanza_new(ctx);
+    xmpp_stanza_set_name(name, "name");
+    xmpp_stanza_t* name_txt = xmpp_stanza_new(ctx);
+    xmpp_stanza_set_text(name_txt, is_custom_client ? client : "Profanity");
+    xmpp_stanza_add_child(name, name_txt);
+    xmpp_stanza_add_child(query, name);
+    bool include_os = prefs_get_boolean(PREF_REVEAL_OS) && !is_custom_client;
+    xmpp_stanza_t* os;
+    xmpp_stanza_t* os_txt;
+    xmpp_stanza_t* version = xmpp_stanza_new(ctx);
+    xmpp_stanza_set_name(version, "version");
+    xmpp_stanza_t* version_txt = xmpp_stanza_new(ctx);
+    GString* version_str = g_string_new(PACKAGE_VERSION);
+
+    if (!is_custom_client) {
         if (strcmp(PACKAGE_STATUS, "development") == 0) {
 #ifdef HAVE_GIT_VERSION
             g_string_append(version_str, "dev.");
@@ -1653,11 +1671,8 @@ _version_get_handler(xmpp_stanza_t* const stanza)
         }
         xmpp_stanza_set_text(version_txt, version_str->str);
         xmpp_stanza_add_child(version, version_txt);
+        xmpp_stanza_add_child(query, version);
 
-        xmpp_stanza_t* os;
-        xmpp_stanza_t* os_txt;
-
-        bool include_os = prefs_get_boolean(PREF_REVEAL_OS);
         if (include_os) {
             os = xmpp_stanza_new(ctx);
             xmpp_stanza_set_name(os, "os");
@@ -1680,31 +1695,30 @@ _version_get_handler(xmpp_stanza_t* const stanza)
             xmpp_stanza_set_text(os_txt, "Unknown");
 #endif
             xmpp_stanza_add_child(os, os_txt);
-        }
-
-        xmpp_stanza_add_child(query, name);
-        xmpp_stanza_add_child(query, version);
-        if (include_os) {
             xmpp_stanza_add_child(query, os);
         }
-        xmpp_stanza_add_child(response, query);
+    }
+    if (is_custom_client && custom_version_str != NULL) {
+        xmpp_stanza_set_text(version_txt, custom_version_str);
+        xmpp_stanza_add_child(version, version_txt);
+        xmpp_stanza_add_child(query, version);
+    }
 
-        iq_send_stanza(response);
+    xmpp_stanza_add_child(response, query);
+    iq_send_stanza(response);
 
-        g_string_free(version_str, TRUE);
-        xmpp_stanza_release(name_txt);
-        xmpp_stanza_release(version_txt);
-        if (include_os) {
-            xmpp_stanza_release(os_txt);
-        }
-        xmpp_stanza_release(name);
-        xmpp_stanza_release(version);
-        if (include_os) {
-            xmpp_stanza_release(os);
-        }
-        xmpp_stanza_release(query);
-        xmpp_stanza_release(response);
+    // Cleanup
+    g_string_free(version_str, TRUE);
+    xmpp_stanza_release(version_txt);
+    xmpp_stanza_release(name_txt);
+    if (include_os) {
+        xmpp_stanza_release(os_txt);
+        xmpp_stanza_release(os);
     }
+    xmpp_stanza_release(name);
+    xmpp_stanza_release(version);
+    xmpp_stanza_release(query);
+    xmpp_stanza_release(response);
 }
 
 static void
diff --git a/src/xmpp/stanza.c b/src/xmpp/stanza.c
index fab6c5e4..bf353113 100644
--- a/src/xmpp/stanza.c
+++ b/src/xmpp/stanza.c
@@ -975,19 +975,25 @@ stanza_create_caps_query_element(xmpp_ctx_t* ctx)
     xmpp_stanza_t* identity = xmpp_stanza_new(ctx);
     xmpp_stanza_set_name(identity, "identity");
     xmpp_stanza_set_attribute(identity, "category", "client");
-    xmpp_stanza_set_type(identity, "console");
 
-    GString* name_str = g_string_new("Profanity ");
-    g_string_append(name_str, PACKAGE_VERSION);
-    if (g_strcmp0(PACKAGE_STATUS, "development") == 0) {
+    ProfAccount* account = accounts_get_account(session_get_account_name());
+    gchar* client = account->client;
+    bool is_custom_client = client != NULL;
+
+    GString* name_str = g_string_new(is_custom_client ? client : "Profanity ");
+    if (!is_custom_client) {
+        xmpp_stanza_set_type(identity, "console");
+        g_string_append(name_str, PACKAGE_VERSION);
+        if (g_strcmp0(PACKAGE_STATUS, "development") == 0) {
 #ifdef HAVE_GIT_VERSION
-        g_string_append(name_str, "dev.");
-        g_string_append(name_str, PROF_GIT_BRANCH);
-        g_string_append(name_str, ".");
-        g_string_append(name_str, PROF_GIT_REVISION);
+            g_string_append(name_str, "dev.");
+            g_string_append(name_str, PROF_GIT_BRANCH);
+            g_string_append(name_str, ".");
+            g_string_append(name_str, PROF_GIT_REVISION);
 #else
-        g_string_append(name_str, "dev");
+            g_string_append(name_str, "dev");
 #endif
+        }
     }
     xmpp_stanza_set_attribute(identity, "name", name_str->str);
     g_string_free(name_str, TRUE);
diff --git a/tests/unittests/config/stub_accounts.c b/tests/unittests/config/stub_accounts.c
index 08b934d9..cea8a76a 100644
--- a/tests/unittests/config/stub_accounts.c
+++ b/tests/unittests/config/stub_accounts.c
@@ -175,6 +175,10 @@ accounts_set_script_start(const char* const account_name, const char* const valu
 {
 }
 void
+accounts_set_client(const char* const account_name, const char* const value)
+{
+}
+void
 accounts_set_theme(const char* const account_name, const char* const value)
 {
 }
@@ -294,6 +298,10 @@ accounts_clear_script_start(const char* const account_name)
 {
 }
 void
+accounts_clear_client(const char* const account_name)
+{
+}
+void
 accounts_clear_theme(const char* const account_name)
 {
 }
diff --git a/tests/unittests/test_cmd_account.c b/tests/unittests/test_cmd_account.c
index 57949470..2a65a875 100644
--- a/tests/unittests/test_cmd_account.c
+++ b/tests/unittests/test_cmd_account.c
@@ -34,7 +34,7 @@ void
 cmd_account_shows_account_when_connected_and_no_args(void** state)
 {
     ProfAccount* account = account_new(g_strdup("jabber_org"), g_strdup("me@jabber.org"), NULL, NULL,
-                                       TRUE, NULL, 0, NULL, NULL, NULL, 0, 0, 0, 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
+                                       TRUE, NULL, 0, NULL, NULL, NULL, 0, 0, 0, 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
     gchar* args[] = { NULL };
 
     will_return(connection_get_status, JABBER_CONNECTED);
@@ -98,7 +98,7 @@ cmd_account_show_shows_account_when_exists(void** state)
 {
     gchar* args[] = { "show", "account_name", NULL };
     ProfAccount* account = account_new(g_strdup("jabber_org"), g_strdup("me@jabber.org"), NULL, NULL,
-                                       TRUE, NULL, 0, NULL, NULL, NULL, 0, 0, 0, 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
+                                       TRUE, NULL, 0, NULL, NULL, NULL, 0, 0, 0, 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
 
     expect_any(accounts_get_account, name);
     will_return(accounts_get_account, account);
@@ -437,7 +437,7 @@ cmd_account_set_password_sets_password(void** state)
 {
     gchar* args[] = { "set", "a_account", "password", "a_password", NULL };
     ProfAccount* account = account_new(g_strdup("a_account"), NULL, NULL, NULL,
-                                       TRUE, NULL, 0, NULL, NULL, NULL, 0, 0, 0, 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
+                                       TRUE, NULL, 0, NULL, NULL, NULL, 0, 0, 0, 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
 
     expect_any(accounts_account_exists, account_name);
     will_return(accounts_account_exists, TRUE);
@@ -460,7 +460,7 @@ cmd_account_set_eval_password_sets_eval_password(void** state)
 {
     gchar* args[] = { "set", "a_account", "eval_password", "a_password", NULL };
     ProfAccount* account = account_new(g_strdup("a_account"), NULL, NULL, NULL,
-                                       TRUE, NULL, 0, NULL, NULL, NULL, 0, 0, 0, 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
+                                       TRUE, NULL, 0, NULL, NULL, NULL, 0, 0, 0, 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
 
     expect_any(accounts_account_exists, account_name);
     will_return(accounts_account_exists, TRUE);
@@ -483,7 +483,7 @@ cmd_account_set_password_when_eval_password_set(void** state)
 {
     gchar* args[] = { "set", "a_account", "password", "a_password", NULL };
     ProfAccount* account = account_new(g_strdup("a_account"), NULL, NULL, g_strdup("a_password"),
-                                       TRUE, NULL, 0, NULL, NULL, NULL, 0, 0, 0, 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
+                                       TRUE, NULL, 0, NULL, NULL, NULL, 0, 0, 0, 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
 
     expect_any(accounts_account_exists, account_name);
     will_return(accounts_account_exists, TRUE);
@@ -502,7 +502,7 @@ cmd_account_set_eval_password_when_password_set(void** state)
 {
     gchar* args[] = { "set", "a_account", "eval_password", "a_password", NULL };
     ProfAccount* account = account_new(g_strdup("a_account"), NULL, g_strdup("a_password"), NULL,
-                                       TRUE, NULL, 0, NULL, NULL, NULL, 0, 0, 0, 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
+                                       TRUE, NULL, 0, NULL, NULL, NULL, 0, 0, 0, 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
 
     expect_any(accounts_account_exists, account_name);
     will_return(accounts_account_exists, TRUE);
@@ -853,7 +853,7 @@ cmd_account_set_priority_updates_presence_when_account_connected_with_presence(v
 
 #ifdef HAVE_LIBGPGME
     ProfAccount* account = account_new(g_strdup("a_account"), g_strdup("a_jid"), NULL, NULL, TRUE, NULL, 5222, g_strdup("a_resource"),
-                                       NULL, NULL, 10, 10, 10, 10, 10, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
+                                       NULL, NULL, 10, 10, 10, 10, 10, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
 
     will_return(session_get_account_name, "a_account");
     expect_any(accounts_get_account, name);
diff --git a/tests/unittests/test_cmd_connect.c b/tests/unittests/test_cmd_connect.c
index 0f6480a0..8def6b64 100644
--- a/tests/unittests/test_cmd_connect.c
+++ b/tests/unittests/test_cmd_connect.c
@@ -124,7 +124,7 @@ cmd_connect_lowercases_argument_with_account(void** state)
 {
     gchar* args[] = { "Jabber_org", NULL };
     ProfAccount* account = account_new(g_strdup("Jabber_org"), g_strdup("me@jabber.org"), g_strdup("password"), NULL,
-                                       TRUE, NULL, 0, NULL, NULL, NULL, 0, 0, 0, 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
+                                       TRUE, NULL, 0, NULL, NULL, NULL, 0, 0, 0, 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
 
     will_return(connection_get_status, JABBER_DISCONNECTED);
 
@@ -145,7 +145,7 @@ cmd_connect_asks_password_when_not_in_account(void** state)
 {
     gchar* args[] = { "jabber_org", NULL };
     ProfAccount* account = account_new(g_strdup("jabber_org"), g_strdup("me@jabber.org"), NULL, NULL,
-                                       TRUE, NULL, 0, NULL, NULL, NULL, 0, 0, 0, 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
+                                       TRUE, NULL, 0, NULL, NULL, NULL, 0, 0, 0, 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
 
     will_return(connection_get_status, JABBER_DISCONNECTED);
 
@@ -408,7 +408,7 @@ cmd_connect_shows_message_when_connecting_with_account(void** state)
 {
     gchar* args[] = { "jabber_org", NULL };
     ProfAccount* account = account_new(g_strdup("jabber_org"), g_strdup("user@jabber.org"), g_strdup("password"), NULL,
-                                       TRUE, NULL, 0, g_strdup("laptop"), NULL, NULL, 0, 0, 0, 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
+                                       TRUE, NULL, 0, g_strdup("laptop"), NULL, NULL, 0, 0, 0, 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
 
     will_return(connection_get_status, JABBER_DISCONNECTED);
 
@@ -429,7 +429,7 @@ cmd_connect_connects_with_account(void** state)
 {
     gchar* args[] = { "jabber_org", NULL };
     ProfAccount* account = account_new(g_strdup("jabber_org"), g_strdup("me@jabber.org"), g_strdup("password"), NULL,
-                                       TRUE, NULL, 0, NULL, NULL, NULL, 0, 0, 0, 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
+                                       TRUE, NULL, 0, NULL, NULL, NULL, 0, 0, 0, 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
 
     will_return(connection_get_status, JABBER_DISCONNECTED);
 
diff --git a/tests/unittests/test_cmd_join.c b/tests/unittests/test_cmd_join.c
index cd187b07..9d6c2eeb 100644
--- a/tests/unittests/test_cmd_join.c
+++ b/tests/unittests/test_cmd_join.c
@@ -71,7 +71,7 @@ cmd_join_uses_account_mucservice_when_no_service_specified(void** state)
     char* expected_room = "room@conference.server.org";
     gchar* args[] = { room, "nick", nick, NULL };
     ProfAccount* account = account_new(account_name, g_strdup("user@server.org"), NULL, NULL,
-                                       TRUE, NULL, 0, g_strdup("laptop"), NULL, NULL, 0, 0, 0, 0, 0, account_service, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
+                                       TRUE, NULL, 0, g_strdup("laptop"), NULL, NULL, 0, 0, 0, 0, 0, account_service, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
 
     muc_init();
 
@@ -99,7 +99,7 @@ cmd_join_uses_supplied_nick(void** state)
     char* nick = "bob";
     gchar* args[] = { room, "nick", nick, NULL };
     ProfAccount* account = account_new(account_name, g_strdup("user@server.org"), NULL, NULL,
-                                       TRUE, NULL, 0, g_strdup("laptop"), NULL, NULL, 0, 0, 0, 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
+                                       TRUE, NULL, 0, g_strdup("laptop"), NULL, NULL, 0, 0, 0, 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
 
     muc_init();
 
@@ -127,7 +127,7 @@ cmd_join_uses_account_nick_when_not_supplied(void** state)
     char* account_nick = g_strdup("a_nick");
     gchar* args[] = { room, NULL };
     ProfAccount* account = account_new(account_name, g_strdup("user@server.org"), NULL, NULL,
-                                       TRUE, NULL, 0, g_strdup("laptop"), NULL, NULL, 0, 0, 0, 0, 0, NULL, account_nick, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
+                                       TRUE, NULL, 0, g_strdup("laptop"), NULL, NULL, 0, 0, 0, 0, 0, NULL, account_nick, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
 
     muc_init();
 
@@ -158,7 +158,7 @@ cmd_join_uses_password_when_supplied(void** state)
     char* expected_room = "room@a_service";
     gchar* args[] = { room, "password", password, NULL };
     ProfAccount* account = account_new(account_name, g_strdup("user@server.org"), NULL, NULL,
-                                       TRUE, NULL, 0, g_strdup("laptop"), NULL, NULL, 0, 0, 0, 0, 0, account_service, account_nick, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
+                                       TRUE, NULL, 0, g_strdup("laptop"), NULL, NULL, 0, 0, 0, 0, 0, account_service, account_nick, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
 
     muc_init();
 
diff --git a/tests/unittests/test_cmd_otr.c b/tests/unittests/test_cmd_otr.c
index ccd219de..ae492cf1 100644
--- a/tests/unittests/test_cmd_otr.c
+++ b/tests/unittests/test_cmd_otr.c
@@ -196,7 +196,7 @@ cmd_otr_gen_generates_key_for_connected_account(void** state)
     gchar* args[] = { "gen", NULL };
     char* account_name = g_strdup("myaccount");
     ProfAccount* account = account_new(account_name, g_strdup("me@jabber.org"), NULL, NULL,
-                                       TRUE, NULL, 0, NULL, NULL, NULL, 0, 0, 0, 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
+                                       TRUE, NULL, 0, NULL, NULL, NULL, 0, 0, 0, 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
 
     will_return(connection_get_status, JABBER_CONNECTED);
     will_return(session_get_account_name, account_name);
diff --git a/tests/unittests/test_cmd_rooms.c b/tests/unittests/test_cmd_rooms.c
index 10e8bf2f..60fca1ce 100644
--- a/tests/unittests/test_cmd_rooms.c
+++ b/tests/unittests/test_cmd_rooms.c
@@ -51,7 +51,7 @@ cmd_rooms_uses_account_default_when_no_arg(void** state)
     gchar* args[] = { NULL };
 
     ProfAccount* account = account_new(g_strdup("testaccount"), NULL, NULL, NULL, TRUE, NULL, 0, NULL, NULL, NULL,
-                                       0, 0, 0, 0, 0, g_strdup("default_conf_server"), NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
+                                       0, 0, 0, 0, 0, g_strdup("default_conf_server"), NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
 
     will_return(connection_get_status, JABBER_CONNECTED);
     will_return(session_get_account_name, "account_name");
@@ -91,7 +91,7 @@ cmd_rooms_filter_arg_used_when_passed(void** state)
     gchar* args[] = { "filter", "text", NULL };
 
     ProfAccount* account = account_new(g_strdup("testaccount"), NULL, NULL, NULL, TRUE, NULL, 0, NULL, NULL, NULL,
-                                       0, 0, 0, 0, 0, g_strdup("default_conf_server"), NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
+                                       0, 0, 0, 0, 0, g_strdup("default_conf_server"), NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
 
     will_return(connection_get_status, JABBER_CONNECTED);
     will_return(session_get_account_name, "account_name");