about summary refs log tree commit diff stats
path: root/src
diff options
context:
space:
mode:
authorJames Booth <boothj5@gmail.com>2013-12-15 19:38:23 +0000
committerJames Booth <boothj5@gmail.com>2013-12-15 19:38:23 +0000
commit079ea5304b7bc99b07d2f05b2910ab370023c14d (patch)
tree284d37758af9592017e38effadeb986583ea5205 /src
parenteff2ef3859e66542b5ce16efd800c3ece63caf71 (diff)
downloadprofani-tty-079ea5304b7bc99b07d2f05b2910ab370023c14d.tar.gz
Moved _ask_password to UI module
Diffstat (limited to 'src')
-rw-r--r--src/command/commands.c18
-rw-r--r--src/ui/core.c13
-rw-r--r--src/ui/ui.h1
3 files changed, 16 insertions, 16 deletions
diff --git a/src/command/commands.c b/src/command/commands.c
index 4b0c5a5c..6c354ec4 100644
--- a/src/command/commands.c
+++ b/src/command/commands.c
@@ -44,7 +44,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,
@@ -80,12 +79,12 @@ cmd_connect(gchar **args, struct cmd_help_t help)
             }
 
             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);
         } 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);
@@ -2243,19 +2242,6 @@ cmd_xa(gchar **args, struct cmd_help_t help)
     return TRUE;
 }
 
-// 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,
diff --git a/src/ui/core.c b/src/ui/core.c
index 507cfb02..1ff41b7d 100644
--- a/src/ui/core.c
+++ b/src/ui/core.c
@@ -1330,6 +1330,19 @@ ui_win_unread(int index)
     }
 }
 
+char *
+ui_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;
+}
+
 static void
 _ui_draw_win_title(void)
 {
diff --git a/src/ui/ui.h b/src/ui/ui.h
index 5ec4debd..f6bb98ac 100644
--- a/src/ui/ui.h
+++ b/src/ui/ui.h
@@ -80,6 +80,7 @@ char * ui_recipient(int index);
 void ui_close_win(int index);
 gboolean ui_win_exists(int index);
 int ui_win_unread(int index);
+char * ui_ask_password(void);
 
 // ui events
 void ui_contact_typing(const char * const from);