Merge branch 'master' into otr
Conflicts: src/command/commands.c
This commit is contained in:
@@ -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,
|
||||
|
||||
@@ -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)
|
||||
{
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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)
|
||||
{
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user