about summary refs log tree commit diff stats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/command/commands.c7
-rw-r--r--src/config/accounts.c10
-rw-r--r--src/config/accounts.h1
3 files changed, 12 insertions, 6 deletions
diff --git a/src/command/commands.c b/src/command/commands.c
index 6c354ec4..910c57d5 100644
--- a/src/command/commands.c
+++ b/src/command/commands.c
@@ -72,12 +72,7 @@ cmd_connect(gchar **args, struct cmd_help_t help)
 
         ProfAccount *account = accounts_get_account(lower);
         if (account != NULL) {
-            if (account->resource != NULL) {
-                jid = create_fulljid(account->jid, account->resource);
-            } else {
-                jid = strdup(account->jid);
-            }
-
+            jid = accounts_create_full_jid(account);
             if (account->password == NULL) {
                 account->password = ui_ask_password();
             }
diff --git a/src/config/accounts.c b/src/config/accounts.c
index 0422a991..6431cd9e 100644
--- a/src/config/accounts.c
+++ b/src/config/accounts.c
@@ -292,6 +292,16 @@ accounts_get_account(const char * const name)
     }
 }
 
+char *
+accounts_create_full_jid(ProfAccount *account)
+{
+    if (account->resource != NULL) {
+        return create_fulljid(account->jid, account->resource);
+    } else {
+        return strdup(account->jid);
+    }
+}
+
 void
 accounts_free_account(ProfAccount *account)
 {
diff --git a/src/config/accounts.h b/src/config/accounts.h
index 96289952..caa8e84c 100644
--- a/src/config/accounts.h
+++ b/src/config/accounts.h
@@ -81,5 +81,6 @@ void accounts_set_priority_all(const char * const account_name, const gint value
 gint accounts_get_priority_for_presence_type(const char * const account_name,
     resource_presence_t presence_type);
 void accounts_clear_password(const char * const account_name);
+char * accounts_create_full_jid(ProfAccount *account);
 
 #endif