diff options
-rw-r--r-- | src/command/cmd_funcs.c | 8 | ||||
-rw-r--r-- | src/config/account.c | 17 | ||||
-rw-r--r-- | src/config/account.h | 3 |
3 files changed, 28 insertions, 0 deletions
diff --git a/src/command/cmd_funcs.c b/src/command/cmd_funcs.c index 7f1a791b..6ec02b1c 100644 --- a/src/command/cmd_funcs.c +++ b/src/command/cmd_funcs.c @@ -393,6 +393,14 @@ cmd_connect(ProfWin *window, const char *const command, gchar **args) // connect with account ProfAccount *account = accounts_get_account(lower); if (account) { + // override account options with connect options + if (altdomain != NULL) + account_set_server(account, altdomain); + if (port != 0) + account_set_port(account, port); + if (tls_policy != NULL) + account_set_tls_policy(account, tls_policy); + // use password if set if (account->password) { conn_status = cl_ev_connect_account(account); diff --git a/src/config/account.c b/src/config/account.c index 705a5edf..1d42ba39 100644 --- a/src/config/account.c +++ b/src/config/account.c @@ -241,3 +241,20 @@ account_free(ProfAccount *account) g_list_free_full(account->otr_always, g_free); free(account); } + +void account_set_server(ProfAccount *account, const char *server) +{ + free(account->server); + account->server = strdup(server); +} + +void account_set_port(ProfAccount *account, int port) +{ + account->port = port; +} + +void account_set_tls_policy(ProfAccount *account, const char *tls_policy) +{ + free(account->tls_policy); + account->tls_policy = strdup(tls_policy); +} diff --git a/src/config/account.h b/src/config/account.h index 1262e518..d0bb28fa 100644 --- a/src/config/account.h +++ b/src/config/account.h @@ -77,5 +77,8 @@ ProfAccount* account_new(const gchar *const name, const gchar *const jid, char* account_create_connect_jid(ProfAccount *account); gboolean account_eval_password(ProfAccount *account); void account_free(ProfAccount *account); +void account_set_server(ProfAccount *account, const char *server); +void account_set_port(ProfAccount *account, int port); +void account_set_tls_policy(ProfAccount *account, const char *tls_policy); #endif |