minor changes
* fix typo * less code duplication * less `GString` usage * more `auto_gchar` usage * document connecting to servers supporting SASL ANONYMOUS * ignore valgrind output Signed-off-by: Steffen Jaeckel <jaeckel-floss@eyet-services.de>
This commit is contained in:
@@ -170,15 +170,18 @@ static struct cmd_t command_defs[] = {
|
||||
CMD_TAG_CONNECTION)
|
||||
CMD_SYN(
|
||||
"/connect [<account>]",
|
||||
"/connect <account> [server <server>] [port <port>] [tls force|allow|trust|legacy|disable] [auth default|legacy]")
|
||||
"/connect <account> [server <server>] [port <port>] [tls force|allow|trust|legacy|disable] [auth default|legacy]",
|
||||
"/connect <server>")
|
||||
CMD_DESC(
|
||||
"Login to a chat service. "
|
||||
"If no account is specified, the default is used if one is configured. "
|
||||
"A local account is created with the JID as it's name if it doesn't already exist.")
|
||||
"A local account is created with the JID as it's name if it doesn't already exist. "
|
||||
"In case you want to connect to a server via SASL ANONYMOUS (c.f. XEP-0175) you can also do that.")
|
||||
CMD_ARGS(
|
||||
{ "<account>", "The local account you wish to connect with, or a JID if connecting for the first time." },
|
||||
{ "server <server>", "Supply a server if it is different to the domain part of your JID." },
|
||||
{ "port <port>", "The port to use if different to the default (5222, or 5223 for SSL)." },
|
||||
{ "<server>", "Connect to said server in an anonymous way. (Be aware: There aren't many servers that support this.)" },
|
||||
{ "tls force", "Force TLS connection, and fail if one cannot be established, this is default behaviour." },
|
||||
{ "tls allow", "Use TLS for the connection if it is available." },
|
||||
{ "tls trust", "Force TLS connection and trust server's certificate." },
|
||||
@@ -192,7 +195,8 @@ static struct cmd_t command_defs[] = {
|
||||
"/connect odin@valhalla.edda server talk.google.com",
|
||||
"/connect freyr@vanaheimr.edda port 5678",
|
||||
"/connect me@localhost.test.org server 127.0.0.1 tls disable",
|
||||
"/connect me@chatty server chatty.com port 5443")
|
||||
"/connect me@chatty server chatty.com port 5443",
|
||||
"/connect server.supporting.sasl.anonymous.example")
|
||||
},
|
||||
|
||||
{ "/tls",
|
||||
@@ -2013,7 +2017,7 @@ static struct cmd_t command_defs[] = {
|
||||
{ "rotate on|off", "Rotate log, default on. Does not take effect if you specified a filename yourself when starting Profanity." },
|
||||
{ "maxsize <bytes>", "With rotate enabled, specifies the max log size, defaults to 10485760 (10MB)." },
|
||||
{ "shared on|off", "Share logs between all instances, default: on. When off, the process id will be included in the log filename. Does not take effect if you specified a filename yourself when starting Profanity." },
|
||||
{"level INFO|DEBUG|WARN|EFFOR", "Set the log level. Default is INFO. Only works with default log file, not with user provided log file during startup via -f." })
|
||||
{"level INFO|DEBUG|WARN|ERROR", "Set the log level. Default is INFO. Only works with default log file, not with user provided log file during startup via -f." })
|
||||
CMD_NOEXAMPLES
|
||||
},
|
||||
|
||||
|
||||
@@ -120,8 +120,8 @@
|
||||
|
||||
static void _update_presence(const resource_presence_t presence,
|
||||
const char* const show, gchar** args);
|
||||
static void _cmd_set_boolean_preference(gchar* arg, const char* const command,
|
||||
const char* const display, preference_t pref);
|
||||
static gboolean _cmd_set_boolean_preference(gchar* arg, const char* const command,
|
||||
const char* const display, preference_t pref);
|
||||
static void _who_room(ProfWin* window, const char* const command, gchar** args);
|
||||
static void _who_roster(ProfWin* window, const char* const command, gchar** args);
|
||||
static gboolean _cmd_execute(ProfWin* window, const char* const command, const char* const inp);
|
||||
@@ -6517,9 +6517,8 @@ cmd_log(ProfWin* window, const char* const command, gchar** args)
|
||||
}
|
||||
|
||||
if (strcmp(subcmd, "level") == 0) {
|
||||
if (g_strcmp0(value, "INFO") == 0 || g_strcmp0(value, "DEBUG") == 0 || g_strcmp0(value, "WARN") == 0 || g_strcmp0(value, "ERROR") == 0) {
|
||||
|
||||
log_level_t prof_log_level = log_level_from_string(value);
|
||||
log_level_t prof_log_level;
|
||||
if (log_level_from_string(value, &prof_log_level) == 0) {
|
||||
log_close();
|
||||
log_init(prof_log_level, NULL);
|
||||
|
||||
@@ -8580,31 +8579,24 @@ _update_presence(const resource_presence_t resource_presence,
|
||||
}
|
||||
|
||||
// helper function for boolean preference commands
|
||||
static void
|
||||
static gboolean
|
||||
_cmd_set_boolean_preference(gchar* arg, const char* const command,
|
||||
const char* const display, preference_t pref)
|
||||
{
|
||||
if (arg == NULL) {
|
||||
cons_bad_cmd_usage(command);
|
||||
} else if (strcmp(arg, "on") == 0) {
|
||||
GString* enabled = g_string_new(display);
|
||||
g_string_append(enabled, " enabled.");
|
||||
|
||||
cons_show(enabled->str);
|
||||
return FALSE;
|
||||
} else if (g_strcmp0(arg, "on") == 0) {
|
||||
cons_show("%s enabled.", display);
|
||||
prefs_set_boolean(pref, TRUE);
|
||||
|
||||
g_string_free(enabled, TRUE);
|
||||
} else if (strcmp(arg, "off") == 0) {
|
||||
GString* disabled = g_string_new(display);
|
||||
g_string_append(disabled, " disabled.");
|
||||
|
||||
cons_show(disabled->str);
|
||||
} else if (g_strcmp0(arg, "off") == 0) {
|
||||
cons_show("%s disabled.", display);
|
||||
prefs_set_boolean(pref, FALSE);
|
||||
|
||||
g_string_free(disabled, TRUE);
|
||||
} else {
|
||||
cons_bad_cmd_usage(command);
|
||||
return FALSE;
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
gboolean
|
||||
|
||||
Reference in New Issue
Block a user