about summary refs log tree commit diff stats
path: root/src/command
diff options
context:
space:
mode:
authorJames Booth <boothj5@gmail.com>2013-12-16 01:11:36 +0000
committerJames Booth <boothj5@gmail.com>2013-12-16 01:11:36 +0000
commit95d08db2925dbaabf5ff88323554ba1afd1fc1cf (patch)
treede13ecab5eaeec7f582df003981e1fe2b94b89ab /src/command
parent2470f642c73a7b13181bf51a6f3c2ee126e9e733 (diff)
parent52f6ad6fe19149a351fba673aa378508cd7c0558 (diff)
downloadprofani-tty-95d08db2925dbaabf5ff88323554ba1afd1fc1cf.tar.gz
Merge branch 'master' into otr
Conflicts:
	src/command/commands.c
Diffstat (limited to 'src/command')
-rw-r--r--src/command/commands.c28
1 files changed, 4 insertions, 24 deletions
diff --git a/src/command/commands.c b/src/command/commands.c
index 5babefe8..147ccf42 100644
--- a/src/command/commands.c
+++ b/src/command/commands.c
@@ -45,7 +45,6 @@
 #include "xmpp/xmpp.h"
 #include "xmpp/bookmark.h"
 
-static char * _ask_password(void);
 static void _update_presence(const resource_presence_t presence,
     const char * const show, gchar **args);
 static gboolean _cmd_set_boolean_preference(gchar *arg, struct cmd_help_t help,
@@ -74,19 +73,15 @@ 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 = _ask_password();
+                account->password = ui_ask_password();
             }
             cons_show("Connecting with account %s as %s", account->name, jid);
             conn_status = jabber_connect_with_account(account);
+            accounts_free_account(account);
         } else {
-            char *passwd = _ask_password();
+            char *passwd = ui_ask_password();
             jid = strdup(lower);
             cons_show("Connecting as %s", jid);
             conn_status = jabber_connect_with_details(jid, passwd, altdomain);
@@ -99,7 +94,6 @@ cmd_connect(gchar **args, struct cmd_help_t help)
             log_debug("Connection attempt for %s failed", jid);
         }
 
-        accounts_free_account(account);
         free(jid);
 
         result = TRUE;
@@ -2267,20 +2261,6 @@ cmd_otr(gchar **args, struct cmd_help_t help)
 #endif
 }
 
-
-// helper function that asks the user for a password and saves it in passwd
-static char *
-_ask_password(void) {
-  char *passwd = malloc(sizeof(char) * (MAX_PASSWORD_SIZE + 1));
-  status_bar_get_password();
-  status_bar_refresh();
-  inp_block();
-  inp_get_password(passwd);
-  inp_non_block();
-
-  return passwd;
-}
-
 // helper function for status change commands
 static void
 _update_presence(const resource_presence_t resource_presence,