mirror of
https://github.com/profanity-im/profanity.git
synced 2024-11-03 19:37:16 -05:00
Merge branch 'master' into plugins
Conflicts: src/profanity.c
This commit is contained in:
commit
305d2e5c85
@ -20,6 +20,7 @@
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <assert.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <limits.h>
|
#include <limits.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
@ -67,6 +68,7 @@ typedef struct cmd_t {
|
|||||||
|
|
||||||
typedef char*(*autocompleter)(char*, int*);
|
typedef char*(*autocompleter)(char*, int*);
|
||||||
|
|
||||||
|
static char * _ask_password(void);
|
||||||
static void _update_presence(const resource_presence_t presence,
|
static void _update_presence(const resource_presence_t presence,
|
||||||
const char * const show, gchar **args);
|
const char * const show, gchar **args);
|
||||||
static gboolean _cmd_set_boolean_preference(gchar *arg, struct cmd_help_t help,
|
static gboolean _cmd_set_boolean_preference(gchar *arg, struct cmd_help_t help,
|
||||||
@ -91,6 +93,7 @@ static int _strtoi(char *str, int *saveptr, int min, int max);
|
|||||||
static gboolean _cmd_about(gchar **args, struct cmd_help_t help);
|
static gboolean _cmd_about(gchar **args, struct cmd_help_t help);
|
||||||
static gboolean _cmd_account(gchar **args, struct cmd_help_t help);
|
static gboolean _cmd_account(gchar **args, struct cmd_help_t help);
|
||||||
static gboolean _cmd_autoaway(gchar **args, struct cmd_help_t help);
|
static gboolean _cmd_autoaway(gchar **args, struct cmd_help_t help);
|
||||||
|
static gboolean _cmd_autoconnect(gchar **args, struct cmd_help_t help);
|
||||||
static gboolean _cmd_autoping(gchar **args, struct cmd_help_t help);
|
static gboolean _cmd_autoping(gchar **args, struct cmd_help_t help);
|
||||||
static gboolean _cmd_away(gchar **args, struct cmd_help_t help);
|
static gboolean _cmd_away(gchar **args, struct cmd_help_t help);
|
||||||
static gboolean _cmd_beep(gchar **args, struct cmd_help_t help);
|
static gboolean _cmd_beep(gchar **args, struct cmd_help_t help);
|
||||||
@ -577,6 +580,16 @@ static struct cmd_t command_defs[] =
|
|||||||
"Switch on or off the ascii logo on start up and when the /about command is called.",
|
"Switch on or off the ascii logo on start up and when the /about command is called.",
|
||||||
NULL } } },
|
NULL } } },
|
||||||
|
|
||||||
|
{ "/autoconnect",
|
||||||
|
_cmd_autoconnect, parse_args, 0, 1, cons_autoconnect_setting,
|
||||||
|
{ "/autoconnect [account]", "Set account to autoconnect with.",
|
||||||
|
{ "/autoconnect [account]",
|
||||||
|
"----------------------",
|
||||||
|
"Set the account to autoconnect with.",
|
||||||
|
"Will be overridden by any command line options specified.",
|
||||||
|
"Passing no account will clear the setting.",
|
||||||
|
NULL } } },
|
||||||
|
|
||||||
{ "/vercheck",
|
{ "/vercheck",
|
||||||
_cmd_vercheck, parse_args, 0, 1, NULL,
|
_cmd_vercheck, parse_args, 0, 1, NULL,
|
||||||
{ "/vercheck [on|off]", "Check for a new release.",
|
{ "/vercheck [on|off]", "Check for a new release.",
|
||||||
@ -746,6 +759,7 @@ static struct cmd_t command_defs[] =
|
|||||||
"online|chat|away",
|
"online|chat|away",
|
||||||
"|xa|dnd : Priority for the specified presence.",
|
"|xa|dnd : Priority for the specified presence.",
|
||||||
"resource : The resource to be used.",
|
"resource : The resource to be used.",
|
||||||
|
"password : Password for the account, note this is currently stored in plaintext if set.",
|
||||||
"muc : The default MUC chat service to use.",
|
"muc : The default MUC chat service to use.",
|
||||||
"nick : The default nickname to use when joining chat rooms.",
|
"nick : The default nickname to use when joining chat rooms.",
|
||||||
"",
|
"",
|
||||||
@ -1339,6 +1353,13 @@ _cmd_complete_parameters(char *input, int *size)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
result = autocomplete_param_with_func(input, size, "/autoconnect", accounts_find_enabled);
|
||||||
|
if (result != NULL) {
|
||||||
|
inp_replace_input(input, result, size);
|
||||||
|
g_free(result);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
gchar *cmds[] = { "/help", "/prefs", "/log", "/disco", "/close", "/wins" };
|
gchar *cmds[] = { "/help", "/prefs", "/log", "/disco", "/close", "/wins" };
|
||||||
Autocomplete completers[] = { help_ac, prefs_ac, log_ac, disco_ac, close_ac, wins_ac };
|
Autocomplete completers[] = { help_ac, prefs_ac, log_ac, disco_ac, close_ac, wins_ac };
|
||||||
|
|
||||||
@ -1386,13 +1407,6 @@ _cmd_connect(gchar **args, struct cmd_help_t help)
|
|||||||
char *lower = g_utf8_strdown(user, -1);
|
char *lower = g_utf8_strdown(user, -1);
|
||||||
char *jid;
|
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);
|
ProfAccount *account = accounts_get_account(lower);
|
||||||
if (account != NULL) {
|
if (account != NULL) {
|
||||||
if (account->resource != NULL) {
|
if (account->resource != NULL) {
|
||||||
@ -1400,12 +1414,18 @@ _cmd_connect(gchar **args, struct cmd_help_t help)
|
|||||||
} else {
|
} else {
|
||||||
jid = strdup(account->jid);
|
jid = strdup(account->jid);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (account->password == NULL) {
|
||||||
|
account->password = _ask_password();
|
||||||
|
}
|
||||||
cons_show("Connecting with account %s as %s", account->name, jid);
|
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 {
|
} else {
|
||||||
|
char *passwd = _ask_password();
|
||||||
jid = strdup(lower);
|
jid = strdup(lower);
|
||||||
cons_show("Connecting as %s", jid);
|
cons_show("Connecting as %s", jid);
|
||||||
conn_status = jabber_connect_with_details(jid, passwd, altdomain);
|
conn_status = jabber_connect_with_details(jid, passwd, altdomain);
|
||||||
|
free(passwd);
|
||||||
}
|
}
|
||||||
g_free(lower);
|
g_free(lower);
|
||||||
|
|
||||||
@ -1538,6 +1558,10 @@ _cmd_account(gchar **args, struct cmd_help_t help)
|
|||||||
accounts_set_resource(account_name, value);
|
accounts_set_resource(account_name, value);
|
||||||
cons_show("Updated resource for account %s: %s", account_name, value);
|
cons_show("Updated resource for account %s: %s", account_name, value);
|
||||||
cons_show("");
|
cons_show("");
|
||||||
|
} else if (strcmp(property, "password") == 0) {
|
||||||
|
accounts_set_password(account_name, value);
|
||||||
|
cons_show("Updated password for account %s", account_name);
|
||||||
|
cons_show("");
|
||||||
} else if (strcmp(property, "muc") == 0) {
|
} else if (strcmp(property, "muc") == 0) {
|
||||||
accounts_set_muc_service(account_name, value);
|
accounts_set_muc_service(account_name, value);
|
||||||
cons_show("Updated muc service for account %s: %s", account_name, value);
|
cons_show("Updated muc service for account %s: %s", account_name, value);
|
||||||
@ -1847,7 +1871,7 @@ _cmd_help(gchar **args, struct cmd_help_t help)
|
|||||||
_cmd_show_filtered_help("Service discovery commands", filter, ARRAY_SIZE(filter));
|
_cmd_show_filtered_help("Service discovery commands", filter, ARRAY_SIZE(filter));
|
||||||
|
|
||||||
} else if (strcmp(args[0], "settings") == 0) {
|
} else if (strcmp(args[0], "settings") == 0) {
|
||||||
gchar *filter[] = { "/account", "/autoaway", "/autoping", "/beep",
|
gchar *filter[] = { "/account", "/autoaway", "/autoping", "/autoconnect", "/beep",
|
||||||
"/chlog", "/flash", "/gone", "/grlog", "/history", "/intype",
|
"/chlog", "/flash", "/gone", "/grlog", "/history", "/intype",
|
||||||
"/log", "/mouse", "/notify", "/outtype", "/prefs", "/priority",
|
"/log", "/mouse", "/notify", "/outtype", "/prefs", "/priority",
|
||||||
"/reconnect", "/roster", "/splash", "/states", "/statuses", "/theme",
|
"/reconnect", "/roster", "/splash", "/states", "/statuses", "/theme",
|
||||||
@ -3518,6 +3542,19 @@ _cmd_splash(gchar **args, struct cmd_help_t help)
|
|||||||
"Splash screen", PREF_SPLASH);
|
"Splash screen", PREF_SPLASH);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static gboolean
|
||||||
|
_cmd_autoconnect(gchar **args, struct cmd_help_t help)
|
||||||
|
{
|
||||||
|
if (args[0] == NULL) {
|
||||||
|
prefs_set_string(PREF_CONNECT_ACCOUNT, NULL);
|
||||||
|
cons_show("Autoconnect account disabled.");
|
||||||
|
} else {
|
||||||
|
prefs_set_string(PREF_CONNECT_ACCOUNT, args[0]);
|
||||||
|
cons_show("Autoconnect account set to: %s.", args[0]);
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
_cmd_chlog(gchar **args, struct cmd_help_t help)
|
_cmd_chlog(gchar **args, struct cmd_help_t help)
|
||||||
{
|
{
|
||||||
@ -3597,6 +3634,20 @@ _cmd_xa(gchar **args, struct cmd_help_t help)
|
|||||||
return TRUE;
|
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
|
// helper function for status change commands
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -39,10 +39,12 @@ static GKeyFile *accounts;
|
|||||||
static Autocomplete all_ac;
|
static Autocomplete all_ac;
|
||||||
static Autocomplete enabled_ac;
|
static Autocomplete enabled_ac;
|
||||||
|
|
||||||
|
// used to rename account (copies properties to new account)
|
||||||
static gchar *string_keys[] = {
|
static gchar *string_keys[] = {
|
||||||
"jid",
|
"jid",
|
||||||
"server",
|
"server",
|
||||||
"resource",
|
"resource",
|
||||||
|
"password",
|
||||||
"presence.last",
|
"presence.last",
|
||||||
"presence.login",
|
"presence.login",
|
||||||
"muc.service",
|
"muc.service",
|
||||||
@ -191,6 +193,14 @@ accounts_get_account(const char * const name)
|
|||||||
_save_accounts();
|
_save_accounts();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
gchar *password = g_key_file_get_string(accounts, name, "password", NULL);
|
||||||
|
if (password != NULL) {
|
||||||
|
account->password = strdup(password);
|
||||||
|
g_free(password);
|
||||||
|
} else {
|
||||||
|
account->password = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
account->enabled = g_key_file_get_boolean(accounts, name, "enabled", NULL);
|
account->enabled = g_key_file_get_boolean(accounts, name, "enabled", NULL);
|
||||||
|
|
||||||
gchar *server = g_key_file_get_string(accounts, name, "server", NULL);
|
gchar *server = g_key_file_get_string(accounts, name, "server", NULL);
|
||||||
@ -288,6 +298,7 @@ accounts_free_account(ProfAccount *account)
|
|||||||
if (account != NULL) {
|
if (account != NULL) {
|
||||||
free(account->name);
|
free(account->name);
|
||||||
free(account->jid);
|
free(account->jid);
|
||||||
|
free(account->password);
|
||||||
free(account->resource);
|
free(account->resource);
|
||||||
free(account->server);
|
free(account->server);
|
||||||
free(account->last_presence);
|
free(account->last_presence);
|
||||||
@ -339,16 +350,17 @@ accounts_rename(const char * const account_name, const char * const new_name)
|
|||||||
g_key_file_get_boolean(accounts, account_name, "enabled", NULL));
|
g_key_file_get_boolean(accounts, account_name, "enabled", NULL));
|
||||||
|
|
||||||
g_key_file_set_integer(accounts, new_name, "priority.online",
|
g_key_file_set_integer(accounts, new_name, "priority.online",
|
||||||
g_key_file_get_boolean(accounts, account_name, "priority.online", NULL));
|
g_key_file_get_integer(accounts, account_name, "priority.online", NULL));
|
||||||
g_key_file_set_integer(accounts, new_name, "priority.chat",
|
g_key_file_set_integer(accounts, new_name, "priority.chat",
|
||||||
g_key_file_get_boolean(accounts, account_name, "priority.chat", NULL));
|
g_key_file_get_integer(accounts, account_name, "priority.chat", NULL));
|
||||||
g_key_file_set_integer(accounts, new_name, "priority.away",
|
g_key_file_set_integer(accounts, new_name, "priority.away",
|
||||||
g_key_file_get_boolean(accounts, account_name, "priority.away", NULL));
|
g_key_file_get_integer(accounts, account_name, "priority.away", NULL));
|
||||||
g_key_file_set_integer(accounts, new_name, "priority.xa",
|
g_key_file_set_integer(accounts, new_name, "priority.xa",
|
||||||
g_key_file_get_boolean(accounts, account_name, "priority.xa", NULL));
|
g_key_file_get_integer(accounts, account_name, "priority.xa", NULL));
|
||||||
g_key_file_set_integer(accounts, new_name, "priority.dnd",
|
g_key_file_set_integer(accounts, new_name, "priority.dnd",
|
||||||
g_key_file_get_boolean(accounts, account_name, "priority.dnd", NULL));
|
g_key_file_get_integer(accounts, account_name, "priority.dnd", NULL));
|
||||||
|
|
||||||
|
// copy other string properties
|
||||||
int i;
|
int i;
|
||||||
for (i = 0; i < ARRAY_SIZE(string_keys); i++) {
|
for (i = 0; i < ARRAY_SIZE(string_keys); i++) {
|
||||||
char *value = g_key_file_get_string(accounts, account_name, string_keys[i], NULL);
|
char *value = g_key_file_get_string(accounts, account_name, string_keys[i], NULL);
|
||||||
@ -422,6 +434,15 @@ accounts_set_resource(const char * const account_name, const char * const value)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
accounts_set_password(const char * const account_name, const char * const value)
|
||||||
|
{
|
||||||
|
if (accounts_account_exists(account_name)) {
|
||||||
|
g_key_file_set_string(accounts, account_name, "password", value);
|
||||||
|
_save_accounts();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
accounts_set_muc_service(const char * const account_name, const char * const value)
|
accounts_set_muc_service(const char * const account_name, const char * const value)
|
||||||
{
|
{
|
||||||
|
@ -23,11 +23,14 @@
|
|||||||
#ifndef ACCOUNTS_H
|
#ifndef ACCOUNTS_H
|
||||||
#define ACCOUNTS_H
|
#define ACCOUNTS_H
|
||||||
|
|
||||||
|
#define MAX_PASSWORD_SIZE 64
|
||||||
|
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
|
|
||||||
typedef struct prof_account_t {
|
typedef struct prof_account_t {
|
||||||
gchar *name;
|
gchar *name;
|
||||||
gchar *jid;
|
gchar *jid;
|
||||||
|
gchar *password;
|
||||||
gchar *resource;
|
gchar *resource;
|
||||||
gchar *server;
|
gchar *server;
|
||||||
gchar *last_presence;
|
gchar *last_presence;
|
||||||
@ -62,6 +65,7 @@ gboolean accounts_account_exists(const char * const account_name);
|
|||||||
void accounts_set_jid(const char * const account_name, const char * const value);
|
void accounts_set_jid(const char * const account_name, const char * const value);
|
||||||
void accounts_set_server(const char * const account_name, const char * const value);
|
void accounts_set_server(const char * const account_name, const char * const value);
|
||||||
void accounts_set_resource(const char * const account_name, const char * const value);
|
void accounts_set_resource(const char * const account_name, const char * const value);
|
||||||
|
void accounts_set_password(const char * const account_name, const char * const value);
|
||||||
void accounts_set_muc_service(const char * const account_name, const char * const value);
|
void accounts_set_muc_service(const char * const account_name, const char * const value);
|
||||||
void accounts_set_muc_nick(const char * const account_name, const char * const value);
|
void accounts_set_muc_nick(const char * const account_name, const char * const value);
|
||||||
void accounts_set_last_presence(const char * const account_name, const char * const value);
|
void accounts_set_last_presence(const char * const account_name, const char * const value);
|
||||||
|
@ -322,6 +322,8 @@ _get_group(preference_t pref)
|
|||||||
case PREF_AUTOAWAY_MODE:
|
case PREF_AUTOAWAY_MODE:
|
||||||
case PREF_AUTOAWAY_MESSAGE:
|
case PREF_AUTOAWAY_MESSAGE:
|
||||||
return "presence";
|
return "presence";
|
||||||
|
case PREF_CONNECT_ACCOUNT:
|
||||||
|
return "connection";
|
||||||
default:
|
default:
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
@ -374,6 +376,8 @@ _get_key(preference_t pref)
|
|||||||
return "autoaway.mode";
|
return "autoaway.mode";
|
||||||
case PREF_AUTOAWAY_MESSAGE:
|
case PREF_AUTOAWAY_MESSAGE:
|
||||||
return "autoaway.message";
|
return "autoaway.message";
|
||||||
|
case PREF_CONNECT_ACCOUNT:
|
||||||
|
return "account";
|
||||||
default:
|
default:
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
@ -56,7 +56,8 @@ typedef enum {
|
|||||||
PREF_GRLOG,
|
PREF_GRLOG,
|
||||||
PREF_AUTOAWAY_CHECK,
|
PREF_AUTOAWAY_CHECK,
|
||||||
PREF_AUTOAWAY_MODE,
|
PREF_AUTOAWAY_MODE,
|
||||||
PREF_AUTOAWAY_MESSAGE
|
PREF_AUTOAWAY_MESSAGE,
|
||||||
|
PREF_CONNECT_ACCOUNT
|
||||||
} preference_t;
|
} preference_t;
|
||||||
|
|
||||||
void prefs_load(void);
|
void prefs_load(void);
|
||||||
|
@ -32,6 +32,7 @@
|
|||||||
static gboolean disable_tls = FALSE;
|
static gboolean disable_tls = FALSE;
|
||||||
static gboolean version = FALSE;
|
static gboolean version = FALSE;
|
||||||
static char *log = "INFO";
|
static char *log = "INFO";
|
||||||
|
static char *account_name = NULL;
|
||||||
|
|
||||||
int
|
int
|
||||||
main(int argc, char **argv)
|
main(int argc, char **argv)
|
||||||
@ -40,6 +41,7 @@ main(int argc, char **argv)
|
|||||||
{
|
{
|
||||||
{ "version", 'v', 0, G_OPTION_ARG_NONE, &version, "Show version information", NULL },
|
{ "version", 'v', 0, G_OPTION_ARG_NONE, &version, "Show version information", NULL },
|
||||||
{ "disable-tls", 'd', 0, G_OPTION_ARG_NONE, &disable_tls, "Disable TLS", NULL },
|
{ "disable-tls", 'd', 0, G_OPTION_ARG_NONE, &disable_tls, "Disable TLS", NULL },
|
||||||
|
{ "account", 'a', 0, G_OPTION_ARG_STRING, &account_name, "Auto connect to an account on start-up" },
|
||||||
{ "log",'l', 0, G_OPTION_ARG_STRING, &log, "Set logging levels, DEBUG, INFO (default), WARN, ERROR", "LEVEL" },
|
{ "log",'l', 0, G_OPTION_ARG_STRING, &log, "Set logging levels, DEBUG, INFO (default), WARN, ERROR", "LEVEL" },
|
||||||
{ NULL }
|
{ NULL }
|
||||||
};
|
};
|
||||||
@ -76,7 +78,7 @@ main(int argc, char **argv)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
prof_run(disable_tls, log);
|
prof_run(disable_tls, log, account_name);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -58,7 +58,7 @@ static void _create_directories(void);
|
|||||||
static gboolean idle = FALSE;
|
static gboolean idle = FALSE;
|
||||||
|
|
||||||
void
|
void
|
||||||
prof_run(const int disable_tls, char *log_level)
|
prof_run(const int disable_tls, char *log_level, char *account_name)
|
||||||
{
|
{
|
||||||
_init(disable_tls, log_level);
|
_init(disable_tls, log_level);
|
||||||
log_info("Starting main event loop");
|
log_info("Starting main event loop");
|
||||||
@ -73,6 +73,16 @@ prof_run(const int disable_tls, char *log_level)
|
|||||||
ui_refresh();
|
ui_refresh();
|
||||||
plugins_on_start();
|
plugins_on_start();
|
||||||
|
|
||||||
|
if (account_name != NULL) {
|
||||||
|
char *cmd = "/connect";
|
||||||
|
snprintf(inp, sizeof(inp), "%s %s", cmd, account_name);
|
||||||
|
_process_input(inp);
|
||||||
|
} else if (prefs_get_string(PREF_CONNECT_ACCOUNT) != NULL) {
|
||||||
|
char *cmd = "/connect";
|
||||||
|
snprintf(inp, sizeof(inp), "%s %s", cmd, prefs_get_string(PREF_CONNECT_ACCOUNT));
|
||||||
|
_process_input(inp);
|
||||||
|
}
|
||||||
|
|
||||||
while(cmd_result == TRUE) {
|
while(cmd_result == TRUE) {
|
||||||
wint_t ch = ERR;
|
wint_t ch = ERR;
|
||||||
size = 0;
|
size = 0;
|
||||||
|
@ -26,7 +26,7 @@
|
|||||||
#include "resource.h"
|
#include "resource.h"
|
||||||
#include "xmpp/xmpp.h"
|
#include "xmpp/xmpp.h"
|
||||||
|
|
||||||
void prof_run(const int disable_tls, char *log_level);
|
void prof_run(const int disable_tls, char *log_level, char *account_name);
|
||||||
|
|
||||||
void prof_handle_login_success(const char *jid, const char *altdomain);
|
void prof_handle_login_success(const char *jid, const char *altdomain);
|
||||||
void prof_handle_login_account_success(char *account_name);
|
void prof_handle_login_account_success(char *account_name);
|
||||||
|
@ -793,6 +793,9 @@ cons_show_account(ProfAccount *account)
|
|||||||
cons_show ("enabled : FALSE");
|
cons_show ("enabled : FALSE");
|
||||||
}
|
}
|
||||||
cons_show ("jid : %s", account->jid);
|
cons_show ("jid : %s", account->jid);
|
||||||
|
if (account->password != NULL) {
|
||||||
|
cons_show ("password : [redacted]");
|
||||||
|
}
|
||||||
if (account->resource != NULL) {
|
if (account->resource != NULL) {
|
||||||
cons_show ("resource : %s", account->resource);
|
cons_show ("resource : %s", account->resource);
|
||||||
}
|
}
|
||||||
@ -939,6 +942,15 @@ cons_splash_setting(void)
|
|||||||
cons_show("Splash screen (/splash) : OFF");
|
cons_show("Splash screen (/splash) : OFF");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
cons_autoconnect_setting(void)
|
||||||
|
{
|
||||||
|
if (prefs_get_string(PREF_CONNECT_ACCOUNT) != NULL)
|
||||||
|
cons_show("Autoconnect (/autoconnect) : %s", prefs_get_string(PREF_CONNECT_ACCOUNT));
|
||||||
|
else
|
||||||
|
cons_show("Autoconnect (/autoconnect) : OFF");
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
cons_vercheck_setting(void)
|
cons_vercheck_setting(void)
|
||||||
{
|
{
|
||||||
@ -1215,6 +1227,7 @@ cons_show_connection_prefs(void)
|
|||||||
cons_show("");
|
cons_show("");
|
||||||
cons_reconnect_setting();
|
cons_reconnect_setting();
|
||||||
cons_autoping_setting();
|
cons_autoping_setting();
|
||||||
|
cons_autoconnect_setting();
|
||||||
|
|
||||||
wins_refresh_console();
|
wins_refresh_console();
|
||||||
cons_alert();
|
cons_alert();
|
||||||
|
@ -35,6 +35,7 @@
|
|||||||
|
|
||||||
#include "command/command.h"
|
#include "command/command.h"
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
|
#include "config/accounts.h"
|
||||||
#include "config/preferences.h"
|
#include "config/preferences.h"
|
||||||
#include "config/theme.h"
|
#include "config/theme.h"
|
||||||
#include "log.h"
|
#include "log.h"
|
||||||
@ -207,7 +208,7 @@ inp_get_password(char *passwd)
|
|||||||
_clear_input();
|
_clear_input();
|
||||||
_inp_win_refresh();
|
_inp_win_refresh();
|
||||||
noecho();
|
noecho();
|
||||||
mvwgetnstr(inp_win, 0, 1, passwd, 20);
|
mvwgetnstr(inp_win, 0, 1, passwd, MAX_PASSWORD_SIZE);
|
||||||
wmove(inp_win, 0, 0);
|
wmove(inp_win, 0, 0);
|
||||||
echo();
|
echo();
|
||||||
status_bar_clear();
|
status_bar_clear();
|
||||||
|
@ -216,6 +216,7 @@ void cons_autoaway_setting(void);
|
|||||||
void cons_reconnect_setting(void);
|
void cons_reconnect_setting(void);
|
||||||
void cons_autoping_setting(void);
|
void cons_autoping_setting(void);
|
||||||
void cons_priority_setting(void);
|
void cons_priority_setting(void);
|
||||||
|
void cons_autoconnect_setting(void);
|
||||||
|
|
||||||
// status bar actions
|
// status bar actions
|
||||||
void status_bar_refresh(void);
|
void status_bar_refresh(void);
|
||||||
|
@ -110,21 +110,20 @@ jabber_init(const int disable_tls)
|
|||||||
}
|
}
|
||||||
|
|
||||||
jabber_conn_status_t
|
jabber_conn_status_t
|
||||||
jabber_connect_with_account(const ProfAccount * const account,
|
jabber_connect_with_account(const ProfAccount * const account)
|
||||||
const char * const passwd)
|
|
||||||
{
|
{
|
||||||
assert(account != NULL);
|
assert(account != NULL);
|
||||||
assert(passwd != NULL);
|
|
||||||
|
|
||||||
log_info("Connecting using account: %s", account->name);
|
log_info("Connecting using account: %s", account->name);
|
||||||
|
|
||||||
// save account name and password for reconnect
|
// save account name and password for reconnect
|
||||||
saved_account.name = strdup(account->name);
|
saved_account.name = strdup(account->name);
|
||||||
saved_account.passwd = strdup(passwd);
|
saved_account.passwd = strdup(account->password);
|
||||||
|
|
||||||
// connect with fulljid
|
// connect with fulljid
|
||||||
Jid *jidp = jid_create_from_bare_and_resource(account->jid, account->resource);
|
Jid *jidp = jid_create_from_bare_and_resource(account->jid, account->resource);
|
||||||
jabber_conn_status_t result = _jabber_connect(jidp->fulljid, passwd, account->server);
|
jabber_conn_status_t result =
|
||||||
|
_jabber_connect(jidp->fulljid, account->password, account->server);
|
||||||
jid_destroy(jidp);
|
jid_destroy(jidp);
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
|
@ -78,8 +78,7 @@ typedef struct disco_identity_t {
|
|||||||
void jabber_init(const int disable_tls);
|
void jabber_init(const int disable_tls);
|
||||||
jabber_conn_status_t jabber_connect_with_details(const char * const jid,
|
jabber_conn_status_t jabber_connect_with_details(const char * const jid,
|
||||||
const char * const passwd, const char * const altdomain);
|
const char * const passwd, const char * const altdomain);
|
||||||
jabber_conn_status_t jabber_connect_with_account(const ProfAccount * const account,
|
jabber_conn_status_t jabber_connect_with_account(const ProfAccount * const account);
|
||||||
const char * const passwd);
|
|
||||||
void jabber_disconnect(void);
|
void jabber_disconnect(void);
|
||||||
void jabber_shutdown(void);
|
void jabber_shutdown(void);
|
||||||
void jabber_process_events(void);
|
void jabber_process_events(void);
|
||||||
|
Loading…
Reference in New Issue
Block a user