Merge pull request #1815 from H3rnand3zzz/feature/the-client-switcher
Feature: Allow setting client identification name/version manually
This commit is contained in:
@@ -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");
|
||||
|
||||
@@ -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")
|
||||
},
|
||||
|
||||
@@ -840,6 +840,14 @@ _account_set_startscript(char* account_name, char* script)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user