mirror of
https://git.jabber.space/devs/cproof.git
synced 2026-07-20 17:06:21 +00:00
Merge remote-tracking branch 'tsenart/passwords-on-accounts-file'
This commit is contained in:
@@ -20,6 +20,7 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include <assert.h>
|
||||
#include <errno.h>
|
||||
#include <limits.h>
|
||||
#include <stdlib.h>
|
||||
@@ -68,6 +69,7 @@ typedef struct cmd_t {
|
||||
|
||||
typedef char*(*autocompleter)(char*, int*);
|
||||
|
||||
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,
|
||||
@@ -1347,13 +1349,6 @@ _cmd_connect(gchar **args, struct cmd_help_t help)
|
||||
char *lower = g_utf8_strdown(user, -1);
|
||||
char *jid;
|
||||
|
||||
status_bar_get_password();
|
||||
status_bar_refresh();
|
||||
char passwd[21];
|
||||
inp_block();
|
||||
inp_get_password(passwd);
|
||||
inp_non_block();
|
||||
|
||||
ProfAccount *account = accounts_get_account(lower);
|
||||
if (account != NULL) {
|
||||
if (account->resource != NULL) {
|
||||
@@ -1361,12 +1356,18 @@ _cmd_connect(gchar **args, struct cmd_help_t help)
|
||||
} else {
|
||||
jid = strdup(account->jid);
|
||||
}
|
||||
|
||||
if (account->password == NULL) {
|
||||
account->password = _ask_password();
|
||||
}
|
||||
cons_show("Connecting with account %s as %s", account->name, jid);
|
||||
conn_status = jabber_connect_with_account(account, passwd);
|
||||
conn_status = jabber_connect_with_account(account);
|
||||
} else {
|
||||
char *passwd = _ask_password();
|
||||
jid = strdup(lower);
|
||||
cons_show("Connecting as %s", jid);
|
||||
conn_status = jabber_connect_with_details(jid, passwd, altdomain);
|
||||
free(passwd);
|
||||
}
|
||||
g_free(lower);
|
||||
|
||||
@@ -3525,6 +3526,20 @@ _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) * 21);
|
||||
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
|
||||
|
||||
Reference in New Issue
Block a user