1
0
mirror of https://github.com/profanity-im/profanity.git synced 2024-06-23 21:45:30 +00:00

Allow setting client identification name/version manually

Add changes allowing user to switch client name and version.

Useful for enhancing user privacy.

Minor cleanup.
This commit is contained in:
John Hernandez 2023-04-03 17:58:09 +02:00
parent 6b597f6608
commit 5d3c8ce7c1
16 changed files with 151 additions and 86 deletions

View File

@ -478,6 +478,7 @@ cmd_ac_init(void)
autocomplete_add(account_set_ac, "otr"); autocomplete_add(account_set_ac, "otr");
autocomplete_add(account_set_ac, "pgpkeyid"); autocomplete_add(account_set_ac, "pgpkeyid");
autocomplete_add(account_set_ac, "startscript"); autocomplete_add(account_set_ac, "startscript");
autocomplete_add(account_set_ac, "clientid");
autocomplete_add(account_set_ac, "tls"); autocomplete_add(account_set_ac, "tls");
autocomplete_add(account_set_ac, "auth"); autocomplete_add(account_set_ac, "auth");
autocomplete_add(account_set_ac, "theme"); autocomplete_add(account_set_ac, "theme");
@ -490,6 +491,7 @@ cmd_ac_init(void)
autocomplete_add(account_clear_ac, "otr"); autocomplete_add(account_clear_ac, "otr");
autocomplete_add(account_clear_ac, "pgpkeyid"); autocomplete_add(account_clear_ac, "pgpkeyid");
autocomplete_add(account_clear_ac, "startscript"); autocomplete_add(account_clear_ac, "startscript");
autocomplete_add(account_clear_ac, "clientid");
autocomplete_add(account_clear_ac, "theme"); autocomplete_add(account_clear_ac, "theme");
autocomplete_add(account_clear_ac, "muc"); autocomplete_add(account_clear_ac, "muc");
autocomplete_add(account_clear_ac, "resource"); autocomplete_add(account_clear_ac, "resource");

View File

@ -2063,6 +2063,7 @@ static const struct cmd_t command_defs[] = {
"/account set <account> otr <policy>", "/account set <account> otr <policy>",
"/account set <account> pgpkeyid <pgpkeyid>", "/account set <account> pgpkeyid <pgpkeyid>",
"/account set <account> startscript <script>", "/account set <account> startscript <script>",
"/account set <account> clientid \"<name> <version>\"",
"/account set <account> tls force|allow|trust|legacy|disable", "/account set <account> tls force|allow|trust|legacy|disable",
"/account set <account> auth default|legacy", "/account set <account> auth default|legacy",
"/account set <account> theme <theme>", "/account set <account> theme <theme>",
@ -2073,6 +2074,7 @@ static const struct cmd_t command_defs[] = {
"/account clear <account> otr", "/account clear <account> otr",
"/account clear <account> pgpkeyid", "/account clear <account> pgpkeyid",
"/account clear <account> startscript", "/account clear <account> startscript",
"/account clear <account> clientid",
"/account clear <account> muc", "/account clear <account> muc",
"/account clear <account> resource") "/account clear <account> resource")
CMD_DESC( CMD_DESC(
@ -2102,6 +2104,7 @@ static const struct cmd_t command_defs[] = {
{ "set <account> otr <policy>", "Override global OTR policy for this account, see /otr." }, { "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> 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> 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 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 allow", "Use TLS for the connection if it is available." },
{ "set <account> tls trust", "Force TLS connection and trust server's certificate." }, { "set <account> tls trust", "Force TLS connection and trust server's certificate." },
@ -2117,6 +2120,7 @@ static const struct cmd_t command_defs[] = {
{ "clear <account> otr", "Remove the OTR policy setting for this account." }, { "clear <account> otr", "Remove the OTR policy setting for this account." },
{ "clear <account> pgpkeyid", "Remove pgpkeyid associated with this account." }, { "clear <account> pgpkeyid", "Remove pgpkeyid associated with this account." },
{ "clear <account> startscript", "Remove startscript 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> 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> resource", "Remove the resource setting for this account." },
{ "clear <account> muc", "Remove the default MUC service setting." }) { "clear <account> muc", "Remove the default MUC service setting." })
@ -2129,6 +2133,7 @@ static const struct cmd_t command_defs[] = {
"/account set me nick dennis", "/account set me nick dennis",
"/account set me status dnd", "/account set me status dnd",
"/account set me dnd -1", "/account set me dnd -1",
"/account set me clientid \"Profanity 0.42 (Dev)\"",
"/account rename me chattyme", "/account rename me chattyme",
"/account clear me pgpkeyid") "/account clear me pgpkeyid")
}, },

View File

@ -840,6 +840,14 @@ _account_set_startscript(char* account_name, char* script)
return TRUE; 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 gboolean
_account_set_theme(char* account_name, char* theme) _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); return _account_set_pgpkeyid(account_name, value);
if (strcmp(property, "startscript") == 0) if (strcmp(property, "startscript") == 0)
return _account_set_startscript(account_name, value); return _account_set_startscript(account_name, value);
if (strcmp(property, "clientid") == 0)
return _account_set_client(account_name, value);
if (strcmp(property, "theme") == 0) if (strcmp(property, "theme") == 0)
return _account_set_theme(account_name, value); return _account_set_theme(account_name, value);
if (strcmp(property, "tls") == 0) 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) { if (strcmp(property, "password") == 0) {
accounts_clear_password(account_name); accounts_clear_password(account_name);
cons_show("Removed password for account %s", account_name); cons_show("Removed password for account %s", account_name);
cons_show("");
} else if (strcmp(property, "eval_password") == 0) { } else if (strcmp(property, "eval_password") == 0) {
accounts_clear_eval_password(account_name); accounts_clear_eval_password(account_name);
cons_show("Removed eval password for account %s", account_name); cons_show("Removed eval password for account %s", account_name);
cons_show("");
} else if (strcmp(property, "server") == 0) { } else if (strcmp(property, "server") == 0) {
accounts_clear_server(account_name); accounts_clear_server(account_name);
cons_show("Removed server for account %s", account_name); cons_show("Removed server for account %s", account_name);
cons_show("");
} else if (strcmp(property, "port") == 0) { } else if (strcmp(property, "port") == 0) {
accounts_clear_port(account_name); accounts_clear_port(account_name);
cons_show("Removed port for account %s", account_name); cons_show("Removed port for account %s", account_name);
cons_show("");
} else if (strcmp(property, "otr") == 0) { } else if (strcmp(property, "otr") == 0) {
accounts_clear_otr(account_name); accounts_clear_otr(account_name);
cons_show("OTR policy removed for account %s", account_name); cons_show("OTR policy removed for account %s", account_name);
cons_show("");
} else if (strcmp(property, "pgpkeyid") == 0) { } else if (strcmp(property, "pgpkeyid") == 0) {
accounts_clear_pgp_keyid(account_name); accounts_clear_pgp_keyid(account_name);
cons_show("Removed PGP key ID for account %s", account_name); cons_show("Removed PGP key ID for account %s", account_name);
cons_show("");
} else if (strcmp(property, "startscript") == 0) { } else if (strcmp(property, "startscript") == 0) {
accounts_clear_script_start(account_name); accounts_clear_script_start(account_name);
cons_show("Removed start script for account %s", 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) { } else if (strcmp(property, "theme") == 0) {
accounts_clear_theme(account_name); accounts_clear_theme(account_name);
cons_show("Removed theme for account %s", account_name); cons_show("Removed theme for account %s", account_name);
cons_show("");
} else if (strcmp(property, "muc") == 0) { } else if (strcmp(property, "muc") == 0) {
accounts_clear_muc(account_name); accounts_clear_muc(account_name);
cons_show("Removed MUC service for account %s", account_name); cons_show("Removed MUC service for account %s", account_name);
cons_show("");
} else if (strcmp(property, "resource") == 0) { } else if (strcmp(property, "resource") == 0) {
accounts_clear_resource(account_name); accounts_clear_resource(account_name);
cons_show("Removed resource for account %s", account_name); cons_show("Removed resource for account %s", account_name);
cons_show("");
} else { } else {
cons_show("Invalid property: %s", property); cons_show("Invalid property: %s", property);
cons_show("");
} }
cons_show("");
return TRUE; return TRUE;
} }

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* otr_policy, GList* otr_manual, GList* otr_opportunistic, GList* otr_always,
gchar* omemo_policy, GList* omemo_enabled, GList* omemo_disabled, gchar* omemo_policy, GList* omemo_enabled, GList* omemo_disabled,
GList* ox_enabled, GList* pgp_enabled, gchar* pgp_keyid, 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)); 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->startscript = startscript;
new_account->client = client;
new_account->theme = theme; new_account->theme = theme;
new_account->tls_policy = tls_policy; new_account->tls_policy = tls_policy;
@ -226,6 +229,7 @@ account_free(ProfAccount* account)
free(account->omemo_policy); free(account->omemo_policy);
free(account->pgp_keyid); free(account->pgp_keyid);
free(account->startscript); free(account->startscript);
free(account->client);
free(account->theme); free(account->theme);
free(account->tls_policy); free(account->tls_policy);
free(account->auth_policy); free(account->auth_policy);

View File

@ -71,6 +71,7 @@ typedef struct prof_account_t
gchar* theme; gchar* theme;
gchar* tls_policy; gchar* tls_policy;
gchar* auth_policy; gchar* auth_policy;
gchar* client;
} ProfAccount; } ProfAccount;
ProfAccount* account_new(gchar* name, gchar* jid, gchar* password, gchar* eval_password, gboolean enabled, 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* otr_policy, GList* otr_manual, GList* otr_opportunistic, GList* otr_always,
gchar* omemo_policy, GList* omemo_enabled, GList* omemo_disabled, gchar* omemo_policy, GList* omemo_enabled, GList* omemo_disabled,
GList* ox_enabled, GList* pgp_enabled, gchar* pgp_keyid, 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); char* account_create_connect_jid(ProfAccount* account);
gboolean account_eval_password(ProfAccount* account); gboolean account_eval_password(ProfAccount* account);
void account_free(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); 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; gchar* theme = NULL;
if (g_key_file_has_key(accounts, name, "theme", NULL)) { if (g_key_file_has_key(accounts, name, "theme", NULL)) {
theme = g_key_file_get_string(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, priority_dnd, muc_service, muc_nick, otr_policy, otr_manual,
otr_opportunistic, otr_always, omemo_policy, omemo_enabled, otr_opportunistic, otr_always, omemo_policy, omemo_enabled,
omemo_disabled, ox_enabled, pgp_enabled, pgp_keyid, omemo_disabled, ox_enabled, pgp_enabled, pgp_keyid,
startscript, theme, tls_policy, auth_policy); startscript, theme, tls_policy, auth_policy, client);
return new_account; 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); _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 void
accounts_set_theme(const char* const account_name, const char* const value) 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"); _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 void
accounts_clear_theme(const char* const account_name) 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); resource_presence_t presence_type);
void accounts_set_pgp_keyid(const char* const account_name, const char* const value); 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_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_set_theme(const char* const account_name, const char* const value);
void accounts_clear_password(const char* const account_name); void accounts_clear_password(const char* const account_name);
void accounts_clear_eval_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_otr(const char* const account_name);
void accounts_clear_pgp_keyid(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_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_theme(const char* const account_name);
void accounts_clear_muc(const char* const account_name); void accounts_clear_muc(const char* const account_name);
void accounts_clear_resource(const char* const account_name); void accounts_clear_resource(const char* const account_name);

View File

@ -1064,6 +1064,9 @@ cons_show_account(ProfAccount* account)
if (account->startscript) { if (account->startscript) {
cons_show("Start script : %s", account->startscript); cons_show("Start script : %s", account->startscript);
} }
if (account->client) {
cons_show("Client name : %s", account->client);
}
if (account->theme) { if (account->theme) {
cons_show("Theme : %s", account->theme); cons_show("Theme : %s", account->theme);
} }

View File

@ -1612,6 +1612,17 @@ _version_get_handler(xmpp_stanza_t* const stanza)
xmpp_ctx_t* const ctx = connection_get_ctx(); xmpp_ctx_t* const ctx = connection_get_ctx();
const char* id = xmpp_stanza_get_id(stanza); const char* id = xmpp_stanza_get_id(stanza);
const char* from = xmpp_stanza_get_from(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) { if (id) {
log_debug("IQ version get handler fired, id: %s.", id); log_debug("IQ version get handler fired, id: %s.", id);
@ -1619,7 +1630,9 @@ _version_get_handler(xmpp_stanza_t* const stanza)
log_debug("IQ version get handler fired."); log_debug("IQ version get handler fired.");
} }
if (from) { if (!from)
return;
if (prefs_get_boolean(PREF_ADV_NOTIFY_DISCO_OR_VERSION)) { if (prefs_get_boolean(PREF_ADV_NOTIFY_DISCO_OR_VERSION)) {
cons_show("Received IQ version request (XEP-0092) from %s", from); cons_show("Received IQ version request (XEP-0092) from %s", from);
} }
@ -1634,13 +1647,18 @@ _version_get_handler(xmpp_stanza_t* const stanza)
xmpp_stanza_t* name = xmpp_stanza_new(ctx); xmpp_stanza_t* name = xmpp_stanza_new(ctx);
xmpp_stanza_set_name(name, "name"); xmpp_stanza_set_name(name, "name");
xmpp_stanza_t* name_txt = xmpp_stanza_new(ctx); xmpp_stanza_t* name_txt = xmpp_stanza_new(ctx);
xmpp_stanza_set_text(name_txt, "Profanity"); xmpp_stanza_set_text(name_txt, is_custom_client ? client : "Profanity");
xmpp_stanza_add_child(name, name_txt); 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_t* version = xmpp_stanza_new(ctx);
xmpp_stanza_set_name(version, "version"); xmpp_stanza_set_name(version, "version");
xmpp_stanza_t* version_txt = xmpp_stanza_new(ctx); xmpp_stanza_t* version_txt = xmpp_stanza_new(ctx);
GString* version_str = g_string_new(PACKAGE_VERSION); GString* version_str = g_string_new(PACKAGE_VERSION);
if (!is_custom_client) {
if (strcmp(PACKAGE_STATUS, "development") == 0) { if (strcmp(PACKAGE_STATUS, "development") == 0) {
#ifdef HAVE_GIT_VERSION #ifdef HAVE_GIT_VERSION
g_string_append(version_str, "dev."); 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_set_text(version_txt, version_str->str);
xmpp_stanza_add_child(version, version_txt); 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) { if (include_os) {
os = xmpp_stanza_new(ctx); os = xmpp_stanza_new(ctx);
xmpp_stanza_set_name(os, "os"); 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"); xmpp_stanza_set_text(os_txt, "Unknown");
#endif #endif
xmpp_stanza_add_child(os, os_txt); 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(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);
}
xmpp_stanza_add_child(response, query);
iq_send_stanza(response); iq_send_stanza(response);
// Cleanup
g_string_free(version_str, TRUE); g_string_free(version_str, TRUE);
xmpp_stanza_release(name_txt);
xmpp_stanza_release(version_txt); xmpp_stanza_release(version_txt);
xmpp_stanza_release(name_txt);
if (include_os) { if (include_os) {
xmpp_stanza_release(os_txt); xmpp_stanza_release(os_txt);
xmpp_stanza_release(os);
} }
xmpp_stanza_release(name); xmpp_stanza_release(name);
xmpp_stanza_release(version); xmpp_stanza_release(version);
if (include_os) {
xmpp_stanza_release(os);
}
xmpp_stanza_release(query); xmpp_stanza_release(query);
xmpp_stanza_release(response); xmpp_stanza_release(response);
}
} }
static void static void

View File

@ -975,9 +975,14 @@ stanza_create_caps_query_element(xmpp_ctx_t* ctx)
xmpp_stanza_t* identity = xmpp_stanza_new(ctx); xmpp_stanza_t* identity = xmpp_stanza_new(ctx);
xmpp_stanza_set_name(identity, "identity"); xmpp_stanza_set_name(identity, "identity");
xmpp_stanza_set_attribute(identity, "category", "client"); xmpp_stanza_set_attribute(identity, "category", "client");
xmpp_stanza_set_type(identity, "console");
GString* name_str = g_string_new("Profanity "); 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); g_string_append(name_str, PACKAGE_VERSION);
if (g_strcmp0(PACKAGE_STATUS, "development") == 0) { if (g_strcmp0(PACKAGE_STATUS, "development") == 0) {
#ifdef HAVE_GIT_VERSION #ifdef HAVE_GIT_VERSION
@ -989,6 +994,7 @@ stanza_create_caps_query_element(xmpp_ctx_t* ctx)
g_string_append(name_str, "dev"); g_string_append(name_str, "dev");
#endif #endif
} }
}
xmpp_stanza_set_attribute(identity, "name", name_str->str); xmpp_stanza_set_attribute(identity, "name", name_str->str);
g_string_free(name_str, TRUE); g_string_free(name_str, TRUE);
xmpp_stanza_add_child(query, identity); xmpp_stanza_add_child(query, identity);

View File

@ -175,6 +175,10 @@ accounts_set_script_start(const char* const account_name, const char* const valu
{ {
} }
void 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) 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 void
accounts_clear_client(const char* const account_name)
{
}
void
accounts_clear_theme(const char* const account_name) accounts_clear_theme(const char* const account_name)
{ {
} }

View File

@ -34,7 +34,7 @@ void
cmd_account_shows_account_when_connected_and_no_args(void** state) 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, 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 }; gchar* args[] = { NULL };
will_return(connection_get_status, JABBER_CONNECTED); 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 }; gchar* args[] = { "show", "account_name", NULL };
ProfAccount* account = account_new(g_strdup("jabber_org"), g_strdup("me@jabber.org"), NULL, 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); expect_any(accounts_get_account, name);
will_return(accounts_get_account, account); 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 }; gchar* args[] = { "set", "a_account", "password", "a_password", NULL };
ProfAccount* account = account_new(g_strdup("a_account"), NULL, NULL, 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); expect_any(accounts_account_exists, account_name);
will_return(accounts_account_exists, TRUE); 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 }; gchar* args[] = { "set", "a_account", "eval_password", "a_password", NULL };
ProfAccount* account = account_new(g_strdup("a_account"), NULL, NULL, 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); expect_any(accounts_account_exists, account_name);
will_return(accounts_account_exists, TRUE); 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 }; gchar* args[] = { "set", "a_account", "password", "a_password", NULL };
ProfAccount* account = account_new(g_strdup("a_account"), NULL, NULL, g_strdup("a_password"), 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); expect_any(accounts_account_exists, account_name);
will_return(accounts_account_exists, TRUE); 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 }; gchar* args[] = { "set", "a_account", "eval_password", "a_password", NULL };
ProfAccount* account = account_new(g_strdup("a_account"), NULL, g_strdup("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); expect_any(accounts_account_exists, account_name);
will_return(accounts_account_exists, TRUE); 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 #ifdef HAVE_LIBGPGME
ProfAccount* account = account_new(g_strdup("a_account"), g_strdup("a_jid"), NULL, NULL, TRUE, NULL, 5222, g_strdup("a_resource"), 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"); will_return(session_get_account_name, "a_account");
expect_any(accounts_get_account, name); expect_any(accounts_get_account, name);

View File

@ -124,7 +124,7 @@ cmd_connect_lowercases_argument_with_account(void** state)
{ {
gchar* args[] = { "Jabber_org", NULL }; gchar* args[] = { "Jabber_org", NULL };
ProfAccount* account = account_new(g_strdup("Jabber_org"), g_strdup("me@jabber.org"), g_strdup("password"), 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); 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 }; gchar* args[] = { "jabber_org", NULL };
ProfAccount* account = account_new(g_strdup("jabber_org"), g_strdup("me@jabber.org"), NULL, 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); 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 }; gchar* args[] = { "jabber_org", NULL };
ProfAccount* account = account_new(g_strdup("jabber_org"), g_strdup("user@jabber.org"), g_strdup("password"), 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); will_return(connection_get_status, JABBER_DISCONNECTED);
@ -429,7 +429,7 @@ cmd_connect_connects_with_account(void** state)
{ {
gchar* args[] = { "jabber_org", NULL }; gchar* args[] = { "jabber_org", NULL };
ProfAccount* account = account_new(g_strdup("jabber_org"), g_strdup("me@jabber.org"), g_strdup("password"), 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); will_return(connection_get_status, JABBER_DISCONNECTED);

View File

@ -71,7 +71,7 @@ cmd_join_uses_account_mucservice_when_no_service_specified(void** state)
char* expected_room = "room@conference.server.org"; char* expected_room = "room@conference.server.org";
gchar* args[] = { room, "nick", nick, NULL }; gchar* args[] = { room, "nick", nick, NULL };
ProfAccount* account = account_new(account_name, g_strdup("user@server.org"), NULL, 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(); muc_init();
@ -99,7 +99,7 @@ cmd_join_uses_supplied_nick(void** state)
char* nick = "bob"; char* nick = "bob";
gchar* args[] = { room, "nick", nick, NULL }; gchar* args[] = { room, "nick", nick, NULL };
ProfAccount* account = account_new(account_name, g_strdup("user@server.org"), NULL, 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(); muc_init();
@ -127,7 +127,7 @@ cmd_join_uses_account_nick_when_not_supplied(void** state)
char* account_nick = g_strdup("a_nick"); char* account_nick = g_strdup("a_nick");
gchar* args[] = { room, NULL }; gchar* args[] = { room, NULL };
ProfAccount* account = account_new(account_name, g_strdup("user@server.org"), NULL, 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(); muc_init();
@ -158,7 +158,7 @@ cmd_join_uses_password_when_supplied(void** state)
char* expected_room = "room@a_service"; char* expected_room = "room@a_service";
gchar* args[] = { room, "password", password, NULL }; gchar* args[] = { room, "password", password, NULL };
ProfAccount* account = account_new(account_name, g_strdup("user@server.org"), NULL, 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(); muc_init();

View File

@ -196,7 +196,7 @@ cmd_otr_gen_generates_key_for_connected_account(void** state)
gchar* args[] = { "gen", NULL }; gchar* args[] = { "gen", NULL };
char* account_name = g_strdup("myaccount"); char* account_name = g_strdup("myaccount");
ProfAccount* account = account_new(account_name, g_strdup("me@jabber.org"), NULL, NULL, 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(connection_get_status, JABBER_CONNECTED);
will_return(session_get_account_name, account_name); will_return(session_get_account_name, account_name);

View File

@ -51,7 +51,7 @@ cmd_rooms_uses_account_default_when_no_arg(void** state)
gchar* args[] = { NULL }; gchar* args[] = { NULL };
ProfAccount* account = account_new(g_strdup("testaccount"), NULL, NULL, NULL, TRUE, NULL, 0, NULL, NULL, 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(connection_get_status, JABBER_CONNECTED);
will_return(session_get_account_name, "account_name"); 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 }; gchar* args[] = { "filter", "text", NULL };
ProfAccount* account = account_new(g_strdup("testaccount"), NULL, NULL, NULL, TRUE, NULL, 0, NULL, NULL, 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(connection_get_status, JABBER_CONNECTED);
will_return(session_get_account_name, "account_name"); will_return(session_get_account_name, "account_name");