about summary refs log tree commit diff stats
path: root/src/xmpp/stanza.c
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 /src/xmpp/stanza.c
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
Diffstat (limited to 'src/xmpp/stanza.c')
-rw-r--r--src/xmpp/stanza.c24
1 files changed, 15 insertions, 9 deletions
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);