Merge pull request #1815 from H3rnand3zzz/feature/the-client-switcher

Feature: Allow setting client identification name/version manually
This commit is contained in:
Michael Vetter
2023-04-09 18:24:23 +02:00
committed by GitHub
16 changed files with 151 additions and 86 deletions

View File

@@ -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);

View File

@@ -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);

View File

@@ -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;
}
@@ -551,6 +556,12 @@ accounts_set_script_start(const char* const account_name, const char* const valu
_accounts_set_string_option(account_name, "script.start", value);
}
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)
{
@@ -593,6 +604,12 @@ accounts_clear_script_start(const char* const account_name)
_accounts_clear_string_option(account_name, "script.start");
}
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)
{

View File

@@ -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);