aboutsummaryrefslogtreecommitdiffstats
path: root/src/command
diff options
context:
space:
mode:
authorMichael Vetter <jubalh@iodoru.org>2020-07-07 13:53:30 +0200
committerMichael Vetter <jubalh@iodoru.org>2020-07-07 13:53:30 +0200
commita4cadf78faabc157e5db00e42302d495bba432c0 (patch)
tree6ff212e24fe750b04b37ca66c418fe366c5e5fd4 /src/command
parent28fde3cd0129202d586cb4c24877a3e3f55ca582 (diff)
downloadprofani-tty-a4cadf78faabc157e5db00e42302d495bba432c0.tar.gz
Revert "Apply coding style"
This reverts commit 9b55f2dec0ea27a9ce4856e303425e12f866cea2. Sorting the includes creates some problems.
Diffstat (limited to 'src/command')
-rw-r--r--src/command/cmd_ac.c946
-rw-r--r--src/command/cmd_ac.h30
-rw-r--r--src/command/cmd_defs.c4569
-rw-r--r--src/command/cmd_defs.h10
-rw-r--r--src/command/cmd_funcs.c2306
-rw-r--r--src/command/cmd_funcs.h355
6 files changed, 4180 insertions, 4036 deletions
diff --git a/src/command/cmd_ac.c b/src/command/cmd_ac.c
index 8655e3c9..0d9d4cc5 100644
--- a/src/command/cmd_ac.c
+++ b/src/command/cmd_ac.c
@@ -36,25 +36,25 @@
#define _GNU_SOURCE 1
-#include <assert.h>
-#include <dirent.h>
-#include <libgen.h>
#include <stdlib.h>
#include <string.h>
+#include <assert.h>
+#include <libgen.h>
+#include <dirent.h>
-#include "command/cmd_ac.h"
-#include "command/cmd_funcs.h"
#include "common.h"
#include "config/preferences.h"
#include "config/scripts.h"
-#include "plugins/plugins.h"
+#include "command/cmd_ac.h"
+#include "command/cmd_funcs.h"
#include "tools/parser.h"
-#include "ui/buffer.h"
+#include "plugins/plugins.h"
#include "ui/win_types.h"
#include "ui/window_list.h"
#include "xmpp/muc.h"
-#include "xmpp/roster_list.h"
#include "xmpp/xmpp.h"
+#include "xmpp/roster_list.h"
+#include "ui/buffer.h"
#ifdef HAVE_LIBGPGME
#include "pgp/gpg.h"
@@ -64,72 +64,72 @@
#include "omemo/omemo.h"
#endif
-static char* _sub_autocomplete(ProfWin* window, const char* const input, gboolean previous);
-static char* _notify_autocomplete(ProfWin* window, const char* const input, gboolean previous);
-static char* _theme_autocomplete(ProfWin* window, const char* const input, gboolean previous);
-static char* _autoaway_autocomplete(ProfWin* window, const char* const input, gboolean previous);
-static char* _autoconnect_autocomplete(ProfWin* window, const char* const input, gboolean previous);
-static char* _account_autocomplete(ProfWin* window, const char* const input, gboolean previous);
-static char* _who_autocomplete(ProfWin* window, const char* const input, gboolean previous);
-static char* _roster_autocomplete(ProfWin* window, const char* const input, gboolean previous);
-static char* _bookmark_autocomplete(ProfWin* window, const char* const input, gboolean previous);
+static char* _sub_autocomplete(ProfWin *window, const char *const input, gboolean previous);
+static char* _notify_autocomplete(ProfWin *window, const char *const input, gboolean previous);
+static char* _theme_autocomplete(ProfWin *window, const char *const input, gboolean previous);
+static char* _autoaway_autocomplete(ProfWin *window, const char *const input, gboolean previous);
+static char* _autoconnect_autocomplete(ProfWin *window, const char *const input, gboolean previous);
+static char* _account_autocomplete(ProfWin *window, const char *const input, gboolean previous);
+static char* _who_autocomplete(ProfWin *window, const char *const input, gboolean previous);
+static char* _roster_autocomplete(ProfWin *window, const char *const input, gboolean previous);
+static char* _bookmark_autocomplete(ProfWin *window, const char *const input, gboolean previous);
#ifdef HAVE_LIBOTR
-static char* _otr_autocomplete(ProfWin* window, const char* const input, gboolean previous);
+static char* _otr_autocomplete(ProfWin *window, const char *const input, gboolean previous);
#endif
#ifdef HAVE_LIBGPGME
-static char* _pgp_autocomplete(ProfWin* window, const char* const input, gboolean previous);
-static char* _ox_autocomplete(ProfWin* window, const char* const input, gboolean previous);
+static char* _pgp_autocomplete(ProfWin *window, const char *const input, gboolean previous);
+static char* _ox_autocomplete(ProfWin *window, const char *const input, gboolean previous);
#endif
#ifdef HAVE_OMEMO
-static char* _omemo_autocomplete(ProfWin* window, const char* const input, gboolean previous);
+static char* _omemo_autocomplete(ProfWin *window, const char *const input, gboolean previous);
#endif
-static char* _connect_autocomplete(ProfWin* window, const char* const input, gboolean previous);
-static char* _alias_autocomplete(ProfWin* window, const char* const input, gboolean previous);
-static char* _join_autocomplete(ProfWin* window, const char* const input, gboolean previous);
-static char* _log_autocomplete(ProfWin* window, const char* const input, gboolean previous);
-static char* _form_autocomplete(ProfWin* window, const char* const input, gboolean previous);
-static char* _form_field_autocomplete(ProfWin* window, const char* const input, gboolean previous);
-static char* _occupants_autocomplete(ProfWin* window, const char* const input, gboolean previous);
-static char* _kick_autocomplete(ProfWin* window, const char* const input, gboolean previous);
-static char* _ban_autocomplete(ProfWin* window, const char* const input, gboolean previous);
-static char* _affiliation_autocomplete(ProfWin* window, const char* const input, gboolean previous);
-static char* _role_autocomplete(ProfWin* window, const char* const input, gboolean previous);
-static char* _resource_autocomplete(ProfWin* window, const char* const input, gboolean previous);
-static char* _wintitle_autocomplete(ProfWin* window, const char* const input, gboolean previous);
-static char* _inpblock_autocomplete(ProfWin* window, const char* const input, gboolean previous);
-static char* _time_autocomplete(ProfWin* window, const char* const input, gboolean previous);
-static char* _receipts_autocomplete(ProfWin* window, const char* const input, gboolean previous);
-static char* _help_autocomplete(ProfWin* window, const char* const input, gboolean previous);
-static char* _wins_autocomplete(ProfWin* window, const char* const input, gboolean previous);
-static char* _tls_autocomplete(ProfWin* window, const char* const input, gboolean previous);
-static char* _titlebar_autocomplete(ProfWin* window, const char* const input, gboolean previous);
-static char* _script_autocomplete(ProfWin* window, const char* const input, gboolean previous);
-static char* _subject_autocomplete(ProfWin* window, const char* const input, gboolean previous);
-static char* _console_autocomplete(ProfWin* window, const char* const input, gboolean previous);
-static char* _win_autocomplete(ProfWin* window, const char* const input, gboolean previous);
-static char* _close_autocomplete(ProfWin* window, const char* const input, gboolean previous);
-static char* _plugins_autocomplete(ProfWin* window, const char* const input, gboolean previous);
-static char* _sendfile_autocomplete(ProfWin* window, const char* const input, gboolean previous);
-static char* _blocked_autocomplete(ProfWin* window, const char* const input, gboolean previous);
-static char* _tray_autocomplete(ProfWin* window, const char* const input, gboolean previous);
-static char* _presence_autocomplete(ProfWin* window, const char* const input, gboolean previous);
-static char* _rooms_autocomplete(ProfWin* window, const char* const input, gboolean previous);
-static char* _statusbar_autocomplete(ProfWin* window, const char* const input, gboolean previous);
-static char* _clear_autocomplete(ProfWin* window, const char* const input, gboolean previous);
-static char* _invite_autocomplete(ProfWin* window, const char* const input, gboolean previous);
-static char* _status_autocomplete(ProfWin* window, const char* const input, gboolean previous);
-static char* _logging_autocomplete(ProfWin* window, const char* const input, gboolean previous);
-static char* _color_autocomplete(ProfWin* window, const char* const input, gboolean previous);
-static char* _avatar_autocomplete(ProfWin* window, const char* const input, gboolean previous);
-static char* _correction_autocomplete(ProfWin* window, const char* const input, gboolean previous);
-static char* _correct_autocomplete(ProfWin* window, const char* const input, gboolean previous);
-static char* _software_autocomplete(ProfWin* window, const char* const input, gboolean previous);
-static char* _url_autocomplete(ProfWin* window, const char* const input, gboolean previous);
-static char* _executable_autocomplete(ProfWin* window, const char* const input, gboolean previous);
-
-static char* _script_autocomplete_func(const char* const prefix, gboolean previous, void* context);
-
-static char* _cmd_ac_complete_params(ProfWin* window, const char* const input, gboolean previous);
+static char* _connect_autocomplete(ProfWin *window, const char *const input, gboolean previous);
+static char* _alias_autocomplete(ProfWin *window, const char *const input, gboolean previous);
+static char* _join_autocomplete(ProfWin *window, const char *const input, gboolean previous);
+static char* _log_autocomplete(ProfWin *window, const char *const input, gboolean previous);
+static char* _form_autocomplete(ProfWin *window, const char *const input, gboolean previous);
+static char* _form_field_autocomplete(ProfWin *window, const char *const input, gboolean previous);
+static char* _occupants_autocomplete(ProfWin *window, const char *const input, gboolean previous);
+static char* _kick_autocomplete(ProfWin *window, const char *const input, gboolean previous);
+static char* _ban_autocomplete(ProfWin *window, const char *const input, gboolean previous);
+static char* _affiliation_autocomplete(ProfWin *window, const char *const input, gboolean previous);
+static char* _role_autocomplete(ProfWin *window, const char *const input, gboolean previous);
+static char* _resource_autocomplete(ProfWin *window, const char *const input, gboolean previous);
+static char* _wintitle_autocomplete(ProfWin *window, const char *const input, gboolean previous);
+static char* _inpblock_autocomplete(ProfWin *window, const char *const input, gboolean previous);
+static char* _time_autocomplete(ProfWin *window, const char *const input, gboolean previous);
+static char* _receipts_autocomplete(ProfWin *window, const char *const input, gboolean previous);
+static char* _help_autocomplete(ProfWin *window, const char *const input, gboolean previous);
+static char* _wins_autocomplete(ProfWin *window, const char *const input, gboolean previous);
+static char* _tls_autocomplete(ProfWin *window, const char *const input, gboolean previous);
+static char* _titlebar_autocomplete(ProfWin *window, const char *const input, gboolean previous);
+static char* _script_autocomplete(ProfWin *window, const char *const input, gboolean previous);
+static char* _subject_autocomplete(ProfWin *window, const char *const input, gboolean previous);
+static char* _console_autocomplete(ProfWin *window, const char *const input, gboolean previous);
+static char* _win_autocomplete(ProfWin *window, const char *const input, gboolean previous);
+static char* _close_autocomplete(ProfWin *window, const char *const input, gboolean previous);
+static char* _plugins_autocomplete(ProfWin *window, const char *const input, gboolean previous);
+static char* _sendfile_autocomplete(ProfWin *window, const char *const input, gboolean previous);
+static char* _blocked_autocomplete(ProfWin *window, const char *const input, gboolean previous);
+static char* _tray_autocomplete(ProfWin *window, const char *const input, gboolean previous);
+static char* _presence_autocomplete(ProfWin *window, const char *const input, gboolean previous);
+static char* _rooms_autocomplete(ProfWin *window, const char *const input, gboolean previous);
+static char* _statusbar_autocomplete(ProfWin *window, const char *const input, gboolean previous);
+static char* _clear_autocomplete(ProfWin *window, const char *const input, gboolean previous);
+static char* _invite_autocomplete(ProfWin *window, const char *const input, gboolean previous);
+static char* _status_autocomplete(ProfWin *window, const char *const input, gboolean previous);
+static char* _logging_autocomplete(ProfWin *window, const char *const input, gboolean previous);
+static char* _color_autocomplete(ProfWin *window, const char *const input, gboolean previous);
+static char* _avatar_autocomplete(ProfWin *window, const char *const input, gboolean previous);
+static char* _correction_autocomplete(ProfWin *window, const char *const input, gboolean previous);
+static char* _correct_autocomplete(ProfWin *window, const char *const input, gboolean previous);
+static char* _software_autocomplete(ProfWin *window, const char *const input, gboolean previous);
+static char* _url_autocomplete(ProfWin *window, const char *const input, gboolean previous);
+static char* _executable_autocomplete(ProfWin *window, const char *const input, gboolean previous);
+
+static char* _script_autocomplete_func(const char *const prefix, gboolean previous, void *context);
+
+static char* _cmd_ac_complete_params(ProfWin *window, const char *const input, gboolean previous);
static Autocomplete commands_ac;
static Autocomplete who_room_ac;
@@ -1053,7 +1053,7 @@ cmd_ac_init(void)
}
void
-cmd_ac_add(const char* const value)
+cmd_ac_add(const char *const value)
{
if (commands_ac == NULL) {
return;
@@ -1063,7 +1063,7 @@ cmd_ac_add(const char* const value)
}
void
-cmd_ac_add_help(const char* const value)
+cmd_ac_add_help(const char *const value)
{
if (help_ac == NULL) {
return;
@@ -1073,16 +1073,16 @@ cmd_ac_add_help(const char* const value)
}
void
-cmd_ac_add_cmd(Command* command)
+cmd_ac_add_cmd(Command *command)
{
autocomplete_add(commands_ac, command->cmd);
- autocomplete_add(help_ac, command->cmd + 1);
+ autocomplete_add(help_ac, command->cmd+1);
}
void
-cmd_ac_add_alias(ProfAlias* alias)
+cmd_ac_add_alias(ProfAlias *alias)
{
- GString* ac_alias = g_string_new("/");
+ GString *ac_alias = g_string_new("/");
g_string_append(ac_alias, alias->name);
autocomplete_add(commands_ac, ac_alias->str);
autocomplete_add(aliases_ac, alias->name);
@@ -1090,7 +1090,7 @@ cmd_ac_add_alias(ProfAlias* alias)
}
void
-cmd_ac_add_alias_value(char* value)
+cmd_ac_add_alias_value(char *value)
{
if (aliases_ac == NULL) {
return;
@@ -1100,7 +1100,7 @@ cmd_ac_add_alias_value(char* value)
}
void
-cmd_ac_remove_alias_value(char* value)
+cmd_ac_remove_alias_value(char *value)
{
if (aliases_ac == NULL) {
return;
@@ -1109,7 +1109,7 @@ cmd_ac_remove_alias_value(char* value)
}
void
-cmd_ac_remove(const char* const value)
+cmd_ac_remove(const char *const value)
{
if (commands_ac == NULL) {
return;
@@ -1119,7 +1119,7 @@ cmd_ac_remove(const char* const value)
}
void
-cmd_ac_remove_help(const char* const value)
+cmd_ac_remove_help(const char *const value)
{
if (help_ac == NULL) {
return;
@@ -1129,7 +1129,7 @@ cmd_ac_remove_help(const char* const value)
}
gboolean
-cmd_ac_exists(char* cmd)
+cmd_ac_exists(char *cmd)
{
if (commands_ac == NULL) {
return FALSE;
@@ -1139,16 +1139,16 @@ cmd_ac_exists(char* cmd)
}
void
-cmd_ac_add_form_fields(DataForm* form)
+cmd_ac_add_form_fields(DataForm *form)
{
if (form == NULL) {
return;
}
- GList* fields = autocomplete_create_list(form->tag_ac);
- GList* curr_field = fields;
+ GList *fields = autocomplete_create_list(form->tag_ac);
+ GList *curr_field = fields;
while (curr_field) {
- GString* field_str = g_string_new("/");
+ GString *field_str = g_string_new("/");
g_string_append(field_str, curr_field->data);
cmd_ac_add(field_str->str);
g_string_free(field_str, TRUE);
@@ -1158,16 +1158,16 @@ cmd_ac_add_form_fields(DataForm* form)
}
void
-cmd_ac_remove_form_fields(DataForm* form)
+cmd_ac_remove_form_fields(DataForm *form)
{
if (form == NULL) {
return;
}
- GList* fields = autocomplete_create_list(form->tag_ac);
- GList* curr_field = fields;
+ GList *fields = autocomplete_create_list(form->tag_ac);
+ GList *curr_field = fields;
while (curr_field) {
- GString* field_str = g_string_new("/");
+ GString *field_str = g_string_new("/");
g_string_append(field_str, curr_field->data);
cmd_ac_remove(field_str->str);
g_string_free(field_str, TRUE);
@@ -1177,19 +1177,19 @@ cmd_ac_remove_form_fields(DataForm* form)
}
char*
-cmd_ac_complete(ProfWin* window, const char* const input, gboolean previous)
+cmd_ac_complete(ProfWin *window, const char *const input, gboolean previous)
{
// autocomplete command
if ((strncmp(input, "/", 1) == 0) && (!str_contains(input, strlen(input), ' '))) {
- char* found = NULL;
+ char *found = NULL;
found = autocomplete_complete(commands_ac, input, TRUE, previous);
if (found) {
return found;
}
- // autocomplete parameters
+ // autocomplete parameters
} else {
- char* found = _cmd_ac_complete_params(window, input, previous);
+ char *found = _cmd_ac_complete_params(window, input, previous);
if (found) {
return found;
}
@@ -1199,14 +1199,14 @@ cmd_ac_complete(ProfWin* window, const char* const input, gboolean previous)
}
void
-cmd_ac_reset(ProfWin* window)
+cmd_ac_reset(ProfWin *window)
{
jabber_conn_status_t conn_status = connection_get_status();
if (conn_status == JABBER_CONNECTED) {
roster_reset_search_attempts();
if (window->type == WIN_CHAT) {
- ProfChatWin* chatwin = (ProfChatWin*)window;
+ ProfChatWin *chatwin = (ProfChatWin*)window;
assert(chatwin->memcheck == PROFCHATWIN_MEMCHECK);
PContact contact = roster_get_contact(chatwin->barejid);
if (contact) {
@@ -1378,14 +1378,14 @@ cmd_ac_reset(ProfWin* window)
}
if (window->type == WIN_MUC) {
- ProfMucWin* mucwin = (ProfMucWin*)window;
+ ProfMucWin *mucwin = (ProfMucWin*)window;
assert(mucwin->memcheck == PROFMUCWIN_MEMCHECK);
muc_autocomplete_reset(mucwin->roomjid);
muc_jid_autocomplete_reset(mucwin->roomjid);
}
if (window->type == WIN_CONFIG) {
- ProfConfWin* confwin = (ProfConfWin*)window;
+ ProfConfWin *confwin = (ProfConfWin*)window;
assert(confwin->memcheck == PROFCONFWIN_MEMCHECK);
if (confwin->form) {
form_reset_autocompleters(confwin->form);
@@ -1535,22 +1535,21 @@ cmd_ac_uninit(void)
}
static void
-_filepath_item_free(char** ptr)
-{
- char* item = *ptr;
+_filepath_item_free(char **ptr) {
+ char *item = *ptr;
free(item);
}
char*
-cmd_ac_complete_filepath(const char* const input, char* const startstr, gboolean previous)
+cmd_ac_complete_filepath(const char *const input, char *const startstr, gboolean previous)
{
unsigned int output_off = 0;
- char* result = NULL;
- char* tmp;
+ char *result = NULL;
+ char *tmp;
// strip command
- char* inpcp = (char*)input + strlen(startstr);
+ char *inpcp = (char*)input + strlen(startstr);
while (*inpcp == ' ') {
inpcp++;
}
@@ -1559,22 +1558,22 @@ cmd_ac_complete_filepath(const char* const input, char* const startstr, gboolean
// strip quotes
if (*inpcp == '"') {
- tmp = strchr(inpcp + 1, '"');
+ tmp = strchr(inpcp+1, '"');
if (tmp) {
*tmp = '\0';
}
- tmp = strdup(inpcp + 1);
+ tmp = strdup(inpcp+1);
free(inpcp);
inpcp = tmp;
}
// expand ~ to $HOME
if (inpcp[0] == '~' && inpcp[1] == '/') {
- if (asprintf(&tmp, "%s/%sfoo", getenv("HOME"), inpcp + 2) == -1) {
+ if (asprintf(&tmp, "%s/%sfoo", getenv("HOME"), inpcp+2) == -1) {
free(inpcp);
return NULL;
}
- output_off = strlen(getenv("HOME")) + 1;
+ output_off = strlen(getenv("HOME"))+1;
} else {
if (asprintf(&tmp, "%sfoo", inpcp) == -1) {
free(inpcp);
@@ -1590,11 +1589,11 @@ cmd_ac_complete_filepath(const char* const input, char* const startstr, gboolean
free(inpcp);
free(inpcp2);
- struct dirent* dir;
- GArray* files = g_array_new(TRUE, FALSE, sizeof(char*));
+ struct dirent *dir;
+ GArray *files = g_array_new(TRUE, FALSE, sizeof(char *));
g_array_set_clear_func(files, (GDestroyNotify)_filepath_item_free);
- DIR* d = opendir(directory);
+ DIR *d = opendir(directory);
if (d) {
while ((dir = readdir(d)) != NULL) {
if (strcmp(dir->d_name, ".") == 0) {
@@ -1606,17 +1605,17 @@ cmd_ac_complete_filepath(const char* const input, char* const startstr, gboolean
continue;
}
- char* acstring;
+ char *acstring;
if (output_off) {
if (asprintf(&tmp, "%s/%s", directory, dir->d_name) == -1) {
free(directory);
free(foofile);
return NULL;
}
- if (asprintf(&acstring, "~/%s", tmp + output_off) == -1) {
+ if (asprintf(&acstring, "~/%s", tmp+output_off) == -1) {
free(directory);
free(foofile);
- return NULL;
+ return NULL;
}
free(tmp);
} else if (strcmp(directory, "/") == 0) {
@@ -1633,7 +1632,7 @@ cmd_ac_complete_filepath(const char* const input, char* const startstr, gboolean
}
}
- char* acstring_cpy = strdup(acstring);
+ char *acstring_cpy = strdup(acstring);
g_array_append_val(files, acstring_cpy);
free(acstring);
}
@@ -1642,7 +1641,7 @@ cmd_ac_complete_filepath(const char* const input, char* const startstr, gboolean
free(directory);
free(foofile);
- autocomplete_update(filepath_ac, (char**)files->data);
+ autocomplete_update(filepath_ac, (char **)files->data);
g_array_free(files, TRUE);
result = autocomplete_param_with_ac(input, startstr, filepath_ac, TRUE, previous);
@@ -1654,16 +1653,16 @@ cmd_ac_complete_filepath(const char* const input, char* const startstr, gboolean
}
static char*
-_cmd_ac_complete_params(ProfWin* window, const char* const input, gboolean previous)
+_cmd_ac_complete_params(ProfWin *window, const char *const input, gboolean previous)
{
int i;
- char* result = NULL;
+ char *result = NULL;
jabber_conn_status_t conn_status = connection_get_status();
// autocomplete boolean settings
- gchar* boolean_choices[] = { "/beep", "/intype", "/states", "/outtype", "/flash", "/splash",
- "/history", "/vercheck", "/privileges", "/wrap", "/carbons", "/lastactivity", "/os", "/slashguard" };
+ gchar *boolean_choices[] = { "/beep", "/intype", "/states", "/outtype", "/flash", "/splash",
+ "/history", "/vercheck", "/privileges", "/wrap", "/carbons", "/lastactivity", "/os", "/slashguard"};
for (i = 0; i < ARRAY_SIZE(boolean_choices); i++) {
result = autocomplete_param_with_func(input, boolean_choices[i], prefs_autocomplete_boolean_choice, previous, NULL);
@@ -1674,14 +1673,14 @@ _cmd_ac_complete_params(ProfWin* window, const char* const input, gboolean previ
// autocomplete nickname in chat rooms
if (window->type == WIN_MUC) {
- ProfMucWin* mucwin = (ProfMucWin*)window;
+ ProfMucWin *mucwin = (ProfMucWin*)window;
assert(mucwin->memcheck == PROFMUCWIN_MEMCHECK);
Autocomplete nick_ac = muc_roster_ac(mucwin->roomjid);
if (nick_ac) {
- gchar* nick_choices[] = { "/msg", "/info", "/caps" };
+ gchar *nick_choices[] = { "/msg", "/info", "/caps" } ;
// Remove quote character before and after names when doing autocomplete
- char* unquoted = strip_arg_quotes(input);
+ char *unquoted = strip_arg_quotes(input);
for (i = 0; i < ARRAY_SIZE(nick_choices); i++) {
result = autocomplete_param_with_ac(unquoted, nick_choices[i], nick_ac, TRUE, previous);
if (result) {
@@ -1692,11 +1691,11 @@ _cmd_ac_complete_params(ProfWin* window, const char* const input, gboolean previ
free(unquoted);
}
- // otherwise autocomplete using roster
+ // otherwise autocomplete using roster
} else if (conn_status == JABBER_CONNECTED) {
- gchar* contact_choices[] = { "/msg", "/info" };
+ gchar *contact_choices[] = { "/msg", "/info" };
// Remove quote character before and after names when doing autocomplete
- char* unquoted = strip_arg_quotes(input);
+ char *unquoted = strip_arg_quotes(input);
for (i = 0; i < ARRAY_SIZE(contact_choices); i++) {
result = autocomplete_param_with_func(unquoted, contact_choices[i], roster_contact_autocomplete, previous, NULL);
if (result) {
@@ -1706,7 +1705,7 @@ _cmd_ac_complete_params(ProfWin* window, const char* const input, gboolean previ
}
free(unquoted);
- gchar* resource_choices[] = { "/caps", "/ping" };
+ gchar *resource_choices[] = { "/caps", "/ping" };
for (i = 0; i < ARRAY_SIZE(resource_choices); i++) {
result = autocomplete_param_with_func(input, resource_choices[i], roster_fulljid_autocomplete, previous, NULL);
if (result) {
@@ -1715,7 +1714,7 @@ _cmd_ac_complete_params(ProfWin* window, const char* const input, gboolean previ
}
}
- gchar* invite_choices[] = { "/join" };
+ gchar *invite_choices[] = { "/join" };
for (i = 0; i < ARRAY_SIZE(invite_choices); i++) {
result = autocomplete_param_with_func(input, invite_choices[i], muc_invites_find, previous, NULL);
if (result) {
@@ -1723,7 +1722,7 @@ _cmd_ac_complete_params(ProfWin* window, const char* const input, gboolean previ
}
}
- gchar* cmds[] = { "/prefs", "/disco", "/room", "/autoping", "/mainwin", "/inputwin" };
+ gchar *cmds[] = { "/prefs", "/disco", "/room", "/autoping", "/mainwin", "/inputwin" };
Autocomplete completers[] = { prefs_ac, disco_ac, room_ac, autoping_ac, winpos_ac, winpos_ac };
for (i = 0; i < ARRAY_SIZE(cmds); i++) {
@@ -1733,71 +1732,71 @@ _cmd_ac_complete_params(ProfWin* window, const char* const input, gboolean previ
}
}
- GHashTable* ac_funcs = g_hash_table_new(g_str_hash, g_str_equal);
- g_hash_table_insert(ac_funcs, "/help", _help_autocomplete);
- g_hash_table_insert(ac_funcs, "/who", _who_autocomplete);
- g_hash_table_insert(ac_funcs, "/sub", _sub_autocomplete);
- g_hash_table_insert(ac_funcs, "/notify", _notify_autocomplete);
- g_hash_table_insert(ac_funcs, "/autoaway", _autoaway_autocomplete);
- g_hash_table_insert(ac_funcs, "/theme", _theme_autocomplete);
- g_hash_table_insert(ac_funcs, "/log", _log_autocomplete);
- g_hash_table_insert(ac_funcs, "/account", _account_autocomplete);
- g_hash_table_insert(ac_funcs, "/roster", _roster_autocomplete);
- g_hash_table_insert(ac_funcs, "/bookmark", _bookmark_autocomplete);
- g_hash_table_insert(ac_funcs, "/autoconnect", _autoconnect_autocomplete);
+ GHashTable *ac_funcs = g_hash_table_new(g_str_hash, g_str_equal);
+ g_hash_table_insert(ac_funcs, "/help", _help_autocomplete);
+ g_hash_table_insert(ac_funcs, "/who", _who_autocomplete);
+ g_hash_table_insert(ac_funcs, "/sub", _sub_autocomplete);
+ g_hash_table_insert(ac_funcs, "/notify", _notify_autocomplete);
+ g_hash_table_insert(ac_funcs, "/autoaway", _autoaway_autocomplete);
+ g_hash_table_insert(ac_funcs, "/theme", _theme_autocomplete);
+ g_hash_table_insert(ac_funcs, "/log", _log_autocomplete);
+ g_hash_table_insert(ac_funcs, "/account", _account_autocomplete);
+ g_hash_table_insert(ac_funcs, "/roster", _roster_autocomplete);
+ g_hash_table_insert(ac_funcs, "/bookmark", _bookmark_autocomplete);
+ g_hash_table_insert(ac_funcs, "/autoconnect", _autoconnect_autocomplete);
#ifdef HAVE_LIBOTR
- g_hash_table_insert(ac_funcs, "/otr", _otr_autocomplete);
+ g_hash_table_insert(ac_funcs, "/otr", _otr_autocomplete);
#endif
#ifdef HAVE_LIBGPGME
- g_hash_table_insert(ac_funcs, "/pgp", _pgp_autocomplete);
- g_hash_table_insert(ac_funcs, "/ox", _ox_autocomplete);
+ g_hash_table_insert(ac_funcs, "/pgp", _pgp_autocomplete);
+ g_hash_table_insert(ac_funcs, "/ox", _ox_autocomplete);
#endif
#ifdef HAVE_OMEMO
- g_hash_table_insert(ac_funcs, "/omemo", _omemo_autocomplete);
+ g_hash_table_insert(ac_funcs, "/omemo", _omemo_autocomplete);
#endif
- g_hash_table_insert(ac_funcs, "/connect", _connect_autocomplete);
- g_hash_table_insert(ac_funcs, "/alias", _alias_autocomplete);
- g_hash_table_insert(ac_funcs, "/join", _join_autocomplete);
- g_hash_table_insert(ac_funcs, "/form", _form_autocomplete);
- g_hash_table_insert(ac_funcs, "/occupants", _occupants_autocomplete);
- g_hash_table_insert(ac_funcs, "/kick", _kick_autocomplete);
- g_hash_table_insert(ac_funcs, "/ban", _ban_autocomplete);
- g_hash_table_insert(ac_funcs, "/affiliation", _affiliation_autocomplete);
- g_hash_table_insert(ac_funcs, "/role", _role_autocomplete);
- g_hash_table_insert(ac_funcs, "/resource", _resource_autocomplete);
- g_hash_table_insert(ac_funcs, "/wintitle", _wintitle_autocomplete);
- g_hash_table_insert(ac_funcs, "/inpblock", _inpblock_autocomplete);
- g_hash_table_insert(ac_funcs, "/time", _time_autocomplete);
- g_hash_table_insert(ac_funcs, "/receipts", _receipts_autocomplete);
- g_hash_table_insert(ac_funcs, "/wins", _wins_autocomplete);
- g_hash_table_insert(ac_funcs, "/tls", _tls_autocomplete);
- g_hash_table_insert(ac_funcs, "/titlebar", _titlebar_autocomplete);
- g_hash_table_insert(ac_funcs, "/script", _script_autocomplete);
- g_hash_table_insert(ac_funcs, "/subject", _subject_autocomplete);
- g_hash_table_insert(ac_funcs, "/console", _console_autocomplete);
- g_hash_table_insert(ac_funcs, "/win", _win_autocomplete);
- g_hash_table_insert(ac_funcs, "/close", _close_autocomplete);
- g_hash_table_insert(ac_funcs, "/plugins", _plugins_autocomplete);
- g_hash_table_insert(ac_funcs, "/sendfile", _sendfile_autocomplete);
- g_hash_table_insert(ac_funcs, "/blocked", _blocked_autocomplete);
- g_hash_table_insert(ac_funcs, "/tray", _tray_autocomplete);
- g_hash_table_insert(ac_funcs, "/presence", _presence_autocomplete);
- g_hash_table_insert(ac_funcs, "/rooms", _rooms_autocomplete);
- g_hash_table_insert(ac_funcs, "/statusbar", _statusbar_autocomplete);
- g_hash_table_insert(ac_funcs, "/clear", _clear_autocomplete);
- g_hash_table_insert(ac_funcs, "/invite", _invite_autocomplete);
- g_hash_table_insert(ac_funcs, "/status", _status_autocomplete);
- g_hash_table_insert(ac_funcs, "/logging", _logging_autocomplete);
- g_hash_table_insert(ac_funcs, "/color", _color_autocomplete);
- g_hash_table_insert(ac_funcs, "/avatar", _avatar_autocomplete);
- g_hash_table_insert(ac_funcs, "/correction", _correction_autocomplete);
- g_hash_table_insert(ac_funcs, "/correct", _correct_autocomplete);
- g_hash_table_insert(ac_funcs, "/software", _software_autocomplete);
- g_hash_table_insert(ac_funcs, "/url", _url_autocomplete);
- g_hash_table_insert(ac_funcs, "/executable", _executable_autocomplete);
+ g_hash_table_insert(ac_funcs, "/connect", _connect_autocomplete);
+ g_hash_table_insert(ac_funcs, "/alias", _alias_autocomplete);
+ g_hash_table_insert(ac_funcs, "/join", _join_autocomplete);
+ g_hash_table_insert(ac_funcs, "/form", _form_autocomplete);
+ g_hash_table_insert(ac_funcs, "/occupants", _occupants_autocomplete);
+ g_hash_table_insert(ac_funcs, "/kick", _kick_autocomplete);
+ g_hash_table_insert(ac_funcs, "/ban", _ban_autocomplete);
+ g_hash_table_insert(ac_funcs, "/affiliation", _affiliation_autocomplete);
+ g_hash_table_insert(ac_funcs, "/role", _role_autocomplete);
+ g_hash_table_insert(ac_funcs, "/resource", _resource_autocomplete);
+ g_hash_table_insert(ac_funcs, "/wintitle", _wintitle_autocomplete);
+ g_hash_table_insert(ac_funcs, "/inpblock", _inpblock_autocomplete);
+ g_hash_table_insert(ac_funcs, "/time", _time_autocomplete);
+ g_hash_table_insert(ac_funcs, "/receipts", _receipts_autocomplete);
+ g_hash_table_insert(ac_funcs, "/wins", _wins_autocomplete);
+ g_hash_table_insert(ac_funcs, "/tls", _tls_autocomplete);
+ g_hash_table_insert(ac_funcs, "/titlebar", _titlebar_autocomplete);
+ g_hash_table_insert(ac_funcs, "/script", _script_autocomplete);
+ g_hash_table_insert(ac_funcs, "/subject", _subject_autocomplete);
+ g_hash_table_insert(ac_funcs, "/console", _console_autocomplete);
+ g_hash_table_insert(ac_funcs, "/win", _win_autocomplete);
+ g_hash_table_insert(ac_funcs, "/close", _close_autocomplete);
+ g_hash_table_insert(ac_funcs, "/plugins", _plugins_autocomplete);
+ g_hash_table_insert(ac_funcs, "/sendfile", _sendfile_autocomplete);
+ g_hash_table_insert(ac_funcs, "/blocked", _blocked_autocomplete);
+ g_hash_table_insert(ac_funcs, "/tray", _tray_autocomplete);
+ g_hash_table_insert(ac_funcs, "/presence", _presence_autocomplete);
+ g_hash_table_insert(ac_funcs, "/rooms", _rooms_autocomplete);
+ g_hash_table_insert(ac_funcs, "/statusbar", _statusbar_autocomplete);
+ g_hash_table_insert(ac_funcs, "/clear", _clear_autocomplete);
+ g_hash_table_insert(ac_funcs, "/invite", _invite_autocomplete);
+ g_hash_table_insert(ac_funcs, "/status", _status_autocomplete);
+ g_hash_table_insert(ac_funcs, "/logging", _logging_autocomplete);
+ g_hash_table_insert(ac_funcs, "/color", _color_autocomplete);
+ g_hash_table_insert(ac_funcs, "/avatar", _avatar_autocomplete);
+ g_hash_table_insert(ac_funcs, "/correction", _correction_autocomplete);
+ g_hash_table_insert(ac_funcs, "/correct", _correct_autocomplete);
+ g_hash_table_insert(ac_funcs, "/software", _software_autocomplete);
+ g_hash_table_insert(ac_funcs, "/url", _url_autocomplete);
+ g_hash_table_insert(ac_funcs, "/executable", _executable_autocomplete);
int len = strlen(input);
- char parsed[len + 1];
+ char parsed[len+1];
i = 0;
while (i < len) {
if (input[i] == ' ') {
@@ -1809,7 +1808,7 @@ _cmd_ac_complete_params(ProfWin* window, const char* const input, gboolean previ
}
parsed[i] = '\0';
- char* (*ac_func)(ProfWin*, const char* const, gboolean) = g_hash_table_lookup(ac_funcs, parsed);
+ char * (*ac_func)(ProfWin*, const char * const, gboolean) = g_hash_table_lookup(ac_funcs, parsed);
if (ac_func) {
result = ac_func(window, input, previous);
if (result) {
@@ -1835,9 +1834,9 @@ _cmd_ac_complete_params(ProfWin* window, const char* const input, gboolean previ
}
static char*
-_sub_autocomplete(ProfWin* window, const char* const input, gboolean previous)
+_sub_autocomplete(ProfWin *window, const char *const input, gboolean previous)
{
- char* result = NULL;
+ char *result = NULL;
result = autocomplete_param_with_func(input, "/sub allow", presence_sub_request_find, previous, NULL);
if (result) {
return result;
@@ -1855,9 +1854,9 @@ _sub_autocomplete(ProfWin* window, const char* const input, gboolean previous)
}
static char*
-_tray_autocomplete(ProfWin* window, const char* const input, gboolean previous)
+_tray_autocomplete(ProfWin *window, const char *const input, gboolean previous)
{
- char* result = NULL;
+ char *result = NULL;
result = autocomplete_param_with_func(input, "/tray read", prefs_autocomplete_boolean_choice, previous, NULL);
if (result) {
return result;
@@ -1872,9 +1871,9 @@ _tray_autocomplete(ProfWin* window, const char* const input, gboolean previous)
}
static char*
-_who_autocomplete(ProfWin* window, const char* const input, gboolean previous)
+_who_autocomplete(ProfWin *window, const char *const input, gboolean previous)
{
- char* result = NULL;
+ char *result = NULL;
if (window->type == WIN_MUC) {
result = autocomplete_param_with_ac(input, "/who", who_room_ac, TRUE, previous);
@@ -1885,9 +1884,9 @@ _who_autocomplete(ProfWin* window, const char* const input, gboolean previous)
jabber_conn_status_t conn_status = connection_get_status();
if (conn_status == JABBER_CONNECTED) {
int i = 0;
- gchar* group_commands[] = { "/who any", "/who online", "/who offline",
- "/who chat", "/who away", "/who xa", "/who dnd", "/who available",
- "/who unavailable" };
+ gchar *group_commands[] = { "/who any", "/who online", "/who offline",
+ "/who chat", "/who away", "/who xa", "/who dnd", "/who available",
+ "/who unavailable" };
for (i = 0; i < ARRAY_SIZE(group_commands); i++) {
result = autocomplete_param_with_func(input, group_commands[i], roster_group_autocomplete, previous, NULL);
@@ -1907,9 +1906,9 @@ _who_autocomplete(ProfWin* window, const char* const input, gboolean previous)
}
static char*
-_roster_autocomplete(ProfWin* window, const char* const input, gboolean previous)
+_roster_autocomplete(ProfWin *window, const char *const input, gboolean previous)
{
- char* result = NULL;
+ char *result = NULL;
result = autocomplete_param_with_ac(input, "/roster room private char", roster_char_ac, TRUE, previous);
if (result) {
return result;
@@ -2085,9 +2084,9 @@ _roster_autocomplete(ProfWin* window, const char* const input, gboolean previous
}
static char*
-_blocked_autocomplete(ProfWin* window, const char* const input, gboolean previous)
+_blocked_autocomplete(ProfWin *window, const char *const input, gboolean previous)
{
- char* result = NULL;
+ char *result = NULL;
result = autocomplete_param_with_func(input, "/blocked remove", blocked_ac_find, previous, NULL);
if (result) {
@@ -2103,18 +2102,18 @@ _blocked_autocomplete(ProfWin* window, const char* const input, gboolean previou
}
static char*
-_bookmark_autocomplete(ProfWin* window, const char* const input, gboolean previous)
+_bookmark_autocomplete(ProfWin *window, const char *const input, gboolean previous)
{
- char* found = NULL;
+ char *found = NULL;
gboolean result;
- gchar** args = parse_args(input, 2, 8, &result);
+ gchar **args = parse_args(input, 2, 8, &result);
- if (result && ((strcmp(args[0], "add") == 0) || (strcmp(args[0], "update") == 0))) {
+ if (result && ((strcmp(args[0], "add") == 0) || (strcmp(args[0], "update") == 0)) ) {
gboolean space_at_end = g_str_has_suffix(input, " ");
int num_args = g_strv_length(args);
if ((num_args == 2 && space_at_end) || (num_args == 3 && !space_at_end)) {
- GString* beginning = g_string_new("/bookmark");
+ GString *beginning = g_string_new("/bookmark");
g_string_append_printf(beginning, " %s %s", args[0], args[1]);
found = autocomplete_param_with_ac(input, beginning->str, bookmark_property_ac, TRUE, previous);
g_string_free(beginning, TRUE);
@@ -2124,8 +2123,8 @@ _bookmark_autocomplete(ProfWin* window, const char* const input, gboolean previo
}
}
if ((num_args == 3 && space_at_end && (g_strcmp0(args[2], "autojoin") == 0))
- || (num_args == 4 && (g_strcmp0(args[2], "autojoin") == 0) && !space_at_end)) {
- GString* beginning = g_string_new("/bookmark");
+ || (num_args == 4 && (g_strcmp0(args[2], "autojoin") == 0) && !space_at_end)) {
+ GString *beginning = g_string_new("/bookmark");
g_string_append_printf(beginning, " %s %s %s", args[0], args[1], args[2]);
found = autocomplete_param_with_func(input, beginning->str, prefs_autocomplete_boolean_choice, previous, NULL);
g_string_free(beginning, TRUE);
@@ -2135,7 +2134,7 @@ _bookmark_autocomplete(ProfWin* window, const char* const input, gboolean previo
}
}
if ((num_args == 4 && space_at_end) || (num_args == 5 && !space_at_end)) {
- GString* beginning = g_string_new("/bookmark");
+ GString *beginning = g_string_new("/bookmark");
g_string_append_printf(beginning, " %s %s %s %s", args[0], args[1], args[2], args[3]);
found = autocomplete_param_with_ac(input, beginning->str, bookmark_property_ac, TRUE, previous);
g_string_free(beginning, TRUE);
@@ -2145,8 +2144,8 @@ _bookmark_autocomplete(ProfWin* window, const char* const input, gboolean previo
}
}
if ((num_args == 5 && space_at_end && (g_strcmp0(args[4], "autojoin") == 0))
- || (num_args == 6 && (g_strcmp0(args[4], "autojoin") == 0) && !space_at_end)) {
- GString* beginning = g_string_new("/bookmark");
+ || (num_args == 6 && (g_strcmp0(args[4], "autojoin") == 0) && !space_at_end)) {
+ GString *beginning = g_string_new("/bookmark");
g_string_append_printf(beginning, " %s %s %s %s %s", args[0], args[1], args[2], args[3], args[4]);
found = autocomplete_param_with_func(input, beginning->str, prefs_autocomplete_boolean_choice, previous, NULL);
g_string_free(beginning, TRUE);
@@ -2156,7 +2155,7 @@ _bookmark_autocomplete(ProfWin* window, const char* const input, gboolean previo
}
}
if ((num_args == 6 && space_at_end) || (num_args == 7 && !space_at_end)) {
- GString* beginning = g_string_new("/bookmark");
+ GString *beginning = g_string_new("/bookmark");
g_string_append_printf(beginning, " %s %s %s %s %s %s", args[0], args[1], args[2], args[3], args[4], args[5]);
found = autocomplete_param_with_ac(input, beginning->str, bookmark_property_ac, TRUE, previous);
g_string_free(beginning, TRUE);
@@ -2166,8 +2165,8 @@ _bookmark_autocomplete(ProfWin* window, const char* const input, gboolean previo
}
}
if ((num_args == 7 && space_at_end && (g_strcmp0(args[6], "autojoin") == 0))
- || (num_args == 8 && (g_strcmp0(args[6], "autojoin") == 0) && !space_at_end)) {
- GString* beginning = g_string_new("/bookmark");
+ || (num_args == 8 && (g_strcmp0(args[6], "autojoin") == 0) && !space_at_end)) {
+ GString *beginning = g_string_new("/bookmark");
g_string_append_printf(beginning, " %s %s %s %s %s %s %s", args[0], args[1], args[2], args[3], args[4], args[5], args[6]);
found = autocomplete_param_with_func(input, beginning->str, prefs_autocomplete_boolean_choice, previous, NULL);
g_string_free(beginning, TRUE);
@@ -2215,18 +2214,18 @@ _bookmark_autocomplete(ProfWin* window, const char* const input, gboolean previo
}
static char*
-_notify_autocomplete(ProfWin* window, const char* const input, gboolean previous)
+_notify_autocomplete(ProfWin *window, const char *const input, gboolean previous)
{
int i = 0;
- char* result = NULL;
+ char *result = NULL;
result = autocomplete_param_with_func(input, "/notify room trigger remove", prefs_autocomplete_room_trigger, previous, NULL);
if (result) {
return result;
}
- gchar* boolean_choices1[] = { "/notify room current", "/notify chat current", "/notify typing current",
- "/notify room text", "/notify chat text" };
+ gchar *boolean_choices1[] = { "/notify room current", "/notify chat current", "/notify typing current",
+ "/notify room text", "/notify chat text" };
for (i = 0; i < ARRAY_SIZE(boolean_choices1); i++) {
result = autocomplete_param_with_func(input, boolean_choices1[i], prefs_autocomplete_boolean_choice, previous, NULL);
if (result) {
@@ -2259,7 +2258,7 @@ _notify_autocomplete(ProfWin* window, const char* const input, gboolean previous
return result;
}
- gchar* boolean_choices2[] = { "/notify invite", "/notify sub", "/notify mention", "/notify trigger" };
+ gchar *boolean_choices2[] = { "/notify invite", "/notify sub", "/notify mention", "/notify trigger"};
for (i = 0; i < ARRAY_SIZE(boolean_choices2); i++) {
result = autocomplete_param_with_func(input, boolean_choices2[i], prefs_autocomplete_boolean_choice, previous, NULL);
if (result) {
@@ -2276,9 +2275,9 @@ _notify_autocomplete(ProfWin* window, const char* const input, gboolean previous
}
static char*
-_autoaway_autocomplete(ProfWin* window, const char* const input, gboolean previous)
+_autoaway_autocomplete(ProfWin *window, const char *const input, gboolean previous)
{
- char* result = NULL;
+ char *result = NULL;
result = autocomplete_param_with_ac(input, "/autoaway mode", autoaway_mode_ac, TRUE, previous);
if (result) {
@@ -2308,9 +2307,9 @@ _autoaway_autocomplete(ProfWin* window, const char* const input, gboolean previo
}
static char*
-_log_autocomplete(ProfWin* window, const char* const input, gboolean previous)
+_log_autocomplete(ProfWin *window, const char *const input, gboolean previous)
{
- char* result = NULL;
+ char *result = NULL;
result = autocomplete_param_with_func(input, "/log rotate", prefs_autocomplete_boolean_choice, previous, NULL);
if (result) {
@@ -2329,9 +2328,9 @@ _log_autocomplete(ProfWin* window, const char* const input, gboolean previous)
}
static char*
-_autoconnect_autocomplete(ProfWin* window, const char* const input, gboolean previous)
+_autoconnect_autocomplete(ProfWin *window, const char *const input, gboolean previous)
{
- char* result = NULL;
+ char *result = NULL;
result = autocomplete_param_with_func(input, "/autoconnect set", accounts_find_enabled, previous, NULL);
if (result) {
@@ -2348,9 +2347,9 @@ _autoconnect_autocomplete(ProfWin* window, const char* const input, gboolean pre
#ifdef HAVE_LIBOTR
static char*
-_otr_autocomplete(ProfWin* window, const char* const input, gboolean previous)
+_otr_autocomplete(ProfWin *window, const char *const input, gboolean previous)
{
- char* found = NULL;
+ char *found = NULL;
jabber_conn_status_t conn_status = connection_get_status();
@@ -2369,9 +2368,9 @@ _otr_autocomplete(ProfWin* window, const char* const input, gboolean previous)
// /otr policy always user@server.com
if (conn_status == JABBER_CONNECTED) {
gboolean result;
- gchar** args = parse_args(input, 2, 3, &result);
+ gchar **args = parse_args(input, 2, 3, &result);
if (result && (strcmp(args[0], "policy") == 0)) {
- GString* beginning = g_string_new("/otr ");
+ GString *beginning = g_string_new("/otr ");
g_string_append(beginning, args[0]);
g_string_append(beginning, " ");
if (args[1]) {
@@ -2409,9 +2408,9 @@ _otr_autocomplete(ProfWin* window, const char* const input, gboolean previous)
#ifdef HAVE_LIBGPGME
static char*
-_pgp_autocomplete(ProfWin* window, const char* const input, gboolean previous)
+_pgp_autocomplete(ProfWin *window, const char *const input, gboolean previous)
{
- char* found = NULL;
+ char *found = NULL;
jabber_conn_status_t conn_status = connection_get_status();
@@ -2433,9 +2432,9 @@ _pgp_autocomplete(ProfWin* window, const char* const input, gboolean previous)
}
gboolean result;
- gchar** args = parse_args(input, 2, 3, &result);
+ gchar **args = parse_args(input, 2, 3, &result);
if ((strncmp(input, "/pgp", 4) == 0) && (result == TRUE)) {
- GString* beginning = g_string_new("/pgp ");
+ GString *beginning = g_string_new("/pgp ");
g_string_append(beginning, args[0]);
if (args[1]) {
g_string_append(beginning, " ");
@@ -2471,9 +2470,9 @@ _pgp_autocomplete(ProfWin* window, const char* const input, gboolean previous)
*
*/
static char*
-_ox_autocomplete(ProfWin* window, const char* const input, gboolean previous)
+_ox_autocomplete(ProfWin *window, const char *const input, gboolean previous)
{
- char* found = NULL;
+ char *found = NULL;
jabber_conn_status_t conn_status = connection_get_status();
@@ -2495,9 +2494,9 @@ _ox_autocomplete(ProfWin* window, const char* const input, gboolean previous)
}
gboolean result;
- gchar** args = parse_args(input, 2, 3, &result);
+ gchar **args = parse_args(input, 2, 3, &result);
if ((strncmp(input, "/ox", 4) == 0) && (result == TRUE)) {
- GString* beginning = g_string_new("/ox ");
+ GString *beginning = g_string_new("/ox ");
g_string_append(beginning, args[0]);
if (args[1]) {
g_string_append(beginning, " ");
@@ -2530,9 +2529,9 @@ _ox_autocomplete(ProfWin* window, const char* const input, gboolean previous)
#ifdef HAVE_OMEMO
static char*
-_omemo_autocomplete(ProfWin* window, const char* const input, gboolean previous)
+_omemo_autocomplete(ProfWin *window, const char *const input, gboolean previous)
{
- char* found = NULL;
+ char *found = NULL;
found = autocomplete_param_with_ac(input, "/omemo log", omemo_log_ac, TRUE, previous);
if (found) {
@@ -2563,7 +2562,7 @@ _omemo_autocomplete(ProfWin* window, const char* const input, gboolean previous)
}
if (window->type == WIN_CHAT) {
- ProfChatWin* chatwin = (ProfChatWin*)window;
+ ProfChatWin *chatwin = (ProfChatWin*)window;
assert(chatwin->memcheck == PROFCHATWIN_MEMCHECK);
found = autocomplete_param_with_func(input, "/omemo trust", omemo_fingerprint_autocomplete, previous, chatwin->barejid);
if (found) {
@@ -2578,9 +2577,9 @@ _omemo_autocomplete(ProfWin* window, const char* const input, gboolean previous)
int num_tokens = count_tokens(input);
if (num_tokens == 4) {
gboolean result;
- gchar** args = parse_args(input, 2, 3, &result);
+ gchar **args = parse_args(input, 2, 3, &result);
if (result) {
- gchar* jid = g_strdup(args[1]);
+ gchar *jid = g_strdup(args[1]);
found = autocomplete_param_no_with_func(input, "/omemo trust", 4, omemo_fingerprint_autocomplete, previous, jid);
if (found) {
return found;
@@ -2600,9 +2599,9 @@ _omemo_autocomplete(ProfWin* window, const char* const input, gboolean previous)
#endif
static char*
-_plugins_autocomplete(ProfWin* window, const char* const input, gboolean previous)
+_plugins_autocomplete(ProfWin *window, const char *const input, gboolean previous)
{
- char* result = NULL;
+ char *result = NULL;
if (strncmp(input, "/plugins sourcepath set ", 24) == 0) {
return cmd_ac_complete_filepath(input, "/plugins sourcepath set", previous);
@@ -2622,8 +2621,8 @@ _plugins_autocomplete(ProfWin* window, const char* const input, gboolean previou
if (strncmp(input, "/plugins load ", 14) == 0) {
if (plugins_load_ac == NULL) {
plugins_load_ac = autocomplete_new();
- GSList* plugins = plugins_unloaded_list();
- GSList* curr = plugins;
+ GSList *plugins = plugins_unloaded_list();
+ GSList *curr = plugins;
while (curr) {
autocomplete_add(plugins_load_ac, curr->data);
curr = g_slist_next(curr);
@@ -2639,8 +2638,8 @@ _plugins_autocomplete(ProfWin* window, const char* const input, gboolean previou
if (strncmp(input, "/plugins reload ", 16) == 0) {
if (plugins_reload_ac == NULL) {
plugins_reload_ac = autocomplete_new();
- GList* plugins = plugins_loaded_list();
- GList* curr = plugins;
+ GList *plugins = plugins_loaded_list();
+ GList *curr = plugins;
while (curr) {
autocomplete_add(plugins_reload_ac, curr->data);
curr = g_list_next(curr);
@@ -2656,8 +2655,8 @@ _plugins_autocomplete(ProfWin* window, const char* const input, gboolean previou
if (strncmp(input, "/plugins unload ", 16) == 0) {
if (plugins_unload_ac == NULL) {
plugins_unload_ac = autocomplete_new();
- GList* plugins = plugins_loaded_list();
- GList* curr = plugins;
+ GList *plugins = plugins_loaded_list();
+ GList *curr = plugins;
while (curr) {
autocomplete_add(plugins_unload_ac, curr->data);
curr = g_list_next(curr);
@@ -2679,15 +2678,15 @@ _plugins_autocomplete(ProfWin* window, const char* const input, gboolean previou
}
static char*
-_theme_autocomplete(ProfWin* window, const char* const input, gboolean previous)
+_theme_autocomplete(ProfWin *window, const char *const input, gboolean previous)
{
- char* result = NULL;
+ char *result = NULL;
if (strncmp(input, "/theme load ", 12) == 0) {
if (theme_load_ac == NULL) {
theme_load_ac = autocomplete_new();
- GSList* themes = theme_list();
- GSList* curr = themes;
+ GSList *themes = theme_list();
+ GSList *curr = themes;
while (curr) {
autocomplete_add(theme_load_ac, curr->data);
@@ -2707,8 +2706,8 @@ _theme_autocomplete(ProfWin* window, const char* const input, gboolean previous)
if (strncmp(input, "/theme full-load ", 17) == 0) {
if (theme_load_ac == NULL) {
theme_load_ac = autocomplete_new();
- GSList* themes = theme_list();
- GSList* curr = themes;
+ GSList *themes = theme_list();
+ GSList *curr = themes;
while (curr) {
autocomplete_add(theme_load_ac, curr->data);
@@ -2734,12 +2733,12 @@ _theme_autocomplete(ProfWin* window, const char* const input, gboolean previous)
}
static char*
-_script_autocomplete_func(const char* const prefix, gboolean previous, void* context)
+_script_autocomplete_func(const char *const prefix, gboolean previous, void *context)
{
if (script_show_ac == NULL) {
script_show_ac = autocomplete_new();
- GSList* scripts = scripts_list();
- GSList* curr = scripts;
+ GSList *scripts = scripts_list();
+ GSList *curr = scripts;
while (curr) {
autocomplete_add(script_show_ac, curr->data);
curr = g_slist_next(curr);
@@ -2750,10 +2749,11 @@ _script_autocomplete_func(const char* const prefix, gboolean previous, void* con
return autocomplete_complete(script_show_ac, prefix, FALSE, previous);
}
+
static char*
-_script_autocomplete(ProfWin* window, const char* const input, gboolean previous)
+_script_autocomplete(ProfWin *window, const char *const input, gboolean previous)
{
- char* result = NULL;
+ char *result = NULL;
if (strncmp(input, "/script show ", 13) == 0) {
result = autocomplete_param_with_func(input, "/script show", _script_autocomplete_func, previous, NULL);
if (result) {
@@ -2777,13 +2777,13 @@ _script_autocomplete(ProfWin* window, const char* const input, gboolean previous
}
static char*
-_resource_autocomplete(ProfWin* window, const char* const input, gboolean previous)
+_resource_autocomplete(ProfWin *window, const char *const input, gboolean previous)
{
- char* found = NULL;
+ char *found = NULL;
jabber_conn_status_t conn_status = connection_get_status();
if (conn_status == JABBER_CONNECTED && window->type == WIN_CHAT) {
- ProfChatWin* chatwin = (ProfChatWin*)window;
+ ProfChatWin *chatwin = (ProfChatWin*)window;
assert(chatwin->memcheck == PROFCHATWIN_MEMCHECK);
PContact contact = roster_get_contact(chatwin->barejid);
if (contact) {
@@ -2814,9 +2814,9 @@ _resource_autocomplete(ProfWin* window, const char* const input, gboolean previo
}
static char*
-_wintitle_autocomplete(ProfWin* window, const char* const input, gboolean previous)
+_wintitle_autocomplete(ProfWin *window, const char *const input, gboolean previous)
{
- char* found = NULL;
+ char *found = NULL;
found = autocomplete_param_with_func(input, "/wintitle show", prefs_autocomplete_boolean_choice, previous, NULL);
if (found) {
@@ -2837,9 +2837,9 @@ _wintitle_autocomplete(ProfWin* window, const char* const input, gboolean previo
}
static char*
-_inpblock_autocomplete(ProfWin* window, const char* const input, gboolean previous)
+_inpblock_autocomplete(ProfWin *window, const char *const input, gboolean previous)
{
- char* found = NULL;
+ char *found = NULL;
found = autocomplete_param_with_func(input, "/inpblock dynamic", prefs_autocomplete_boolean_choice, previous, NULL);
if (found) {
@@ -2855,16 +2855,16 @@ _inpblock_autocomplete(ProfWin* window, const char* const input, gboolean previo
}
static char*
-_form_autocomplete(ProfWin* window, const char* const input, gboolean previous)
+_form_autocomplete(ProfWin *window, const char *const input, gboolean previous)
{
if (window->type != WIN_CONFIG) {
return NULL;
}
- char* found = NULL;
+ char *found = NULL;
- ProfConfWin* confwin = (ProfConfWin*)window;
- DataForm* form = confwin->form;
+ ProfConfWin *confwin = (ProfConfWin*)window;
+ DataForm *form = confwin->form;
if (form) {
found = autocomplete_param_with_ac(input, "/form help", form->tag_ac, TRUE, previous);
if (found) {
@@ -2881,34 +2881,33 @@ _form_autocomplete(ProfWin* window, const char* const input, gboolean previous)
}
static char*
-_form_field_autocomplete(ProfWin* window, const char* const input, gboolean previous)
+_form_field_autocomplete(ProfWin *window, const char *const input, gboolean previous)
{
if (window->type != WIN_CONFIG) {
return NULL;
}
- char* found = NULL;
+ char *found = NULL;
- ProfConfWin* confwin = (ProfConfWin*)window;
- DataForm* form = confwin->form;
+ ProfConfWin *confwin = (ProfConfWin*)window;
+ DataForm *form = confwin->form;
if (form == NULL) {
return NULL;
}
- gchar** split = g_strsplit(input, " ", 0);
+ gchar **split = g_strsplit(input, " ", 0);
if (g_strv_length(split) == 3) {
- char* field_tag = split[0] + 1;
+ char *field_tag = split[0]+1;
if (form_tag_exists(form, field_tag)) {
form_field_type_t field_type = form_get_field_type(form, field_tag);
- Autocomplete value_ac = form_get_value_ac(form, field_tag);
- ;
- GString* beginning = g_string_new(split[0]);
+ Autocomplete value_ac = form_get_value_ac(form, field_tag);;
+ GString *beginning = g_string_new(split[0]);
g_string_append(beginning, " ");
g_string_append(beginning, split[1]);
if (((g_strcmp0(split[1], "add") == 0) || (g_strcmp0(split[1], "remove") == 0))
- && field_type == FIELD_LIST_MULTI) {
+ && field_type == FIELD_LIST_MULTI) {
found = autocomplete_param_with_ac(input, beginning->str, value_ac, TRUE, previous);
} else if ((g_strcmp0(split[1], "remove") == 0) && field_type == FIELD_TEXT_MULTI) {
@@ -2922,26 +2921,26 @@ _form_field_autocomplete(ProfWin* window, const char* const input, gboolean prev
}
} else if (g_strv_length(split) == 2) {
- char* field_tag = split[0] + 1;
+ char *field_tag = split[0]+1;
if (form_tag_exists(form, field_tag)) {
form_field_type_t field_type = form_get_field_type(form, field_tag);
- Autocomplete value_ac = form_get_value_ac(form, field_tag);
- ;
-
- switch (field_type) {
- case FIELD_BOOLEAN:
- found = autocomplete_param_with_func(input, split[0], prefs_autocomplete_boolean_choice, previous, NULL);
- break;
- case FIELD_LIST_SINGLE:
- found = autocomplete_param_with_ac(input, split[0], value_ac, TRUE, previous);
- break;
- case FIELD_LIST_MULTI:
- case FIELD_JID_MULTI:
- case FIELD_TEXT_MULTI:
- found = autocomplete_param_with_ac(input, split[0], form_field_multi_ac, TRUE, previous);
- break;
- default:
- break;
+ Autocomplete value_ac = form_get_value_ac(form, field_tag);;
+
+ switch (field_type)
+ {
+ case FIELD_BOOLEAN:
+ found = autocomplete_param_with_func(input, split[0], prefs_autocomplete_boolean_choice, previous, NULL);
+ break;
+ case FIELD_LIST_SINGLE:
+ found = autocomplete_param_with_ac(input, split[0], value_ac, TRUE, previous);
+ break;
+ case FIELD_LIST_MULTI:
+ case FIELD_JID_MULTI:
+ case FIELD_TEXT_MULTI:
+ found = autocomplete_param_with_ac(input, split[0], form_field_multi_ac, TRUE, previous);
+ break;
+ default:
+ break;
}
}
}
@@ -2952,9 +2951,9 @@ _form_field_autocomplete(ProfWin* window, const char* const input, gboolean prev
}
static char*
-_occupants_autocomplete(ProfWin* window, const char* const input, gboolean previous)
+_occupants_autocomplete(ProfWin *window, const char *const input, gboolean previous)
{
- char* found = NULL;
+ char *found = NULL;
found = autocomplete_param_with_ac(input, "/occupants default show", occupants_show_ac, TRUE, previous);
if (found) {
@@ -3015,9 +3014,9 @@ _occupants_autocomplete(ProfWin* window, const char* const input, gboolean previ
}
static char*
-_time_autocomplete(ProfWin* window, const char* const input, gboolean previous)
+_time_autocomplete(ProfWin *window, const char *const input, gboolean previous)
{
- char* found = NULL;
+ char *found = NULL;
found = autocomplete_param_with_ac(input, "/time statusbar", time_format_ac, TRUE, previous);
if (found) {
@@ -3073,58 +3072,58 @@ _time_autocomplete(ProfWin* window, const char* const input, gboolean previous)
}
static char*
-_kick_autocomplete(ProfWin* window, const char* const input, gboolean previous)
+_kick_autocomplete(ProfWin *window, const char *const input, gboolean previous)
{
if (window->type != WIN_MUC) {
return NULL;
}
- ProfMucWin* mucwin = (ProfMucWin*)window;
+ ProfMucWin *mucwin = (ProfMucWin*)window;
assert(mucwin->memcheck == PROFMUCWIN_MEMCHECK);
Autocomplete nick_ac = muc_roster_ac(mucwin->roomjid);
if (nick_ac == NULL) {
return NULL;
}
- char* result = autocomplete_param_with_ac(input, "/kick", nick_ac, TRUE, previous);
+ char *result = autocomplete_param_with_ac(input, "/kick", nick_ac, TRUE, previous);
return result;
}
static char*
-_ban_autocomplete(ProfWin* window, const char* const input, gboolean previous)
+_ban_autocomplete(ProfWin *window, const char *const input, gboolean previous)
{
if (window->type != WIN_MUC) {
return NULL;
}
- ProfMucWin* mucwin = (ProfMucWin*)window;
+ ProfMucWin *mucwin = (ProfMucWin*)window;
assert(mucwin->memcheck == PROFMUCWIN_MEMCHECK);
Autocomplete jid_ac = muc_roster_jid_ac(mucwin->roomjid);
if (jid_ac == NULL) {
return NULL;
}
- char* result = autocomplete_param_with_ac(input, "/ban", jid_ac, TRUE, previous);
+ char *result = autocomplete_param_with_ac(input, "/ban", jid_ac, TRUE, previous);
return result;
}
static char*
-_affiliation_autocomplete(ProfWin* window, const char* const input, gboolean previous)
+_affiliation_autocomplete(ProfWin *window, const char *const input, gboolean previous)
{
- char* result = NULL;
+ char *result = NULL;
if (window->type == WIN_MUC) {
- ProfMucWin* mucwin = (ProfMucWin*)window;
+ ProfMucWin *mucwin = (ProfMucWin*)window;
assert(mucwin->memcheck == PROFMUCWIN_MEMCHECK);
gboolean parse_result;
Autocomplete jid_ac = muc_roster_jid_ac(mucwin->roomjid);
- gchar** args = parse_args(input, 2, 3, &parse_result);
+ gchar **args = parse_args(input, 2, 3, &parse_result);
if ((strncmp(input, "/affiliation", 12) == 0) && (parse_result == TRUE)) {
- GString* beginning = g_string_new("/affiliation ");
+ GString *beginning = g_string_new("/affiliation ");
g_string_append(beginning, args[0]);
g_string_append(beginning, " ");
if (args[1]) {
@@ -3161,20 +3160,20 @@ _affiliation_autocomplete(ProfWin* window, const char* const input, gboolean pre
}
static char*
-_role_autocomplete(ProfWin* window, const char* const input, gboolean previous)
+_role_autocomplete(ProfWin *window, const char *const input, gboolean previous)
{
- char* result = NULL;
+ char *result = NULL;
if (window->type == WIN_MUC) {
- ProfMucWin* mucwin = (ProfMucWin*)window;
+ ProfMucWin *mucwin = (ProfMucWin*)window;
assert(mucwin->memcheck == PROFMUCWIN_MEMCHECK);
gboolean parse_result;
Autocomplete nick_ac = muc_roster_ac(mucwin->roomjid);
- gchar** args = parse_args(input, 2, 3, &parse_result);
+ gchar **args = parse_args(input, 2, 3, &parse_result);
if ((strncmp(input, "/role", 5) == 0) && (parse_result == TRUE)) {
- GString* beginning = g_string_new("/role ");
+ GString *beginning = g_string_new("/role ");
g_string_append(beginning, args[0]);
g_string_append(beginning, " ");
if (args[1]) {
@@ -3211,9 +3210,9 @@ _role_autocomplete(ProfWin* window, const char* const input, gboolean previous)
}
static char*
-_wins_autocomplete(ProfWin* window, const char* const input, gboolean previous)
+_wins_autocomplete(ProfWin *window, const char *const input, gboolean previous)
{
- char* result = NULL;
+ char *result = NULL;
result = autocomplete_param_with_ac(input, "/wins", wins_ac, TRUE, previous);
if (result) {
@@ -3224,9 +3223,9 @@ _wins_autocomplete(ProfWin* window, const char* const input, gboolean previous)
}
static char*
-_tls_autocomplete(ProfWin* window, const char* const input, gboolean previous)
+_tls_autocomplete(ProfWin *window, const char *const input, gboolean previous)
{
- char* result = NULL;
+ char *result = NULL;
result = autocomplete_param_with_func(input, "/tls revoke", tlscerts_complete, previous, NULL);
if (result) {
@@ -3252,9 +3251,9 @@ _tls_autocomplete(ProfWin* window, const char* const input, gboolean previous)
}
static char*
-_titlebar_autocomplete(ProfWin* window, const char* const input, gboolean previous)
+_titlebar_autocomplete(ProfWin *window, const char *const input, gboolean previous)
{
- char* result = NULL;
+ char *result = NULL;
result = autocomplete_param_with_ac(input, "/titlebar show", titlebar_show_ac, TRUE, previous);
if (result) {
@@ -3275,9 +3274,9 @@ _titlebar_autocomplete(ProfWin* window, const char* const input, gboolean previo
}
static char*
-_receipts_autocomplete(ProfWin* window, const char* const input, gboolean previous)
+_receipts_autocomplete(ProfWin *window, const char *const input, gboolean previous)
{
- char* result = NULL;
+ char *result = NULL;
result = autocomplete_param_with_func(input, "/receipts send", prefs_autocomplete_boolean_choice, previous, NULL);
if (result) {
@@ -3298,9 +3297,9 @@ _receipts_autocomplete(ProfWin* window, const char* const input, gboolean previo
}
static char*
-_alias_autocomplete(ProfWin* window, const char* const input, gboolean previous)
+_alias_autocomplete(ProfWin *window, const char *const input, gboolean previous)
{
- char* result = NULL;
+ char *result = NULL;
result = autocomplete_param_with_ac(input, "/alias remove", aliases_ac, TRUE, previous);
if (result) {
@@ -3316,18 +3315,18 @@ _alias_autocomplete(ProfWin* window, const char* const input, gboolean previous)
}
static char*
-_connect_autocomplete(ProfWin* window, const char* const input, gboolean previous)
+_connect_autocomplete(ProfWin *window, const char *const input, gboolean previous)
{
- char* found = NULL;
+ char *found = NULL;
gboolean result = FALSE;
- gchar** args = parse_args(input, 1, 9, &result);
+ gchar **args = parse_args(input, 1, 9, &result);
if (result) {
gboolean space_at_end = g_str_has_suffix(input, " ");
int num_args = g_strv_length(args);
if ((num_args == 1 && space_at_end) || (num_args == 2 && !space_at_end)) {
- GString* beginning = g_string_new("/connect");
+ GString *beginning = g_string_new("/connect");
g_string_append_printf(beginning, " %s", args[0]);
found = autocomplete_param_with_ac(input, beginning->str, connect_property_ac, TRUE, previous);
g_string_free(beginning, TRUE);
@@ -3337,8 +3336,8 @@ _connect_autocomplete(ProfWin* window, const char* const input, gboolean previou
}
}
if ((num_args == 2 && space_at_end && (g_strcmp0(args[1], "tls") == 0))
- || (num_args == 3 && (g_strcmp0(args[1], "tls") == 0) && !space_at_end)) {
- GString* beginning = g_string_new("/connect");
+ || (num_args == 3 && (g_strcmp0(args[1], "tls") == 0) && !space_at_end)) {
+ GString *beginning = g_string_new("/connect");
g_string_append_printf(beginning, " %s %s", args[0], args[1]);
found = autocomplete_param_with_ac(input, beginning->str, tls_property_ac, TRUE, previous);
g_string_free(beginning, TRUE);
@@ -3348,7 +3347,7 @@ _connect_autocomplete(ProfWin* window, const char* const input, gboolean previou
}
}
if ((num_args == 3 && space_at_end) || (num_args == 4 && !space_at_end)) {
- GString* beginning = g_string_new("/connect");
+ GString *beginning = g_string_new("/connect");
g_string_append_printf(beginning, " %s %s %s", args[0], args[1], args[2]);
found = autocomplete_param_with_ac(input, beginning->str, connect_property_ac, TRUE, previous);
g_string_free(beginning, TRUE);
@@ -3358,8 +3357,8 @@ _connect_autocomplete(ProfWin* window, const char* const input, gboolean previou
}
}
if ((num_args == 4 && space_at_end && (g_strcmp0(args[3], "tls") == 0))
- || (num_args == 5 && (g_strcmp0(args[3], "tls") == 0) && !space_at_end)) {
- GString* beginning = g_string_new("/connect");
+ || (num_args == 5 && (g_strcmp0(args[3], "tls") == 0) && !space_at_end)) {
+ GString *beginning = g_string_new("/connect");
g_string_append_printf(beginning, " %s %s %s %s", args[0], args[1], args[2], args[3]);
found = autocomplete_param_with_ac(input, beginning->str, tls_property_ac, TRUE, previous);
g_string_free(beginning, TRUE);
@@ -3369,7 +3368,7 @@ _connect_autocomplete(ProfWin* window, const char* const input, gboolean previou
}
}
if ((num_args == 5 && space_at_end) || (num_args == 6 && !space_at_end)) {
- GString* beginning = g_string_new("/connect");
+ GString *beginning = g_string_new("/connect");
g_string_append_printf(beginning, " %s %s %s %s %s", args[0], args[1], args[2], args[3], args[4]);
found = autocomplete_param_with_ac(input, beginning->str, connect_property_ac, TRUE, previous);
g_string_free(beginning, TRUE);
@@ -3379,8 +3378,8 @@ _connect_autocomplete(ProfWin* window, const char* const input, gboolean previou
}
}
if ((num_args == 6 && space_at_end && (g_strcmp0(args[5], "tls") == 0))
- || (num_args == 7 && (g_strcmp0(args[5], "tls") == 0) && !space_at_end)) {
- GString* beginning = g_string_new("/connect");
+ || (num_args == 7 && (g_strcmp0(args[5], "tls") == 0) && !space_at_end)) {
+ GString *beginning = g_string_new("/connect");
g_string_append_printf(beginning, " %s %s %s %s %s %s", args[0], args[1], args[2], args[3], args[4], args[5]);
found = autocomplete_param_with_ac(input, beginning->str, tls_property_ac, TRUE, previous);
g_string_free(beginning, TRUE);
@@ -3390,7 +3389,7 @@ _connect_autocomplete(ProfWin* window, const char* const input, gboolean previou
}
}
if ((num_args == 7 && space_at_end) || (num_args == 8 && !space_at_end)) {
- GString* beginning = g_string_new("/connect");
+ GString *beginning = g_string_new("/connect");
g_string_append_printf(beginning, " %s %s %s %s %s %s %s", args[0], args[1], args[2], args[3], args[4], args[5], args[6]);
found = autocomplete_param_with_ac(input, beginning->str, connect_property_ac, TRUE, previous);
g_string_free(beginning, TRUE);
@@ -3400,8 +3399,8 @@ _connect_autocomplete(ProfWin* window, const char* const input, gboolean previou
}
}
if ((num_args == 8 && space_at_end && (g_strcmp0(args[7], "tls") == 0))
- || (num_args == 9 && (g_strcmp0(args[7], "tls") == 0) && !space_at_end)) {
- GString* beginning = g_string_new("/connect");
+ || (num_args == 9 && (g_strcmp0(args[7], "tls") == 0) && !space_at_end)) {
+ GString *beginning = g_string_new("/connect");
g_string_append_printf(beginning, " %s %s %s %s %s %s %s %s", args[0], args[1], args[2], args[3], args[4], args[5], args[6], args[7]);
found = autocomplete_param_with_ac(input, beginning->str, tls_property_ac, TRUE, previous);
g_string_free(beginning, TRUE);
@@ -3414,8 +3413,8 @@ _connect_autocomplete(ProfWin* window, const char* const input, gboolean previou
/* auth option */
if ((num_args == 2 && space_at_end && (g_strcmp0(args[1], "auth") == 0))
- || (num_args == 3 && (g_strcmp0(args[1], "auth") == 0) && !space_at_end)) {
- GString* beginning = g_string_new("/connect");
+ || (num_args == 3 && (g_strcmp0(args[1], "auth") == 0) && !space_at_end)) {
+ GString *beginning = g_string_new("/connect");
g_string_append_printf(beginning, " %s %s", args[0], args[1]);
found = autocomplete_param_with_ac(input, beginning->str, auth_property_ac, TRUE, previous);
g_string_free(beginning, TRUE);
@@ -3425,8 +3424,8 @@ _connect_autocomplete(ProfWin* window, const char* const input, gboolean previou
}
}
if ((num_args == 4 && space_at_end && (g_strcmp0(args[3], "auth") == 0))
- || (num_args == 5 && (g_strcmp0(args[3], "auth") == 0) && !space_at_end)) {
- GString* beginning = g_string_new("/connect");
+ || (num_args == 5 && (g_strcmp0(args[3], "auth") == 0) && !space_at_end)) {
+ GString *beginning = g_string_new("/connect");
g_string_append_printf(beginning, " %s %s %s %s", args[0], args[1], args[2], args[3]);
found = autocomplete_param_with_ac(input, beginning->str, auth_property_ac, TRUE, previous);
g_string_free(beginning, TRUE);
@@ -3436,8 +3435,8 @@ _connect_autocomplete(ProfWin* window, const char* const input, gboolean previou
}
}
if ((num_args == 6 && space_at_end && (g_strcmp0(args[5], "auth") == 0))
- || (num_args == 7 && (g_strcmp0(args[5], "auth") == 0) && !space_at_end)) {
- GString* beginning = g_string_new("/connect");
+ || (num_args == 7 && (g_strcmp0(args[5], "auth") == 0) && !space_at_end)) {
+ GString *beginning = g_string_new("/connect");
g_string_append_printf(beginning, " %s %s %s %s %s %s", args[0], args[1], args[2], args[3], args[4], args[5]);
found = autocomplete_param_with_ac(input, beginning->str, auth_property_ac, TRUE, previous);
g_string_free(beginning, TRUE);
@@ -3447,8 +3446,8 @@ _connect_autocomplete(ProfWin* window, const char* const input, gboolean previou
}
}
if ((num_args == 8 && space_at_end && (g_strcmp0(args[7], "auth") == 0))
- || (num_args == 9 && (g_strcmp0(args[7], "auth") == 0) && !space_at_end)) {
- GString* beginning = g_string_new("/connect");
+ || (num_args == 9 && (g_strcmp0(args[7], "auth") == 0) && !space_at_end)) {
+ GString *beginning = g_string_new("/connect");
g_string_append_printf(beginning, " %s %s %s %s %s %s %s %s", args[0], args[1], args[2], args[3], args[4], args[5], args[6], args[7]);
found = autocomplete_param_with_ac(input, beginning->str, auth_property_ac, TRUE, previous);
g_string_free(beginning, TRUE);
@@ -3470,9 +3469,9 @@ _connect_autocomplete(ProfWin* window, const char* const input, gboolean previou
}
static char*
-_help_autocomplete(ProfWin* window, const char* const input, gboolean previous)
+_help_autocomplete(ProfWin *window, const char *const input, gboolean previous)
{
- char* result = NULL;
+ char *result = NULL;
result = autocomplete_param_with_ac(input, "/help commands", help_commands_ac, TRUE, previous);
if (result) {
@@ -3488,18 +3487,18 @@ _help_autocomplete(ProfWin* window, const char* const input, gboolean previous)
}
static char*
-_join_autocomplete(ProfWin* window, const char* const input, gboolean previous)
+_join_autocomplete(ProfWin *window, const char *const input, gboolean previous)
{
- char* found = NULL;
+ char *found = NULL;
gboolean result = FALSE;
- gchar** args = parse_args(input, 1, 5, &result);
+ gchar **args = parse_args(input, 1, 5, &result);
if (result) {
gboolean space_at_end = g_str_has_suffix(input, " ");
int num_args = g_strv_length(args);
if ((num_args == 1 && space_at_end) || (num_args == 2 && !space_at_end)) {
- GString* beginning = g_string_new("/join");
+ GString *beginning = g_string_new("/join");
g_string_append_printf(beginning, " %s", args[0]);
found = autocomplete_param_with_ac(input, beginning->str, join_property_ac, TRUE, previous);
g_string_free(beginning, TRUE);
@@ -3509,7 +3508,7 @@ _join_autocomplete(ProfWin* window, const char* const input, gboolean previous)
}
}
if ((num_args == 3 && space_at_end) || (num_args == 4 && !space_at_end)) {
- GString* beginning = g_string_new("/join");
+ GString *beginning = g_string_new("/join");
g_string_append_printf(beginning, " %s %s %s", args[0], args[1], args[2]);
found = autocomplete_param_with_ac(input, beginning->str, join_property_ac, TRUE, previous);
g_string_free(beginning, TRUE);
@@ -3531,9 +3530,9 @@ _join_autocomplete(ProfWin* window, const char* const input, gboolean previous)
}
static char*
-_console_autocomplete(ProfWin* window, const char* const input, gboolean previous)
+_console_autocomplete(ProfWin *window, const char *const input, gboolean previous)
{
- char* result = NULL;
+ char *result = NULL;
result = autocomplete_param_with_ac(input, "/console chat", console_msg_ac, TRUE, previous);
if (result) {
@@ -3557,41 +3556,41 @@ _console_autocomplete(ProfWin* window, const char* const input, gboolean previou
}
static char*
-_win_autocomplete(ProfWin* window, const char* const input, gboolean previous)
+_win_autocomplete(ProfWin *window, const char *const input, gboolean previous)
{
return autocomplete_param_with_func(input, "/win", win_autocomplete, previous, NULL);
}
static char*
-_close_autocomplete(ProfWin* window, const char* const input, gboolean previous)
+_close_autocomplete(ProfWin *window, const char *const input, gboolean previous)
{
return autocomplete_param_with_func(input, "/close", win_close_autocomplete, previous, NULL);
}
static char*
-_sendfile_autocomplete(ProfWin* window, const char* const input, gboolean previous)
+_sendfile_autocomplete(ProfWin *window, const char *const input, gboolean previous)
{
return cmd_ac_complete_filepath(input, "/sendfile", previous);
}
static char*
-_subject_autocomplete(ProfWin* window, const char* const input, gboolean previous)
+_subject_autocomplete(ProfWin *window, const char *const input, gboolean previous)
{
- char* result = NULL;
+ char *result = NULL;
if (window->type == WIN_MUC) {
if ((g_strcmp0(input, "/subject e") == 0)
- || (g_strcmp0(input, "/subject ed") == 0)
- || (g_strcmp0(input, "/subject edi") == 0)
- || (g_strcmp0(input, "/subject edit") == 0)
- || (g_strcmp0(input, "/subject edit ") == 0)
- || (g_strcmp0(input, "/subject edit \"") == 0)) {
- ProfMucWin* mucwin = (ProfMucWin*)window;
+ || (g_strcmp0(input, "/subject ed") == 0)
+ || (g_strcmp0(input, "/subject edi") == 0)
+ || (g_strcmp0(input, "/subject edit") == 0)
+ || (g_strcmp0(input, "/subject edit ") == 0)
+ || (g_strcmp0(input, "/subject edit \"") == 0)) {
+ ProfMucWin *mucwin = (ProfMucWin*)window;
assert(mucwin->memcheck == PROFMUCWIN_MEMCHECK);
- char* subject = muc_subject(mucwin->roomjid);
+ char *subject = muc_subject(mucwin->roomjid);
if (subject) {
- GString* result_str = g_string_new("/subject edit \"");
+ GString *result_str = g_string_new("/subject edit \"");
g_string_append(result_str, subject);
g_string_append(result_str, "\"");
@@ -3613,17 +3612,17 @@ _subject_autocomplete(ProfWin* window, const char* const input, gboolean previou
}
static char*
-_account_autocomplete(ProfWin* window, const char* const input, gboolean previous)
+_account_autocomplete(ProfWin *window, const char *const input, gboolean previous)
{
- char* found = NULL;
+ char *found = NULL;
gboolean result = FALSE;
- gchar** args = parse_args(input, 2, 4, &result);
+ gchar **args = parse_args(input, 2, 4, &result);
if (result && (strcmp(args[0], "set") == 0)) {
gboolean space_at_end = g_str_has_suffix(input, " ");
int num_args = g_strv_length(args);
if ((num_args == 2 && space_at_end) || (num_args == 3 && !space_at_end)) {
- GString* beginning = g_string_new("/account");
+ GString *beginning = g_string_new("/account");
g_string_append_printf(beginning, " %s %s", args[0], args[1]);
found = autocomplete_param_with_ac(input, beginning->str, account_set_ac, TRUE, previous);
g_string_free(beginning, TRUE);
@@ -3634,8 +3633,8 @@ _account_autocomplete(ProfWin* window, const char* const input, gboolean previou
}
#ifdef HAVE_LIBOTR
if ((num_args == 3 && space_at_end && (g_strcmp0(args[2], "otr") == 0))
- || (num_args == 4 && (g_strcmp0(args[2], "otr") == 0) && !space_at_end)) {
- GString* beginning = g_string_new("/account");
+ || (num_args == 4 && (g_strcmp0(args[2], "otr") == 0) && !space_at_end)) {
+ GString *beginning = g_string_new("/account");
g_string_append_printf(beginning, " %s %s %s", args[0], args[1], args[2]);
found = autocomplete_param_with_ac(input, beginning->str, otr_policy_ac, TRUE, previous);
g_string_free(beginning, TRUE);
@@ -3646,8 +3645,8 @@ _account_autocomplete(ProfWin* window, const char* const input, gboolean previou
}
#endif
if ((num_args == 3 && space_at_end && (g_strcmp0(args[2], "status") == 0))
- || (num_args == 4 && (g_strcmp0(args[2], "status") == 0) && !space_at_end)) {
- GString* beginning = g_string_new("/account");
+ || (num_args == 4 && (g_strcmp0(args[2], "status") == 0) && !space_at_end)) {
+ GString *beginning = g_string_new("/account");
g_string_append_printf(beginning, " %s %s %s", args[0], args[1], args[2]);
found = autocomplete_param_with_ac(input, beginning->str, account_status_ac, TRUE, previous);
g_string_free(beginning, TRUE);
@@ -3657,8 +3656,8 @@ _account_autocomplete(ProfWin* window, const char* const input, gboolean previou
}
}
if ((num_args == 3 && space_at_end && (g_strcmp0(args[2], "tls") == 0))
- || (num_args == 4 && (g_strcmp0(args[2], "tls") == 0) && !space_at_end)) {
- GString* beginning = g_string_new("/account");
+ || (num_args == 4 && (g_strcmp0(args[2], "tls") == 0) && !space_at_end)) {
+ GString *beginning = g_string_new("/account");
g_string_append_printf(beginning, " %s %s %s", args[0], args[1], args[2]);
found = autocomplete_param_with_ac(input, beginning->str, tls_property_ac, TRUE, previous);
g_string_free(beginning, TRUE);
@@ -3668,8 +3667,8 @@ _account_autocomplete(ProfWin* window, const char* const input, gboolean previou
}
}
if ((num_args == 3 && space_at_end && (g_strcmp0(args[2], "auth") == 0))
- || (num_args == 4 && (g_strcmp0(args[2], "auth") == 0) && !space_at_end)) {
- GString* beginning = g_string_new("/account");
+ || (num_args == 4 && (g_strcmp0(args[2], "auth") == 0) && !space_at_end)) {
+ GString *beginning = g_string_new("/account");
g_string_append_printf(beginning, " %s %s %s", args[0], args[1], args[2]);
found = autocomplete_param_with_ac(input, beginning->str, auth_property_ac, TRUE, previous);
g_string_free(beginning, TRUE);
@@ -3679,8 +3678,8 @@ _account_autocomplete(ProfWin* window, const char* const input, gboolean previou
}
}
if ((num_args == 3 && space_at_end && (g_strcmp0(args[2], "startscript") == 0))
- || (num_args == 4 && (g_strcmp0(args[2], "startscript") == 0) && !space_at_end)) {
- GString* beginning = g_string_new("/account");
+ || (num_args == 4 && (g_strcmp0(args[2], "startscript") == 0) && !space_at_end)) {
+ GString *beginning = g_string_new("/account");
g_string_append_printf(beginning, " %s %s %s", args[0], args[1], args[2]);
found = autocomplete_param_with_func(input, beginning->str, _script_autocomplete_func, previous, NULL);
g_string_free(beginning, TRUE);
@@ -3690,13 +3689,13 @@ _account_autocomplete(ProfWin* window, const char* const input, gboolean previou
}
}
if ((num_args == 3 && space_at_end && (g_strcmp0(args[2], "theme") == 0))
- || (num_args == 4 && (g_strcmp0(args[2], "theme") == 0) && !space_at_end)) {
- GString* beginning = g_string_new("/account");
+ || (num_args == 4 && (g_strcmp0(args[2], "theme") == 0) && !space_at_end)) {
+ GString *beginning = g_string_new("/account");
g_string_append_printf(beginning, " %s %s %s", args[0], args[1], args[2]);
if (theme_load_ac == NULL) {
theme_load_ac = autocomplete_new();
- GSList* themes = theme_list();
- GSList* curr = themes;
+ GSList *themes = theme_list();
+ GSList *curr = themes;
while (curr) {
autocomplete_add(theme_load_ac, curr->data);
curr = g_slist_next(curr);
@@ -3713,8 +3712,8 @@ _account_autocomplete(ProfWin* window, const char* const input, gboolean previou
}
#ifdef HAVE_LIBGPGME
if ((num_args == 3 && space_at_end && (g_strcmp0(args[2], "pgpkeyid") == 0))
- || (num_args == 4 && (g_strcmp0(args[2], "pgpkeyid") == 0) && !space_at_end)) {
- GString* beginning = g_string_new("/account");
+ || (num_args == 4 && (g_strcmp0(args[2], "pgpkeyid") == 0) && !space_at_end)) {
+ GString *beginning = g_string_new("/account");
g_string_append_printf(beginning, " %s %s %s", args[0], args[1], args[2]);
found = autocomplete_param_with_func(input, beginning->str, p_gpg_autocomplete_key, previous, NULL);
g_string_free(beginning, TRUE);
@@ -3727,7 +3726,7 @@ _account_autocomplete(ProfWin* window, const char* const input, gboolean previou
}
if ((strncmp(input, "/account clear", 14) == 0) && (result == TRUE)) {
- GString* beginning = g_string_new("/account clear ");
+ GString *beginning = g_string_new("/account clear ");
g_string_append(beginning, args[1]);
found = autocomplete_param_with_ac(input, beginning->str, account_clear_ac, TRUE, previous);
g_string_free(beginning, TRUE);
@@ -3740,14 +3739,14 @@ _account_autocomplete(ProfWin* window, const char* const input, gboolean previou
g_strfreev(args);
found = autocomplete_param_with_ac(input, "/account default", account_default_ac, TRUE, previous);
- if (found) {
+ if(found){
return found;
}
int i = 0;
- gchar* account_choice[] = { "/account set", "/account show", "/account enable",
- "/account disable", "/account rename", "/account clear", "/account remove",
- "/account default set" };
+ gchar *account_choice[] = { "/account set", "/account show", "/account enable",
+ "/account disable", "/account rename", "/account clear", "/account remove",
+ "/account default set" };
for (i = 0; i < ARRAY_SIZE(account_choice); i++) {
found = autocomplete_param_with_func(input, account_choice[i], accounts_find_all, previous, NULL);
@@ -3761,9 +3760,9 @@ _account_autocomplete(ProfWin* window, const char* const input, gboolean previou
}
static char*
-_presence_autocomplete(ProfWin* window, const char* const input, gboolean previous)
+_presence_autocomplete(ProfWin *window, const char *const input, gboolean previous)
{
- char* found = NULL;
+ char *found = NULL;
found = autocomplete_param_with_func(input, "/presence titlebar", prefs_autocomplete_boolean_choice, previous, NULL);
if (found) {
@@ -3794,12 +3793,12 @@ _presence_autocomplete(ProfWin* window, const char* const input, gboolean previo
}
static char*
-_rooms_autocomplete(ProfWin* window, const char* const input, gboolean previous)
+_rooms_autocomplete(ProfWin *window, const char *const input, gboolean previous)
{
- char* found = NULL;
+ char *found = NULL;
gboolean result = FALSE;
- gchar** args = parse_args(input, 0, 4, &result);
+ gchar **args = parse_args(input, 0, 4, &result);
if (result) {
gboolean space_at_end = g_str_has_suffix(input, " ");
@@ -3811,14 +3810,16 @@ _rooms_autocomplete(ProfWin* window, const char* const input, gboolean previous)
return found;
}
}
- if ((num_args == 1 && g_strcmp0(args[0], "service") == 0 && space_at_end) || (num_args == 2 && g_strcmp0(args[0], "service") == 0 && !space_at_end)) {
+ if ((num_args == 1 && g_strcmp0(args[0], "service") == 0 && space_at_end) ||
+ (num_args == 2 && g_strcmp0(args[0], "service") == 0 && !space_at_end)) {
found = autocomplete_param_with_func(input, "/rooms service", muc_confserver_find, previous, NULL);
if (found) {
g_strfreev(args);
return found;
}
}
- if ((num_args == 1 && g_strcmp0(args[0], "cache") == 0 && space_at_end) || (num_args == 2 && g_strcmp0(args[0], "cache") == 0 && !space_at_end)) {
+ if ((num_args == 1 && g_strcmp0(args[0], "cache") == 0 && space_at_end) ||
+ (num_args == 2 && g_strcmp0(args[0], "cache") == 0 && !space_at_end)) {
found = autocomplete_param_with_ac(input, "/rooms cache", rooms_cache_ac, TRUE, previous);
if (found) {
g_strfreev(args);
@@ -3826,7 +3827,7 @@ _rooms_autocomplete(ProfWin* window, const char* const input, gboolean previous)
}
}
if ((num_args == 2 && space_at_end) || (num_args == 3 && !space_at_end)) {
- GString* beginning = g_string_new("/rooms");
+ GString *beginning = g_string_new("/rooms");
g_string_append_printf(beginning, " %s %s", args[0], args[1]);
found = autocomplete_param_with_ac(input, beginning->str, rooms_list_ac, TRUE, previous);
g_string_free(beginning, TRUE);
@@ -3835,8 +3836,9 @@ _rooms_autocomplete(ProfWin* window, const char* const input, gboolean previous)
return found;
}
}
- if ((num_args == 3 && g_strcmp0(args[2], "service") == 0 && space_at_end) || (num_args == 4 && g_strcmp0(args[2], "service") == 0 && !space_at_end)) {
- GString* beginning = g_string_new("/rooms");
+ if ((num_args == 3 && g_strcmp0(args[2], "service") == 0 && space_at_end) ||
+ (num_args == 4 && g_strcmp0(args[2], "service") == 0 && !space_at_end)) {
+ GString *beginning = g_string_new("/rooms");
g_string_append_printf(beginning, " %s %s %s", args[0], args[1], args[2]);
found = autocomplete_param_with_func(input, beginning->str, muc_confserver_find, previous, NULL);
g_string_free(beginning, TRUE);
@@ -3857,9 +3859,9 @@ _rooms_autocomplete(ProfWin* window, const char* const input, gboolean previous)
}
static char*
-_statusbar_autocomplete(ProfWin* window, const char* const input, gboolean previous)
+_statusbar_autocomplete(ProfWin *window, const char *const input, gboolean previous)
{
- char* found = NULL;
+ char *found = NULL;
found = autocomplete_param_with_ac(input, "/statusbar", statusbar_ac, TRUE, previous);
if (found) {
@@ -3895,9 +3897,9 @@ _statusbar_autocomplete(ProfWin* window, const char* const input, gboolean previ
}
static char*
-_clear_autocomplete(ProfWin* window, const char* const input, gboolean previous)
+_clear_autocomplete(ProfWin *window, const char *const input, gboolean previous)
{
- char* result = NULL;
+ char *result = NULL;
result = autocomplete_param_with_ac(input, "/clear", clear_ac, TRUE, previous);
if (result) {
@@ -3913,9 +3915,9 @@ _clear_autocomplete(ProfWin* window, const char* const input, gboolean previous)
}
static char*
-_invite_autocomplete(ProfWin* window, const char* const input, gboolean previous)
+_invite_autocomplete(ProfWin *window, const char *const input, gboolean previous)
{
- char* result = NULL;
+ char *result = NULL;
result = autocomplete_param_with_ac(input, "/invite", invite_ac, TRUE, previous);
if (result) {
@@ -3940,9 +3942,9 @@ _invite_autocomplete(ProfWin* window, const char* const input, gboolean previous
}
static char*
-_status_autocomplete(ProfWin* window, const char* const input, gboolean previous)
+_status_autocomplete(ProfWin *window, const char *const input, gboolean previous)
{
- char* result = NULL;
+ char *result = NULL;
result = autocomplete_param_with_ac(input, "/status", status_ac, TRUE, previous);
if (result) {
@@ -3960,11 +3962,11 @@ _status_autocomplete(ProfWin* window, const char* const input, gboolean previous
}
// Remove quote character before and after names when doing autocomplete
- char* unquoted = strip_arg_quotes(input);
+ char *unquoted = strip_arg_quotes(input);
// MUC completion with nicknames
if (window->type == WIN_MUC) {
- ProfMucWin* mucwin = (ProfMucWin*)window;
+ ProfMucWin *mucwin = (ProfMucWin*)window;
assert(mucwin->memcheck == PROFMUCWIN_MEMCHECK);
Autocomplete nick_ac = muc_roster_ac(mucwin->roomjid);
if (nick_ac) {
@@ -3974,7 +3976,7 @@ _status_autocomplete(ProfWin* window, const char* const input, gboolean previous
return result;
}
}
- // roster completion
+ // roster completion
} else {
result = autocomplete_param_with_func(unquoted, "/status get", roster_contact_autocomplete, previous, NULL);
if (result) {
@@ -3990,9 +3992,9 @@ _status_autocomplete(ProfWin* window, const char* const input, gboolean previous
}
static char*
-_logging_autocomplete(ProfWin* window, const char* const input, gboolean previous)
+_logging_autocomplete(ProfWin *window, const char *const input, gboolean previous)
{
- char* result = NULL;
+ char *result = NULL;
result = autocomplete_param_with_ac(input, "/logging", logging_ac, TRUE, previous);
if (result) {
@@ -4013,9 +4015,9 @@ _logging_autocomplete(ProfWin* window, const char* const input, gboolean previou
}
static char*
-_color_autocomplete(ProfWin* window, const char* const input, gboolean previous)
+_color_autocomplete(ProfWin *window, const char *const input, gboolean previous)
{
- char* result = NULL;
+ char *result = NULL;
result = autocomplete_param_with_func(input, "/color own", prefs_autocomplete_boolean_choice, previous, NULL);
if (result) {
@@ -4031,9 +4033,9 @@ _color_autocomplete(ProfWin* window, const char* const input, gboolean previous)
}
static char*
-_avatar_autocomplete(ProfWin* window, const char* const input, gboolean previous)
+_avatar_autocomplete(ProfWin *window, const char *const input, gboolean previous)
{
- char* result = NULL;
+ char *result = NULL;
result = autocomplete_param_with_ac(input, "/avatar", avatar_ac, TRUE, previous);
if (result) {
@@ -4057,9 +4059,9 @@ _avatar_autocomplete(ProfWin* window, const char* const input, gboolean previous
}
static char*
-_correction_autocomplete(ProfWin* window, const char* const input, gboolean previous)
+_correction_autocomplete(ProfWin *window, const char *const input, gboolean previous)
{
- char* result = NULL;
+ char *result = NULL;
result = autocomplete_param_with_ac(input, "/correction", correction_ac, TRUE, previous);
if (result) {
@@ -4070,55 +4072,55 @@ _correction_autocomplete(ProfWin* window, const char* const input, gboolean prev
}
static char*
-_correct_autocomplete(ProfWin* window, const char* const input, gboolean previous)
+_correct_autocomplete(ProfWin *window, const char *const input, gboolean previous)
{
- char* last_message = NULL;
- switch (window->type) {
- case WIN_CHAT:
- {
- ProfChatWin* chatwin = (ProfChatWin*)window;
- assert(chatwin->memcheck == PROFCHATWIN_MEMCHECK);
- last_message = chatwin->last_message;
- break;
- }
- case WIN_MUC:
- {
- ProfMucWin* mucwin = (ProfMucWin*)window;
- assert(mucwin->memcheck == PROFMUCWIN_MEMCHECK);
- last_message = mucwin->last_message;
- }
- default:
- break;
- }
-
- if (last_message == NULL) {
- return NULL;
- }
-
- GString* result_str = g_string_new("/correct ");
- g_string_append(result_str, last_message);
- char* result = result_str->str;
- g_string_free(result_str, FALSE);
-
- return result;
+ char *last_message = NULL;
+ switch(window->type) {
+ case WIN_CHAT:
+ {
+ ProfChatWin *chatwin = (ProfChatWin*)window;
+ assert(chatwin->memcheck == PROFCHATWIN_MEMCHECK);
+ last_message = chatwin->last_message;
+ break;
+ }
+ case WIN_MUC:
+ {
+ ProfMucWin *mucwin = (ProfMucWin*)window;
+ assert(mucwin->memcheck == PROFMUCWIN_MEMCHECK);
+ last_message = mucwin->last_message;
+ }
+ default:
+ break;
+ }
+
+ if (last_message == NULL) {
+ return NULL;
+ }
+
+ GString *result_str = g_string_new("/correct ");
+ g_string_append(result_str, last_message);
+ char *result = result_str->str;
+ g_string_free(result_str, FALSE);
+
+ return result;
}
static char*
-_software_autocomplete(ProfWin* window, const char* const input, gboolean previous)
+_software_autocomplete(ProfWin *window, const char *const input, gboolean previous)
{
- char* result = NULL;
+ char *result = NULL;
- if (window->type == WIN_CHAT) {
- ProfChatWin* chatwin = (ProfChatWin*)window;
+ if (window->type == WIN_CHAT){
+ ProfChatWin *chatwin = (ProfChatWin*)window;
assert(chatwin->memcheck == PROFCHATWIN_MEMCHECK);
- GString* search_str = g_string_new("/software ");
+ GString *search_str = g_string_new("/software ");
g_string_append(search_str, chatwin->barejid);
result = autocomplete_param_with_func(search_str->str, "/software", roster_fulljid_autocomplete, previous, NULL);
g_string_free(search_str, TRUE);
} else if (window->type == WIN_MUC) {
- ProfMucWin* mucwin = (ProfMucWin*)window;
- assert(mucwin->memcheck == PROFMUCWIN_MEMCHECK);
+ ProfMucWin *mucwin = (ProfMucWin*)window;
+ assert(mucwin->memcheck == PROFMUCWIN_MEMCHECK);
Autocomplete nick_ac = muc_roster_ac(mucwin->roomjid);
@@ -4128,27 +4130,29 @@ _software_autocomplete(ProfWin* window, const char* const input, gboolean previo
return result;
}
}
- } else {
+ } else {
result = autocomplete_param_with_func(input, "/software", roster_fulljid_autocomplete, previous, NULL);
if (result) {
return result;
}
- }
+ }
- return result;
+ return result;
}
static char*
-_url_autocomplete(ProfWin* window, const char* const input, gboolean previous)
+_url_autocomplete(ProfWin *window, const char *const input, gboolean previous)
{
- char* result = NULL;
+ char *result = NULL;
result = autocomplete_param_with_ac(input, "/url", url_ac, TRUE, previous);
if (result) {
return result;
}
- if (window->type == WIN_CHAT || window->type == WIN_MUC || window->type == WIN_PRIVATE) {
+ if (window->type == WIN_CHAT ||
+ window->type == WIN_MUC ||
+ window->type == WIN_PRIVATE) {
result = autocomplete_param_with_func(input, "/url open", wins_get_url, previous, window);
if (result) {
return result;
@@ -4161,9 +4165,9 @@ _url_autocomplete(ProfWin* window, const char* const input, gboolean previous)
}
static char*
-_executable_autocomplete(ProfWin* window, const char* const input, gboolean previous)
+_executable_autocomplete(ProfWin *window, const char *const input, gboolean previous)
{
- char* result = NULL;
+ char *result = NULL;
result = autocomplete_param_with_ac(input, "/executable", executable_ac, TRUE, previous);
if (result) {
diff --git a/src/command/cmd_ac.h b/src/command/cmd_ac.h
index 148f4ff3..d6ba3e2a 100644
--- a/src/command/cmd_ac.h
+++ b/src/command/cmd_ac.h
@@ -36,28 +36,28 @@
#ifndef COMMAND_CMD_AC_H
#define COMMAND_CMD_AC_H
-#include "command/cmd_funcs.h"
#include "config/preferences.h"
+#include "command/cmd_funcs.h"
void cmd_ac_init(void);
void cmd_ac_uninit(void);
-char* cmd_ac_complete(ProfWin* window, const char* const input, gboolean previous);
-void cmd_ac_reset(ProfWin* window);
-gboolean cmd_ac_exists(char* cmd);
+char* cmd_ac_complete(ProfWin *window, const char *const input, gboolean previous);
+void cmd_ac_reset(ProfWin *window);
+gboolean cmd_ac_exists(char *cmd);
-void cmd_ac_add(const char* const value);
-void cmd_ac_add_help(const char* const value);
-void cmd_ac_add_cmd(Command* command);
-void cmd_ac_add_alias(ProfAlias* alias);
-void cmd_ac_add_alias_value(char* value);
+void cmd_ac_add(const char *const value);
+void cmd_ac_add_help(const char *const value);
+void cmd_ac_add_cmd(Command *command);
+void cmd_ac_add_alias(ProfAlias *alias);
+void cmd_ac_add_alias_value(char *value);
-void cmd_ac_remove(const char* const value);
-void cmd_ac_remove_help(const char* const value);
-void cmd_ac_remove_alias_value(char* value);
+void cmd_ac_remove(const char *const value);
+void cmd_ac_remove_help(const char *const value);
+void cmd_ac_remove_alias_value(char *value);
-void cmd_ac_add_form_fields(DataForm* form);
-void cmd_ac_remove_form_fields(DataForm* form);
+void cmd_ac_add_form_fields(DataForm *form);
+void cmd_ac_remove_form_fields(DataForm *form);
-char* cmd_ac_complete_filepath(const char* const input, char* const startstr, gboolean previous);
+char* cmd_ac_complete_filepath(const char *const input, char *const startstr, gboolean previous);
#endif
diff --git a/src/command/cmd_defs.c b/src/command/cmd_defs.c
index 3ab77cdd..48cbc80d 100644
--- a/src/command/cmd_defs.c
+++ b/src/command/cmd_defs.c
@@ -39,40 +39,40 @@
#include "config.h"
#include <assert.h>
-#include <dirent.h>
#include <errno.h>
-#include <libgen.h>
#include <limits.h>
-#include <stdio.h>
#include <stdlib.h>
+#include <stdio.h>
#include <string.h>
+#include <libgen.h>
+#include <dirent.h>
#include <sys/types.h>
#include <glib.h>
-#include "command/cmd_ac.h"
+#include "profanity.h"
+#include "log.h"
+#include "common.h"
#include "command/cmd_defs.h"
#include "command/cmd_funcs.h"
-#include "common.h"
+#include "command/cmd_ac.h"
#include "config/accounts.h"
#include "config/preferences.h"
-#include "config/scripts.h"
#include "config/theme.h"
#include "config/tlscerts.h"
-#include "log.h"
+#include "config/scripts.h"
#include "plugins/plugins.h"
-#include "profanity.h"
#include "tools/autocomplete.h"
#include "tools/parser.h"
#include "tools/tinyurl.h"
#include "ui/ui.h"
#include "ui/window_list.h"
-#include "xmpp/chat_session.h"
+#include "xmpp/xmpp.h"
#include "xmpp/contact.h"
+#include "xmpp/roster_list.h"
#include "xmpp/jid.h"
+#include "xmpp/chat_session.h"
#include "xmpp/muc.h"
-#include "xmpp/roster_list.h"
-#include "xmpp/xmpp.h"
#ifdef HAVE_LIBOTR
#include "otr/otr.h"
@@ -82,2394 +82,2482 @@
#include "pgp/gpg.h"
#endif
-#define CMD_TAG_CHAT "chat"
-#define CMD_TAG_GROUPCHAT "groupchat"
-#define CMD_TAG_ROSTER "roster"
-#define CMD_TAG_PRESENCE "presence"
-#define CMD_TAG_CONNECTION "connection"
-#define CMD_TAG_DISCOVERY "discovery"
-#define CMD_TAG_UI "ui"
-#define CMD_TAG_PLUGINS "plugins"
-
-#define CMD_MAINFUNC(func) func,
-#define CMD_NOMAINFUNC NULL,
-#define CMD_SUBFUNCS(...) { __VA_ARGS__, { NULL, NULL } },
-#define CMD_NOSUBFUNCS { { NULL, NULL } },
-
-#define CMD_NOTAGS \
- { \
- { NULL },
-#define CMD_TAGS(...) \
- { \
- { __VA_ARGS__, NULL },
-#define CMD_SYN(...) { __VA_ARGS__, NULL },
-#define CMD_DESC(desc) desc,
-#define CMD_NOARGS { { NULL, NULL } },
-#define CMD_ARGS(...) { __VA_ARGS__, { NULL, NULL } },
-#define CMD_NOEXAMPLES \
- { \
- NULL \
- } \
- }
-#define CMD_EXAMPLES(...) \
- { \
- __VA_ARGS__, NULL \
- } \
- }
-
-GHashTable* commands = NULL;
-
-static gboolean _cmd_has_tag(Command* pcmd, const char* const tag);
+#define CMD_TAG_CHAT "chat"
+#define CMD_TAG_GROUPCHAT "groupchat"
+#define CMD_TAG_ROSTER "roster"
+#define CMD_TAG_PRESENCE "presence"
+#define CMD_TAG_CONNECTION "connection"
+#define CMD_TAG_DISCOVERY "discovery"
+#define CMD_TAG_UI "ui"
+#define CMD_TAG_PLUGINS "plugins"
+
+#define CMD_MAINFUNC(func) func,
+#define CMD_NOMAINFUNC NULL,
+#define CMD_SUBFUNCS(...) { __VA_ARGS__, { NULL, NULL } },
+#define CMD_NOSUBFUNCS { { NULL, NULL } },
+
+#define CMD_NOTAGS { { NULL },
+#define CMD_TAGS(...) { { __VA_ARGS__, NULL },
+#define CMD_SYN(...) { __VA_ARGS__, NULL },
+#define CMD_DESC(desc) desc,
+#define CMD_NOARGS { { NULL, NULL } },
+#define CMD_ARGS(...) { __VA_ARGS__, { NULL, NULL } },
+#define CMD_NOEXAMPLES { NULL } }
+#define CMD_EXAMPLES(...) { __VA_ARGS__, NULL } }
+
+GHashTable *commands = NULL;
+
+static gboolean _cmd_has_tag(Command *pcmd, const char *const tag);
/*
* Command list
*/
-static struct cmd_t command_defs[] = {
+static struct cmd_t command_defs[] =
+{
{ "/help",
- parse_args_with_freetext, 0, 2, NULL,
- CMD_NOSUBFUNCS
- CMD_MAINFUNC(cmd_help)
- CMD_NOTAGS
- CMD_SYN(
- "/help [<area>|<command>|search_all|search_any] [<search_terms>]")
- CMD_DESC(
- "Help on using Profanity. Passing no arguments list help areas. "
- "For command help, optional arguments are shown using square brackets, "
- "arguments representing variables rather than a literal name are surrounded by angle brackets. "
- "Arguments that may be one of a number of values are separated by a pipe "
- "e.g. val1|val2|val3.")
- CMD_ARGS(
- { "<area>", "Summary help for commands in a certain area of functionality." },
- { "<command>", "Full help for a specific command, for example '/help connect'." },
- { "search_all <search_terms>", "Search commands for returning matches that contain all of the search terms." },
- { "search_any <search_terms>", "Search commands for returning matches that contain any of the search terms." })
- CMD_EXAMPLES(
- "/help search_all presence online",
- "/help commands",
- "/help presence",
- "/help who") },
+ parse_args_with_freetext, 0, 2, NULL,
+ CMD_NOSUBFUNCS
+ CMD_MAINFUNC(cmd_help)
+ CMD_NOTAGS
+ CMD_SYN(
+ "/help [<area>|<command>|search_all|search_any] [<search_terms>]")
+ CMD_DESC(
+ "Help on using Profanity. Passing no arguments list help areas. "
+ "For command help, optional arguments are shown using square brackets, "
+ "arguments representing variables rather than a literal name are surrounded by angle brackets. "
+ "Arguments that may be one of a number of values are separated by a pipe "
+ "e.g. val1|val2|val3.")
+ CMD_ARGS(
+ { "<area>", "Summary help for commands in a certain area of functionality." },
+ { "<command>", "Full help for a specific command, for example '/help connect'." },
+ { "search_all <search_terms>", "Search commands for returning matches that contain all of the search terms." },
+ { "search_any <search_terms>", "Search commands for returning matches that contain any of the search terms." })
+ CMD_EXAMPLES(
+ "/help search_all presence online",
+ "/help commands",
+ "/help presence",
+ "/help who")
+ },
{ "/about",
- parse_args, 0, 0, NULL,
- CMD_NOSUBFUNCS
- CMD_MAINFUNC(cmd_about)
- CMD_NOTAGS
- CMD_SYN(
- "/about")
- CMD_DESC(
- "Show version and license information.")
- CMD_NOARGS
- CMD_NOEXAMPLES },
+ parse_args, 0, 0, NULL,
+ CMD_NOSUBFUNCS
+ CMD_MAINFUNC(cmd_about)
+ CMD_NOTAGS
+ CMD_SYN(
+ "/about")
+ CMD_DESC(
+ "Show version and license information.")
+ CMD_NOARGS
+ CMD_NOEXAMPLES
+ },
{ "/connect",
- parse_args, 0, 7, NULL,
- CMD_NOSUBFUNCS
- CMD_MAINFUNC(cmd_connect)
- CMD_TAGS(
- CMD_TAG_CONNECTION)
- CMD_SYN(
- "/connect [<account>]",
- "/connect <account> [server <server>] [port <port>] [tls force|allow|trust|legacy|disable] [auth default|legacy]")
- 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.")
- 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)." },
- { "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." },
- { "tls legacy", "Use legacy TLS for the connection. It means server doesn't support STARTTLS and TLS is forced just after TCP connection is established." },
- { "tls disable", "Disable TLS for the connection." },
- { "auth default", "Default authentication process." },
- { "auth legacy", "Allow legacy authentication." })
- CMD_EXAMPLES(
- "/connect",
- "/connect odin@valhalla.edda",
- "/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") },
+ parse_args, 0, 7, NULL,
+ CMD_NOSUBFUNCS
+ CMD_MAINFUNC(cmd_connect)
+ CMD_TAGS(
+ CMD_TAG_CONNECTION)
+ CMD_SYN(
+ "/connect [<account>]",
+ "/connect <account> [server <server>] [port <port>] [tls force|allow|trust|legacy|disable] [auth default|legacy]")
+ 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.")
+ 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)." },
+ { "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." },
+ { "tls legacy", "Use legacy TLS for the connection. It means server doesn't support STARTTLS and TLS is forced just after TCP connection is established." },
+ { "tls disable", "Disable TLS for the connection." },
+ { "auth default", "Default authentication process." },
+ { "auth legacy", "Allow legacy authentication." })
+ CMD_EXAMPLES(
+ "/connect",
+ "/connect odin@valhalla.edda",
+ "/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")
+ },
{ "/tls",
- parse_args, 1, 3, NULL,
- CMD_SUBFUNCS(
- { "certpath", cmd_tls_certpath },
- { "trust", cmd_tls_trust },
- { "trusted", cmd_tls_trusted },
- { "revoke", cmd_tls_revoke },
- { "cert", cmd_tls_cert })
- CMD_NOMAINFUNC
- CMD_TAGS(
- CMD_TAG_CONNECTION,
- CMD_TAG_UI)
- CMD_SYN(
- "/tls allow",
- "/tls always",
- "/tls deny",
- "/tls cert [<fingerprint>]",
- "/tls trust",
- "/tls trusted",
- "/tls revoke <fingerprint>",
- "/tls certpath",
- "/tls certpath set <path>",
- "/tls certpath clear",
- "/tls certpath default")
- CMD_DESC(
- "Handle TLS certificates. ")
- CMD_ARGS(
- { "allow", "Allow connection to continue with TLS certificate." },
- { "always", "Always allow connections with TLS certificate." },
- { "deny", "Abort connection." },
- { "cert", "Show the current TLS certificate." },
- { "cert <fingerprint>", "Show details of trusted certificate." },
- { "trust", "Add the current TLS certificate to manually trusted certificates." },
- { "trusted", "List summary of manually trusted certificates (with '/tls always' or '/tls trust')." },
- { "revoke <fingerprint>", "Remove a manually trusted certificate." },
- { "certpath", "Show the trusted certificate path." },
- { "certpath set <path>", "Specify filesystem path containing trusted certificates." },
- { "certpath clear", "Clear the trusted certificate path." },
- { "certpath default", "Use default system certificate path, if it can be found." })
- CMD_NOEXAMPLES },
+ parse_args, 1, 3, NULL,
+ CMD_SUBFUNCS(
+ { "certpath", cmd_tls_certpath },
+ { "trust", cmd_tls_trust },
+ { "trusted", cmd_tls_trusted },
+ { "revoke", cmd_tls_revoke },
+ { "cert", cmd_tls_cert })
+ CMD_NOMAINFUNC
+ CMD_TAGS(
+ CMD_TAG_CONNECTION,
+ CMD_TAG_UI)
+ CMD_SYN(
+ "/tls allow",
+ "/tls always",
+ "/tls deny",
+ "/tls cert [<fingerprint>]",
+ "/tls trust",
+ "/tls trusted",
+ "/tls revoke <fingerprint>",
+ "/tls certpath",
+ "/tls certpath set <path>",
+ "/tls certpath clear",
+ "/tls certpath default")
+ CMD_DESC(
+ "Handle TLS certificates. ")
+ CMD_ARGS(
+ { "allow", "Allow connection to continue with TLS certificate." },
+ { "always", "Always allow connections with TLS certificate." },
+ { "deny", "Abort connection." },
+ { "cert", "Show the current TLS certificate." },
+ { "cert <fingerprint>", "Show details of trusted certificate." },
+ { "trust", "Add the current TLS certificate to manually trusted certificates." },
+ { "trusted", "List summary of manually trusted certificates (with '/tls always' or '/tls trust')." },
+ { "revoke <fingerprint>", "Remove a manually trusted certificate." },
+ { "certpath", "Show the trusted certificate path." },
+ { "certpath set <path>", "Specify filesystem path containing trusted certificates." },
+ { "certpath clear", "Clear the trusted certificate path." },
+ { "certpath default", "Use default system certificate path, if it can be found." })
+ CMD_NOEXAMPLES
+ },
{ "/disconnect",
- parse_args, 0, 0, NULL,
- CMD_NOSUBFUNCS
- CMD_MAINFUNC(cmd_disconnect)
- CMD_TAGS(
- CMD_TAG_CONNECTION)
- CMD_SYN(
- "/disconnect")
- CMD_DESC(
- "Disconnect from the current chat service.")
- CMD_NOARGS
- CMD_NOEXAMPLES },
+ parse_args, 0, 0, NULL,
+ CMD_NOSUBFUNCS
+ CMD_MAINFUNC(cmd_disconnect)
+ CMD_TAGS(
+ CMD_TAG_CONNECTION)
+ CMD_SYN(
+ "/disconnect")
+ CMD_DESC(
+ "Disconnect from the current chat service.")
+ CMD_NOARGS
+ CMD_NOEXAMPLES
+ },
{ "/msg",
- parse_args_with_freetext, 1, 2, NULL,
- CMD_NOSUBFUNCS
- CMD_MAINFUNC(cmd_msg)
- CMD_TAGS(
- CMD_TAG_CHAT)
- CMD_SYN(
- "/msg <contact> [<message>]",
- "/msg <nick> [<message>]")
- CMD_DESC(
- "Send a one to one chat message, or a private message to a chat room occupant. "
- "If the message is omitted, a new chat window will be opened without sending a message. "
- "Use quotes if the nickname includes spaces.")
- CMD_ARGS(
- { "<contact>", "Open chat window with contact, by JID or nickname." },
- { "<contact> [<message>]", "Send message to contact, by JID or nickname." },
- { "<nick>", "Open private chat window with chat room occupant." },
- { "<nick> [<message>]", "Send a private message to a chat room occupant." })
- CMD_EXAMPLES(
- "/msg thor@valhalla.edda Hey, here's a message!",
- "/msg heimdall@valhalla.edda",
- "/msg Thor Here is a private message",
- "/msg \"My Friend\" Hi, how are you?") },
+ parse_args_with_freetext, 1, 2, NULL,
+ CMD_NOSUBFUNCS
+ CMD_MAINFUNC(cmd_msg)
+ CMD_TAGS(
+ CMD_TAG_CHAT)
+ CMD_SYN(
+ "/msg <contact> [<message>]",
+ "/msg <nick> [<message>]")
+ CMD_DESC(
+ "Send a one to one chat message, or a private message to a chat room occupant. "
+ "If the message is omitted, a new chat window will be opened without sending a message. "
+ "Use quotes if the nickname includes spaces.")
+ CMD_ARGS(
+ { "<contact>", "Open chat window with contact, by JID or nickname." },
+ { "<contact> [<message>]", "Send message to contact, by JID or nickname." },
+ { "<nick>", "Open private chat window with chat room occupant." },
+ { "<nick> [<message>]", "Send a private message to a chat room occupant." })
+ CMD_EXAMPLES(
+ "/msg thor@valhalla.edda Hey, here's a message!",
+ "/msg heimdall@valhalla.edda",
+ "/msg Thor Here is a private message",
+ "/msg \"My Friend\" Hi, how are you?")
+ },
{ "/roster",
- parse_args_with_freetext, 0, 4, NULL,
- CMD_SUBFUNCS(
- { "group", cmd_group })
- CMD_MAINFUNC(cmd_roster)
- CMD_TAGS(
- CMD_TAG_ROSTER,
- CMD_TAG_UI)
- CMD_SYN(
- "/roster",
- "/roster online",
- "/roster show [offline|resource|presence|status|empty|priority|contacts|rooms]",
- "/roster hide [offline|resource|presence|status|empty|priority|contacts|rooms]",
- "/roster by group|presence|none",
- "/roster count unread|items|off",
- "/roster count zero on|off",
- "/roster color on|off",
- "/roster order name|presence",
- "/roster unread before|after|off",
- "/roster room char <char>|none",
- "/roster room private char <char>|none",
- "/roster room position first|last",
- "/roster room by service|none",
- "/roster room order name|unread",
- "/roster room unread before|after|off",
- "/roster room show server",
- "/roster room hide server",
- "/roster room use name|jid",
- "/roster private room|group|off",
- "/roster private char <char>|none",
- "/roster header char <char>|none",
- "/roster presence indent <indent>",
- "/roster contact char <char>|none",
- "/roster contact indent <indent>",
- "/roster resource char <char>|none",
- "/roster resource indent <indent>",
- "/roster resource join on|off",
- "/roster size <percent>",
- "/roster wrap on|off",
- "/roster add <jid> [<nick>]",
- "/roster remove <jid>",
- "/roster remove_all contacts",
- "/roster nick <jid> <nick>",
- "/roster clearnick <jid>",
- "/roster group",
- "/roster group show <group>",
- "/roster group add <group> <contat>",
- "/roster group remove <group> <contact>")
- CMD_DESC(
- "Manage your roster, and roster display settings. "
- "Passing no arguments lists all contacts in your roster.")
- CMD_ARGS(
- { "online", "Show all online contacts in console." },
- { "show", "Show the roster panel." },
- { "show offline", "Show offline contacts in roster panel." },
- { "show resource", "Show contact's connected resources in roster panel." },
- { "show presence", "Show contact's presence in roster panel." },
- { "show status", "Show contact's status message in roster panel." },
- { "show empty", "Show empty groups in roster panel." },
- { "show priority", "Show resource priority in roster panel." },
- { "show contacts", "Show contacts in roster panel." },
- { "show rooms", "Show chat rooms in roster panel." },
- { "hide", "Hide the roster panel." },
- { "hide offline", "Hide offline contacts in roster panel." },
- { "hide resource", "Hide contact's connected resources in roster panel." },
- { "hide presence", "Hide contact's presence in roster panel." },
- { "hide status", "Hide contact's status message in roster panel." },
- { "hide empty", "Hide empty groups in roster panel." },
- { "hide priority", "Hide resource priority in roster panel." },
- { "hide contacts", "Hide contacts in roster panel." },
- { "hide rooms", "Hide chat rooms in roster panel." },
- { "by group", "Group contacts in roster panel by roster group." },
- { "by presence", "Group contacts in roster panel by presence." },
- { "by none", "No grouping in roster panel." },
- { "count unread", "Show unread message count with roster headers." },
- { "count items", "Show item count with roster headers." },
- { "count off", "Do not show any count with roster headers." },
- { "count zero on", "Show roster header count when 0." },
- { "count zero off", "Hide roster header count when 0." },
- { "color on", "Enable generated color names (XEP-0392)" },
- { "color off", "Disable generated color names (XEP-0392)" },
- { "order name", "Order roster contacts by name only." },
- { "order presence", "Order roster contacts by presence, and then by name." },
- { "unread before", "Show unread message count before contact." },
- { "unread after", "Show unread message count after contact." },
- { "unread off", "Do not show unread message count for contacts." },
- { "room char <char>", "Prefix rooms with specified character." },
- { "room char none", "Remove room character prefix." },
- { "room private char <char>", "Prefix private room chat with specified character when displayed with room." },
- { "room private char none", "Remove private room chat character prefix when displayed with room." },
- { "room position first", "Show rooms first in roster." },
- { "room position last", "Show rooms last in roster." },
- { "room by service", "Group rooms by chat service." },
- { "room by none", "Do not group rooms." },
- { "room order name", "Order rooms by name." },
- { "room order unread", "Order rooms by unread messages, and then by name." },
- { "room unread before", "Show unread message count before room." },
- { "room unread after", "Show unread message count after room." },
- { "room unread off", "Do not show unread message count for rooms." },
- { "room show server", "Show the conference server with room JIDs." },
- { "room hide server", "Do not show the conference server with room JIDs." },
- { "room use name", "Use the MUC name as room name." },
- { "room use jid", "Use the JID as room name." },
- { "private room", "Show room private chats with the room." },
- { "private group", "Show room private chats as a separate roster group." },
- { "private off", "Do not show room private chats." },
- { "private char <char>", "Prefix private room chats with specified character when displayed in separate group." },
- { "private char none", "Remove private room chat character prefix." },
- { "header char <char>", "Prefix roster headers with specified character." },
- { "header char none", "Remove roster header character prefix." },
- { "contact char <char>", "Prefix roster contacts with specified character." },
- { "contact char none", "Remove roster contact character prefix." },
- { "contact indent <indent>", "Indent contact line by <indent> spaces (0 to 10)." },
- { "resource char <char>", "Prefix roster resources with specified character." },
- { "resource char none", "Remove roster resource character prefix." },
- { "resource indent <indent>", "Indent resource line by <indent> spaces (0 to 10)." },
- { "resource join on|off", "Join resource with previous line when only one available resource." },
- { "presence indent <indent>", "Indent presence line by <indent> spaces (-1 to 10), a value of -1 will show presence on the previous line." },
- { "size <percent>", "Percentage of the screen taken up by the roster (1-99)." },
- { "wrap on|off", "Enable or disable line wrapping in roster panel." },
- { "add <jid> [<nick>]", "Add a new item to the roster." },
- { "remove <jid>", "Removes an item from the roster." },
- { "remove_all contacts", "Remove all items from roster." },
- { "nick <jid> <nick>", "Change a contacts nickname." },
- { "clearnick <jid>", "Removes the current nickname." },
- { "group show <group>", "List all roster items in a group." },
- { "group add <group> <contact>", "Add a contact to a group." },
- { "group remove <group> <contact>", "Remove a contact from a group." })
- CMD_EXAMPLES(
- "/roster",
- "/roster add odin@valhalla.edda",
- "/roster add odin@valhalla.edda Allfather",
- "/roster remove loki@ownserver.org",
- "/roster nick odin@valhalla.edda \"All Father\"",
- "/roster clearnick thor@valhalla.edda",
- "/roster size 15",
- "/roster group",
- "/roster group show friends",
- "/roster group add friends fenris@ownserver.org",
- "/roster group add family Brother",
- "/roster group remove colleagues boss@work.com") },
+ parse_args_with_freetext, 0, 4, NULL,
+ CMD_SUBFUNCS(
+ { "group", cmd_group })
+ CMD_MAINFUNC(cmd_roster)
+ CMD_TAGS(
+ CMD_TAG_ROSTER,
+ CMD_TAG_UI)
+ CMD_SYN(
+ "/roster",
+ "/roster online",
+ "/roster show [offline|resource|presence|status|empty|priority|contacts|rooms]",
+ "/roster hide [offline|resource|presence|status|empty|priority|contacts|rooms]",
+ "/roster by group|presence|none",
+ "/roster count unread|items|off",
+ "/roster count zero on|off",
+ "/roster color on|off",
+ "/roster order name|presence",
+ "/roster unread before|after|off",
+ "/roster room char <char>|none",
+ "/roster room private char <char>|none",
+ "/roster room position first|last",
+ "/roster room by service|none",
+ "/roster room order name|unread",
+ "/roster room unread before|after|off",
+ "/roster room show server",
+ "/roster room hide server",
+ "/roster room use name|jid",
+ "/roster private room|group|off",
+ "/roster private char <char>|none",
+ "/roster header char <char>|none",
+ "/roster presence indent <indent>",
+ "/roster contact char <char>|none",
+ "/roster contact indent <indent>",
+ "/roster resource char <char>|none",
+ "/roster resource indent <indent>",
+ "/roster resource join on|off",
+ "/roster size <percent>",
+ "/roster wrap on|off",
+ "/roster add <jid> [<nick>]",
+ "/roster remove <jid>",
+ "/roster remove_all contacts",
+ "/roster nick <jid> <nick>",
+ "/roster clearnick <jid>",
+ "/roster group",
+ "/roster group show <group>",
+ "/roster group add <group> <contat>",
+ "/roster group remove <group> <contact>")
+ CMD_DESC(
+ "Manage your roster, and roster display settings. "
+ "Passing no arguments lists all contacts in your roster.")
+ CMD_ARGS(
+ { "online", "Show all online contacts in console." },
+ { "show", "Show the roster panel." },
+ { "show offline", "Show offline contacts in roster panel." },
+ { "show resource", "Show contact's connected resources in roster panel." },
+ { "show presence", "Show contact's presence in roster panel." },
+ { "show status", "Show contact's status message in roster panel." },
+ { "show empty", "Show empty groups in roster panel." },
+ { "show priority", "Show resource priority in roster panel." },
+ { "show contacts", "Show contacts in roster panel." },
+ { "show rooms", "Show chat rooms in roster panel." },
+ { "hide", "Hide the roster panel." },
+ { "hide offline", "Hide offline contacts in roster panel." },
+ { "hide resource", "Hide contact's connected resources in roster panel." },
+ { "hide presence", "Hide contact's presence in roster panel." },
+ { "hide status", "Hide contact's status message in roster panel." },
+ { "hide empty", "Hide empty groups in roster panel." },
+ { "hide priority", "Hide resource priority in roster panel." },
+ { "hide contacts", "Hide contacts in roster panel." },
+ { "hide rooms", "Hide chat rooms in roster panel." },
+ { "by group", "Group contacts in roster panel by roster group." },
+ { "by presence", "Group contacts in roster panel by presence." },
+ { "by none", "No grouping in roster panel." },
+ { "count unread", "Show unread message count with roster headers." },
+ { "count items", "Show item count with roster headers." },
+ { "count off", "Do not show any count with roster headers." },
+ { "count zero on", "Show roster header count when 0." },
+ { "count zero off", "Hide roster header count when 0." },
+ { "color on", "Enable generated color names (XEP-0392)" },
+ { "color off", "Disable generated color names (XEP-0392)" },
+ { "order name", "Order roster contacts by name only." },
+ { "order presence", "Order roster contacts by presence, and then by name." },
+ { "unread before", "Show unread message count before contact." },
+ { "unread after", "Show unread message count after contact." },
+ { "unread off", "Do not show unread message count for contacts." },
+ { "room char <char>", "Prefix rooms with specified character." },
+ { "room char none", "Remove room character prefix." },
+ { "room private char <char>", "Prefix private room chat with specified character when displayed with room." },
+ { "room private char none", "Remove private room chat character prefix when displayed with room." },
+ { "room position first", "Show rooms first in roster." },
+ { "room position last", "Show rooms last in roster." },
+ { "room by service", "Group rooms by chat service." },
+ { "room by none", "Do not group rooms." },
+ { "room order name", "Order rooms by name." },
+ { "room order unread", "Order rooms by unread messages, and then by name." },
+ { "room unread before", "Show unread message count before room." },
+ { "room unread after", "Show unread message count after room." },
+ { "room unread off", "Do not show unread message count for rooms." },
+ { "room show server", "Show the conference server with room JIDs." },
+ { "room hide server", "Do not show the conference server with room JIDs." },
+ { "room use name", "Use the MUC name as room name." },
+ { "room use jid", "Use the JID as room name." },
+ { "private room", "Show room private chats with the room." },
+ { "private group", "Show room private chats as a separate roster group." },
+ { "private off", "Do not show room private chats." },
+ { "private char <char>", "Prefix private room chats with specified character when displayed in separate group." },
+ { "private char none", "Remove private room chat character prefix." },
+ { "header char <char>", "Prefix roster headers with specified character." },
+ { "header char none", "Remove roster header character prefix." },
+ { "contact char <char>", "Prefix roster contacts with specified character." },
+ { "contact char none", "Remove roster contact character prefix." },
+ { "contact indent <indent>", "Indent contact line by <indent> spaces (0 to 10)." },
+ { "resource char <char>", "Prefix roster resources with specified character." },
+ { "resource char none", "Remove roster resource character prefix." },
+ { "resource indent <indent>", "Indent resource line by <indent> spaces (0 to 10)." },
+ { "resource join on|off", "Join resource with previous line when only one available resource." },
+ { "presence indent <indent>", "Indent presence line by <indent> spaces (-1 to 10), a value of -1 will show presence on the previous line." },
+ { "size <percent>", "Percentage of the screen taken up by the roster (1-99)." },
+ { "wrap on|off", "Enable or disable line wrapping in roster panel." },
+ { "add <jid> [<nick>]", "Add a new item to the roster." },
+ { "remove <jid>", "Removes an item from the roster." },
+ { "remove_all contacts", "Remove all items from roster." },
+ { "nick <jid> <nick>", "Change a contacts nickname." },
+ { "clearnick <jid>", "Removes the current nickname." },
+ { "group show <group>", "List all roster items in a group." },
+ { "group add <group> <contact>", "Add a contact to a group." },
+ { "group remove <group> <contact>", "Remove a contact from a group." })
+ CMD_EXAMPLES(
+ "/roster",
+ "/roster add odin@valhalla.edda",
+ "/roster add odin@valhalla.edda Allfather",
+ "/roster remove loki@ownserver.org",
+ "/roster nick odin@valhalla.edda \"All Father\"",
+ "/roster clearnick thor@valhalla.edda",
+ "/roster size 15",
+ "/roster group",
+ "/roster group show friends",
+ "/roster group add friends fenris@ownserver.org",
+ "/roster group add family Brother",
+ "/roster group remove colleagues boss@work.com")
+ },
{ "/blocked",
- parse_args, 0, 2, NULL,
- CMD_NOSUBFUNCS
- CMD_MAINFUNC(cmd_blocked)
- CMD_TAGS(
- CMD_TAG_ROSTER,
- CMD_TAG_CHAT)
- CMD_SYN(
- "/blocked",
- "/blocked add [<jid>]",
- "/blocked remove <jid>")
- CMD_DESC(
- "Manage blocked users (XEP-0191), calling with no arguments shows the current list of blocked users. "
- "To blog a certain user in a MUC use the following as jid: room@conference.example.org/spammy-user")
- CMD_ARGS(
- { "add [<jid>]", "Block the specified Jabber ID. If in a chat window and no jid is specified, the current recipient will be blocked." },
- { "remove <jid>", "Remove the specified Jabber ID from the blocked list." })
- CMD_EXAMPLES(
- "/blocked add hel@helheim.edda",
- "/blocked add profanity@rooms.dismail.de/spammy-user") },
+ parse_args, 0, 2, NULL,
+ CMD_NOSUBFUNCS
+ CMD_MAINFUNC(cmd_blocked)
+ CMD_TAGS(
+ CMD_TAG_ROSTER,
+ CMD_TAG_CHAT)
+ CMD_SYN(
+ "/blocked",
+ "/blocked add [<jid>]",
+ "/blocked remove <jid>")
+ CMD_DESC(
+ "Manage blocked users (XEP-0191), calling with no arguments shows the current list of blocked users. "
+ "To blog a certain user in a MUC use the following as jid: room@conference.example.org/spammy-user")
+ CMD_ARGS(
+ { "add [<jid>]", "Block the specified Jabber ID. If in a chat window and no jid is specified, the current recipient will be blocked." },
+ { "remove <jid>", "Remove the specified Jabber ID from the blocked list." })
+ CMD_EXAMPLES(
+ "/blocked add hel@helheim.edda",
+ "/blocked add profanity@rooms.dismail.de/spammy-user")
+ },
{ "/info",
- parse_args, 0, 1, NULL,
- CMD_NOSUBFUNCS
- CMD_MAINFUNC(cmd_info)
- CMD_TAGS(
- CMD_TAG_ROSTER,
- CMD_TAG_CHAT,
- CMD_TAG_GROUPCHAT)
- CMD_SYN(
- "/info",
- "/info <contact>|<nick>")
- CMD_DESC(
- "Show information about a contact, room, or room member. "
- "Passing no argument in a chat window will use the current recipient. "
- "Passing no argument in a chat room will display information about the room.")
- CMD_ARGS(
- { "<contact>", "The contact you wish to view information about." },
- { "<nick>", "When in a chat room, the occupant you wish to view information about." })
- CMD_EXAMPLES(
- "/info thor@aasgard.server.org",
- "/info heimdall") },
+ parse_args, 0, 1, NULL,
+ CMD_NOSUBFUNCS
+ CMD_MAINFUNC(cmd_info)
+ CMD_TAGS(
+ CMD_TAG_ROSTER,
+ CMD_TAG_CHAT,
+ CMD_TAG_GROUPCHAT)
+ CMD_SYN(
+ "/info",
+ "/info <contact>|<nick>")
+ CMD_DESC(
+ "Show information about a contact, room, or room member. "
+ "Passing no argument in a chat window will use the current recipient. "
+ "Passing no argument in a chat room will display information about the room.")
+ CMD_ARGS(
+ { "<contact>", "The contact you wish to view information about." },
+ { "<nick>", "When in a chat room, the occupant you wish to view information about." })
+ CMD_EXAMPLES(
+ "/info thor@aasgard.server.org",
+ "/info heimdall")
+ },
{ "/caps",
- parse_args, 0, 1, NULL,
- CMD_NOSUBFUNCS
- CMD_MAINFUNC(cmd_caps)
- CMD_TAGS(
- CMD_TAG_DISCOVERY,
- CMD_TAG_CHAT,
- CMD_TAG_GROUPCHAT)
- CMD_SYN(
- "/caps",
- "/caps <fulljid>|<nick>")
- CMD_DESC(
- "Find out a contacts, or room members client software capabilities. "
- "If in private chat initiated from a chat room, no parameter is required.")
- CMD_ARGS(
- { "<fulljid>", "If in the console or a chat window, the full JID for which you wish to see capabilities." },
- { "<nick>", "If in a chat room, nickname for which you wish to see capabilities." })
- CMD_EXAMPLES(
- "/caps ran@cold.sea.org/laptop",
- "/caps ran@cold.sea.org/phone",
- "/caps aegir") },
+ parse_args, 0, 1, NULL,
+ CMD_NOSUBFUNCS
+ CMD_MAINFUNC(cmd_caps)
+ CMD_TAGS(
+ CMD_TAG_DISCOVERY,
+ CMD_TAG_CHAT,
+ CMD_TAG_GROUPCHAT)
+ CMD_SYN(
+ "/caps",
+ "/caps <fulljid>|<nick>")
+ CMD_DESC(
+ "Find out a contacts, or room members client software capabilities. "
+ "If in private chat initiated from a chat room, no parameter is required.")
+ CMD_ARGS(
+ { "<fulljid>", "If in the console or a chat window, the full JID for which you wish to see capabilities." },
+ { "<nick>", "If in a chat room, nickname for which you wish to see capabilities." })
+ CMD_EXAMPLES(
+ "/caps ran@cold.sea.org/laptop",
+ "/caps ran@cold.sea.org/phone",
+ "/caps aegir")
+ },
{ "/software",
- parse_args, 0, 1, NULL,
- CMD_NOSUBFUNCS
- CMD_MAINFUNC(cmd_software)
- CMD_TAGS(
- CMD_TAG_DISCOVERY,
- CMD_TAG_CHAT,
- CMD_TAG_GROUPCHAT)
- CMD_SYN(
- "/software",
- "/software <fulljid>|<nick>")
- CMD_DESC(
- "Find out a contact, or room members software version information. "
- "If in private chat initiated from a chat room, no parameter is required. "
- "If the contact's software does not support software version requests, nothing will be displayed.")
- CMD_ARGS(
- { "<fulljid>", "If in the console or a chat window, the full JID for which you wish to see software information." },
- { "<nick>", "If in a chat room, nickname for which you wish to see software information." })
- CMD_EXAMPLES(
- "/software odin@valhalla.edda/laptop",
- "/software odin@valhalla.edda/phone",
- "/software thor") },
+ parse_args, 0, 1, NULL,
+ CMD_NOSUBFUNCS
+ CMD_MAINFUNC(cmd_software)
+ CMD_TAGS(
+ CMD_TAG_DISCOVERY,
+ CMD_TAG_CHAT,
+ CMD_TAG_GROUPCHAT)
+ CMD_SYN(
+ "/software",
+ "/software <fulljid>|<nick>")
+ CMD_DESC(
+ "Find out a contact, or room members software version information. "
+ "If in private chat initiated from a chat room, no parameter is required. "
+ "If the contact's software does not support software version requests, nothing will be displayed.")
+ CMD_ARGS(
+ { "<fulljid>", "If in the console or a chat window, the full JID for which you wish to see software information." },
+ { "<nick>", "If in a chat room, nickname for which you wish to see software information." })
+ CMD_EXAMPLES(
+ "/software odin@valhalla.edda/laptop",
+ "/software odin@valhalla.edda/phone",
+ "/software thor")
+ },
{ "/status",
- parse_args, 2, 3, NULL,
- CMD_SUBFUNCS(
- { "get", cmd_status_get },
- { "set", cmd_status_set })
- CMD_NOMAINFUNC
- CMD_TAGS(
- CMD_TAG_CHAT,
- CMD_TAG_GROUPCHAT)
- CMD_SYN(
- "/status set <state> [\"<message>\"]",
- "/status get <contact>|<nick>")
- CMD_DESC(
- "/status get: Find out a contact, or room members presence information. "
- "/status set: set own status.")
- CMD_ARGS(
- { "<state>", "Own status. Possible values: chat, online, away, dnd, xa" },
- { "<message>", "Optional message to use with the status. Needs quotation marks if it's more than one word." },
- { "<contact>", "The contact who's presence you which to see." },
- { "<nick>", "If in a chat room, the occupant who's presence you wish to see." })
- CMD_EXAMPLES(
- "/status get odin@valhalla.edda",
- "/status get jon",
- "/status set online") },
+ parse_args, 2, 3, NULL,
+ CMD_SUBFUNCS(
+ { "get", cmd_status_get },
+ { "set", cmd_status_set })
+ CMD_NOMAINFUNC
+ CMD_TAGS(
+ CMD_TAG_CHAT,
+ CMD_TAG_GROUPCHAT)
+ CMD_SYN(
+ "/status set <state> [\"<message>\"]",
+ "/status get <contact>|<nick>")
+ CMD_DESC(
+ "/status get: Find out a contact, or room members presence information. "
+ "/status set: set own status.")
+ CMD_ARGS(
+ { "<state>", "Own status. Possible values: chat, online, away, dnd, xa" },
+ { "<message>", "Optional message to use with the status. Needs quotation marks if it's more than one word." },
+ { "<contact>", "The contact who's presence you which to see." },
+ { "<nick>", "If in a chat room, the occupant who's presence you wish to see." })
+ CMD_EXAMPLES(
+ "/status get odin@valhalla.edda",
+ "/status get jon",
+ "/status set online")
+ },
{ "/resource",
- parse_args, 1, 2, &cons_resource_setting,
- CMD_NOSUBFUNCS
- CMD_MAINFUNC(cmd_resource)
- CMD_TAGS(
- CMD_TAG_CHAT,
- CMD_TAG_UI)
- CMD_SYN(
- "/resource set <resource>",
- "/resource off",
- "/resource title on|off",
- "/resource message on|off")
- CMD_DESC(
- "Override chat session resource, and manage resource display settings.")
- CMD_ARGS(
- { "set <resource>", "Set the resource to which messages will be sent." },
- { "off", "Let the server choose which resource to route messages to." },
- { "title on|off", "Show or hide the current resource in the titlebar." },
- { "message on|off", "Show or hide the resource when showing an incoming message." })
- CMD_NOEXAMPLES },
+ parse_args, 1, 2, &cons_resource_setting,
+ CMD_NOSUBFUNCS
+ CMD_MAINFUNC(cmd_resource)
+ CMD_TAGS(
+ CMD_TAG_CHAT,
+ CMD_TAG_UI)
+ CMD_SYN(
+ "/resource set <resource>",
+ "/resource off",
+ "/resource title on|off",
+ "/resource message on|off")
+ CMD_DESC(
+ "Override chat session resource, and manage resource display settings.")
+ CMD_ARGS(
+ { "set <resource>", "Set the resource to which messages will be sent." },
+ { "off", "Let the server choose which resource to route messages to." },
+ { "title on|off", "Show or hide the current resource in the titlebar." },
+ { "message on|off", "Show or hide the resource when showing an incoming message." })
+ CMD_NOEXAMPLES
+ },
{ "/join",
- parse_args, 0, 5, NULL,
- CMD_NOSUBFUNCS
- CMD_MAINFUNC(cmd_join)
- CMD_TAGS(
- CMD_TAG_GROUPCHAT)
- CMD_SYN(
- "/join",
- "/join <room> [nick <nick>] [password <password>]")
- CMD_DESC(
- "Join a chat room at the conference server. "
- "If no room is supplied, a generated name will be used with the format private-chat-[UUID]. "
- "If the domain part is not included in the room name, the account preference 'muc.service' will be used. "
- "If no nickname is specified the account preference 'muc.nick' will be used which by default is the localpart of your JID. "
- "If the room doesn't exist, and the server allows it, a new one will be created.")
- CMD_ARGS(
- { "<room>", "The chat room to join." },
- { "nick <nick>", "Nickname to use in the room." },
- { "password <password>", "Password if the room requires one." })
- CMD_EXAMPLES(
- "/join",
- "/join profanity@rooms.dismail.de",
- "/join profanity@rooms.dismail.de nick mynick",
- "/join private@conference.jabber.org nick mynick password mypassword",
- "/join mychannel") },
+ parse_args, 0, 5, NULL,
+ CMD_NOSUBFUNCS
+ CMD_MAINFUNC(cmd_join)
+ CMD_TAGS(
+ CMD_TAG_GROUPCHAT)
+ CMD_SYN(
+ "/join",
+ "/join <room> [nick <nick>] [password <password>]")
+ CMD_DESC(
+ "Join a chat room at the conference server. "
+ "If no room is supplied, a generated name will be used with the format private-chat-[UUID]. "
+ "If the domain part is not included in the room name, the account preference 'muc.service' will be used. "
+ "If no nickname is specified the account preference 'muc.nick' will be used which by default is the localpart of your JID. "
+ "If the room doesn't exist, and the server allows it, a new one will be created.")
+ CMD_ARGS(
+ { "<room>", "The chat room to join." },
+ { "nick <nick>", "Nickname to use in the room." },
+ { "password <password>", "Password if the room requires one." })
+ CMD_EXAMPLES(
+ "/join",
+ "/join profanity@rooms.dismail.de",
+ "/join profanity@rooms.dismail.de nick mynick",
+ "/join private@conference.jabber.org nick mynick password mypassword",
+ "/join mychannel")
+ },
{ "/invite",
- parse_args_with_freetext, 1, 3, NULL,
- CMD_NOSUBFUNCS
- CMD_MAINFUNC(cmd_invite)
- CMD_TAGS(
- CMD_TAG_GROUPCHAT)
- CMD_SYN(
- "/invite send <contact> [<message>]",
- "/invite list",
- "/invite decline")
- CMD_DESC(
- "Manage room invites. "
- "Send an invite to a contact for the current chat room. "
- "List received invites. "
- "Decline them using /invite decline and accept them using /join.")
- CMD_ARGS(
- { "send <contact> [<message>]", "The contact you wish to invite. And an optional message." },
- { "list", "Show all rooms that you have been invited to, and not accepted or declined." },
- { "decline <room>", "Decline a chat room invitation." })
- CMD_EXAMPLES(
- "/invite send gustavo@pollos.tx",
- "/invite decline profanity@rooms.dismail.de",
- "/invite list") },
+ parse_args_with_freetext, 1, 3, NULL,
+ CMD_NOSUBFUNCS
+ CMD_MAINFUNC(cmd_invite)
+ CMD_TAGS(
+ CMD_TAG_GROUPCHAT)
+ CMD_SYN(
+ "/invite send <contact> [<message>]",
+ "/invite list",
+ "/invite decline")
+ CMD_DESC(
+ "Manage room invites. "
+ "Send an invite to a contact for the current chat room. "
+ "List received invites. "
+ "Decline them using /invite decline and accept them using /join.")
+ CMD_ARGS(
+ { "send <contact> [<message>]", "The contact you wish to invite. And an optional message." },
+ { "list", "Show all rooms that you have been invited to, and not accepted or declined."},
+ { "decline <room>", "Decline a chat room invitation."})
+ CMD_EXAMPLES(
+ "/invite send gustavo@pollos.tx",
+ "/invite decline profanity@rooms.dismail.de",
+ "/invite list")
+ },
{ "/room",
- parse_args, 1, 1, NULL,
- CMD_NOSUBFUNCS
- CMD_MAINFUNC(cmd_room)
- CMD_TAGS(
- CMD_TAG_GROUPCHAT)
- CMD_SYN(
- "/room accept|destroy|config")
- CMD_DESC(
- "Chat room configuration.")
- CMD_ARGS(
- { "accept", "Accept default room configuration." },
- { "destroy", "Reject default room configuration, and destroy the room." },
- { "config", "Edit room configuration." })
- CMD_NOEXAMPLES },
+ parse_args, 1, 1, NULL,
+ CMD_NOSUBFUNCS
+ CMD_MAINFUNC(cmd_room)
+ CMD_TAGS(
+ CMD_TAG_GROUPCHAT)
+ CMD_SYN(
+ "/room accept|destroy|config")
+ CMD_DESC(
+ "Chat room configuration.")
+ CMD_ARGS(
+ { "accept", "Accept default room configuration." },
+ { "destroy", "Reject default room configuration, and destroy the room." },
+ { "config", "Edit room configuration." })
+ CMD_NOEXAMPLES
+ },
{ "/kick",
- parse_args_with_freetext, 1, 2, NULL,
- CMD_NOSUBFUNCS
- CMD_MAINFUNC(cmd_kick)
- CMD_TAGS(
- CMD_TAG_GROUPCHAT)
- CMD_SYN(
- "/kick <nick> [<reason>]")
- CMD_DESC(
- "Kick occupant from chat room.")
- CMD_ARGS(
- { "<nick>", "Nickname of the occupant to kick from the room." },
- { "<reason>", "Optional reason for kicking the occupant." })
- CMD_NOEXAMPLES },
+ parse_args_with_freetext, 1, 2, NULL,
+ CMD_NOSUBFUNCS
+ CMD_MAINFUNC(cmd_kick)
+ CMD_TAGS(
+ CMD_TAG_GROUPCHAT)
+ CMD_SYN(
+ "/kick <nick> [<reason>]")
+ CMD_DESC(
+ "Kick occupant from chat room.")
+ CMD_ARGS(
+ { "<nick>", "Nickname of the occupant to kick from the room." },
+ { "<reason>", "Optional reason for kicking the occupant." })
+ CMD_NOEXAMPLES
+ },
{ "/ban",
- parse_args_with_freetext, 1, 2, NULL,
- CMD_NOSUBFUNCS
- CMD_MAINFUNC(cmd_ban)
- CMD_TAGS(
- CMD_TAG_GROUPCHAT)
- CMD_SYN(
- "/ban <jid> [<reason>]")
- CMD_DESC(
- "Ban user from chat room.")
- CMD_ARGS(
- { "<jid>", "Bare JID of the user to ban from the room." },
- { "<reason>", "Optional reason for banning the user." })
- CMD_NOEXAMPLES },
+ parse_args_with_freetext, 1, 2, NULL,
+ CMD_NOSUBFUNCS
+ CMD_MAINFUNC(cmd_ban)
+ CMD_TAGS(
+ CMD_TAG_GROUPCHAT)
+ CMD_SYN(
+ "/ban <jid> [<reason>]")
+ CMD_DESC(
+ "Ban user from chat room.")
+ CMD_ARGS(
+ { "<jid>", "Bare JID of the user to ban from the room." },
+ { "<reason>", "Optional reason for banning the user." })
+ CMD_NOEXAMPLES
+ },
{ "/subject",
- parse_args_with_freetext, 0, 2, NULL,
- CMD_NOSUBFUNCS
- CMD_MAINFUNC(cmd_subject)
- CMD_TAGS(
- CMD_TAG_GROUPCHAT)
- CMD_SYN(
- "/subject set <subject>",
- "/subject edit <subject>",
- "/subject prepend <text>",
- "/subject append <text>",
- "/subject clear")
- CMD_DESC(
- "Set, modify, or clear room subject.")
- CMD_ARGS(
- { "set <subject>", "Set the room subject." },
- { "edit <subject>", "Edit the current room subject, tab autocompletion will display the subject to edit." },
- { "prepend <text>", "Prepend text to the current room subject, use double quotes if a trailing space is needed." },
- { "append <text>", "Append text to the current room subject, use double quotes if a preceding space is needed." },
- { "clear", "Clear the room subject." })
- CMD_NOEXAMPLES },
+ parse_args_with_freetext, 0, 2, NULL,
+ CMD_NOSUBFUNCS
+ CMD_MAINFUNC(cmd_subject)
+ CMD_TAGS(
+ CMD_TAG_GROUPCHAT)
+ CMD_SYN(
+ "/subject set <subject>",
+ "/subject edit <subject>",
+ "/subject prepend <text>",
+ "/subject append <text>",
+ "/subject clear")
+ CMD_DESC(
+ "Set, modify, or clear room subject.")
+ CMD_ARGS(
+ { "set <subject>", "Set the room subject." },
+ { "edit <subject>", "Edit the current room subject, tab autocompletion will display the subject to edit." },
+ { "prepend <text>", "Prepend text to the current room subject, use double quotes if a trailing space is needed." },
+ { "append <text>", "Append text to the current room subject, use double quotes if a preceding space is needed." },
+ { "clear", "Clear the room subject." })
+ CMD_NOEXAMPLES
+ },
{ "/affiliation",
- parse_args_with_freetext, 1, 4, NULL,
- CMD_NOSUBFUNCS
- CMD_MAINFUNC(cmd_affiliation)
- CMD_TAGS(
- CMD_TAG_GROUPCHAT)
- CMD_SYN(
- "/affiliation set <affiliation> <jid> [<reason>]",
- "/affiliation list [<affiliation>]")
- CMD_DESC(
- "Manage room affiliations. "
- "Affiliation may be one of owner, admin, member, outcast or none.")
- CMD_ARGS(
- { "set <affiliation> <jid> [<reason>]", "Set the affiliation of user with jid, with an optional reason." },
- { "list [<affiliation>]", "List all users with the specified affiliation, or all if none specified." })
- CMD_NOEXAMPLES },
+ parse_args_with_freetext, 1, 4, NULL,
+ CMD_NOSUBFUNCS
+ CMD_MAINFUNC(cmd_affiliation)
+ CMD_TAGS(
+ CMD_TAG_GROUPCHAT)
+ CMD_SYN(
+ "/affiliation set <affiliation> <jid> [<reason>]",
+ "/affiliation list [<affiliation>]")
+ CMD_DESC(
+ "Manage room affiliations. "
+ "Affiliation may be one of owner, admin, member, outcast or none.")
+ CMD_ARGS(
+ { "set <affiliation> <jid> [<reason>]", "Set the affiliation of user with jid, with an optional reason." },
+ { "list [<affiliation>]", "List all users with the specified affiliation, or all if none specified." })
+ CMD_NOEXAMPLES
+ },
{ "/role",
- parse_args_with_freetext, 1, 4, NULL,
- CMD_NOSUBFUNCS
- CMD_MAINFUNC(cmd_role)
- CMD_TAGS(
- CMD_TAG_GROUPCHAT)
- CMD_SYN(
- "/role set <role> <nick> [<reason>]",
- "/role list [<role>]")
- CMD_DESC(
- "Manage room roles. "
- "Role may be one of moderator, participant, visitor or none.")
- CMD_ARGS(
- { "set <role> <nick> [<reason>]", "Set the role of occupant with nick, with an optional reason." },
- { "list [<role>]", "List all occupants with the specified role, or all if none specified." })
- CMD_NOEXAMPLES },
+ parse_args_with_freetext, 1, 4, NULL,
+ CMD_NOSUBFUNCS
+ CMD_MAINFUNC(cmd_role)
+ CMD_TAGS(
+ CMD_TAG_GROUPCHAT)
+ CMD_SYN(
+ "/role set <role> <nick> [<reason>]",
+ "/role list [<role>]")
+ CMD_DESC(
+ "Manage room roles. "
+ "Role may be one of moderator, participant, visitor or none.")
+ CMD_ARGS(
+ { "set <role> <nick> [<reason>]", "Set the role of occupant with nick, with an optional reason." },
+ { "list [<role>]", "List all occupants with the specified role, or all if none specified." })
+ CMD_NOEXAMPLES
+ },
{ "/occupants",
- parse_args, 1, 3, cons_occupants_setting,
- CMD_NOSUBFUNCS
- CMD_MAINFUNC(cmd_occupants)
- CMD_TAGS(
- CMD_TAG_GROUPCHAT,
- CMD_TAG_UI)
- CMD_SYN(
- "/occupants show|hide [jid]",
- "/occupants char <char>|none",
- "/occupants color on|off",
- "/occupants default show|hide [jid]",
- "/occupants size [<percent>]",
- "/occupants indent <indent>",
- "/occupants header char <char>|none",
- "/occupants wrap on|off")
- CMD_DESC(
- "Show or hide room occupants, and occupants panel display settings.")
- CMD_ARGS(
- { "show", "Show the occupants panel in current room." },
- { "char <char>", "Prefix occupants with specified character." },
- { "char none", "Remove occupants character prefix." },
- { "color on", "Enable generated color names (XEP-0392) for occupants" },
- { "color off", "Disable generated color names (XEP-0392) for occupants" },
- { "hide", "Hide the occupants panel in current room." },
- { "show jid", "Show jid in the occupants panel in current room." },
- { "hide jid", "Hide jid in the occupants panel in current room." },
- { "default show|hide", "Whether occupants are shown by default in new rooms." },
- { "default show|hide jid", "Whether occupants jids are shown by default in new rooms." },
- { "size <percent>", "Percentage of the screen taken by the occupants list in rooms (1-99)." },
- { "indent <indent>", "Indent contact line by <indent> spaces (0 to 10)." },
- { "header char <char>", "Prefix occupants headers with specified character." },
- { "header char none", "Remove occupants header character prefix." },
- { "wrap on|off", "Enable or disable line wrapping in occupants panel." })
- CMD_NOEXAMPLES },
+ parse_args, 1, 3, cons_occupants_setting,
+ CMD_NOSUBFUNCS
+ CMD_MAINFUNC(cmd_occupants)
+ CMD_TAGS(
+ CMD_TAG_GROUPCHAT,
+ CMD_TAG_UI)
+ CMD_SYN(
+ "/occupants show|hide [jid]",
+ "/occupants char <char>|none",
+ "/occupants color on|off",
+ "/occupants default show|hide [jid]",
+ "/occupants size [<percent>]",
+ "/occupants indent <indent>",
+ "/occupants header char <char>|none",
+ "/occupants wrap on|off")
+ CMD_DESC(
+ "Show or hide room occupants, and occupants panel display settings.")
+ CMD_ARGS(
+ { "show", "Show the occupants panel in current room." },
+ { "char <char>", "Prefix occupants with specified character." },
+ { "char none", "Remove occupants character prefix." },
+ { "color on", "Enable generated color names (XEP-0392) for occupants" },
+ { "color off", "Disable generated color names (XEP-0392) for occupants" },
+ { "hide", "Hide the occupants panel in current room." },
+ { "show jid", "Show jid in the occupants panel in current room." },
+ { "hide jid", "Hide jid in the occupants panel in current room." },
+ { "default show|hide", "Whether occupants are shown by default in new rooms." },
+ { "default show|hide jid", "Whether occupants jids are shown by default in new rooms." },
+ { "size <percent>", "Percentage of the screen taken by the occupants list in rooms (1-99)." },
+ { "indent <indent>", "Indent contact line by <indent> spaces (0 to 10)." },
+ { "header char <char>", "Prefix occupants headers with specified character." },
+ { "header char none", "Remove occupants header character prefix." },
+ { "wrap on|off", "Enable or disable line wrapping in occupants panel." })
+ CMD_NOEXAMPLES
+ },
{ "/form",
- parse_args, 1, 2, NULL,
- CMD_NOSUBFUNCS
- CMD_MAINFUNC(cmd_form)
- CMD_TAGS(
- CMD_TAG_GROUPCHAT)
- CMD_SYN(
- "/form show",
- "/form submit",
- "/form cancel",
- "/form help [<tag>]")
- CMD_DESC(
- "Form configuration.")
- CMD_ARGS(
- { "show", "Show the current form." },
- { "submit", "Submit the current form." },
- { "cancel", "Cancel changes to the current form." },
- { "help [<tag>]", "Display help for form, or a specific field." })
- CMD_NOEXAMPLES },
+ parse_args, 1, 2, NULL,
+ CMD_NOSUBFUNCS
+ CMD_MAINFUNC(cmd_form)
+ CMD_TAGS(
+ CMD_TAG_GROUPCHAT)
+ CMD_SYN(
+ "/form show",
+ "/form submit",
+ "/form cancel",
+ "/form help [<tag>]")
+ CMD_DESC(
+ "Form configuration.")
+ CMD_ARGS(
+ { "show", "Show the current form." },
+ { "submit", "Submit the current form." },
+ { "cancel", "Cancel changes to the current form." },
+ { "help [<tag>]", "Display help for form, or a specific field." })
+ CMD_NOEXAMPLES
+ },
{ "/rooms",
- parse_args, 0, 4, NULL,
- CMD_NOSUBFUNCS
- CMD_MAINFUNC(cmd_rooms)
- CMD_TAGS(
- CMD_TAG_GROUPCHAT)
- CMD_SYN(
- "/rooms",
- "/rooms filter <text>",
- "/rooms service <service>",
- "/rooms service <service> filter <text>",
- "/rooms cache on|off|clear")
- CMD_DESC(
- "List the chat rooms available at the specified conference service. "
- "If no argument is supplied, the account preference 'muc.service' is used, 'conference.<domain-part>' by default. "
- "The filter argument only shows rooms that contain the provided text, case insensitive.")
- CMD_ARGS(
- { "service <service>", "The conference service to query." },
- { "filter <text>", "The text to filter results by." },
- { "cache on|off", "Enable or disable caching of rooms list response, enabled by default." },
- { "cache clear", "Clear the rooms response cache if enabled." })
- CMD_EXAMPLES(
- "/rooms",
- "/rooms filter development",
- "/rooms service conference.jabber.org",
- "/rooms service conference.jabber.org filter \"News Room\"") },
+ parse_args, 0, 4, NULL,
+ CMD_NOSUBFUNCS
+ CMD_MAINFUNC(cmd_rooms)
+ CMD_TAGS(
+ CMD_TAG_GROUPCHAT)
+ CMD_SYN(
+ "/rooms",
+ "/rooms filter <text>",
+ "/rooms service <service>",
+ "/rooms service <service> filter <text>",
+ "/rooms cache on|off|clear")
+ CMD_DESC(
+ "List the chat rooms available at the specified conference service. "
+ "If no argument is supplied, the account preference 'muc.service' is used, 'conference.<domain-part>' by default. "
+ "The filter argument only shows rooms that contain the provided text, case insensitive.")
+ CMD_ARGS(
+ { "service <service>", "The conference service to query." },
+ { "filter <text>", "The text to filter results by."},
+ { "cache on|off", "Enable or disable caching of rooms list response, enabled by default."},
+ { "cache clear", "Clear the rooms response cache if enabled."})
+ CMD_EXAMPLES(
+ "/rooms",
+ "/rooms filter development",
+ "/rooms service conference.jabber.org",
+ "/rooms service conference.jabber.org filter \"News Room\"")
+ },
{ "/bookmark",
- parse_args, 0, 8, NULL,
- CMD_SUBFUNCS(
- { "ignore", cmd_bookmark_ignore })
- CMD_MAINFUNC(cmd_bookmark)
- CMD_TAGS(
- CMD_TAG_GROUPCHAT)
- CMD_SYN(
- "/bookmark",
- "/bookmark list",
- "/bookmark add [<room>] [nick <nick>] [password <password>] [name <roomname>] [autojoin on|off]",
- "/bookmark update <room> [nick <nick>] [password <password>] [name <roomname>] autojoin on|off]",
- "/bookmark remove [<room>]",
- "/bookmark join <room>",
- "/bookmark invites on|off",
- "/bookmark ignore",
- "/bookmark ignore add <jid>",
- "/bookmark ignore remove <jid>")
- CMD_DESC(
- "Manage bookmarks and join bookmarked rooms. "
- "In a chat room, no arguments will bookmark the current room, setting autojoin to \"on\"."
- "There is also an autojoin ignore list in case you want to autojoind in many clients but not on Profanity.")
- CMD_ARGS(
- { "list", "List all bookmarks." },
- { "add [<room>]", "Add a bookmark, passing no room will bookmark the current room, setting autojoin to \"on\"." },
- { "remove [<room>]", "Remove a bookmark, passing no room will remove the bookmark for the current room, if one exists." },
- { "update <room>", "Update the properties associated with a bookmark." },
- { "nick <nick>", "Nickname used in the chat room." },
- { "password <password>", "Password if required, may be stored in plaintext on your server." },
- { "name <roomname>", "Optional name for the bookmark. By default localpart of the JID will be used." },
- { "autojoin on|off", "Whether to join the room automatically on login." },
- { "join <room>", "Join room using the properties associated with the bookmark." },
- { "invites on|off", "Whether or not to bookmark accepted room invites, defaults to 'on'." },
- { "ignore add <barejid>", "Add a bookmark to the autojoin ignore list." },
- { "ignore remove <barejid>", "Remove a bookmark from the autojoin ignore list." })
- CMD_NOEXAMPLES },
+ parse_args, 0, 8, NULL,
+ CMD_SUBFUNCS(
+ { "ignore", cmd_bookmark_ignore }
+ )
+ CMD_MAINFUNC(cmd_bookmark)
+ CMD_TAGS(
+ CMD_TAG_GROUPCHAT)
+ CMD_SYN(
+ "/bookmark",
+ "/bookmark list",
+ "/bookmark add [<room>] [nick <nick>] [password <password>] [name <roomname>] [autojoin on|off]",
+ "/bookmark update <room> [nick <nick>] [password <password>] [name <roomname>] autojoin on|off]",
+ "/bookmark remove [<room>]",
+ "/bookmark join <room>",
+ "/bookmark invites on|off",
+ "/bookmark ignore",
+ "/bookmark ignore add <jid>",
+ "/bookmark ignore remove <jid>")
+ CMD_DESC(
+ "Manage bookmarks and join bookmarked rooms. "
+ "In a chat room, no arguments will bookmark the current room, setting autojoin to \"on\"."
+ "There is also an autojoin ignore list in case you want to autojoind in many clients but not on Profanity.")
+ CMD_ARGS(
+ { "list", "List all bookmarks." },
+ { "add [<room>]", "Add a bookmark, passing no room will bookmark the current room, setting autojoin to \"on\"." },
+ { "remove [<room>]", "Remove a bookmark, passing no room will remove the bookmark for the current room, if one exists." },
+ { "update <room>", "Update the properties associated with a bookmark." },
+ { "nick <nick>", "Nickname used in the chat room." },
+ { "password <password>", "Password if required, may be stored in plaintext on your server." },
+ { "name <roomname>", "Optional name for the bookmark. By default localpart of the JID will be used." },
+ { "autojoin on|off", "Whether to join the room automatically on login." },
+ { "join <room>", "Join room using the properties associated with the bookmark." },
+ { "invites on|off", "Whether or not to bookmark accepted room invites, defaults to 'on'."},
+ { "ignore add <barejid>", "Add a bookmark to the autojoin ignore list."},
+ { "ignore remove <barejid>", "Remove a bookmark from the autojoin ignore list."})
+ CMD_NOEXAMPLES
+ },
{ "/disco",
- parse_args, 1, 2, NULL,
- CMD_NOSUBFUNCS
- CMD_MAINFUNC(cmd_disco)
- CMD_TAGS(
- CMD_TAG_DISCOVERY)
- CMD_SYN(
- "/disco info [<jid>]",
- "/disco items [<jid>]")
- CMD_DESC(
- "Find out information about an entities supported services. "
- "Calling with no arguments will query the server you are currently connected to.")
- CMD_ARGS(
- { "info [<jid>]", "List protocols and features supported by an entity." },
- { "items [<jid>]", "List items associated with an entity." })
- CMD_EXAMPLES(
- "/disco info",
- "/disco items myserver.org",
- "/disco items conference.jabber.org",
- "/disco info odin@valhalla.edda/laptop") },
+ parse_args, 1, 2, NULL,
+ CMD_NOSUBFUNCS
+ CMD_MAINFUNC(cmd_disco)
+ CMD_TAGS(
+ CMD_TAG_DISCOVERY)
+ CMD_SYN(
+ "/disco info [<jid>]",
+ "/disco items [<jid>]")
+ CMD_DESC(
+ "Find out information about an entities supported services. "
+ "Calling with no arguments will query the server you are currently connected to.")
+ CMD_ARGS(
+ { "info [<jid>]", "List protocols and features supported by an entity." },
+ { "items [<jid>]", "List items associated with an entity." })
+ CMD_EXAMPLES(
+ "/disco info",
+ "/disco items myserver.org",
+ "/disco items conference.jabber.org",
+ "/disco info odin@valhalla.edda/laptop")
+ },
{ "/sendfile",
- parse_args_with_freetext, 1, 1, NULL,
- CMD_NOSUBFUNCS
- CMD_MAINFUNC(cmd_sendfile)
- CMD_TAGS(
- CMD_TAG_CHAT,
- CMD_TAG_GROUPCHAT)
- CMD_SYN(
- "/sendfile <file>")
- CMD_DESC(
- "Send a file using XEP-0363 HTTP file transfer.")
- CMD_ARGS(
- { "<file>", "Path to the file." })
- CMD_EXAMPLES(
- "/sendfile /etc/hosts",
- "/sendfile ~/images/sweet_cat.jpg") },
+ parse_args_with_freetext, 1, 1, NULL,
+ CMD_NOSUBFUNCS
+ CMD_MAINFUNC(cmd_sendfile)
+ CMD_TAGS(
+ CMD_TAG_CHAT,
+ CMD_TAG_GROUPCHAT)
+ CMD_SYN(
+ "/sendfile <file>")
+ CMD_DESC(
+ "Send a file using XEP-0363 HTTP file transfer.")
+ CMD_ARGS(
+ { "<file>", "Path to the file." })
+ CMD_EXAMPLES(
+ "/sendfile /etc/hosts",
+ "/sendfile ~/images/sweet_cat.jpg")
+ },
{ "/lastactivity",
- parse_args, 0, 1, NULL,
- CMD_NOSUBFUNCS
- CMD_MAINFUNC(cmd_lastactivity)
- CMD_TAGS(
- CMD_TAG_PRESENCE)
- CMD_SYN(
- "/lastactivity on|off",
- "/lastactivity [<jid>]")
- CMD_DESC(
- "Enable/disable sending last activity, and send last activity requests.")
- CMD_ARGS(
- { "on|off", "Enable or disable sending of last activity." },
- { "<jid>", "The JID of the entity to query, omitting the JID will query your server." })
- CMD_EXAMPLES(
- "/lastactivity",
- "/lastactivity off",
- "/lastactivity freyja@asgaard.edda",
- "/lastactivity freyja@asgaard.edda/laptop",
- "/lastactivity someserver.com") },
+ parse_args, 0, 1, NULL,
+ CMD_NOSUBFUNCS
+ CMD_MAINFUNC(cmd_lastactivity)
+ CMD_TAGS(
+ CMD_TAG_PRESENCE)
+ CMD_SYN(
+ "/lastactivity on|off",
+ "/lastactivity [<jid>]")
+ CMD_DESC(
+ "Enable/disable sending last activity, and send last activity requests.")
+ CMD_ARGS(
+ { "on|off", "Enable or disable sending of last activity." },
+ { "<jid>", "The JID of the entity to query, omitting the JID will query your server." })
+ CMD_EXAMPLES(
+ "/lastactivity",
+ "/lastactivity off",
+ "/lastactivity freyja@asgaard.edda",
+ "/lastactivity freyja@asgaard.edda/laptop",
+ "/lastactivity someserver.com")
+ },
{ "/nick",
- parse_args_with_freetext, 1, 1, NULL,
- CMD_NOSUBFUNCS
- CMD_MAINFUNC(cmd_nick)
- CMD_TAGS(
- CMD_TAG_GROUPCHAT)
- CMD_SYN(
- "/nick <nickname>")
- CMD_DESC(
- "Change your nickname in the current chat room.")
- CMD_ARGS(
- { "<nickname>", "Your new nickname." })
- CMD_NOEXAMPLES },
+ parse_args_with_freetext, 1, 1, NULL,
+ CMD_NOSUBFUNCS
+ CMD_MAINFUNC(cmd_nick)
+ CMD_TAGS(
+ CMD_TAG_GROUPCHAT)
+ CMD_SYN(
+ "/nick <nickname>")
+ CMD_DESC(
+ "Change your nickname in the current chat room.")
+ CMD_ARGS(
+ { "<nickname>", "Your new nickname." })
+ CMD_NOEXAMPLES
+ },
{ "/win",
- parse_args, 1, 1, NULL,
- CMD_NOSUBFUNCS
- CMD_MAINFUNC(cmd_win)
- CMD_TAGS(
- CMD_TAG_UI)
- CMD_SYN(
- "/win console",
- "/win <num>",
- "/win <barejid>",
- "/win <nick>",
- "/win <roomjid>",
- "/win <roomoccupantjid>",
- "/win xmlconsole",
- "/win <plugin>")
- CMD_DESC(
- "Move to the specified window.")
- CMD_ARGS(
- { "console", "Focus the Console window." },
- { "<num>", "Focus specified window number." },
- { "<barejid>", "Focus chat window with contact by JID if open." },
- { "<nick>", "Focus chat window with contact by nickname if open." },
- { "<roomjid>", "Focus chat room window with roomjid if open." },
- { "<roomoccupantjid>", "Focus private chat roomoccupantjid if open." },
- { "xmlconsole", "Focus the XML Console window if open." },
- { "<plugin>", "Focus the plugin window." })
- CMD_EXAMPLES(
- "/win console",
- "/win 4",
- "/win odin@valhalla.edda",
- "/win Eddie",
- "/win bigroom@conference.chat.org",
- "/win bigroom@conference.chat.org/thor",
- "/win wikipedia") },
+ parse_args, 1, 1, NULL,
+ CMD_NOSUBFUNCS
+ CMD_MAINFUNC(cmd_win)
+ CMD_TAGS(
+ CMD_TAG_UI)
+ CMD_SYN(
+ "/win console",
+ "/win <num>",
+ "/win <barejid>",
+ "/win <nick>",
+ "/win <roomjid>",
+ "/win <roomoccupantjid>",
+ "/win xmlconsole",
+ "/win <plugin>")
+ CMD_DESC(
+ "Move to the specified window.")
+ CMD_ARGS(
+ { "console", "Focus the Console window." },
+ { "<num>", "Focus specified window number." },
+ { "<barejid>", "Focus chat window with contact by JID if open." },
+ { "<nick>", "Focus chat window with contact by nickname if open." },
+ { "<roomjid>", "Focus chat room window with roomjid if open." },
+ { "<roomoccupantjid>", "Focus private chat roomoccupantjid if open." },
+ { "xmlconsole", "Focus the XML Console window if open." },
+ { "<plugin>", "Focus the plugin window."})
+ CMD_EXAMPLES(
+ "/win console",
+ "/win 4",
+ "/win odin@valhalla.edda",
+ "/win Eddie",
+ "/win bigroom@conference.chat.org",
+ "/win bigroom@conference.chat.org/thor",
+ "/win wikipedia")
+ },
{ "/wins",
- parse_args, 0, 3, NULL,
- CMD_SUBFUNCS(
- { "unread", cmd_wins_unread },
- { "prune", cmd_wins_prune },
- { "swap", cmd_wins_swap })
- CMD_MAINFUNC(cmd_wins)
- CMD_TAGS(
- CMD_TAG_UI)
- CMD_SYN(
- "/wins",
- "/wins unread",
- "/wins prune",
- "/wins swap <source> <target>")
- CMD_DESC(
- "Manage windows. "
- "Passing no argument will list all currently active windows and information about their usage.")
- CMD_ARGS(
- { "unread", "List windows with unread messages." },
- { "prune", "Close all windows with no unread messages." },
- { "swap <source> <target>", "Swap windows, target may be an empty position." })
- CMD_NOEXAMPLES },
+ parse_args, 0, 3, NULL,
+ CMD_SUBFUNCS(
+ { "unread", cmd_wins_unread },
+ { "prune", cmd_wins_prune },
+ { "swap", cmd_wins_swap })
+ CMD_MAINFUNC(cmd_wins)
+ CMD_TAGS(
+ CMD_TAG_UI)
+ CMD_SYN(
+ "/wins",
+ "/wins unread",
+ "/wins prune",
+ "/wins swap <source> <target>")
+ CMD_DESC(
+ "Manage windows. "
+ "Passing no argument will list all currently active windows and information about their usage.")
+ CMD_ARGS(
+ { "unread", "List windows with unread messages." },
+ { "prune", "Close all windows with no unread messages." },
+ { "swap <source> <target>", "Swap windows, target may be an empty position." })
+ CMD_NOEXAMPLES
+ },
{ "/sub",
- parse_args, 1, 2, NULL,
- CMD_NOSUBFUNCS
- CMD_MAINFUNC(cmd_sub)
- CMD_TAGS(
- CMD_TAG_ROSTER)
- CMD_SYN(
- "/sub request [<jid>]",
- "/sub allow [<jid>]",
- "/sub deny [<jid>]",
- "/sub show [<jid>]",
- "/sub sent",
- "/sub received")
- CMD_DESC(
- "Manage subscriptions to contact presence. "
- "If jid is omitted, the contact of the current window is used.")
- CMD_ARGS(
- { "request [<jid>]", "Send a subscription request to the user." },
- { "allow [<jid>]", "Approve a contact's subscription request." },
- { "deny [<jid>]", "Remove subscription for a contact, or deny a request." },
- { "show [<jid>]", "Show subscription status for a contact." },
- { "sent", "Show all sent subscription requests pending a response." },
- { "received", "Show all received subscription requests awaiting your response." })
- CMD_EXAMPLES(
- "/sub request odin@valhalla.edda",
- "/sub allow odin@valhalla.edda",
- "/sub request",
- "/sub sent") },
+ parse_args, 1, 2, NULL,
+ CMD_NOSUBFUNCS
+ CMD_MAINFUNC(cmd_sub)
+ CMD_TAGS(
+ CMD_TAG_ROSTER)
+ CMD_SYN(
+ "/sub request [<jid>]",
+ "/sub allow [<jid>]",
+ "/sub deny [<jid>]",
+ "/sub show [<jid>]",
+ "/sub sent",
+ "/sub received")
+ CMD_DESC(
+ "Manage subscriptions to contact presence. "
+ "If jid is omitted, the contact of the current window is used.")
+ CMD_ARGS(
+ { "request [<jid>]", "Send a subscription request to the user." },
+ { "allow [<jid>]", "Approve a contact's subscription request." },
+ { "deny [<jid>]", "Remove subscription for a contact, or deny a request." },
+ { "show [<jid>]", "Show subscription status for a contact." },
+ { "sent", "Show all sent subscription requests pending a response." },
+ { "received", "Show all received subscription requests awaiting your response." })
+ CMD_EXAMPLES(
+ "/sub request odin@valhalla.edda",
+ "/sub allow odin@valhalla.edda",
+ "/sub request",
+ "/sub sent")
+ },
{ "/tiny",
- parse_args, 1, 1, NULL,
- CMD_NOSUBFUNCS
- CMD_MAINFUNC(cmd_tiny)
- CMD_TAGS(
- CMD_TAG_CHAT,
- CMD_TAG_GROUPCHAT)
- CMD_SYN(
- "/tiny <url>")
- CMD_DESC(
- "Send url as tinyurl in current chat.")
- CMD_ARGS(
- { "<url>", "The url to make tiny." })
- CMD_EXAMPLES(
- "Example: /tiny https://profanity-im.github.io/") },
+ parse_args, 1, 1, NULL,
+ CMD_NOSUBFUNCS
+ CMD_MAINFUNC(cmd_tiny)
+ CMD_TAGS(
+ CMD_TAG_CHAT,
+ CMD_TAG_GROUPCHAT)
+ CMD_SYN(
+ "/tiny <url>")
+ CMD_DESC(
+ "Send url as tinyurl in current chat.")
+ CMD_ARGS(
+ { "<url>", "The url to make tiny." })
+ CMD_EXAMPLES(
+ "Example: /tiny https://profanity-im.github.io/")
+ },
{ "/who",
- parse_args, 0, 2, NULL,
- CMD_NOSUBFUNCS
- CMD_MAINFUNC(cmd_who)
- CMD_TAGS(
- CMD_TAG_CHAT,
- CMD_TAG_GROUPCHAT,
- CMD_TAG_ROSTER)
- CMD_SYN(
- "/who",
- "/who online|offline|away|dnd|xa|chat|available|unavailable|any [<group>]",
- "/who moderator|participant|visitor",
- "/who owner|admin|member")
- CMD_DESC(
- "Show contacts or room occupants with chosen status, role or affiliation.")
- CMD_ARGS(
- { "offline|away|dnd|xa|chat", "Show contacts or room occupants with specified presence." },
- { "online", "Contacts that are online, chat, away, xa, dnd." },
- { "available", "Contacts that are available for chat - online, chat." },
- { "unavailable", "Contacts that are not available for chat - offline, away, xa, dnd." },
- { "any", "Contacts with any status (same as calling with no argument)." },
- { "<group>", "Filter the results by the specified roster group, not applicable in chat rooms." },
- { "moderator|participant|visitor", "Room occupants with the specified role." },
- { "owner|admin|member", "Room occupants with the specified affiliation." })
- CMD_EXAMPLES(
- "/who",
- "/who xa",
- "/who online friends",
- "/who any family",
- "/who participant",
- "/who admin") },
+ parse_args, 0, 2, NULL,
+ CMD_NOSUBFUNCS
+ CMD_MAINFUNC(cmd_who)
+ CMD_TAGS(
+ CMD_TAG_CHAT,
+ CMD_TAG_GROUPCHAT,
+ CMD_TAG_ROSTER)
+ CMD_SYN(
+ "/who",
+ "/who online|offline|away|dnd|xa|chat|available|unavailable|any [<group>]",
+ "/who moderator|participant|visitor",
+ "/who owner|admin|member")
+ CMD_DESC(
+ "Show contacts or room occupants with chosen status, role or affiliation.")
+ CMD_ARGS(
+ { "offline|away|dnd|xa|chat", "Show contacts or room occupants with specified presence." },
+ { "online", "Contacts that are online, chat, away, xa, dnd." },
+ { "available", "Contacts that are available for chat - online, chat." },
+ { "unavailable", "Contacts that are not available for chat - offline, away, xa, dnd." },
+ { "any", "Contacts with any status (same as calling with no argument)." },
+ { "<group>", "Filter the results by the specified roster group, not applicable in chat rooms." },
+ { "moderator|participant|visitor", "Room occupants with the specified role." },
+ { "owner|admin|member", "Room occupants with the specified affiliation." })
+ CMD_EXAMPLES(
+ "/who",
+ "/who xa",
+ "/who online friends",
+ "/who any family",
+ "/who participant",
+ "/who admin")
+ },
{ "/close",
- parse_args, 0, 1, NULL,
- CMD_NOSUBFUNCS
- CMD_MAINFUNC(cmd_close)
- CMD_TAGS(
- CMD_TAG_UI)
- CMD_SYN(
- "/close",
- "/close <num>",
- "/close <barejid>",
- "/close <nick>",
- "/close <roomjid>",
- "/close <roomoccupantjid>",
- "/close xmlconsole",
- "/close all|read")
- CMD_DESC(
- "Close windows. "
- "Passing no argument closes the current window.")
- CMD_ARGS(
- { "<num>", "Close specified window number." },
- { "<barejid>", "Close chat window with contact by JID if open." },
- { "<nick>", "Close chat window with contact by nickname if open." },
- { "<roomjid>", "Close chat room window with roomjid if open." },
- { "<roomoccupantjid>", "Close private chat roomoccupantjid if open." },
- { "xmlconsole", "Close the XML Console window if open." },
- { "all", "Close all windows." },
- { "read", "Close all windows that have no unread messages." })
- CMD_NOEXAMPLES },
+ parse_args, 0, 1, NULL,
+ CMD_NOSUBFUNCS
+ CMD_MAINFUNC(cmd_close)
+ CMD_TAGS(
+ CMD_TAG_UI)
+ CMD_SYN(
+ "/close",
+ "/close <num>",
+ "/close <barejid>",
+ "/close <nick>",
+ "/close <roomjid>",
+ "/close <roomoccupantjid>",
+ "/close xmlconsole",
+ "/close all|read")
+ CMD_DESC(
+ "Close windows. "
+ "Passing no argument closes the current window.")
+ CMD_ARGS(
+ { "<num>", "Close specified window number." },
+ { "<barejid>", "Close chat window with contact by JID if open." },
+ { "<nick>", "Close chat window with contact by nickname if open." },
+ { "<roomjid>", "Close chat room window with roomjid if open." },
+ { "<roomoccupantjid>", "Close private chat roomoccupantjid if open." },
+ { "xmlconsole", "Close the XML Console window if open." },
+ { "all", "Close all windows." },
+ { "read", "Close all windows that have no unread messages." })
+ CMD_NOEXAMPLES
+ },
{ "/clear",
- parse_args, 0, 2, NULL,
- CMD_NOSUBFUNCS
- CMD_MAINFUNC(cmd_clear)
- CMD_TAGS(
- CMD_TAG_UI)
- CMD_SYN(
- "/clear",
- "/clear persist_history <on|off>")
- CMD_DESC(
- "Clear the current window. "
- "If you set persist_history you can still access the history by pressing PAGE UP.")
- CMD_ARGS(
- { "persist_history on|off", "Whether or not to clear the screen persistently." })
- CMD_EXAMPLES(
- "/clear",
- "/clear persist_history",
- "/clear persist_history on") },
+ parse_args, 0, 2, NULL,
+ CMD_NOSUBFUNCS
+ CMD_MAINFUNC(cmd_clear)
+ CMD_TAGS(
+ CMD_TAG_UI)
+ CMD_SYN(
+ "/clear",
+ "/clear persist_history <on|off>")
+ CMD_DESC(
+ "Clear the current window. "
+ "If you set persist_history you can still access the history by pressing PAGE UP.")
+ CMD_ARGS(
+ { "persist_history on|off", "Whether or not to clear the screen persistently."})
+ CMD_EXAMPLES(
+ "/clear",
+ "/clear persist_history",
+ "/clear persist_history on")
+ },
{ "/quit",
- parse_args, 0, 0, NULL,
- CMD_NOSUBFUNCS
- CMD_MAINFUNC(cmd_quit)
- CMD_NOTAGS
- CMD_SYN(
- "/quit")
- CMD_DESC(
- "Logout of any current session, and quit Profanity.")
- CMD_NOARGS
- CMD_NOEXAMPLES },
+ parse_args, 0, 0, NULL,
+ CMD_NOSUBFUNCS
+ CMD_MAINFUNC(cmd_quit)
+ CMD_NOTAGS
+ CMD_SYN(
+ "/quit")
+ CMD_DESC(
+ "Logout of any current session, and quit Profanity.")
+ CMD_NOARGS
+ CMD_NOEXAMPLES
+ },
{ "/privileges",
- parse_args, 1, 1, &cons_privileges_setting,
- CMD_NOSUBFUNCS
- CMD_MAINFUNC(cmd_privileges)
- CMD_TAGS(
- CMD_TAG_GROUPCHAT,
- CMD_TAG_UI)
- CMD_SYN(
- "/privileges on|off")
- CMD_DESC(
- "Group occupants panel by role, and show role information in chat rooms.")
- CMD_ARGS(
- { "on|off", "Enable or disable privilege information." })
- CMD_NOEXAMPLES },
+ parse_args, 1, 1, &cons_privileges_setting,
+ CMD_NOSUBFUNCS
+ CMD_MAINFUNC(cmd_privileges)
+ CMD_TAGS(
+ CMD_TAG_GROUPCHAT,
+ CMD_TAG_UI)
+ CMD_SYN(
+ "/privileges on|off")
+ CMD_DESC(
+ "Group occupants panel by role, and show role information in chat rooms.")
+ CMD_ARGS(
+ { "on|off", "Enable or disable privilege information." })
+ CMD_NOEXAMPLES
+ },
{ "/charset",
- parse_args, 0, 0, NULL,
- CMD_NOSUBFUNCS
- CMD_MAINFUNC(cmd_charset)
- CMD_TAGS(
- CMD_TAG_UI)
- CMD_SYN(
- "/charset")
- CMD_DESC(
- "Display information about the current character set supported by the terminal. ")
- CMD_NOARGS
- CMD_NOEXAMPLES },
+ parse_args, 0, 0, NULL,
+ CMD_NOSUBFUNCS
+ CMD_MAINFUNC(cmd_charset)
+ CMD_TAGS(
+ CMD_TAG_UI)
+ CMD_SYN(
+ "/charset")
+ CMD_DESC(
+ "Display information about the current character set supported by the terminal. ")
+ CMD_NOARGS
+ CMD_NOEXAMPLES
+ },
{ "/beep",
- parse_args, 1, 1, &cons_beep_setting,
- CMD_NOSUBFUNCS
- CMD_MAINFUNC(cmd_beep)
- CMD_TAGS(
- CMD_TAG_UI)
- CMD_SYN(
- "/beep on|off")
- CMD_DESC(
- "Switch the terminal bell on or off. "
- "The bell will sound when incoming messages are received. "
- "If the terminal does not support sounds, it may attempt to flash the screen instead.")
- CMD_ARGS(
- { "on|off", "Enable or disable terminal bell." })
- CMD_NOEXAMPLES },
+ parse_args, 1, 1, &cons_beep_setting,
+ CMD_NOSUBFUNCS
+ CMD_MAINFUNC(cmd_beep)
+ CMD_TAGS(
+ CMD_TAG_UI)
+ CMD_SYN(
+ "/beep on|off")
+ CMD_DESC(
+ "Switch the terminal bell on or off. "
+ "The bell will sound when incoming messages are received. "
+ "If the terminal does not support sounds, it may attempt to flash the screen instead.")
+ CMD_ARGS(
+ { "on|off", "Enable or disable terminal bell." })
+ CMD_NOEXAMPLES
+ },
{ "/console",
- parse_args, 2, 2, &cons_console_setting,
- CMD_NOSUBFUNCS
- CMD_MAINFUNC(cmd_console)
- CMD_TAGS(
- CMD_TAG_UI,
- CMD_TAG_CHAT,
- CMD_TAG_GROUPCHAT)
- CMD_SYN(
- "/console chat all|first|none",
- "/console muc all|first|none",
- "/console private all|first|none")
- CMD_DESC(
- "Configure what is displayed in the console window when messages are received. "
- "The default is set to 'all' for all types of messages.")
- CMD_ARGS(
- { "chat all", "Indicate all new chat messages in the console." },
- { "chat first", "Indicate only the first new message per chat in the console." },
- { "chat none", "Do not show any new chat messages in the console window." },
- { "muc all", "Indicate all new chat room messages in the console." },
- { "muc first", "Indicate only the first new message in each room in the console." },
- { "muc none", "Do not show any new chat room messages in the console window." },
- { "private all", "Indicate all new private room messages in the console." },
- { "private first", "Indicate only the first private room message in the console." },
- { "private none", "Do not show any new private room messages in the console window." })
- CMD_NOEXAMPLES },
+ parse_args, 2, 2, &cons_console_setting,
+ CMD_NOSUBFUNCS
+ CMD_MAINFUNC(cmd_console)
+ CMD_TAGS(
+ CMD_TAG_UI,
+ CMD_TAG_CHAT,
+ CMD_TAG_GROUPCHAT)
+ CMD_SYN(
+ "/console chat all|first|none",
+ "/console muc all|first|none",
+ "/console private all|first|none")
+ CMD_DESC(
+ "Configure what is displayed in the console window when messages are received. "
+ "The default is set to 'all' for all types of messages.")
+ CMD_ARGS(
+ { "chat all", "Indicate all new chat messages in the console." },
+ { "chat first", "Indicate only the first new message per chat in the console." },
+ { "chat none", "Do not show any new chat messages in the console window." },
+ { "muc all", "Indicate all new chat room messages in the console." },
+ { "muc first", "Indicate only the first new message in each room in the console." },
+ { "muc none", "Do not show any new chat room messages in the console window." },
+ { "private all", "Indicate all new private room messages in the console." },
+ { "private first", "Indicate only the first private room message in the console." },
+ { "private none", "Do not show any new private room messages in the console window." })
+ CMD_NOEXAMPLES
+ },
{ "/presence",
- parse_args, 2, 2, &cons_presence_setting,
- CMD_NOSUBFUNCS
- CMD_MAINFUNC(cmd_presence)
- CMD_TAGS(
- CMD_TAG_UI,
- CMD_TAG_CHAT,
- CMD_TAG_GROUPCHAT)
- CMD_SYN(
- "/presence titlebar on|off",
- "/presence console all|online|none",
- "/presence chat all|online|none",
- "/presence room all|online|none")
- CMD_DESC(
- "Show the contacts presence in the titlebar and configure presence messages in different window types.")
- CMD_ARGS(
- { "titlebar on|off", "Switch display of the contacts presence in the titlebar on or off." },
- { "console all", "Show all presence changes in the console window." },
- { "console online", "Show only online/offline presence changes in the console window." },
- { "console none", "Don't show any presence changes in the console window." },
- { "chat all", "Show all presence changes in the chat windows." },
- { "chat online", "Show only online/offline presence changes in chat windows." },
- { "chat none", "Don't show any presence changes in chat windows." },
- { "room all", "Show all presence changes in chat room windows." },
- { "room online", "Show only online/offline presence changes in chat room windows." },
- { "room none", "Don't show any presence changes in chat room windows." })
- CMD_EXAMPLES(
- "/presence titlebar off",
- "/presence console none",
- "/presence chat online",
- "/presence room all") },
+ parse_args, 2, 2, &cons_presence_setting,
+ CMD_NOSUBFUNCS
+ CMD_MAINFUNC(cmd_presence)
+ CMD_TAGS(
+ CMD_TAG_UI,
+ CMD_TAG_CHAT,
+ CMD_TAG_GROUPCHAT)
+ CMD_SYN(
+ "/presence titlebar on|off",
+ "/presence console all|online|none",
+ "/presence chat all|online|none",
+ "/presence room all|online|none")
+ CMD_DESC(
+ "Show the contacts presence in the titlebar and configure presence messages in different window types.")
+ CMD_ARGS(
+ { "titlebar on|off", "Switch display of the contacts presence in the titlebar on or off." },
+ { "console all", "Show all presence changes in the console window." },
+ { "console online", "Show only online/offline presence changes in the console window." },
+ { "console none", "Don't show any presence changes in the console window." },
+ { "chat all", "Show all presence changes in the chat windows." },
+ { "chat online", "Show only online/offline presence changes in chat windows." },
+ { "chat none", "Don't show any presence changes in chat windows." },
+ { "room all", "Show all presence changes in chat room windows." },
+ { "room online", "Show only online/offline presence changes in chat room windows." },
+ { "room none", "Don't show any presence changes in chat room windows." })
+ CMD_EXAMPLES(
+ "/presence titlebar off",
+ "/presence console none",
+ "/presence chat online",
+ "/presence room all")
+ },
{ "/wrap",
- parse_args, 1, 1, &cons_wrap_setting,
- CMD_NOSUBFUNCS
- CMD_MAINFUNC(cmd_wrap)
- CMD_TAGS(
- CMD_TAG_UI)
- CMD_SYN(
- "/wrap on|off")
- CMD_DESC(
- "Word wrapping.")
- CMD_ARGS(
- { "on|off", "Enable or disable word wrapping in the main window." })
- CMD_NOEXAMPLES },
+ parse_args, 1, 1, &cons_wrap_setting,
+ CMD_NOSUBFUNCS
+ CMD_MAINFUNC(cmd_wrap)
+ CMD_TAGS(
+ CMD_TAG_UI)
+ CMD_SYN(
+ "/wrap on|off")
+ CMD_DESC(
+ "Word wrapping.")
+ CMD_ARGS(
+ { "on|off", "Enable or disable word wrapping in the main window." })
+ CMD_NOEXAMPLES
+ },
{ "/time",
- parse_args, 1, 3, &cons_time_setting,
- CMD_NOSUBFUNCS
- CMD_MAINFUNC(cmd_time)
- CMD_TAGS(
- CMD_TAG_UI)
- CMD_SYN(
- "/time all|console|chat|muc|config|private|xml set <format>",
- "/time all|console|chat|muc|config|private|xml off",
- "/time statusbar set <format>",
- "/time statusbar off",
- "/time lastactivity set <format>")
- CMD_DESC(
- "Configure time display preferences. "
- "Time formats are strings supported by g_date_time_format. "
- "See https://developer.gnome.org/glib/stable/glib-GDateTime.html#g-date-time-format for more details. "
- "Setting the format to an unsupported string, will display the string. "
- "If the format contains spaces, it must be surrounded with double quotes.")
- CMD_ARGS(
- { "console set <format>", "Set time format for console window." },
- { "console off", "Do not show time in console window." },
- { "chat set <format>", "Set time format for chat windows." },
- { "chat off", "Do not show time in chat windows." },
- { "muc set <format>", "Set time format for chat room windows." },
- { "muc off", "Do not show time in chat room windows." },
- { "config set <format>", "Set time format for config windows." },
- { "config off", "Do not show time in config windows." },
- { "private set <format>", "Set time format for private chat windows." },
- { "private off", "Do not show time in private chat windows." },
- { "xml set <format>", "Set time format for XML console window." },
- { "xml off", "Do not show time in XML console window." },
- { "statusbar set <format>", "Change time format in statusbar." },
- { "statusbar off", "Do not show time in status bar." },
- { "lastactivity set <format>", "Change time format for last activity." },
- { "all set <format>", "Set time for: console, chat, muc, config, private and xml windows." },
- { "all off", "Do not show time for: console, chat, muc, config, private and xml windows." })
- CMD_EXAMPLES(
- "/time console set %H:%M:%S",
- "/time chat set \"%d-%m-%y %H:%M:%S\"",
- "/time xml off",
- "/time statusbar set %H:%M",
- "/time lastactivity set \"%d-%m-%y %H:%M:%S\"",
- "/time all set \"%d-%m-%y %H:%M:%S\"") },
+ parse_args, 1, 3, &cons_time_setting,
+ CMD_NOSUBFUNCS
+ CMD_MAINFUNC(cmd_time)
+ CMD_TAGS(
+ CMD_TAG_UI)
+ CMD_SYN(
+ "/time all|console|chat|muc|config|private|xml set <format>",
+ "/time all|console|chat|muc|config|private|xml off",
+ "/time statusbar set <format>",
+ "/time statusbar off",
+ "/time lastactivity set <format>")
+ CMD_DESC(
+ "Configure time display preferences. "
+ "Time formats are strings supported by g_date_time_format. "
+ "See https://developer.gnome.org/glib/stable/glib-GDateTime.html#g-date-time-format for more details. "
+ "Setting the format to an unsupported string, will display the string. "
+ "If the format contains spaces, it must be surrounded with double quotes.")
+ CMD_ARGS(
+ { "console set <format>", "Set time format for console window." },
+ { "console off", "Do not show time in console window." },
+ { "chat set <format>", "Set time format for chat windows." },
+ { "chat off", "Do not show time in chat windows." },
+ { "muc set <format>", "Set time format for chat room windows." },
+ { "muc off", "Do not show time in chat room windows." },
+ { "config set <format>", "Set time format for config windows." },
+ { "config off", "Do not show time in config windows." },
+ { "private set <format>", "Set time format for private chat windows." },
+ { "private off", "Do not show time in private chat windows." },
+ { "xml set <format>", "Set time format for XML console window." },
+ { "xml off", "Do not show time in XML console window." },
+ { "statusbar set <format>", "Change time format in statusbar." },
+ { "statusbar off", "Do not show time in status bar." },
+ { "lastactivity set <format>", "Change time format for last activity." },
+ { "all set <format>", "Set time for: console, chat, muc, config, private and xml windows." },
+ { "all off", "Do not show time for: console, chat, muc, config, private and xml windows." })
+ CMD_EXAMPLES(
+ "/time console set %H:%M:%S",
+ "/time chat set \"%d-%m-%y %H:%M:%S\"",
+ "/time xml off",
+ "/time statusbar set %H:%M",
+ "/time lastactivity set \"%d-%m-%y %H:%M:%S\"",
+ "/time all set \"%d-%m-%y %H:%M:%S\"")
+ },
{ "/inpblock",
- parse_args, 2, 2, &cons_inpblock_setting,
- CMD_NOSUBFUNCS
- CMD_MAINFUNC(cmd_inpblock)
- CMD_TAGS(
- CMD_TAG_UI)
- CMD_SYN(
- "/inpblock timeout <millis>",
- "/inpblock dynamic on|off")
- CMD_DESC(
- "How long to wait for keyboard input before checking for new messages or checking for state changes such as 'idle'.")
- CMD_ARGS(
- { "timeout <millis>", "Time to wait (1-1000) in milliseconds before reading input from the terminal buffer, default: 1000." },
- { "dynamic on|off", "Start with 0 millis and dynamically increase up to timeout when no activity, default: on." })
- CMD_NOEXAMPLES },
+ parse_args, 2, 2, &cons_inpblock_setting,
+ CMD_NOSUBFUNCS
+ CMD_MAINFUNC(cmd_inpblock)
+ CMD_TAGS(
+ CMD_TAG_UI)
+ CMD_SYN(
+ "/inpblock timeout <millis>",
+ "/inpblock dynamic on|off")
+ CMD_DESC(
+ "How long to wait for keyboard input before checking for new messages or checking for state changes such as 'idle'.")
+ CMD_ARGS(
+ { "timeout <millis>", "Time to wait (1-1000) in milliseconds before reading input from the terminal buffer, default: 1000." },
+ { "dynamic on|off", "Start with 0 millis and dynamically increase up to timeout when no activity, default: on." })
+ CMD_NOEXAMPLES
+ },
{ "/titlebar",
- parse_args, 1, 2, &cons_titlebar_setting,
- CMD_SUBFUNCS(
- { "show", cmd_titlebar_show_hide },
- { "hide", cmd_titlebar_show_hide })
- CMD_MAINFUNC(cmd_titlebar)
- CMD_TAGS(
- CMD_TAG_UI)
- CMD_SYN(
- "/titlebar up",
- "/titlebar down",
- "/titlebar show|hide [encwarn|resource|tls]")
- CMD_DESC(
- "Titlebar settings.")
- CMD_ARGS(
- { "up", "Move the title bar up the screen." },
- { "down", "Move the title bar down the screen." },
- { "show tls", "Show or hide TLS indicator in the titlebar." },
- { "show encwarn", "Enable or disable the unencrypted warning message in the titlebar." },
- { "show resource", "Show or hide the current resource in the titlebar." },
- { "show name", "In case of a MUC. Show the MUC name in the titlebar." },
- { "show jid", "In case of a MUC. Show the JID in the titlebar." })
- CMD_EXAMPLES(
- "/titlebar up",
- "/titlebar show tls",
- "/titlebar hide encwarn") },
+ parse_args, 1, 2, &cons_titlebar_setting,
+ CMD_SUBFUNCS(
+ { "show", cmd_titlebar_show_hide },
+ { "hide", cmd_titlebar_show_hide }
+ )
+ CMD_MAINFUNC(cmd_titlebar)
+ CMD_TAGS(
+ CMD_TAG_UI)
+ CMD_SYN(
+ "/titlebar up",
+ "/titlebar down",
+ "/titlebar show|hide [encwarn|resource|tls]"
+ )
+ CMD_DESC(
+ "Titlebar settings.")
+ CMD_ARGS(
+ { "up", "Move the title bar up the screen." },
+ { "down", "Move the title bar down the screen." },
+ { "show tls", "Show or hide TLS indicator in the titlebar." },
+ { "show encwarn", "Enable or disable the unencrypted warning message in the titlebar." },
+ { "show resource", "Show or hide the current resource in the titlebar." },
+ { "show name", "In case of a MUC. Show the MUC name in the titlebar." },
+ { "show jid", "In case of a MUC. Show the JID in the titlebar." }
+ )
+ CMD_EXAMPLES(
+ "/titlebar up",
+ "/titlebar show tls",
+ "/titlebar hide encwarn")
+ },
{ "/mainwin",
- parse_args, 1, 1, &cons_winpos_setting,
- CMD_NOSUBFUNCS
- CMD_MAINFUNC(cmd_mainwin)
- CMD_TAGS(
- CMD_TAG_UI)
- CMD_SYN(
- "/mainwin up",
- "/mainwin down")
- CMD_DESC(
- "Move the main window.")
- CMD_ARGS(
- { "up", "Move the main window up the screen." },
- { "down", "Move the main window down the screen." })
- CMD_NOEXAMPLES },
+ parse_args, 1, 1, &cons_winpos_setting,
+ CMD_NOSUBFUNCS
+ CMD_MAINFUNC(cmd_mainwin)
+ CMD_TAGS(
+ CMD_TAG_UI)
+ CMD_SYN(
+ "/mainwin up",
+ "/mainwin down")
+ CMD_DESC(
+ "Move the main window.")
+ CMD_ARGS(
+ { "up", "Move the main window up the screen." },
+ { "down", "Move the main window down the screen." })
+ CMD_NOEXAMPLES
+ },
{ "/statusbar",
- parse_args, 1, 2, &cons_statusbar_setting,
- CMD_NOSUBFUNCS
- CMD_MAINFUNC(cmd_statusbar)
- CMD_TAGS(
- CMD_TAG_UI)
- CMD_SYN(
- "/statusbar show name|number|read",
- "/statusbar hide name|number|read",
- "/statusbar maxtabs <value>",
- "/statusbar tablen <value>",
- "/statusbar self user|barejid|fulljid|off",
- "/statusbar chat user|jid",
- "/statusbar room room|jid",
- "/statusbar up",
- "/statusbar down")
- CMD_DESC(
- "Manage statusbar display preferences.")
- CMD_ARGS(
- { "maxtabs <value>", "Set the maximum number of tabs to display, <value> must be between 0 and 10." },
- { "tablen <value>", "Set the maximum number of characters to show as the tab name, 0 sets to unlimited." },
- { "show|hide name", "Show or hide names in tabs." },
- { "show|hide number", "Show or hide numbers in tabs." },
- { "show|hide read", "Show or hide inactive tabs." },
- { "self user|barejid|fulljid", "Show account user name, barejid, fulljid as status bar title." },
- { "self off", "Disable showing self as status bar title." },
- { "chat user|jid", "Show users name, or the fulljid if no nick is present for chat tabs." },
- { "room room|jid", "Show room name, or the fulljid for room tabs." },
- { "up", "Move the status bar up the screen." },
- { "down", "Move the status bar down the screen." })
- CMD_EXAMPLES(
- "/statusbar maxtabs 8",
- "/statusbar tablen 5",
- "/statusbar self user",
- "/statusbar chat jid",
- "/statusbar hide read",
- "/statusbar hide name") },
+ parse_args, 1, 2, &cons_statusbar_setting,
+ CMD_NOSUBFUNCS
+ CMD_MAINFUNC(cmd_statusbar)
+ CMD_TAGS(
+ CMD_TAG_UI)
+ CMD_SYN(
+ "/statusbar show name|number|read",
+ "/statusbar hide name|number|read",
+ "/statusbar maxtabs <value>",
+ "/statusbar tablen <value>",
+ "/statusbar self user|barejid|fulljid|off",
+ "/statusbar chat user|jid",
+ "/statusbar room room|jid",
+ "/statusbar up",
+ "/statusbar down")
+ CMD_DESC(
+ "Manage statusbar display preferences.")
+ CMD_ARGS(
+ { "maxtabs <value>", "Set the maximum number of tabs to display, <value> must be between 0 and 10." },
+ { "tablen <value>", "Set the maximum number of characters to show as the tab name, 0 sets to unlimited." },
+ { "show|hide name", "Show or hide names in tabs." },
+ { "show|hide number", "Show or hide numbers in tabs." },
+ { "show|hide read", "Show or hide inactive tabs." },
+ { "self user|barejid|fulljid", "Show account user name, barejid, fulljid as status bar title." },
+ { "self off", "Disable showing self as status bar title." },
+ { "chat user|jid", "Show users name, or the fulljid if no nick is present for chat tabs." },
+ { "room room|jid", "Show room name, or the fulljid for room tabs." },
+ { "up", "Move the status bar up the screen." },
+ { "down", "Move the status bar down the screen." })
+ CMD_EXAMPLES(
+ "/statusbar maxtabs 8",
+ "/statusbar tablen 5",
+ "/statusbar self user",
+ "/statusbar chat jid",
+ "/statusbar hide read",
+ "/statusbar hide name")
+ },
{ "/inputwin",
- parse_args, 1, 1, &cons_winpos_setting,
- CMD_NOSUBFUNCS
- CMD_MAINFUNC(cmd_inputwin)
- CMD_TAGS(
- CMD_TAG_UI)
- CMD_SYN(
- "/inputwin up",
- "/inputwin down")
- CMD_DESC(
- "Move the input window.")
- CMD_ARGS(
- { "up", "Move the input window up the screen." },
- { "down", "Move the input window down the screen." })
- CMD_NOEXAMPLES },
+ parse_args, 1, 1, &cons_winpos_setting,
+ CMD_NOSUBFUNCS
+ CMD_MAINFUNC(cmd_inputwin)
+ CMD_TAGS(
+ CMD_TAG_UI)
+ CMD_SYN(
+ "/inputwin up",
+ "/inputwin down")
+ CMD_DESC(
+ "Move the input window.")
+ CMD_ARGS(
+ { "up", "Move the input window up the screen." },
+ { "down", "Move the input window down the screen." })
+ CMD_NOEXAMPLES
+ },
{ "/notify",
- parse_args_with_freetext, 0, 4, NULL,
- CMD_NOSUBFUNCS
- CMD_MAINFUNC(cmd_notify)
- CMD_TAGS(
- CMD_TAG_UI,
- CMD_TAG_CHAT,
- CMD_TAG_GROUPCHAT)
- CMD_SYN(
- "/notify chat on|off",
- "/notify chat current on|off",
- "/notify chat text on|off",
- "/notify room on|off",
- "/notify room mention on|off",
- "/notify room mention case_sensitive|case_insensitive",
- "/notify room mention word_whole|word_part",
- "/notify room current on|off",
- "/notify room text on|off",
- "/notify room trigger add <text>",
- "/notify room trigger remove <text>",
- "/notify room trigger list",
- "/notify room trigger on|off",
- "/notify on|off",
- "/notify mention on|off",
- "/notify trigger on|off",
- "/notify reset",
- "/notify remind <seconds>",
- "/notify typing on|off",
- "/notify typing current on|off",
- "/notify invite on|off",
- "/notify sub on|off")
- CMD_DESC(
- "Configure desktop notifications. "
- "To configure presence update messages in the console, chat and chat room windows, see '/help presence'.")
- CMD_ARGS(
- { "chat on|off", "Notifications for regular chat messages." },
- { "chat current on|off", "Whether to show regular chat message notifications when the window is focussed." },
- { "chat text on|off", "Show message text in regular message notifications." },
- { "room on|off", "Notifications for all chat room messages." },
- { "room mention on|off", "Notifications for chat room messages when your nick is mentioned." },
- { "room mention case_sensitive", "Set room mention notifications as case sensitive." },
- { "room mention case_insensitive", "Set room mention notifications as case insensitive." },
- { "room mention word_whole", "Set room mention notifications only on whole word match, i.e. when nickname is not part of a larger word." },
- { "room mention word_part", "Set room mention notifications on partial word match, i.e. nickname may be part of a larger word." },
- { "room current on|off", "Whether to show all chat room messages notifications when the window is focussed." },
- { "room text on|off", "Show message text in chat room message notifications." },
- { "room trigger add <text>", "Notify when specified text included in all chat room messages." },
- { "room trigger remove <text>", "Remove chat room notification trigger." },
- { "room trigger list", "List all chat room highlight triggers." },
- { "room trigger on|off", "Enable or disable all chat room notification triggers." },
- { "on|off", "Override the global message setting for the current chat room." },
- { "mention on|off", "Override the global 'mention' setting for the current chat room." },
- { "trigger on|off", "Override the global 'trigger' setting for the current chat room." },
- { "reset", "Reset to global notification settings for the current chat room." },
- { "remind <seconds>", "Notification reminder period for unread messages, use 0 to disable." },
- { "typing on|off", "Notifications when contacts are typing." },
- { "typing current on|off", "Whether typing notifications are triggered for the current window." },
- { "invite on|off", "Notifications for chat room invites." },
- { "sub on|off", "Notifications for subscription requests." })
- CMD_EXAMPLES(
- "/notify chat on",
- "/notify chat text on",
- "/notify room mention on",
- "/notify room trigger add beer",
- "/notify room trigger on",
- "/notify room current off",
- "/notify room text off",
- "/notify remind 60",
- "/notify typing on",
- "/notify invite on") },
+ parse_args_with_freetext, 0, 4, NULL,
+ CMD_NOSUBFUNCS
+ CMD_MAINFUNC(cmd_notify)
+ CMD_TAGS(
+ CMD_TAG_UI,
+ CMD_TAG_CHAT,
+ CMD_TAG_GROUPCHAT)
+ CMD_SYN(
+ "/notify chat on|off",
+ "/notify chat current on|off",
+ "/notify chat text on|off",
+ "/notify room on|off",
+ "/notify room mention on|off",
+ "/notify room mention case_sensitive|case_insensitive",
+ "/notify room mention word_whole|word_part",
+ "/notify room current on|off",
+ "/notify room text on|off",
+ "/notify room trigger add <text>",
+ "/notify room trigger remove <text>",
+ "/notify room trigger list",
+ "/notify room trigger on|off",
+ "/notify on|off",
+ "/notify mention on|off",
+ "/notify trigger on|off",
+ "/notify reset",
+ "/notify remind <seconds>",
+ "/notify typing on|off",
+ "/notify typing current on|off",
+ "/notify invite on|off",
+ "/notify sub on|off")
+ CMD_DESC(
+ "Configure desktop notifications. "
+ "To configure presence update messages in the console, chat and chat room windows, see '/help presence'.")
+ CMD_ARGS(
+ { "chat on|off", "Notifications for regular chat messages." },
+ { "chat current on|off", "Whether to show regular chat message notifications when the window is focussed." },
+ { "chat text on|off", "Show message text in regular message notifications." },
+ { "room on|off", "Notifications for all chat room messages." },
+ { "room mention on|off", "Notifications for chat room messages when your nick is mentioned." },
+ { "room mention case_sensitive", "Set room mention notifications as case sensitive." },
+ { "room mention case_insensitive", "Set room mention notifications as case insensitive." },
+ { "room mention word_whole", "Set room mention notifications only on whole word match, i.e. when nickname is not part of a larger word." },
+ { "room mention word_part", "Set room mention notifications on partial word match, i.e. nickname may be part of a larger word." },
+ { "room current on|off", "Whether to show all chat room messages notifications when the window is focussed." },
+ { "room text on|off", "Show message text in chat room message notifications." },
+ { "room trigger add <text>", "Notify when specified text included in all chat room messages." },
+ { "room trigger remove <text>", "Remove chat room notification trigger." },
+ { "room trigger list", "List all chat room highlight triggers." },
+ { "room trigger on|off", "Enable or disable all chat room notification triggers." },
+ { "on|off", "Override the global message setting for the current chat room." },
+ { "mention on|off", "Override the global 'mention' setting for the current chat room." },
+ { "trigger on|off", "Override the global 'trigger' setting for the current chat room." },
+ { "reset", "Reset to global notification settings for the current chat room." },
+ { "remind <seconds>", "Notification reminder period for unread messages, use 0 to disable." },
+ { "typing on|off", "Notifications when contacts are typing." },
+ { "typing current on|off", "Whether typing notifications are triggered for the current window." },
+ { "invite on|off", "Notifications for chat room invites." },
+ { "sub on|off", "Notifications for subscription requests." })
+ CMD_EXAMPLES(
+ "/notify chat on",
+ "/notify chat text on",
+ "/notify room mention on",
+ "/notify room trigger add beer",
+ "/notify room trigger on",
+ "/notify room current off",
+ "/notify room text off",
+ "/notify remind 60",
+ "/notify typing on",
+ "/notify invite on")
+ },
{ "/flash",
- parse_args, 1, 1, &cons_flash_setting,
- CMD_NOSUBFUNCS
- CMD_MAINFUNC(cmd_flash)
- CMD_TAGS(
- CMD_TAG_UI)
- CMD_SYN(
- "/flash on|off")
- CMD_DESC(
- "Make the terminal flash when incoming messages are received in another window. "
- "If the terminal doesn't support flashing, it may attempt to beep.")
- CMD_ARGS(
- { "on|off", "Enable or disable terminal flash." })
- CMD_NOEXAMPLES },
+ parse_args, 1, 1, &cons_flash_setting,
+ CMD_NOSUBFUNCS
+ CMD_MAINFUNC(cmd_flash)
+ CMD_TAGS(
+ CMD_TAG_UI)
+ CMD_SYN(
+ "/flash on|off")
+ CMD_DESC(
+ "Make the terminal flash when incoming messages are received in another window. "
+ "If the terminal doesn't support flashing, it may attempt to beep.")
+ CMD_ARGS(
+ { "on|off", "Enable or disable terminal flash." })
+ CMD_NOEXAMPLES
+ },
{ "/tray",
- parse_args, 1, 2, &cons_tray_setting,
- CMD_NOSUBFUNCS
- CMD_MAINFUNC(cmd_tray)
- CMD_TAGS(
- CMD_TAG_UI)
- CMD_SYN(
- "/tray on|off",
- "/tray read on|off",
- "/tray timer <seconds>")
- CMD_DESC(
- "Display an icon in the tray that will indicate new messages.")
- CMD_ARGS(
- { "on|off", "Show tray icon." },
- { "read on|off", "Show tray icon when no unread messages." },
- { "timer <seconds>", "Set tray icon timer, seconds must be between 1-10." })
- CMD_NOEXAMPLES },
+ parse_args, 1, 2, &cons_tray_setting,
+ CMD_NOSUBFUNCS
+ CMD_MAINFUNC(cmd_tray)
+ CMD_TAGS(
+ CMD_TAG_UI)
+ CMD_SYN(
+ "/tray on|off",
+ "/tray read on|off",
+ "/tray timer <seconds>")
+ CMD_DESC(
+ "Display an icon in the tray that will indicate new messages.")
+ CMD_ARGS(
+ { "on|off", "Show tray icon." },
+ { "read on|off", "Show tray icon when no unread messages." },
+ { "timer <seconds>", "Set tray icon timer, seconds must be between 1-10." })
+ CMD_NOEXAMPLES
+ },
{ "/intype",
- parse_args, 1, 1, &cons_intype_setting,
- CMD_NOSUBFUNCS
- CMD_MAINFUNC(cmd_intype)
- CMD_TAGS(
- CMD_TAG_UI,
- CMD_TAG_CHAT)
- CMD_SYN(
- "/intype on|off")
- CMD_DESC(
- "Show when a contact is typing in the console, and in active message window.")
- CMD_ARGS(
- { "on|off", "Enable or disable contact typing messages." })
- CMD_NOEXAMPLES },
+ parse_args, 1, 1, &cons_intype_setting,
+ CMD_NOSUBFUNCS
+ CMD_MAINFUNC(cmd_intype)
+ CMD_TAGS(
+ CMD_TAG_UI,
+ CMD_TAG_CHAT)
+ CMD_SYN(
+ "/intype on|off")
+ CMD_DESC(
+ "Show when a contact is typing in the console, and in active message window.")
+ CMD_ARGS(
+ { "on|off", "Enable or disable contact typing messages." })
+ CMD_NOEXAMPLES
+ },
{ "/splash",
- parse_args, 1, 1, &cons_splash_setting,
- CMD_NOSUBFUNCS
- CMD_MAINFUNC(cmd_splash)
- CMD_TAGS(
- CMD_TAG_UI)
- CMD_SYN(
- "/splash on|off")
- CMD_DESC(
- "Switch on or off the ascii logo on start up and when the /about command is called.")
- CMD_ARGS(
- { "on|off", "Enable or disable splash logo." })
- CMD_NOEXAMPLES },
+ parse_args, 1, 1, &cons_splash_setting,
+ CMD_NOSUBFUNCS
+ CMD_MAINFUNC(cmd_splash)
+ CMD_TAGS(
+ CMD_TAG_UI)
+ CMD_SYN(
+ "/splash on|off")
+ CMD_DESC(
+ "Switch on or off the ascii logo on start up and when the /about command is called.")
+ CMD_ARGS(
+ { "on|off", "Enable or disable splash logo." })
+ CMD_NOEXAMPLES
+ },
{ "/autoconnect",
- parse_args, 1, 2, &cons_autoconnect_setting,
- CMD_NOSUBFUNCS
- CMD_MAINFUNC(cmd_autoconnect)
- CMD_TAGS(
- CMD_TAG_CONNECTION)
- CMD_SYN(
- "/autoconnect set <account>",
- "/autoconnect off")
- CMD_DESC(
- "Enable or disable autoconnect on start up. "
- "The setting can be overridden by the -a (--account) command line option.")
- CMD_ARGS(
- { "set <account>", "Connect with account on start up." },
- { "off", "Disable autoconnect." })
- CMD_EXAMPLES(
- "/autoconnect set ulfhednar@valhalla.edda",
- "/autoconnect off") },
+ parse_args, 1, 2, &cons_autoconnect_setting,
+ CMD_NOSUBFUNCS
+ CMD_MAINFUNC(cmd_autoconnect)
+ CMD_TAGS(
+ CMD_TAG_CONNECTION)
+ CMD_SYN(
+ "/autoconnect set <account>",
+ "/autoconnect off")
+ CMD_DESC(
+ "Enable or disable autoconnect on start up. "
+ "The setting can be overridden by the -a (--account) command line option.")
+ CMD_ARGS(
+ { "set <account>", "Connect with account on start up." },
+ { "off", "Disable autoconnect." })
+ CMD_EXAMPLES(
+ "/autoconnect set ulfhednar@valhalla.edda",
+ "/autoconnect off")
+ },
{ "/vercheck",
- parse_args, 0, 1, NULL,
- CMD_NOSUBFUNCS
- CMD_MAINFUNC(cmd_vercheck)
- CMD_TAGS(
- CMD_TAG_UI)
- CMD_SYN(
- "/vercheck on|off")
- CMD_DESC(
- "Check for new versions when Profanity starts, and when the /about command is run.")
- CMD_ARGS(
- { "on|off", "Enable or disable the version check." })
- CMD_NOEXAMPLES },
+ parse_args, 0, 1, NULL,
+ CMD_NOSUBFUNCS
+ CMD_MAINFUNC(cmd_vercheck)
+ CMD_TAGS(
+ CMD_TAG_UI)
+ CMD_SYN(
+ "/vercheck on|off")
+ CMD_DESC(
+ "Check for new versions when Profanity starts, and when the /about command is run.")
+ CMD_ARGS(
+ { "on|off", "Enable or disable the version check." })
+ CMD_NOEXAMPLES
+ },
{ "/wintitle",
- parse_args, 2, 2, &cons_wintitle_setting,
- CMD_NOSUBFUNCS
- CMD_MAINFUNC(cmd_wintitle)
- CMD_TAGS(
- CMD_TAG_UI)
- CMD_SYN(
- "/wintitle show on|off",
- "/wintitle goodbye on|off")
- CMD_DESC(
- "Allow Profanity to modify the window title bar.")
- CMD_ARGS(
- { "show on|off", "Show current logged in user, and unread messages as the window title." },
- { "goodbye on|off", "Show a message in the title when exiting profanity." })
- CMD_NOEXAMPLES },
+ parse_args, 2, 2, &cons_wintitle_setting,
+ CMD_NOSUBFUNCS
+ CMD_MAINFUNC(cmd_wintitle)
+ CMD_TAGS(
+ CMD_TAG_UI)
+ CMD_SYN(
+ "/wintitle show on|off",
+ "/wintitle goodbye on|off")
+ CMD_DESC(
+ "Allow Profanity to modify the window title bar.")
+ CMD_ARGS(
+ { "show on|off", "Show current logged in user, and unread messages as the window title." },
+ { "goodbye on|off", "Show a message in the title when exiting profanity." })
+ CMD_NOEXAMPLES
+ },
{ "/alias",
- parse_args_with_freetext, 1, 3, NULL,
- CMD_NOSUBFUNCS
- CMD_MAINFUNC(cmd_alias)
- CMD_NOTAGS
- CMD_SYN(
- "/alias list",
- "/alias add <name> <value>",
- "/alias remove <name>")
- CMD_DESC(
- "Add, remove or list command aliases.")
- CMD_ARGS(
- { "list", "List all aliases." },
- { "add <name> <value>", "Add a new command alias." },
- { "remove <name>", "Remove a command alias." })
- CMD_EXAMPLES(
- "/alias add friends /who online friends",
- "/alias add /q /quit",
- "/alias add a /away \"I'm in a meeting.\"",
- "/alias remove q",
- "/alias list") },
+ parse_args_with_freetext, 1, 3, NULL,
+ CMD_NOSUBFUNCS
+ CMD_MAINFUNC(cmd_alias)
+ CMD_NOTAGS
+ CMD_SYN(
+ "/alias list",
+ "/alias add <name> <value>",
+ "/alias remove <name>")
+ CMD_DESC(
+ "Add, remove or list command aliases.")
+ CMD_ARGS(
+ { "list", "List all aliases." },
+ { "add <name> <value>", "Add a new command alias." },
+ { "remove <name>", "Remove a command alias." })
+ CMD_EXAMPLES(
+ "/alias add friends /who online friends",
+ "/alias add /q /quit",
+ "/alias add a /away \"I'm in a meeting.\"",
+ "/alias remove q",
+ "/alias list")
+ },
{ "/logging",
- parse_args, 2, 3, &cons_logging_setting,
- CMD_NOSUBFUNCS
- CMD_MAINFUNC(cmd_logging)
- CMD_TAGS(
- CMD_TAG_CHAT)
- CMD_SYN(
- "/logging chat|group on|off")
- CMD_DESC(
- "Configure chat logging. "
- "Switch logging on or off. "
- "Chat logging will be enabled if /history is set to on. "
- "When disabling this option, /history will also be disabled. ")
- CMD_ARGS(
- { "chat on|off", "Enable/Disable regular chat logging." },
- { "group on|off", "Enable/Disable groupchat (room) logging." })
- CMD_EXAMPLES(
- "/logging chat on",
- "/logging group off") },
+ parse_args, 2, 3, &cons_logging_setting,
+ CMD_NOSUBFUNCS
+ CMD_MAINFUNC(cmd_logging)
+ CMD_TAGS(
+ CMD_TAG_CHAT)
+ CMD_SYN(
+ "/logging chat|group on|off")
+ CMD_DESC(
+ "Configure chat logging. "
+ "Switch logging on or off. "
+ "Chat logging will be enabled if /history is set to on. "
+ "When disabling this option, /history will also be disabled. ")
+ CMD_ARGS(
+ { "chat on|off", "Enable/Disable regular chat logging." },
+ { "group on|off", "Enable/Disable groupchat (room) logging." })
+ CMD_EXAMPLES(
+ "/logging chat on",
+ "/logging group off")
+ },
{ "/states",
- parse_args, 1, 1, &cons_states_setting,
- CMD_NOSUBFUNCS
- CMD_MAINFUNC(cmd_states)
- CMD_TAGS(
- CMD_TAG_CHAT)
- CMD_SYN(
- "/states on|off")
- CMD_DESC(
- "Send chat state notifications to recipient during chat sessions, such as typing, paused, active, gone.")
- CMD_ARGS(
- { "on|off", "Enable or disable sending of chat state notifications." })
- CMD_NOEXAMPLES },
+ parse_args, 1, 1, &cons_states_setting,
+ CMD_NOSUBFUNCS
+ CMD_MAINFUNC(cmd_states)
+ CMD_TAGS(
+ CMD_TAG_CHAT)
+ CMD_SYN(
+ "/states on|off")
+ CMD_DESC(
+ "Send chat state notifications to recipient during chat sessions, such as typing, paused, active, gone.")
+ CMD_ARGS(
+ { "on|off", "Enable or disable sending of chat state notifications." })
+ CMD_NOEXAMPLES
+ },
{ "/pgp",
- parse_args, 1, 3, NULL,
- CMD_NOSUBFUNCS
- CMD_MAINFUNC(cmd_pgp)
- CMD_TAGS(
- CMD_TAG_CHAT,
- CMD_TAG_UI)
- CMD_SYN(
- "/pgp libver",
- "/pgp keys",
- "/pgp contacts",
- "/pgp setkey <contact> <keyid>",
- "/pgp start [<contact>]",
- "/pgp end",
- "/pgp log on|off|redact",
- "/pgp char <char>",
- "/pgp sendfile on|off")
- CMD_DESC(
- "Open PGP commands to manage keys, and perform PGP encryption during chat sessions. "
- "See the /account command to set your own PGP key.")
- CMD_ARGS(
- { "libver", "Show which version of the libgpgme library is being used." },
- { "keys", "List all keys known to the system." },
- { "contacts", "Show contacts with assigned public keys." },
- { "setkey <contact> <keyid>", "Manually associate a contact with a public key." },
- { "start [<contact>]", "Start PGP encrypted chat, current contact will be used if not specified." },
- { "end", "End PGP encrypted chat with the current recipient." },
- { "log on|off", "Enable or disable plaintext logging of PGP encrypted messages." },
- { "log redact", "Log PGP encrypted messages, but replace the contents with [redacted]. This is the default." },
- { "char <char>", "Set the character to be displayed next to PGP encrypted messages." },
- { "sendfile on|off", "Allow /sendfile to send unencrypted files while otherwise using PGP." })
- CMD_EXAMPLES(
- "/pgp log off",
- "/pgp setkey odin@valhalla.edda BA19CACE5A9592C5",
- "/pgp start odin@valhalla.edda",
- "/pgp end",
- "/pgp char P") },
+ parse_args, 1, 3, NULL,
+ CMD_NOSUBFUNCS
+ CMD_MAINFUNC(cmd_pgp)
+ CMD_TAGS(
+ CMD_TAG_CHAT,
+ CMD_TAG_UI)
+ CMD_SYN(
+ "/pgp libver",
+ "/pgp keys",
+ "/pgp contacts",
+ "/pgp setkey <contact> <keyid>",
+ "/pgp start [<contact>]",
+ "/pgp end",
+ "/pgp log on|off|redact",
+ "/pgp char <char>",
+ "/pgp sendfile on|off")
+ CMD_DESC(
+ "Open PGP commands to manage keys, and perform PGP encryption during chat sessions. "
+ "See the /account command to set your own PGP key.")
+ CMD_ARGS(
+ { "libver", "Show which version of the libgpgme library is being used." },
+ { "keys", "List all keys known to the system." },
+ { "contacts", "Show contacts with assigned public keys." },
+ { "setkey <contact> <keyid>", "Manually associate a contact with a public key." },
+ { "start [<contact>]", "Start PGP encrypted chat, current contact will be used if not specified." },
+ { "end", "End PGP encrypted chat with the current recipient." },
+ { "log on|off", "Enable or disable plaintext logging of PGP encrypted messages." },
+ { "log redact", "Log PGP encrypted messages, but replace the contents with [redacted]. This is the default." },
+ { "char <char>", "Set the character to be displayed next to PGP encrypted messages." },
+ { "sendfile on|off", "Allow /sendfile to send unencrypted files while otherwise using PGP."})
+ CMD_EXAMPLES(
+ "/pgp log off",
+ "/pgp setkey odin@valhalla.edda BA19CACE5A9592C5",
+ "/pgp start odin@valhalla.edda",
+ "/pgp end",
+ "/pgp char P")
+ },
// XEP-0373: OpenPGP for XMPP
#ifdef HAVE_LIBGPGME
{ "/ox",
- parse_args, 1, 3, NULL,
- CMD_NOSUBFUNCS
- CMD_MAINFUNC(cmd_ox)
- CMD_TAGS(
- CMD_TAG_CHAT,
- CMD_TAG_UI)
- CMD_SYN(
- "/ox keys",
- "/ox contacts",
- "/ox start [<contact>]",
- "/ox end",
- "/ox log on|off|redact",
- "/ox char <char>",
- "/ox sendfile on|off",
- "/ox announce <file>",
- "/ox discover",
- "/ox request <jid>")
- CMD_DESC(
- "OpenPGP (OX) commands to manage keys, and perform PGP encryption during chat sessions. ")
- CMD_ARGS(
- { "keys", "List all keys known to the system." },
- { "contacts", "Show contacts with assigned public keys." },
- { "start [<contact>]", "Start PGP encrypted chat, current contact will be used if not specified." },
- { "end", "End PGP encrypted chat with the current recipient." },
- { "log on|off", "Enable or disable plaintext logging of PGP encrypted messages." },
- { "log redact", "Log PGP encrypted messages, but replace the contents with [redacted]. This is the default." },
- { "char <char>", "Set the character to be displayed next to PGP encrypted messages." },
- { "announce <file>", "Announce a public key by pushing it on the XMPP Server" },
- { "discover <jid>", "Discover public keys of a jid " },
- { "request <jid>", "Request public keys" },
- { "sendfile on|off", "Allow /sendfile to send unencrypted files while otherwise using PGP." })
- CMD_EXAMPLES(
- "/ox log off",
- "/ox start odin@valhalla.edda",
- "/ox end",
- "/ox char X") },
+ parse_args, 1, 3, NULL,
+ CMD_NOSUBFUNCS
+ CMD_MAINFUNC(cmd_ox)
+ CMD_TAGS(
+ CMD_TAG_CHAT,
+ CMD_TAG_UI)
+ CMD_SYN(
+ "/ox keys",
+ "/ox contacts",
+ "/ox start [<contact>]",
+ "/ox end",
+ "/ox log on|off|redact",
+ "/ox char <char>",
+ "/ox sendfile on|off",
+ "/ox announce <file>",
+ "/ox discover",
+ "/ox request <jid>")
+ CMD_DESC(
+ "OpenPGP (OX) commands to manage keys, and perform PGP encryption during chat sessions. ")
+ CMD_ARGS(
+ { "keys", "List all keys known to the system." },
+ { "contacts", "Show contacts with assigned public keys." },
+ { "start [<contact>]", "Start PGP encrypted chat, current contact will be used if not specified." },
+ { "end", "End PGP encrypted chat with the current recipient." },
+ { "log on|off", "Enable or disable plaintext logging of PGP encrypted messages." },
+ { "log redact", "Log PGP encrypted messages, but replace the contents with [redacted]. This is the default." },
+ { "char <char>", "Set the character to be displayed next to PGP encrypted messages." },
+ { "announce <file>", "Announce a public key by pushing it on the XMPP Server"},
+ { "discover <jid>", "Discover public keys of a jid "},
+ { "request <jid>", "Request public keys"},
+ { "sendfile on|off", "Allow /sendfile to send unencrypted files while otherwise using PGP."})
+ CMD_EXAMPLES(
+ "/ox log off",
+ "/ox start odin@valhalla.edda",
+ "/ox end",
+ "/ox char X")
+ },
#endif // HAVE_LIBGPGME
{ "/otr",
- parse_args, 1, 3, NULL,
- CMD_SUBFUNCS(
- { "char", cmd_otr_char },
- { "log", cmd_otr_log },
- { "libver", cmd_otr_libver },
- { "policy", cmd_otr_policy },
- { "gen", cmd_otr_gen },
- { "myfp", cmd_otr_myfp },
- { "theirfp", cmd_otr_theirfp },
- { "start", cmd_otr_start },
- { "end", cmd_otr_end },
- { "trust", cmd_otr_trust },
- { "untrust", cmd_otr_untrust },
- { "secret", cmd_otr_secret },
- { "question", cmd_otr_question },
- { "answer", cmd_otr_answer },
- { "sendfile", cmd_otr_sendfile })
- CMD_NOMAINFUNC
- CMD_TAGS(
- CMD_TAG_CHAT,
- CMD_TAG_UI)
- CMD_SYN(
- "/otr libver",
- "/otr gen",
- "/otr myfp|theirfp",
- "/otr start [<contact>]",
- "/otr end",
- "/otr trust|untrust",
- "/otr secret <secret>",
- "/otr question <question> <answer>",
- "/otr answer <answer>",
- "/otr policy manual|opportunistic|always [<contact>]",
- "/otr log on|off|redact",
- "/otr char <char>",
- "/otr sendfile on|off")
- CMD_DESC(
- "Off The Record (OTR) commands to manage keys, and perform OTR encryption during chat sessions.")
- CMD_ARGS(
- { "libver", "Show which version of the libotr library is being used." },
- { "gen", "Generate your private key." },
- { "myfp", "Show your fingerprint." },
- { "theirfp", "Show contacts fingerprint." },
- { "start [<contact>]", "Start an OTR session with contact, or current recipient if omitted." },
- { "end", "End the current OTR session." },
- { "trust|untrust", "Indicate whether or not you trust the contact's fingerprint." },
- { "secret <secret>", "Verify a contact's identity using a shared secret." },
- { "question <question> <answer>", "Verify a contact's identity using a question and expected answer." },
- { "answer <answer>", "Respond to a question answer verification request with your answer." },
- { "policy manual", "Set the global OTR policy to manual, OTR sessions must be started manually." },
- { "policy manual <contact>", "Set the OTR policy to manual for a specific contact." },
- { "policy opportunistic", "Set the global OTR policy to opportunistic, an OTR session will be attempted upon starting a conversation." },
- { "policy opportunistic <contact>", "Set the OTR policy to opportunistic for a specific contact." },
- { "policy always", "Set the global OTR policy to always, an error will be displayed if an OTR session cannot be initiated upon starting a conversation." },
- { "policy always <contact>", "Set the OTR policy to always for a specific contact." },
- { "log on|off", "Enable or disable plaintext logging of OTR encrypted messages." },
- { "log redact", "Log OTR encrypted messages, but replace the contents with [redacted]. This is the default." },
- { "char <char>", "Set the character to be displayed next to OTR encrypted messages." },
- { "sendfile on|off", "Allow /sendfile to send unencrypted files while in an OTR session." })
- CMD_EXAMPLES(
- "/otr log off",
- "/otr policy manual",
- "/otr policy opportunistic odin@valhalla.edda",
- "/otr gen",
- "/otr start odin@valhalla.edda",
- "/otr myfp",
- "/otr theirfp",
- "/otr question \"What is the name of my rabbit?\" fiffi",
- "/otr end",
- "/otr char *") },
+ parse_args, 1, 3, NULL,
+ CMD_SUBFUNCS(
+ { "char", cmd_otr_char },
+ { "log", cmd_otr_log },
+ { "libver", cmd_otr_libver },
+ { "policy", cmd_otr_policy },
+ { "gen", cmd_otr_gen },
+ { "myfp", cmd_otr_myfp },
+ { "theirfp", cmd_otr_theirfp },
+ { "start", cmd_otr_start },
+ { "end", cmd_otr_end },
+ { "trust", cmd_otr_trust },
+ { "untrust", cmd_otr_untrust },
+ { "secret", cmd_otr_secret },
+ { "question", cmd_otr_question },
+ { "answer", cmd_otr_answer },
+ { "sendfile", cmd_otr_sendfile })
+ CMD_NOMAINFUNC
+ CMD_TAGS(
+ CMD_TAG_CHAT,
+ CMD_TAG_UI)
+ CMD_SYN(
+ "/otr libver",
+ "/otr gen",
+ "/otr myfp|theirfp",
+ "/otr start [<contact>]",
+ "/otr end",
+ "/otr trust|untrust",
+ "/otr secret <secret>",
+ "/otr question <question> <answer>",
+ "/otr answer <answer>",
+ "/otr policy manual|opportunistic|always [<contact>]",
+ "/otr log on|off|redact",
+ "/otr char <char>",
+ "/otr sendfile on|off")
+ CMD_DESC(
+ "Off The Record (OTR) commands to manage keys, and perform OTR encryption during chat sessions.")
+ CMD_ARGS(
+ { "libver", "Show which version of the libotr library is being used." },
+ { "gen", "Generate your private key." },
+ { "myfp", "Show your fingerprint." },
+ { "theirfp", "Show contacts fingerprint." },
+ { "start [<contact>]", "Start an OTR session with contact, or current recipient if omitted." },
+ { "end", "End the current OTR session." },
+ { "trust|untrust", "Indicate whether or not you trust the contact's fingerprint." },
+ { "secret <secret>", "Verify a contact's identity using a shared secret." },
+ { "question <question> <answer>", "Verify a contact's identity using a question and expected answer." },
+ { "answer <answer>", "Respond to a question answer verification request with your answer." },
+ { "policy manual", "Set the global OTR policy to manual, OTR sessions must be started manually." },
+ { "policy manual <contact>", "Set the OTR policy to manual for a specific contact." },
+ { "policy opportunistic", "Set the global OTR policy to opportunistic, an OTR session will be attempted upon starting a conversation." },
+ { "policy opportunistic <contact>", "Set the OTR policy to opportunistic for a specific contact." },
+ { "policy always", "Set the global OTR policy to always, an error will be displayed if an OTR session cannot be initiated upon starting a conversation." },
+ { "policy always <contact>", "Set the OTR policy to always for a specific contact." },
+ { "log on|off", "Enable or disable plaintext logging of OTR encrypted messages." },
+ { "log redact", "Log OTR encrypted messages, but replace the contents with [redacted]. This is the default." },
+ { "char <char>", "Set the character to be displayed next to OTR encrypted messages." },
+ { "sendfile on|off", "Allow /sendfile to send unencrypted files while in an OTR session."})
+ CMD_EXAMPLES(
+ "/otr log off",
+ "/otr policy manual",
+ "/otr policy opportunistic odin@valhalla.edda",
+ "/otr gen",
+ "/otr start odin@valhalla.edda",
+ "/otr myfp",
+ "/otr theirfp",
+ "/otr question \"What is the name of my rabbit?\" fiffi",
+ "/otr end",
+ "/otr char *")
+ },
{ "/outtype",
- parse_args, 1, 1, &cons_outtype_setting,
- CMD_NOSUBFUNCS
- CMD_MAINFUNC(cmd_outtype)
- CMD_TAGS(
- CMD_TAG_CHAT)
- CMD_SYN(
- "/outtype on|off")
- CMD_DESC(
- "Send typing notifications, chat states (/states) will be enabled if this setting is enabled.")
- CMD_ARGS(
- { "on|off", "Enable or disable sending typing notifications." })
- CMD_NOEXAMPLES },
+ parse_args, 1, 1, &cons_outtype_setting,
+ CMD_NOSUBFUNCS
+ CMD_MAINFUNC(cmd_outtype)
+ CMD_TAGS(
+ CMD_TAG_CHAT)
+ CMD_SYN(
+ "/outtype on|off")
+ CMD_DESC(
+ "Send typing notifications, chat states (/states) will be enabled if this setting is enabled.")
+ CMD_ARGS(
+ { "on|off", "Enable or disable sending typing notifications." })
+ CMD_NOEXAMPLES
+ },
{ "/gone",
- parse_args, 1, 1, &cons_gone_setting,
- CMD_NOSUBFUNCS
- CMD_MAINFUNC(cmd_gone)
- CMD_TAGS(
- CMD_TAG_CHAT)
- CMD_SYN(
- "/gone <minutes>")
- CMD_DESC(
- "Send a 'gone' state to the recipient after the specified number of minutes. "
- "Chat states (/states) will be enabled if this setting is set.")
- CMD_ARGS(
- { "<minutes>", "Number of minutes of inactivity before sending the 'gone' state, a value of 0 will disable sending this state." })
- CMD_NOEXAMPLES },
+ parse_args, 1, 1, &cons_gone_setting,
+ CMD_NOSUBFUNCS
+ CMD_MAINFUNC(cmd_gone)
+ CMD_TAGS(
+ CMD_TAG_CHAT)
+ CMD_SYN(
+ "/gone <minutes>")
+ CMD_DESC(
+ "Send a 'gone' state to the recipient after the specified number of minutes. "
+ "Chat states (/states) will be enabled if this setting is set.")
+ CMD_ARGS(
+ { "<minutes>", "Number of minutes of inactivity before sending the 'gone' state, a value of 0 will disable sending this state." })
+ CMD_NOEXAMPLES
+ },
{ "/history",
- parse_args, 1, 1, &cons_history_setting,
- CMD_NOSUBFUNCS
- CMD_MAINFUNC(cmd_history)
- CMD_TAGS(
- CMD_TAG_UI,
- CMD_TAG_CHAT)
- CMD_SYN(
- "/history on|off")
- CMD_DESC(
- "Switch chat history on or off, /chlog will automatically be enabled when this setting is on. "
- "When history is enabled, previous messages are shown in chat windows.")
- CMD_ARGS(
- { "on|off", "Enable or disable showing chat history." })
- CMD_NOEXAMPLES },
+ parse_args, 1, 1, &cons_history_setting,
+ CMD_NOSUBFUNCS
+ CMD_MAINFUNC(cmd_history)
+ CMD_TAGS(
+ CMD_TAG_UI,
+ CMD_TAG_CHAT)
+ CMD_SYN(
+ "/history on|off")
+ CMD_DESC(
+ "Switch chat history on or off, /chlog will automatically be enabled when this setting is on. "
+ "When history is enabled, previous messages are shown in chat windows.")
+ CMD_ARGS(
+ { "on|off", "Enable or disable showing chat history." })
+ CMD_NOEXAMPLES
+ },
{ "/log",
- parse_args, 1, 2, &cons_log_setting,
- CMD_NOSUBFUNCS
- CMD_MAINFUNC(cmd_log)
- CMD_NOTAGS
- CMD_SYN(
- "/log where",
- "/log rotate on|off",
- "/log maxsize <bytes>",
- "/log shared on|off")
- CMD_DESC(
- "Manage profanity log settings.")
- CMD_ARGS(
- { "where", "Show the current log file location." },
- { "rotate on|off", "Rotate log, default on." },
- { "maxsize <bytes>", "With rotate enabled, specifies the max log size, defaults to 1048580 (1MB)." },
- { "shared on|off", "Share logs between all instances, default: on. When off, the process id will be included in the log filename." })
- CMD_NOEXAMPLES },
+ parse_args, 1, 2, &cons_log_setting,
+ CMD_NOSUBFUNCS
+ CMD_MAINFUNC(cmd_log)
+ CMD_NOTAGS
+ CMD_SYN(
+ "/log where",
+ "/log rotate on|off",
+ "/log maxsize <bytes>",
+ "/log shared on|off")
+ CMD_DESC(
+ "Manage profanity log settings.")
+ CMD_ARGS(
+ { "where", "Show the current log file location." },
+ { "rotate on|off", "Rotate log, default on." },
+ { "maxsize <bytes>", "With rotate enabled, specifies the max log size, defaults to 1048580 (1MB)." },
+ { "shared on|off", "Share logs between all instances, default: on. When off, the process id will be included in the log filename." })
+ CMD_NOEXAMPLES
+ },
{ "/carbons",
- parse_args, 1, 1, &cons_carbons_setting,
- CMD_NOSUBFUNCS
- CMD_MAINFUNC(cmd_carbons)
- CMD_TAGS(
- CMD_TAG_CHAT)
- CMD_SYN(
- "/carbons on|off")
- CMD_DESC(
- "Enable or disable message carbons. "
- "Message carbons ensure that both sides of all conversations are shared with all the user's clients that implement this protocol.")
- CMD_ARGS(
- { "on|off", "Enable or disable message carbons." })
- CMD_NOEXAMPLES },
+ parse_args, 1, 1, &cons_carbons_setting,
+ CMD_NOSUBFUNCS
+ CMD_MAINFUNC(cmd_carbons)
+ CMD_TAGS(
+ CMD_TAG_CHAT)
+ CMD_SYN(
+ "/carbons on|off")
+ CMD_DESC(
+ "Enable or disable message carbons. "
+ "Message carbons ensure that both sides of all conversations are shared with all the user's clients that implement this protocol.")
+ CMD_ARGS(
+ { "on|off", "Enable or disable message carbons." })
+ CMD_NOEXAMPLES
+ },
{ "/receipts",
- parse_args, 2, 2, &cons_receipts_setting,
- CMD_NOSUBFUNCS
- CMD_MAINFUNC(cmd_receipts)
- CMD_TAGS(
- CMD_TAG_CHAT)
- CMD_SYN(
- "/receipts request on|off",
- "/receipts send on|off")
- CMD_DESC(
- "Enable or disable message delivery receipts. The interface will indicate when a message has been received.")
- CMD_ARGS(
- { "request on|off", "Whether or not to request a receipt upon sending a message." },
- { "send on|off", "Whether or not to send a receipt if one has been requested with a received message." })
- CMD_NOEXAMPLES },
+ parse_args, 2, 2, &cons_receipts_setting,
+ CMD_NOSUBFUNCS
+ CMD_MAINFUNC(cmd_receipts)
+ CMD_TAGS(
+ CMD_TAG_CHAT)
+ CMD_SYN(
+ "/receipts request on|off",
+ "/receipts send on|off")
+ CMD_DESC(
+ "Enable or disable message delivery receipts. The interface will indicate when a message has been received.")
+ CMD_ARGS(
+ { "request on|off", "Whether or not to request a receipt upon sending a message." },
+ { "send on|off", "Whether or not to send a receipt if one has been requested with a received message." })
+ CMD_NOEXAMPLES
+ },
{ "/reconnect",
- parse_args, 1, 1, &cons_reconnect_setting,
- CMD_NOSUBFUNCS
- CMD_MAINFUNC(cmd_reconnect)
- CMD_TAGS(
- CMD_TAG_CONNECTION)
- CMD_SYN(
- "/reconnect <seconds>")
- CMD_DESC(
- "Set the reconnect attempt interval for when the connection is lost.")
- CMD_ARGS(
- { "<seconds>", "Number of seconds before attempting to reconnect, a value of 0 disables reconnect." })
- CMD_NOEXAMPLES },
+ parse_args, 1, 1, &cons_reconnect_setting,
+ CMD_NOSUBFUNCS
+ CMD_MAINFUNC(cmd_reconnect)
+ CMD_TAGS(
+ CMD_TAG_CONNECTION)
+ CMD_SYN(
+ "/reconnect <seconds>")
+ CMD_DESC(
+ "Set the reconnect attempt interval for when the connection is lost.")
+ CMD_ARGS(
+ { "<seconds>", "Number of seconds before attempting to reconnect, a value of 0 disables reconnect." })
+ CMD_NOEXAMPLES
+ },
{ "/autoping",
- parse_args, 2, 2, &cons_autoping_setting,
- CMD_NOSUBFUNCS
- CMD_MAINFUNC(cmd_autoping)
- CMD_TAGS(
- CMD_TAG_CONNECTION)
- CMD_SYN(
- "/autoping set <seconds>",
- "/autoping timeout <seconds>")
- CMD_DESC(
- "Set the interval between sending ping requests to the server to ensure the connection is kept alive.")
- CMD_ARGS(
- { "set <seconds>", "Number of seconds between sending pings, a value of 0 disables autoping." },
- { "timeout <seconds>", "Seconds to wait for autoping responses, after which the connection is considered broken." })
- CMD_NOEXAMPLES },
+ parse_args, 2, 2, &cons_autoping_setting,
+ CMD_NOSUBFUNCS
+ CMD_MAINFUNC(cmd_autoping)
+ CMD_TAGS(
+ CMD_TAG_CONNECTION)
+ CMD_SYN(
+ "/autoping set <seconds>",
+ "/autoping timeout <seconds>")
+ CMD_DESC(
+ "Set the interval between sending ping requests to the server to ensure the connection is kept alive.")
+ CMD_ARGS(
+ { "set <seconds>", "Number of seconds between sending pings, a value of 0 disables autoping." },
+ { "timeout <seconds>", "Seconds to wait for autoping responses, after which the connection is considered broken." })
+ CMD_NOEXAMPLES
+ },
{ "/ping",
- parse_args, 0, 1, NULL,
- CMD_NOSUBFUNCS
- CMD_MAINFUNC(cmd_ping)
- CMD_TAGS(
- CMD_TAG_CONNECTION)
- CMD_SYN(
- "/ping [<jid>]")
- CMD_DESC(
- "Sends an IQ ping stanza to the specified JID. "
- "If no JID is supplied, your chat server will be pinged.")
- CMD_ARGS(
- { "<jid>", "The Jabber ID to send the ping request to." })
- CMD_NOEXAMPLES },
+ parse_args, 0, 1, NULL,
+ CMD_NOSUBFUNCS
+ CMD_MAINFUNC(cmd_ping)
+ CMD_TAGS(
+ CMD_TAG_CONNECTION)
+ CMD_SYN(
+ "/ping [<jid>]")
+ CMD_DESC(
+ "Sends an IQ ping stanza to the specified JID. "
+ "If no JID is supplied, your chat server will be pinged.")
+ CMD_ARGS(
+ { "<jid>", "The Jabber ID to send the ping request to." })
+ CMD_NOEXAMPLES
+ },
{ "/autoaway",
- parse_args_with_freetext, 2, 3, &cons_autoaway_setting,
- CMD_NOSUBFUNCS
- CMD_MAINFUNC(cmd_autoaway)
- CMD_TAGS(
- CMD_TAG_PRESENCE)
- CMD_SYN(
- "/autoaway mode idle|away|off",
- "/autoaway time away|xa <minutes>",
- "/autoaway message away|xa <message>|off",
- "/autoaway check on|off")
- CMD_DESC(
- "Manage autoaway settings for idle time.")
- CMD_ARGS(
- { "mode idle", "Sends idle time, status remains online." },
- { "mode away", "Sends away and xa presence as well as idle time." },
- { "mode off", "Disabled (default)." },
- { "time away <minutes>", "Number of minutes before the away presence is sent, default: 15." },
- { "time xa <minutes>", "Number of minutes before the xa presence is sent, default: 0 (disabled)." },
- { "message away <message>", "Optional message to send with the away presence, default: off (disabled)." },
- { "message xa <message>", "Optional message to send with the xa presence, default: off (disabled)." },
- { "message away off", "Send no message with away presence." },
- { "message xa off", "Send no message with xa presence." },
- { "check on|off", "When enabled, checks for activity and sends online presence, default: on." })
- CMD_EXAMPLES(
- "/autoaway mode away",
- "/autoaway time away 30",
- "/autoaway message away Away from computer for a while",
- "/autoaway time xa 120",
- "/autoaway message xa Away from computer for a very long time",
- "/autoaway check off") },
+ parse_args_with_freetext, 2, 3, &cons_autoaway_setting,
+ CMD_NOSUBFUNCS
+ CMD_MAINFUNC(cmd_autoaway)
+ CMD_TAGS(
+ CMD_TAG_PRESENCE)
+ CMD_SYN(
+ "/autoaway mode idle|away|off",
+ "/autoaway time away|xa <minutes>",
+ "/autoaway message away|xa <message>|off",
+ "/autoaway check on|off")
+ CMD_DESC(
+ "Manage autoaway settings for idle time.")
+ CMD_ARGS(
+ { "mode idle", "Sends idle time, status remains online." },
+ { "mode away", "Sends away and xa presence as well as idle time." },
+ { "mode off", "Disabled (default)." },
+ { "time away <minutes>", "Number of minutes before the away presence is sent, default: 15." },
+ { "time xa <minutes>", "Number of minutes before the xa presence is sent, default: 0 (disabled)." },
+ { "message away <message>", "Optional message to send with the away presence, default: off (disabled)." },
+ { "message xa <message>", "Optional message to send with the xa presence, default: off (disabled)." },
+ { "message away off", "Send no message with away presence." },
+ { "message xa off", "Send no message with xa presence." },
+ { "check on|off", "When enabled, checks for activity and sends online presence, default: on." })
+ CMD_EXAMPLES(
+ "/autoaway mode away",
+ "/autoaway time away 30",
+ "/autoaway message away Away from computer for a while",
+ "/autoaway time xa 120",
+ "/autoaway message xa Away from computer for a very long time",
+ "/autoaway check off")
+ },
{ "/priority",
- parse_args, 1, 1, NULL,
- CMD_NOSUBFUNCS
- CMD_MAINFUNC(cmd_priority)
- CMD_TAGS(
- CMD_TAG_PRESENCE)
- CMD_SYN(
- "/priority <priority>")
- CMD_DESC(
- "Set priority for the current account. "
- "See the /account command for specific priority settings per presence status.")
- CMD_ARGS(
- { "<priority>", "Number between -128 and 127, default: 0." })
- CMD_NOEXAMPLES },
+ parse_args, 1, 1, NULL,
+ CMD_NOSUBFUNCS
+ CMD_MAINFUNC(cmd_priority)
+ CMD_TAGS(
+ CMD_TAG_PRESENCE)
+ CMD_SYN(
+ "/priority <priority>")
+ CMD_DESC(
+ "Set priority for the current account. "
+ "See the /account command for specific priority settings per presence status.")
+ CMD_ARGS(
+ { "<priority>", "Number between -128 and 127, default: 0." })
+ CMD_NOEXAMPLES
+ },
{ "/account",
- parse_args, 0, 4, NULL,
- CMD_SUBFUNCS(
- { "list", cmd_account_list },
- { "show", cmd_account_show },
- { "add", cmd_account_add },
- { "remove", cmd_account_remove },
- { "enable", cmd_account_enable },
- { "disable", cmd_account_disable },
- { "rename", cmd_account_rename },
- { "default", cmd_account_default },
- { "set", cmd_account_set },
- { "clear", cmd_account_clear })
- CMD_MAINFUNC(cmd_account)
- CMD_TAGS(
- CMD_TAG_CONNECTION,
- CMD_TAG_PRESENCE,
- CMD_TAG_CHAT,
- CMD_TAG_GROUPCHAT)
- CMD_SYN(
- "/account",
- "/account list",
- "/account show <account>",
- "/account enable|disable <account>",
- "/account default set <account>",
- "/account default off",
- "/account add <account>",
- "/account remove <account>",
- "/account rename <account> <newaccount>",
- "/account set <account> jid <jid>",
- "/account set <account> server <server>",
- "/account set <account> port <port>",
- "/account set <account> status <presence>",
- "/account set <account> status last",
- "/account set <account> <presence> <priority>",
- "/account set <account> resource <resource>",
- "/account set <account> password <password>",
- "/account set <account> eval_password <command>",
- "/account set <account> muc <service>",
- "/account set <account> nick <nick>",
- "/account set <account> otr <policy>",
- "/account set <account> pgpkeyid <pgpkeyid>",
- "/account set <account> startscript <script>",
- "/account set <account> tls force|allow|trust|legacy|disable",
- "/account set <account> auth default|legacy",
- "/account set <account> theme <theme>",
- "/account clear <account> password",
- "/account clear <account> eval_password",
- "/account clear <account> server",
- "/account clear <account> port",
- "/account clear <account> otr",
- "/account clear <account> pgpkeyid",
- "/account clear <account> startscript",
- "/account clear <account> muc",
- "/account clear <account> resource")
- CMD_DESC(
- "Commands for creating and managing accounts. "
- "Calling with no arguments will display information for the current account.")
- CMD_ARGS(
- { "list", "List all accounts." },
- { "enable <account>", "Enable the account, it will be used for autocompletion." },
- { "show <account>", "Show details for the specified account." },
- { "disable <account>", "Disable the account." },
- { "default set <account>", "Set the default account, used when no argument passed to the /connect command." },
- { "default off", "Clear the default account setting." },
- { "add <account>", "Create a new account." },
- { "remove <account>", "Remove an account." },
- { "rename <account> <newaccount>", "Rename 'account' to 'newaccount'." },
- { "set <account> jid <jid>", "Set the Jabber ID for the account, account name will be used if not set." },
- { "set <account> server <server>", "The chat server, if different to the domainpart of the JID." },
- { "set <account> port <port>", "The port used for connecting if not the default (5222, or 5223 for SSL)." },
- { "set <account> status <presence>", "The presence status to use on login." },
- { "set <account> status last", "Use your last status before logging out, when logging in." },
- { "set <account> <presence> <priority>", "Set the priority (-128..127) to use for the specified presence." },
- { "set <account> resource <resource>", "The resource to be used for this account, defaults to 'profanity'." },
- { "set <account> password <password>", "Password for the account, note this is currently stored in plaintext if set." },
- { "set <account> eval_password <command>", "Shell command evaluated to retrieve password for the account. Can be used to retrieve password from keyring." },
- { "set <account> muc <service>", "The default MUC chat service to use, defaults to the servers disco info response." },
- { "set <account> nick <nick>", "The default nickname to use when joining chat rooms." },
- { "set <account> otr <policy>", "Override global OTR policy for this account, see /otr." },
- { "set <account> pgpkeyid <pgpkeyid>", "Set the ID of the PGP key for this account, see /pgp." },
- { "set <account> startscript <script>", "Set the script to execute after connecting." },
- { "set <account> tls force", "Force TLS connection, and fail if one cannot be established, this is default behaviour." },
- { "set <account> tls allow", "Use TLS for the connection if it is available." },
- { "set <account> tls trust", "Force TLS connection and trust server's certificate." },
- { "set <account> tls legacy", "Use legacy TLS for the connection. It means server doesn't support STARTTLS and TLS is forced just after TCP connection is established." },
- { "set <account> tls disable", "Disable TLS for the connection." },
- { "set <account> auth default", "Use default authentication process." },
- { "set <account> auth legacy", "Allow legacy authentication." },
- { "set <account> <theme>", "Set the UI theme for the account." },
- { "clear <account> server", "Remove the server setting for this account." },
- { "clear <account> port", "Remove the port setting for this account." },
- { "clear <account> password", "Remove the password setting for this account." },
- { "clear <account> eval_password", "Remove the eval_password setting for this account." },
- { "clear <account> otr", "Remove the OTR policy setting for this account." },
- { "clear <account> pgpkeyid", "Remove pgpkeyid associated with this account." },
- { "clear <account> startscript", "Remove startscript associated with this account." },
- { "clear <account> theme", "Clear the theme setting for the account, the global theme will be used." },
- { "clear <account> resource", "Remove the resource setting for this account." },
- { "clear <account> muc", "Remove the default MUC service setting." })
- CMD_EXAMPLES(
- "/account add me",
- "/account set me jid ulfhednar@valhalla.edda",
- "/account set me server talk.chat.com",
- "/account set me port 5111",
- "/account set me muc chatservice.mycompany.com",
- "/account set me nick dennis",
- "/account set me status dnd",
- "/account set me dnd -1",
- "/account rename me chattyme",
- "/account clear me pgpkeyid") },
+ parse_args, 0, 4, NULL,
+ CMD_SUBFUNCS(
+ { "list", cmd_account_list },
+ { "show", cmd_account_show },
+ { "add", cmd_account_add },
+ { "remove", cmd_account_remove },
+ { "enable", cmd_account_enable },
+ { "disable", cmd_account_disable },
+ { "rename", cmd_account_rename },
+ { "default", cmd_account_default },
+ { "set", cmd_account_set },
+ { "clear", cmd_account_clear })
+ CMD_MAINFUNC(cmd_account)
+ CMD_TAGS(
+ CMD_TAG_CONNECTION,
+ CMD_TAG_PRESENCE,
+ CMD_TAG_CHAT,
+ CMD_TAG_GROUPCHAT)
+ CMD_SYN(
+ "/account",
+ "/account list",
+ "/account show <account>",
+ "/account enable|disable <account>",
+ "/account default set <account>",
+ "/account default off",
+ "/account add <account>",
+ "/account remove <account>",
+ "/account rename <account> <newaccount>",
+ "/account set <account> jid <jid>",
+ "/account set <account> server <server>",
+ "/account set <account> port <port>",
+ "/account set <account> status <presence>",
+ "/account set <account> status last",
+ "/account set <account> <presence> <priority>",
+ "/account set <account> resource <resource>",
+ "/account set <account> password <password>",
+ "/account set <account> eval_password <command>",
+ "/account set <account> muc <service>",
+ "/account set <account> nick <nick>",
+ "/account set <account> otr <policy>",
+ "/account set <account> pgpkeyid <pgpkeyid>",
+ "/account set <account> startscript <script>",
+ "/account set <account> tls force|allow|trust|legacy|disable",
+ "/account set <account> auth default|legacy",
+ "/account set <account> theme <theme>",
+ "/account clear <account> password",
+ "/account clear <account> eval_password",
+ "/account clear <account> server",
+ "/account clear <account> port",
+ "/account clear <account> otr",
+ "/account clear <account> pgpkeyid",
+ "/account clear <account> startscript",
+ "/account clear <account> muc",
+ "/account clear <account> resource")
+ CMD_DESC(
+ "Commands for creating and managing accounts. "
+ "Calling with no arguments will display information for the current account.")
+ CMD_ARGS(
+ { "list", "List all accounts." },
+ { "enable <account>", "Enable the account, it will be used for autocompletion." },
+ { "show <account>", "Show details for the specified account." },
+ { "disable <account>", "Disable the account." },
+ { "default set <account>", "Set the default account, used when no argument passed to the /connect command." },
+ { "default off", "Clear the default account setting." },
+ { "add <account>", "Create a new account." },
+ { "remove <account>", "Remove an account." },
+ { "rename <account> <newaccount>", "Rename 'account' to 'newaccount'." },
+ { "set <account> jid <jid>", "Set the Jabber ID for the account, account name will be used if not set." },
+ { "set <account> server <server>", "The chat server, if different to the domainpart of the JID." },
+ { "set <account> port <port>", "The port used for connecting if not the default (5222, or 5223 for SSL)." },
+ { "set <account> status <presence>", "The presence status to use on login." },
+ { "set <account> status last", "Use your last status before logging out, when logging in." },
+ { "set <account> <presence> <priority>", "Set the priority (-128..127) to use for the specified presence." },
+ { "set <account> resource <resource>", "The resource to be used for this account, defaults to 'profanity'." },
+ { "set <account> password <password>", "Password for the account, note this is currently stored in plaintext if set." },
+ { "set <account> eval_password <command>", "Shell command evaluated to retrieve password for the account. Can be used to retrieve password from keyring." },
+ { "set <account> muc <service>", "The default MUC chat service to use, defaults to the servers disco info response." },
+ { "set <account> nick <nick>", "The default nickname to use when joining chat rooms." },
+ { "set <account> otr <policy>", "Override global OTR policy for this account, see /otr." },
+ { "set <account> pgpkeyid <pgpkeyid>", "Set the ID of the PGP key for this account, see /pgp." },
+ { "set <account> startscript <script>", "Set the script to execute after connecting." },
+ { "set <account> tls force", "Force TLS connection, and fail if one cannot be established, this is default behaviour." },
+ { "set <account> tls allow", "Use TLS for the connection if it is available." },
+ { "set <account> tls trust", "Force TLS connection and trust server's certificate." },
+ { "set <account> tls legacy", "Use legacy TLS for the connection. It means server doesn't support STARTTLS and TLS is forced just after TCP connection is established." },
+ { "set <account> tls disable", "Disable TLS for the connection." },
+ { "set <account> auth default", "Use default authentication process." },
+ { "set <account> auth legacy", "Allow legacy authentication." },
+ { "set <account> <theme>", "Set the UI theme for the account." },
+ { "clear <account> server", "Remove the server setting for this account." },
+ { "clear <account> port", "Remove the port setting for this account." },
+ { "clear <account> password", "Remove the password setting for this account." },
+ { "clear <account> eval_password", "Remove the eval_password setting for this account." },
+ { "clear <account> otr", "Remove the OTR policy setting for this account." },
+ { "clear <account> pgpkeyid", "Remove pgpkeyid associated with this account." },
+ { "clear <account> startscript", "Remove startscript associated with this account." },
+ { "clear <account> theme", "Clear the theme setting for the account, the global theme will be used." },
+ { "clear <account> resource", "Remove the resource setting for this account."},
+ { "clear <account> muc", "Remove the default MUC service setting."})
+ CMD_EXAMPLES(
+ "/account add me",
+ "/account set me jid ulfhednar@valhalla.edda",
+ "/account set me server talk.chat.com",
+ "/account set me port 5111",
+ "/account set me muc chatservice.mycompany.com",
+ "/account set me nick dennis",
+ "/account set me status dnd",
+ "/account set me dnd -1",
+ "/account rename me chattyme",
+ "/account clear me pgpkeyid"
+ )
+ },
{ "/plugins",
- parse_args, 0, 3, NULL,
- CMD_SUBFUNCS(
- { "sourcepath", cmd_plugins_sourcepath },
- { "install", cmd_plugins_install },
- { "uninstall", cmd_plugins_uninstall },
- { "update", cmd_plugins_update },
- { "load", cmd_plugins_load },
- { "unload", cmd_plugins_unload },
- { "reload", cmd_plugins_reload },
- { "python_version", cmd_plugins_python_version })
- CMD_MAINFUNC(cmd_plugins)
- CMD_NOTAGS
- CMD_SYN(
- "/plugins",
- "/plugins sourcepath set <path>",
- "/plugins sourcepath clear",
- "/plugins install [<path>]",
- "/plugins uninstall [<plugin>]",
- "/plugins update [<path>]",
- "/plugins unload [<plugin>]",
- "/plugins load [<plugin>]",
- "/plugins reload [<plugin>]",
- "/plugins python_version")
- CMD_DESC(
- "Manage plugins. Passing no arguments lists currently loaded plugins.")
- CMD_ARGS(
- { "sourcepath set <path>", "Set the default path to install plugins from, will be used if no arg is passed to /plugins install." },
- { "sourcepath clear", "Clear the default plugins source path." },
- { "install [<path>]", "Install a plugin, or all plugins found in a directory (recursive). Passing no argument will use the sourcepath if one is set." },
- { "uninstall [<plugin>]", "Uninstall a plugin." },
- { "update [<path>]", "Updates an installed plugin" },
- { "load [<plugin>]", "Load a plugin that already exists in the plugin directory, passing no argument loads all found plugins." },
- { "unload [<plugin>]", "Unload a loaded plugin, passing no argument will unload all plugins." },
- { "reload [<plugin>]", "Reload a plugin, passing no argument will reload all plugins." },
- { "python_version", "Show the Python interpreter version." })
- CMD_EXAMPLES(
- "/plugins sourcepath set /home/meee/projects/profanity-plugins",
- "/plugins install",
- "/plugins install /home/steveharris/Downloads/metal.py",
- "/plugins update /home/steveharris/Downloads/metal.py",
- "/plugins uninstall browser.py",
- "/plugins load browser.py",
- "/plugins unload say.py",
- "/plugins reload wikipedia.py") },
+ parse_args, 0, 3, NULL,
+ CMD_SUBFUNCS(
+ { "sourcepath", cmd_plugins_sourcepath },
+ { "install", cmd_plugins_install },
+ { "uninstall", cmd_plugins_uninstall },
+ { "update", cmd_plugins_update },
+ { "load", cmd_plugins_load },
+ { "unload", cmd_plugins_unload },
+ { "reload", cmd_plugins_reload },
+ { "python_version", cmd_plugins_python_version })
+ CMD_MAINFUNC(cmd_plugins)
+ CMD_NOTAGS
+ CMD_SYN(
+ "/plugins",
+ "/plugins sourcepath set <path>",
+ "/plugins sourcepath clear",
+ "/plugins install [<path>]",
+ "/plugins uninstall [<plugin>]",
+ "/plugins update [<path>]",
+ "/plugins unload [<plugin>]",
+ "/plugins load [<plugin>]",
+ "/plugins reload [<plugin>]",
+ "/plugins python_version")
+ CMD_DESC(
+ "Manage plugins. Passing no arguments lists currently loaded plugins.")
+ CMD_ARGS(
+ { "sourcepath set <path>", "Set the default path to install plugins from, will be used if no arg is passed to /plugins install." },
+ { "sourcepath clear", "Clear the default plugins source path." },
+ { "install [<path>]", "Install a plugin, or all plugins found in a directory (recursive). Passing no argument will use the sourcepath if one is set." },
+ { "uninstall [<plugin>]", "Uninstall a plugin." },
+ { "update [<path>]", "Updates an installed plugin" },
+ { "load [<plugin>]", "Load a plugin that already exists in the plugin directory, passing no argument loads all found plugins." },
+ { "unload [<plugin>]", "Unload a loaded plugin, passing no argument will unload all plugins." },
+ { "reload [<plugin>]", "Reload a plugin, passing no argument will reload all plugins." },
+ { "python_version", "Show the Python interpreter version." })
+ CMD_EXAMPLES(
+ "/plugins sourcepath set /home/meee/projects/profanity-plugins",
+ "/plugins install",
+ "/plugins install /home/steveharris/Downloads/metal.py",
+ "/plugins update /home/steveharris/Downloads/metal.py",
+ "/plugins uninstall browser.py",
+ "/plugins load browser.py",
+ "/plugins unload say.py",
+ "/plugins reload wikipedia.py")
+ },
{ "/prefs",
- parse_args, 0, 1, NULL,
- CMD_NOSUBFUNCS
- CMD_MAINFUNC(cmd_prefs)
- CMD_NOTAGS
- CMD_SYN(
- "/prefs [ui|desktop|chat|log|conn|presence|otr|pgp|omemo]")
- CMD_DESC(
- "Show preferences for different areas of functionality. "
- "Passing no arguments shows all preferences.")
- CMD_ARGS(
- { "ui", "User interface preferences." },
- { "desktop", "Desktop notification preferences." },
- { "chat", "Chat state preferences." },
- { "log", "Logging preferences." },
- { "conn", "Connection handling preferences." },
- { "presence", "Chat presence preferences." },
- { "otr", "Off The Record preferences." },
- { "pgp", "OpenPGP preferences." },
- { "omemo", "OMEMO preferences." })
- CMD_NOEXAMPLES },
+ parse_args, 0, 1, NULL,
+ CMD_NOSUBFUNCS
+ CMD_MAINFUNC(cmd_prefs)
+ CMD_NOTAGS
+ CMD_SYN(
+ "/prefs [ui|desktop|chat|log|conn|presence|otr|pgp|omemo]")
+ CMD_DESC(
+ "Show preferences for different areas of functionality. "
+ "Passing no arguments shows all preferences.")
+ CMD_ARGS(
+ { "ui", "User interface preferences." },
+ { "desktop", "Desktop notification preferences." },
+ { "chat", "Chat state preferences." },
+ { "log", "Logging preferences." },
+ { "conn", "Connection handling preferences." },
+ { "presence", "Chat presence preferences." },
+ { "otr", "Off The Record preferences." },
+ { "pgp", "OpenPGP preferences." },
+ { "omemo", "OMEMO preferences." })
+ CMD_NOEXAMPLES
+ },
{ "/theme",
- parse_args, 1, 2, &cons_theme_setting,
- CMD_NOSUBFUNCS
- CMD_MAINFUNC(cmd_theme)
- CMD_TAGS(
- CMD_TAG_UI)
- CMD_SYN(
- "/theme list",
- "/theme load <theme>",
- "/theme full-load <theme>",
- "/theme colours",
- "/theme properties")
- CMD_DESC(
- "Load a theme, includes colours and UI options.")
- CMD_ARGS(
- { "list", "List all available themes." },
- { "load <theme>", "Load colours from specified theme. 'default' will reset to the default theme." },
- { "full-load <theme>", "Same as 'load' but will also load preferences set in the theme, not just colours." },
- { "colours", "Show colour values as rendered by the terminal." },
- { "properties", "Show colour settings for current theme." })
- CMD_EXAMPLES(
- "/theme list",
- "/theme load forest") },
+ parse_args, 1, 2, &cons_theme_setting,
+ CMD_NOSUBFUNCS
+ CMD_MAINFUNC(cmd_theme)
+ CMD_TAGS(
+ CMD_TAG_UI)
+ CMD_SYN(
+ "/theme list",
+ "/theme load <theme>",
+ "/theme full-load <theme>",
+ "/theme colours",
+ "/theme properties")
+ CMD_DESC(
+ "Load a theme, includes colours and UI options.")
+ CMD_ARGS(
+ { "list", "List all available themes." },
+ { "load <theme>", "Load colours from specified theme. 'default' will reset to the default theme." },
+ { "full-load <theme>", "Same as 'load' but will also load preferences set in the theme, not just colours." },
+ { "colours", "Show colour values as rendered by the terminal." },
+ { "properties", "Show colour settings for current theme." })
+ CMD_EXAMPLES(
+ "/theme list",
+ "/theme load forest")
+ },
{ "/xmlconsole",
- parse_args, 0, 0, NULL,
- CMD_NOSUBFUNCS
- CMD_MAINFUNC(cmd_xmlconsole)
- CMD_TAGS(
- CMD_TAG_UI)
- CMD_SYN(
- "/xmlconsole")
- CMD_DESC(
- "Open the XML console to view incoming and outgoing XMPP traffic.")
- CMD_NOARGS
- CMD_NOEXAMPLES },
+ parse_args, 0, 0, NULL,
+ CMD_NOSUBFUNCS
+ CMD_MAINFUNC(cmd_xmlconsole)
+ CMD_TAGS(
+ CMD_TAG_UI)
+ CMD_SYN(
+ "/xmlconsole")
+ CMD_DESC(
+ "Open the XML console to view incoming and outgoing XMPP traffic.")
+ CMD_NOARGS
+ CMD_NOEXAMPLES
+ },
{ "/script",
- parse_args, 1, 2, NULL,
- CMD_NOSUBFUNCS
- CMD_MAINFUNC(cmd_script)
- CMD_NOTAGS
- CMD_SYN(
- "/script run <script>",
- "/script list",
- "/script show <script>")
- CMD_DESC(
- "Run command scripts. "
- "Scripts are stored in $XDG_DATA_HOME/profanity/scripts/ which is usually $HOME/.local/share/profanity/scripts/.")
- CMD_ARGS(
- { "script run <script>", "Execute a script." },
- { "script list", "List all scripts TODO." },
- { "script show <script>", "Show the commands in script TODO." })
- CMD_EXAMPLES(
- "/script list",
- "/script run myscript",
- "/script show somescript") },
+ parse_args, 1, 2, NULL,
+ CMD_NOSUBFUNCS
+ CMD_MAINFUNC(cmd_script)
+ CMD_NOTAGS
+ CMD_SYN(
+ "/script run <script>",
+ "/script list",
+ "/script show <script>")
+ CMD_DESC(
+ "Run command scripts. "
+ "Scripts are stored in $XDG_DATA_HOME/profanity/scripts/ which is usually $HOME/.local/share/profanity/scripts/.")
+ CMD_ARGS(
+ { "script run <script>", "Execute a script." },
+ { "script list", "List all scripts TODO." },
+ { "script show <script>", "Show the commands in script TODO." })
+ CMD_EXAMPLES(
+ "/script list",
+ "/script run myscript",
+ "/script show somescript")
+ },
{ "/export",
- parse_args, 1, 1, NULL,
- CMD_NOSUBFUNCS
- CMD_MAINFUNC(cmd_export)
- CMD_NOTAGS
- CMD_SYN(
- "/export <filepath>")
- CMD_DESC(
- "Exports contacts to a csv file.")
- CMD_ARGS(
- { "<filepath>", "Path to the output file." })
- CMD_EXAMPLES(
- "/export /path/to/output.csv",
- "/export ~/contacts.csv") },
+ parse_args, 1, 1, NULL,
+ CMD_NOSUBFUNCS
+ CMD_MAINFUNC(cmd_export)
+ CMD_NOTAGS
+ CMD_SYN(
+ "/export <filepath>")
+ CMD_DESC(
+ "Exports contacts to a csv file.")
+ CMD_ARGS(
+ { "<filepath>", "Path to the output file." })
+ CMD_EXAMPLES(
+ "/export /path/to/output.csv",
+ "/export ~/contacts.csv")
+ },
{ "/cmd",
- parse_args, 1, 3, NULL,
- CMD_SUBFUNCS(
- { "list", cmd_command_list },
- { "exec", cmd_command_exec })
- CMD_NOMAINFUNC
- CMD_NOTAGS
- CMD_SYN(
- "/cmd list [<jid>]",
- "/cmd exec <command> [<jid>]")
- CMD_DESC(
- "Execute ad hoc commands.")
- CMD_ARGS(
- { "list", "List supported ad hoc commands." },
- { "exec <command>", "Execute a command." })
- CMD_EXAMPLES(
- "/cmd list",
- "/cmd exec ping") },
+ parse_args, 1, 3, NULL,
+ CMD_SUBFUNCS(
+ { "list", cmd_command_list },
+ { "exec", cmd_command_exec })
+ CMD_NOMAINFUNC
+ CMD_NOTAGS
+ CMD_SYN(
+ "/cmd list [<jid>]",
+ "/cmd exec <command> [<jid>]")
+ CMD_DESC(
+ "Execute ad hoc commands.")
+ CMD_ARGS(
+ { "list", "List supported ad hoc commands." },
+ { "exec <command>", "Execute a command." })
+ CMD_EXAMPLES(
+ "/cmd list",
+ "/cmd exec ping")
+ },
{ "/omemo",
- parse_args, 1, 3, NULL,
- CMD_SUBFUNCS(
- { "gen", cmd_omemo_gen },
- { "log", cmd_omemo_log },
- { "start", cmd_omemo_start },
- { "end", cmd_omemo_end },
- { "trust", cmd_omemo_trust },
- { "untrust", cmd_omemo_untrust },
- { "fingerprint", cmd_omemo_fingerprint },
- { "char", cmd_omemo_char },
- { "policy", cmd_omemo_policy },
- { "clear_device_list", cmd_omemo_clear_device_list },
- { "sendfile", cmd_omemo_sendfile })
- CMD_NOMAINFUNC
- CMD_TAGS(
- CMD_TAG_CHAT,
- CMD_TAG_UI)
- CMD_SYN(
- "/omemo gen",
- "/omemo log on|off|redact",
- "/omemo start [<contact>]",
- "/omemo trust [<contact>] <fingerprint>",
- "/omemo end",
- "/omemo fingerprint [<contact>]",
- "/omemo char <char>",
- "/omemo policy manual|automatic|always",
- "/omemo sendfile on|off",
- "/omemo clear_device_list")
- CMD_DESC(
- "OMEMO commands to manage keys, and perform encryption during chat sessions.")
- CMD_ARGS(
- { "gen", "Generate OMEMO crytographic materials for current account." },
- { "start [<contact>]", "Start an OMEMO session with contact, or current recipient if omitted." },
- { "end", "End the current OMEMO session." },
- { "log on|off", "Enable or disable plaintext logging of OMEMO encrypted messages." },
- { "log redact", "Log OMEMO encrypted messages, but replace the contents with [redacted]. This is the default." },
- { "fingerprint [<contact>]", "Show contact fingerprints, or current recipient if omitted." },
- { "char <char>", "Set the character to be displayed next to OMEMO encrypted messages." },
- { "policy manual", "Set the global OMEMO policy to manual, OMEMO sessions must be started manually." },
- { "policy automatic", "Set the global OMEMO policy to opportunistic, an OMEMO session will be attempted upon starting a conversation." },
- { "policy always", "Set the global OMEMO policy to always, an error will be displayed if an OMEMO session cannot be initiated upon starting a conversation." },
- { "sendfile on|off", "Allow /sendfile to send unencrypted files while in an OMEMO session." },
- { "clear_device_list", "Clear your own device list on server side. Each client will reannounce itself when connected back." })
- CMD_EXAMPLES(
- "/omemo gen",
- "/omemo start odin@valhalla.edda",
- "/omemo trust c4f9c875-144d7a3b-0c4a05b6-ca3be51a-a037f329-0bd3ae62-07f99719-55559d2a",
- "/omemo untrust loki@valhalla.edda c4f9c875-144d7a3b-0c4a05b6-ca3be51a-a037f329-0bd3ae62-07f99719-55559d2a",
- "/omemo char *") },
+ parse_args, 1, 3, NULL,
+ CMD_SUBFUNCS(
+ { "gen", cmd_omemo_gen },
+ { "log", cmd_omemo_log },
+ { "start", cmd_omemo_start },
+ { "end", cmd_omemo_end },
+ { "trust", cmd_omemo_trust },
+ { "untrust", cmd_omemo_untrust },
+ { "fingerprint", cmd_omemo_fingerprint },
+ { "char", cmd_omemo_char },
+ { "policy", cmd_omemo_policy },
+ { "clear_device_list", cmd_omemo_clear_device_list },
+ { "sendfile", cmd_omemo_sendfile} )
+ CMD_NOMAINFUNC
+ CMD_TAGS(
+ CMD_TAG_CHAT,
+ CMD_TAG_UI)
+ CMD_SYN(
+ "/omemo gen",
+ "/omemo log on|off|redact",
+ "/omemo start [<contact>]",
+ "/omemo trust [<contact>] <fingerprint>",
+ "/omemo end",
+ "/omemo fingerprint [<contact>]",
+ "/omemo char <char>",
+ "/omemo policy manual|automatic|always",
+ "/omemo sendfile on|off",
+ "/omemo clear_device_list")
+ CMD_DESC(
+ "OMEMO commands to manage keys, and perform encryption during chat sessions.")
+ CMD_ARGS(
+ { "gen", "Generate OMEMO crytographic materials for current account." },
+ { "start [<contact>]", "Start an OMEMO session with contact, or current recipient if omitted." },
+ { "end", "End the current OMEMO session." },
+ { "log on|off", "Enable or disable plaintext logging of OMEMO encrypted messages." },
+ { "log redact", "Log OMEMO encrypted messages, but replace the contents with [redacted]. This is the default." },
+ { "fingerprint [<contact>]", "Show contact fingerprints, or current recipient if omitted." },
+ { "char <char>", "Set the character to be displayed next to OMEMO encrypted messages." },
+ { "policy manual", "Set the global OMEMO policy to manual, OMEMO sessions must be started manually." },
+ { "policy automatic", "Set the global OMEMO policy to opportunistic, an OMEMO session will be attempted upon starting a conversation." },
+ { "policy always", "Set the global OMEMO policy to always, an error will be displayed if an OMEMO session cannot be initiated upon starting a conversation." },
+ { "sendfile on|off", "Allow /sendfile to send unencrypted files while in an OMEMO session."},
+ { "clear_device_list", "Clear your own device list on server side. Each client will reannounce itself when connected back."})
+ CMD_EXAMPLES(
+ "/omemo gen",
+ "/omemo start odin@valhalla.edda",
+ "/omemo trust c4f9c875-144d7a3b-0c4a05b6-ca3be51a-a037f329-0bd3ae62-07f99719-55559d2a",
+ "/omemo untrust loki@valhalla.edda c4f9c875-144d7a3b-0c4a05b6-ca3be51a-a037f329-0bd3ae62-07f99719-55559d2a",
+ "/omemo char *")
+ },
{ "/save",
- parse_args, 0, 0, NULL,
- CMD_NOSUBFUNCS
- CMD_MAINFUNC(cmd_save)
- CMD_NOTAGS
- CMD_SYN(
- "/save")
- CMD_DESC(
- "Save preferences to configuration file.")
- CMD_NOARGS
- CMD_NOEXAMPLES },
+ parse_args, 0, 0, NULL,
+ CMD_NOSUBFUNCS
+ CMD_MAINFUNC(cmd_save)
+ CMD_NOTAGS
+ CMD_SYN(
+ "/save")
+ CMD_DESC(
+ "Save preferences to configuration file.")
+ CMD_NOARGS
+ CMD_NOEXAMPLES
+ },
{ "/reload",
- parse_args, 0, 0, NULL,
- CMD_NOSUBFUNCS
- CMD_MAINFUNC(cmd_reload)
- CMD_NOTAGS
- CMD_SYN(
- "/reload")
- CMD_DESC(
- "Reload preferences from configuration file.")
- CMD_NOARGS
- CMD_NOEXAMPLES },
+ parse_args, 0, 0, NULL,
+ CMD_NOSUBFUNCS
+ CMD_MAINFUNC(cmd_reload)
+ CMD_NOTAGS
+ CMD_SYN(
+ "/reload")
+ CMD_DESC(
+ "Reload preferences from configuration file.")
+ CMD_NOARGS
+ CMD_NOEXAMPLES
+ },
{ "/paste",
- parse_args, 0, 0, NULL,
- CMD_NOSUBFUNCS
- CMD_MAINFUNC(cmd_paste)
- CMD_NOTAGS
- CMD_SYN(
- "/paste")
- CMD_DESC(
- "Paste clipboard.")
- CMD_NOARGS
- CMD_NOEXAMPLES },
+ parse_args, 0, 0, NULL,
+ CMD_NOSUBFUNCS
+ CMD_MAINFUNC(cmd_paste)
+ CMD_NOTAGS
+ CMD_SYN(
+ "/paste")
+ CMD_DESC(
+ "Paste clipboard.")
+ CMD_NOARGS
+ CMD_NOEXAMPLES
+ },
{ "/color",
- parse_args, 1, 2, &cons_color_setting,
- CMD_NOSUBFUNCS
- CMD_MAINFUNC(cmd_color)
- CMD_TAGS(
- CMD_TAG_UI)
- CMD_SYN(
- "/color on|off|redgreen|blue",
- "/color own on|off")
- CMD_DESC(
- "Settings for consistent color generation for nicks (XEP-0392). Including corrections for Color Vision Deficiencies. "
- "Your terminal needs to support 256 colors.")
- CMD_ARGS(
- { "on|off|redgreen|blue", "Enable or disable nick colorization for MUC nicks. 'redgreen' is for people with red/green blindess and 'blue' for people with blue blindness." },
- { "own on|off", "Enable color generation for own nick. If disabled the color from the color from the theme ('me') will get used." })
- CMD_EXAMPLES(
- "/color off",
- "/color on",
- "/color blue",
- "/color own off") },
+ parse_args, 1, 2, &cons_color_setting,
+ CMD_NOSUBFUNCS
+ CMD_MAINFUNC(cmd_color)
+ CMD_TAGS(
+ CMD_TAG_UI)
+ CMD_SYN(
+ "/color on|off|redgreen|blue",
+ "/color own on|off")
+ CMD_DESC(
+ "Settings for consistent color generation for nicks (XEP-0392). Including corrections for Color Vision Deficiencies. "
+ "Your terminal needs to support 256 colors.")
+ CMD_ARGS(
+ { "on|off|redgreen|blue", "Enable or disable nick colorization for MUC nicks. 'redgreen' is for people with red/green blindess and 'blue' for people with blue blindness."},
+ { "own on|off", "Enable color generation for own nick. If disabled the color from the color from the theme ('me') will get used."})
+ CMD_EXAMPLES(
+ "/color off",
+ "/color on",
+ "/color blue",
+ "/color own off")
+ },
{ "/avatar",
- parse_args, 2, 2, NULL,
- CMD_NOSUBFUNCS
- CMD_MAINFUNC(cmd_avatar)
- CMD_TAGS(
- CMD_TAG_CHAT)
- CMD_SYN(
- "/avatar get <barejid>",
- "/avatar open <barejid>")
- CMD_DESC(
- "Download avatar (XEP-0084) for a certain contact. "
- "If nothing happens after using this command the user either doesn't have an avatar set at all "
- "or doesn't use XEP-0084 to publish it.")
- CMD_ARGS(
- { "get <barejid>", "Download the avatar. barejid is the JID to download avatar from." },
- { "open <barejid>", "Download avatar and open it with command." })
- CMD_EXAMPLES(
- "/avatar get thor@valhalla.edda",
- "/avatar open freyja@vanaheimr.edda") },
+ parse_args, 2, 2, NULL,
+ CMD_NOSUBFUNCS
+ CMD_MAINFUNC(cmd_avatar)
+ CMD_TAGS(
+ CMD_TAG_CHAT)
+ CMD_SYN(
+ "/avatar get <barejid>",
+ "/avatar open <barejid>")
+ CMD_DESC(
+ "Download avatar (XEP-0084) for a certain contact. "
+ "If nothing happens after using this command the user either doesn't have an avatar set at all "
+ "or doesn't use XEP-0084 to publish it.")
+ CMD_ARGS(
+ { "get <barejid>", "Download the avatar. barejid is the JID to download avatar from."},
+ { "open <barejid>", "Download avatar and open it with command."})
+ CMD_EXAMPLES(
+ "/avatar get thor@valhalla.edda",
+ "/avatar open freyja@vanaheimr.edda")
+ },
{ "/os",
- parse_args, 1, 1, &cons_os_setting,
- CMD_NOSUBFUNCS
- CMD_MAINFUNC(cmd_os)
- CMD_TAGS(
- CMD_TAG_DISCOVERY)
- CMD_SYN(
- "/os <on>|<off>")
- CMD_DESC(
- "Choose whether to include the OS name if a user asks for software information (XEP-0092).")
- CMD_ARGS(
- { "on|off", "" })
- CMD_NOEXAMPLES },
+ parse_args, 1, 1, &cons_os_setting,
+ CMD_NOSUBFUNCS
+ CMD_MAINFUNC(cmd_os)
+ CMD_TAGS(
+ CMD_TAG_DISCOVERY)
+ CMD_SYN(
+ "/os <on>|<off>")
+ CMD_DESC(
+ "Choose whether to include the OS name if a user asks for software information (XEP-0092).")
+ CMD_ARGS(
+ { "on|off", ""})
+ CMD_NOEXAMPLES
+ },
{ "/correction",
- parse_args, 1, 2, &cons_correction_setting,
- CMD_NOSUBFUNCS
- CMD_MAINFUNC(cmd_correction)
- CMD_TAGS(
- CMD_TAG_UI,
- CMD_TAG_CHAT,
- CMD_TAG_GROUPCHAT)
- CMD_SYN(
- "/correction <on>|<off>",
- "/correction char <char>")
- CMD_DESC(
- "Settings regarding Last Message Correction (XEP-0308). "
- "Corrections will only work in MUC and regular chat windows. MUC PMs won't be allowed. "
- "For more information on how to correct messages, see: /help correct.")
- CMD_ARGS(
- { "on|off", "Enable/Disable support for last message correction." },
- { "char", "Set character that will prefix corrected messages. Default: '+'." })
- CMD_NOEXAMPLES },
+ parse_args, 1, 2, &cons_correction_setting,
+ CMD_NOSUBFUNCS
+ CMD_MAINFUNC(cmd_correction)
+ CMD_TAGS(
+ CMD_TAG_UI,
+ CMD_TAG_CHAT,
+ CMD_TAG_GROUPCHAT)
+ CMD_SYN(
+ "/correction <on>|<off>",
+ "/correction char <char>")
+ CMD_DESC(
+ "Settings regarding Last Message Correction (XEP-0308). "
+ "Corrections will only work in MUC and regular chat windows. MUC PMs won't be allowed. "
+ "For more information on how to correct messages, see: /help correct.")
+ CMD_ARGS(
+ { "on|off", "Enable/Disable support for last message correction."},
+ { "char", "Set character that will prefix corrected messages. Default: '+'."})
+ CMD_NOEXAMPLES
+ },
{ "/correct",
- parse_args, 1, -1, NULL,
- CMD_NOSUBFUNCS
- CMD_MAINFUNC(cmd_correct)
- CMD_TAGS(
- CMD_TAG_CHAT,
- CMD_TAG_GROUPCHAT)
- CMD_SYN(
- "/correct <message>")
- CMD_DESC(
- "Correct and resend the last message (XEP-0308). "
- "Use tab completion to get the last sent message. "
- "For more information on how to configure corrections, see: /help correction.")
- CMD_ARGS(
- { "message", "The corrected message." })
- CMD_NOEXAMPLES },
+ parse_args, 1, -1, NULL,
+ CMD_NOSUBFUNCS
+ CMD_MAINFUNC(cmd_correct)
+ CMD_TAGS(
+ CMD_TAG_CHAT,
+ CMD_TAG_GROUPCHAT)
+ CMD_SYN(
+ "/correct <message>")
+ CMD_DESC(
+ "Correct and resend the last message (XEP-0308). "
+ "Use tab completion to get the last sent message. "
+ "For more information on how to configure corrections, see: /help correction.")
+ CMD_ARGS(
+ { "message", "The corrected message."})
+ CMD_NOEXAMPLES
+ },
{ "/slashguard",
- parse_args, 1, 1, &cons_slashguard_setting,
- CMD_NOSUBFUNCS
- CMD_MAINFUNC(cmd_slashguard)
- CMD_TAGS(
- CMD_TAG_UI,
- CMD_TAG_CHAT)
- CMD_SYN(
- "/slashguard on|off")
- CMD_DESC(
- "Slashguard won't accept a slash in the first 4 characters of your input field. "
- "It tries to protect you from typing ' /quit' and similar things in chats.")
- CMD_ARGS(
- { "on|off", "Enable or disable slashguard." })
- CMD_NOEXAMPLES },
+ parse_args, 1, 1, &cons_slashguard_setting,
+ CMD_NOSUBFUNCS
+ CMD_MAINFUNC(cmd_slashguard)
+ CMD_TAGS(
+ CMD_TAG_UI,
+ CMD_TAG_CHAT)
+ CMD_SYN(
+ "/slashguard on|off")
+ CMD_DESC(
+ "Slashguard won't accept a slash in the first 4 characters of your input field. "
+ "It tries to protect you from typing ' /quit' and similar things in chats.")
+ CMD_ARGS(
+ { "on|off", "Enable or disable slashguard." })
+ CMD_NOEXAMPLES
+ },
{ "/serversoftware",
- parse_args, 1, 1, NULL,
- CMD_NOSUBFUNCS
- CMD_MAINFUNC(cmd_serversoftware)
- CMD_TAGS(
- CMD_TAG_DISCOVERY)
- CMD_SYN(
- "/serversoftware <domain>")
- CMD_DESC(
- "Find server or component software version information.")
- CMD_ARGS(
- { "<domain>", "The jid of your server or component." })
- CMD_EXAMPLES(
- "/software valhalla.edda",
- "/software xmpp.vanaheimr.edda") },
+ parse_args, 1, 1, NULL,
+ CMD_NOSUBFUNCS
+ CMD_MAINFUNC(cmd_serversoftware)
+ CMD_TAGS(
+ CMD_TAG_DISCOVERY)
+ CMD_SYN(
+ "/serversoftware <domain>")
+ CMD_DESC(
+ "Find server or component software version information.")
+ CMD_ARGS(
+ { "<domain>", "The jid of your server or component." })
+ CMD_EXAMPLES(
+ "/software valhalla.edda",
+ "/software xmpp.vanaheimr.edda")
+ },
{ "/executable",
- parse_args, 2, 4, &cons_executable_setting,
- CMD_NOSUBFUNCS
- CMD_MAINFUNC(cmd_executable)
- CMD_TAGS(
- CMD_TAG_DISCOVERY)
- CMD_SYN(
- "/executable avatar <cmd>",
- "/executable urlopen (<fileType>|DEF <require_save> <cmd>",
- "/executable urlsave (<protocol>|DEF) <cmd>")
- CMD_DESC(
- "Configure executable that should be called upon a certain command."
- "Default is xdg-open.")
- CMD_ARGS(
- { "avatar", "Set executable that is run in /avatar open. Use your favourite image viewer." },
- { "urlopen", "Set executable that is run in /url open for a given file type. It may be your favorite browser or a specific viewer. Use DEF to set default command for undefined file type." },
- { "urlsave", "Set executable that is run in /url save for a given protocol. Use your favourite downloader. Use DEF to set default command for undefined protocol." })
- CMD_EXAMPLES(
- "/executable avatar xdg-open",
- "/executable urlopen DEF false \"xdg-open %u\"",
- "/executable urlopen html false \"firefox %u\"",
- "/executable urlsave aesgcm \"omut -d -o %p %u\"") },
+ parse_args, 2, 4, &cons_executable_setting,
+ CMD_NOSUBFUNCS
+ CMD_MAINFUNC(cmd_executable)
+ CMD_TAGS(
+ CMD_TAG_DISCOVERY)
+ CMD_SYN(
+ "/executable avatar <cmd>",
+ "/executable urlopen (<fileType>|DEF <require_save> <cmd>",
+ "/executable urlsave (<protocol>|DEF) <cmd>")
+ CMD_DESC(
+ "Configure executable that should be called upon a certain command."
+ "Default is xdg-open.")
+ CMD_ARGS(
+ { "avatar", "Set executable that is run in /avatar open. Use your favourite image viewer." },
+ { "urlopen", "Set executable that is run in /url open for a given file type. It may be your favorite browser or a specific viewer. Use DEF to set default command for undefined file type." },
+ { "urlsave", "Set executable that is run in /url save for a given protocol. Use your favourite downloader. Use DEF to set default command for undefined protocol."})
+ CMD_EXAMPLES(
+ "/executable avatar xdg-open",
+ "/executable urlopen DEF false \"xdg-open %u\"",
+ "/executable urlopen html false \"firefox %u\"",
+ "/executable urlsave aesgcm \"omut -d -o %p %u\"")
+ },
{ "/url",
- parse_args, 2, 3, NULL,
- CMD_SUBFUNCS(
- { "open", cmd_url_open },
- { "save", cmd_url_save })
- CMD_NOMAINFUNC
- CMD_TAGS(
- CMD_TAG_CHAT,
- CMD_TAG_GROUPCHAT)
- CMD_SYN(
- "/url open <url>",
- "/url save <url> [<path>]")
- CMD_DESC(
- "Deal with URLs")
- CMD_ARGS(
- { "open", "Open URL with predefined executable." },
- { "save", "Save URL to optional path, default path is current directory" })
- CMD_EXAMPLES(
- "/url open https://profanity-im.github.io",
- "/url save https://profanity-im.github.io/guide/latest/userguide.html /home/user/Download/") },
+ parse_args, 2, 3, NULL,
+ CMD_SUBFUNCS(
+ { "open", cmd_url_open},
+ { "save", cmd_url_save })
+ CMD_NOMAINFUNC
+ CMD_TAGS(
+ CMD_TAG_CHAT,
+ CMD_TAG_GROUPCHAT)
+ CMD_SYN(
+ "/url open <url>",
+ "/url save <url> [<path>]")
+ CMD_DESC(
+ "Deal with URLs")
+ CMD_ARGS(
+ { "open", "Open URL with predefined executable." },
+ { "save", "Save URL to optional path, default path is current directory"})
+ CMD_EXAMPLES(
+ "/url open https://profanity-im.github.io",
+ "/url save https://profanity-im.github.io/guide/latest/userguide.html /home/user/Download/")
+ },
};
-static GHashTable* search_index;
+static GHashTable *search_index;
char*
-_cmd_index(Command* cmd)
-{
- GString* index_source = g_string_new("");
+_cmd_index(Command *cmd) {
+ GString *index_source = g_string_new("");
index_source = g_string_append(index_source, cmd->cmd);
index_source = g_string_append(index_source, " ");
index_source = g_string_append(index_source, cmd->help.desc);
@@ -2493,36 +2581,36 @@ _cmd_index(Command* cmd)
index_source = g_string_append(index_source, " ");
}
- gchar** tokens = g_str_tokenize_and_fold(index_source->str, NULL, NULL);
+ gchar **tokens = g_str_tokenize_and_fold(index_source->str, NULL, NULL);
g_string_free(index_source, TRUE);
- GString* index = g_string_new("");
+ GString *index = g_string_new("");
for (i = 0; i < g_strv_length(tokens); i++) {
index = g_string_append(index, tokens[i]);
index = g_string_append(index, " ");
}
g_strfreev(tokens);
- char* res = index->str;
+ char *res = index->str;
g_string_free(index, FALSE);
return res;
}
GList*
-cmd_search_index_any(char* term)
+cmd_search_index_any(char *term)
{
- GList* results = NULL;
+ GList *results = NULL;
- gchar** processed_terms = g_str_tokenize_and_fold(term, NULL, NULL);
+ gchar **processed_terms = g_str_tokenize_and_fold(term, NULL, NULL);
int terms_len = g_strv_length(processed_terms);
int i = 0;
for (i = 0; i < terms_len; i++) {
- GList* index_keys = g_hash_table_get_keys(search_index);
- GList* curr = index_keys;
+ GList *index_keys = g_hash_table_get_keys(search_index);
+ GList *curr = index_keys;
while (curr) {
- char* index_entry = g_hash_table_lookup(search_index, curr->data);
+ char *index_entry = g_hash_table_lookup(search_index, curr->data);
if (g_str_match_string(processed_terms[i], index_entry, FALSE)) {
results = g_list_append(results, curr->data);
}
@@ -2537,21 +2625,21 @@ cmd_search_index_any(char* term)
}
GList*
-cmd_search_index_all(char* term)
+cmd_search_index_all(char *term)
{
- GList* results = NULL;
+ GList *results = NULL;
- gchar** terms = g_str_tokenize_and_fold(term, NULL, NULL);
+ gchar **terms = g_str_tokenize_and_fold(term, NULL, NULL);
int terms_len = g_strv_length(terms);
- GList* commands = g_hash_table_get_keys(search_index);
- GList* curr = commands;
+ GList *commands = g_hash_table_get_keys(search_index);
+ GList *curr = commands;
while (curr) {
- char* command = curr->data;
+ char *command = curr->data;
int matches = 0;
int i = 0;
for (i = 0; i < terms_len; i++) {
- char* command_index = g_hash_table_lookup(search_index, command);
+ char *command_index = g_hash_table_lookup(search_index, command);
if (g_str_match_string(terms[i], command_index, FALSE)) {
matches++;
}
@@ -2584,7 +2672,7 @@ cmd_init(void)
commands = g_hash_table_new(g_str_hash, g_str_equal);
unsigned int i;
for (i = 0; i < ARRAY_SIZE(command_defs); i++) {
- Command* pcmd = command_defs + i;
+ Command *pcmd = command_defs+i;
// add to hash
g_hash_table_insert(commands, pcmd->cmd, pcmd);
@@ -2597,10 +2685,10 @@ cmd_init(void)
}
// load aliases
- GList* aliases = prefs_get_aliases();
- GList* curr = aliases;
+ GList *aliases = prefs_get_aliases();
+ GList *curr = aliases;
while (curr) {
- ProfAlias* alias = curr->data;
+ ProfAlias *alias = curr->data;
cmd_ac_add_alias(alias);
curr = g_list_next(curr);
}
@@ -2615,13 +2703,20 @@ cmd_uninit(void)
}
gboolean
-cmd_valid_tag(const char* const str)
+cmd_valid_tag(const char *const str)
{
- return ((g_strcmp0(str, CMD_TAG_CHAT) == 0) || (g_strcmp0(str, CMD_TAG_GROUPCHAT) == 0) || (g_strcmp0(str, CMD_TAG_PRESENCE) == 0) || (g_strcmp0(str, CMD_TAG_ROSTER) == 0) || (g_strcmp0(str, CMD_TAG_DISCOVERY) == 0) || (g_strcmp0(str, CMD_TAG_CONNECTION) == 0) || (g_strcmp0(str, CMD_TAG_UI) == 0) || (g_strcmp0(str, CMD_TAG_PLUGINS) == 0));
+ return ((g_strcmp0(str, CMD_TAG_CHAT) == 0) ||
+ (g_strcmp0(str, CMD_TAG_GROUPCHAT) == 0) ||
+ (g_strcmp0(str, CMD_TAG_PRESENCE) == 0) ||
+ (g_strcmp0(str, CMD_TAG_ROSTER) == 0) ||
+ (g_strcmp0(str, CMD_TAG_DISCOVERY) == 0) ||
+ (g_strcmp0(str, CMD_TAG_CONNECTION) == 0) ||
+ (g_strcmp0(str, CMD_TAG_UI) == 0) ||
+ (g_strcmp0(str, CMD_TAG_PLUGINS) == 0));
}
Command*
-cmd_get(const char* const command)
+cmd_get(const char *const command)
{
if (commands) {
return g_hash_table_lookup(commands, command);
@@ -2631,9 +2726,9 @@ cmd_get(const char* const command)
}
GList*
-cmd_get_ordered(const char* const tag)
+cmd_get_ordered(const char *const tag)
{
- GList* ordered_commands = NULL;
+ GList *ordered_commands = NULL;
GHashTableIter iter;
gpointer key;
@@ -2641,7 +2736,7 @@ cmd_get_ordered(const char* const tag)
g_hash_table_iter_init(&iter, commands);
while (g_hash_table_iter_next(&iter, &key, &value)) {
- Command* pcmd = (Command*)value;
+ Command *pcmd = (Command *)value;
if (tag) {
if (_cmd_has_tag(pcmd, tag)) {
ordered_commands = g_list_insert_sorted(ordered_commands, pcmd->cmd, (GCompareFunc)g_strcmp0);
@@ -2655,7 +2750,7 @@ cmd_get_ordered(const char* const tag)
}
static gboolean
-_cmd_has_tag(Command* pcmd, const char* const tag)
+_cmd_has_tag(Command *pcmd, const char *const tag)
{
int i = 0;
for (i = 0; pcmd->help.tags[i] != NULL; i++) {
@@ -2668,7 +2763,7 @@ _cmd_has_tag(Command* pcmd, const char* const tag)
}
static int
-_cmp_command(Command* cmd1, Command* cmd2)
+_cmp_command(Command *cmd1, Command *cmd2)
{
return g_strcmp0(cmd1->cmd, cmd2->cmd);
}
@@ -2676,22 +2771,22 @@ _cmp_command(Command* cmd1, Command* cmd2)
void
command_docgen(void)
{
- GList* cmds = NULL;
+ GList *cmds = NULL;
unsigned int i;
for (i = 0; i < ARRAY_SIZE(command_defs); i++) {
- Command* pcmd = command_defs + i;
+ Command *pcmd = command_defs+i;
cmds = g_list_insert_sorted(cmds, pcmd, (GCompareFunc)_cmp_command);
}
- FILE* toc_fragment = fopen("toc_fragment.html", "w");
- FILE* main_fragment = fopen("main_fragment.html", "w");
+ FILE *toc_fragment = fopen("toc_fragment.html", "w");
+ FILE *main_fragment = fopen("main_fragment.html", "w");
fputs("<ul><li><ul><li>\n", toc_fragment);
fputs("<hr>\n", main_fragment);
- GList* curr = cmds;
+ GList *curr = cmds;
while (curr) {
- Command* pcmd = curr->data;
+ Command *pcmd = curr->data;
fprintf(toc_fragment, "<a href=\"#%s\">%s</a>,\n", &pcmd->cmd[1], pcmd->cmd);
fprintf(main_fragment, "<a name=\"%s\"></a>\n", &pcmd->cmd[1]);
@@ -2701,8 +2796,8 @@ command_docgen(void)
fputs("<p><pre><code>", main_fragment);
int i = 0;
while (pcmd->help.synopsis[i]) {
- char* str1 = str_replace(pcmd->help.synopsis[i], "<", "&lt;");
- char* str2 = str_replace(str1, ">", "&gt;");
+ char *str1 = str_replace(pcmd->help.synopsis[i], "<", "&lt;");
+ char *str2 = str_replace(str1, ">", "&gt;");
fprintf(main_fragment, "%s\n", str2);
i++;
}
@@ -2720,8 +2815,8 @@ command_docgen(void)
fputs("<tr>", main_fragment);
fputs("<td>", main_fragment);
fputs("<code>", main_fragment);
- char* str1 = str_replace(pcmd->help.args[i][0], "<", "&lt;");
- char* str2 = str_replace(str1, ">", "&gt;");
+ char *str1 = str_replace(pcmd->help.args[i][0], "<", "&lt;");
+ char *str2 = str_replace(str1, ">", "&gt;");
fprintf(main_fragment, "%s", str2);
fputs("</code>", main_fragment);
fputs("</td>", main_fragment);
diff --git a/src/command/cmd_defs.h b/src/command/cmd_defs.h
index 32167c6d..6d829adc 100644
--- a/src/command/cmd_defs.h
+++ b/src/command/cmd_defs.h
@@ -44,14 +44,14 @@
void cmd_init(void);
void cmd_uninit(void);
-Command* cmd_get(const char* const command);
-GList* cmd_get_ordered(const char* const tag);
+Command* cmd_get(const char *const command);
+GList* cmd_get_ordered(const char *const tag);
-gboolean cmd_valid_tag(const char* const str);
+gboolean cmd_valid_tag(const char *const str);
void command_docgen(void);
-GList* cmd_search_index_all(char* term);
-GList* cmd_search_index_any(char* term);
+GList* cmd_search_index_all(char *term);
+GList* cmd_search_index_any(char *term);
#endif
diff --git a/src/command/cmd_funcs.c b/src/command/cmd_funcs.c
index 1eb47f84..1020db96 100644
--- a/src/command/cmd_funcs.c
+++ b/src/command/cmd_funcs.c
@@ -38,50 +38,50 @@
#include "config.h"
-#include <assert.h>
-#include <ctype.h>
+#include <string.h>
+#include <stdlib.h>
+#include <stdio.h>
#include <errno.h>
-#include <fcntl.h>
-#include <gio/gio.h>
+#include <assert.h>
#include <glib.h>
#include <glib/gstdio.h>
-#include <langinfo.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
+#include <gio/gio.h>
#include <sys/stat.h>
#include <sys/types.h>
+#include <fcntl.h>
#include <unistd.h>
+#include <langinfo.h>
+#include <ctype.h>
-#include "command/cmd_ac.h"
-#include "command/cmd_defs.h"
-#include "command/cmd_funcs.h"
+#include "profanity.h"
+#include "log.h"
#include "common.h"
-#include "config/account.h"
+#include "command/cmd_funcs.h"
+#include "command/cmd_defs.h"
+#include "command/cmd_ac.h"
#include "config/accounts.h"
+#include "config/account.h"
#include "config/preferences.h"
-#include "config/scripts.h"
#include "config/theme.h"
#include "config/tlscerts.h"
+#include "config/scripts.h"
#include "event/client_events.h"
-#include "log.h"
-#include "plugins/plugins.h"
-#include "profanity.h"
-#include "tools/autocomplete.h"
-#include "tools/bookmark_ignore.h"
#include "tools/http_upload.h"
+#include "tools/autocomplete.h"
#include "tools/parser.h"
#include "tools/tinyurl.h"
+#include "tools/bookmark_ignore.h"
+#include "plugins/plugins.h"
#include "ui/ui.h"
#include "ui/window_list.h"
-#include "xmpp/avatar.h"
-#include "xmpp/chat_session.h"
+#include "xmpp/xmpp.h"
#include "xmpp/connection.h"
#include "xmpp/contact.h"
+#include "xmpp/roster_list.h"
#include "xmpp/jid.h"
#include "xmpp/muc.h"
-#include "xmpp/roster_list.h"
-#include "xmpp/xmpp.h"
+#include "xmpp/chat_session.h"
+#include "xmpp/avatar.h"
#ifdef HAVE_LIBOTR
#include "otr/otr.h"
@@ -98,8 +98,8 @@
#endif
#ifdef HAVE_GTK
-#include "tools/clipboard.h"
#include "ui/tray.h"
+#include "tools/clipboard.h"
#endif
#ifdef HAVE_PYTHON
@@ -107,21 +107,21 @@
#endif
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 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);
-static gboolean _cmd_execute_default(ProfWin* window, const char* inp);
-static gboolean _cmd_execute_alias(ProfWin* window, const char* const inp, gboolean* ran);
+ 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 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);
+static gboolean _cmd_execute_default(ProfWin *window, const char *inp);
+static gboolean _cmd_execute_alias(ProfWin *window, const char *const inp, gboolean *ran);
/*
* Take a line of input and process it, return TRUE if profanity is to
* continue, FALSE otherwise
*/
gboolean
-cmd_process_input(ProfWin* window, char* inp)
+cmd_process_input(ProfWin *window, char *inp)
{
log_debug("Input received: %s", inp);
gboolean result = FALSE;
@@ -131,15 +131,15 @@ cmd_process_input(ProfWin* window, char* inp)
if (strlen(inp) == 0) {
result = TRUE;
- // handle command if input starts with a '/'
+ // handle command if input starts with a '/'
} else if (inp[0] == '/') {
- char* inp_cpy = strdup(inp);
- char* command = strtok(inp_cpy, " ");
- char* question_mark = strchr(command, '?');
+ char *inp_cpy = strdup(inp);
+ char *command = strtok(inp_cpy, " ");
+ char *question_mark = strchr(command, '?');
if (question_mark) {
*question_mark = '\0';
- char* fakeinp;
- if (asprintf(&fakeinp, "/help %s", command + 1)) {
+ char *fakeinp;
+ if (asprintf(&fakeinp, "/help %s", command+1)) {
result = _cmd_execute(window, "/help", fakeinp);
free(fakeinp);
}
@@ -148,7 +148,7 @@ cmd_process_input(ProfWin* window, char* inp)
}
free(inp_cpy);
- // call a default handler if input didn't start with '/'
+ // call a default handler if input didn't start with '/'
} else {
result = _cmd_execute_default(window, inp);
}
@@ -159,16 +159,16 @@ cmd_process_input(ProfWin* window, char* inp)
// Command execution
void
-cmd_execute_connect(ProfWin* window, const char* const account)
+cmd_execute_connect(ProfWin *window, const char *const account)
{
- GString* command = g_string_new("/connect ");
+ GString *command = g_string_new("/connect ");
g_string_append(command, account);
cmd_process_input(window, command->str);
g_string_free(command, TRUE);
}
gboolean
-cmd_tls_certpath(ProfWin* window, const char* const command, gchar** args)
+cmd_tls_certpath(ProfWin *window, const char *const command, gchar **args)
{
#ifdef HAVE_LIBMESODE
if (g_strcmp0(args[1], "set") == 0) {
@@ -193,7 +193,7 @@ cmd_tls_certpath(ProfWin* window, const char* const command, gchar** args)
cons_show("Certificate path defaulted to finding system certpath.");
return TRUE;
} else if (args[1] == NULL) {
- char* path = prefs_get_tls_certpath();
+ char *path = prefs_get_tls_certpath();
if (path) {
cons_show("Trusted certificate path: %s", path);
free(path);
@@ -209,10 +209,11 @@ cmd_tls_certpath(ProfWin* window, const char* const command, gchar** args)
cons_show("Certificate path setting only supported when built with libmesode.");
return TRUE;
#endif
+
}
gboolean
-cmd_tls_trust(ProfWin* window, const char* const command, gchar** args)
+cmd_tls_trust(ProfWin *window, const char *const command, gchar **args)
{
#ifdef HAVE_LIBMESODE
jabber_conn_status_t conn_status = connection_get_status();
@@ -224,7 +225,7 @@ cmd_tls_trust(ProfWin* window, const char* const command, gchar** args)
cons_show("No TLS connection established");
return TRUE;
}
- TLSCertificate* cert = connection_get_tls_peer_cert();
+ TLSCertificate *cert = connection_get_tls_peer_cert();
if (!cert) {
cons_show("Error getting TLS certificate.");
return TRUE;
@@ -245,11 +246,11 @@ cmd_tls_trust(ProfWin* window, const char* const command, gchar** args)
}
gboolean
-cmd_tls_trusted(ProfWin* window, const char* const command, gchar** args)
+cmd_tls_trusted(ProfWin *window, const char *const command, gchar **args)
{
#ifdef HAVE_LIBMESODE
- GList* certs = tlscerts_list();
- GList* curr = certs;
+ GList *certs = tlscerts_list();
+ GList *curr = certs;
if (curr) {
cons_show("Trusted certificates:");
@@ -258,7 +259,7 @@ cmd_tls_trusted(ProfWin* window, const char* const command, gchar** args)
cons_show("No trusted certificates found.");
}
while (curr) {
- TLSCertificate* cert = curr->data;
+ TLSCertificate *cert = curr->data;
cons_show_tlscert_summary(cert);
cons_show("");
curr = g_list_next(curr);
@@ -272,7 +273,7 @@ cmd_tls_trusted(ProfWin* window, const char* const command, gchar** args)
}
gboolean
-cmd_tls_revoke(ProfWin* window, const char* const command, gchar** args)
+cmd_tls_revoke(ProfWin *window, const char *const command, gchar **args)
{
#ifdef HAVE_LIBMESODE
if (args[1] == NULL) {
@@ -293,11 +294,11 @@ cmd_tls_revoke(ProfWin* window, const char* const command, gchar** args)
}
gboolean
-cmd_tls_cert(ProfWin* window, const char* const command, gchar** args)
+cmd_tls_cert(ProfWin *window, const char *const command, gchar **args)
{
#ifdef HAVE_LIBMESODE
if (args[1]) {
- TLSCertificate* cert = tlscerts_get_trusted(args[1]);
+ TLSCertificate *cert = tlscerts_get_trusted(args[1]);
if (!cert) {
cons_show("No such certificate.");
} else {
@@ -315,7 +316,7 @@ cmd_tls_cert(ProfWin* window, const char* const command, gchar** args)
cons_show("No TLS connection established");
return TRUE;
}
- TLSCertificate* cert = connection_get_tls_peer_cert();
+ TLSCertificate *cert = connection_get_tls_peer_cert();
if (!cert) {
cons_show("Error getting TLS certificate.");
return TRUE;
@@ -332,7 +333,7 @@ cmd_tls_cert(ProfWin* window, const char* const command, gchar** args)
}
gboolean
-cmd_connect(ProfWin* window, const char* const command, gchar** args)
+cmd_connect(ProfWin *window, const char *const command, gchar **args)
{
jabber_conn_status_t conn_status = connection_get_status();
if (conn_status != JABBER_DISCONNECTED) {
@@ -340,10 +341,10 @@ cmd_connect(ProfWin* window, const char* const command, gchar** args)
return TRUE;
}
- gchar* opt_keys[] = { "server", "port", "tls", "auth", NULL };
+ gchar *opt_keys[] = { "server", "port", "tls", "auth", NULL };
gboolean parsed;
- GHashTable* options = parse_options(&args[args[0] ? 1 : 0], opt_keys, &parsed);
+ GHashTable *options = parse_options(&args[args[0] ? 1 : 0], opt_keys, &parsed);
if (!parsed) {
cons_bad_cmd_usage(command);
cons_show("");
@@ -351,18 +352,25 @@ cmd_connect(ProfWin* window, const char* const command, gchar** args)
return TRUE;
}
- char* altdomain = g_hash_table_lookup(options, "server");
+ char *altdomain = g_hash_table_lookup(options, "server");
- char* tls_policy = g_hash_table_lookup(options, "tls");
- if (tls_policy && (g_strcmp0(tls_policy, "force") != 0) && (g_strcmp0(tls_policy, "allow") != 0) && (g_strcmp0(tls_policy, "trust") != 0) && (g_strcmp0(tls_policy, "disable") != 0) && (g_strcmp0(tls_policy, "legacy") != 0)) {
+ char *tls_policy = g_hash_table_lookup(options, "tls");
+ if (tls_policy &&
+ (g_strcmp0(tls_policy, "force") != 0) &&
+ (g_strcmp0(tls_policy, "allow") != 0) &&
+ (g_strcmp0(tls_policy, "trust") != 0) &&
+ (g_strcmp0(tls_policy, "disable") != 0) &&
+ (g_strcmp0(tls_policy, "legacy") != 0)) {
cons_bad_cmd_usage(command);
cons_show("");
options_destroy(options);
return TRUE;
}
- char* auth_policy = g_hash_table_lookup(options, "auth");
- if (auth_policy && (g_strcmp0(auth_policy, "default") != 0) && (g_strcmp0(auth_policy, "legacy") != 0)) {
+ char *auth_policy = g_hash_table_lookup(options, "auth");
+ if (auth_policy &&
+ (g_strcmp0(auth_policy, "default") != 0) &&
+ (g_strcmp0(auth_policy, "legacy") != 0)) {
cons_bad_cmd_usage(command);
cons_show("");
options_destroy(options);
@@ -371,8 +379,8 @@ cmd_connect(ProfWin* window, const char* const command, gchar** args)
int port = 0;
if (g_hash_table_contains(options, "port")) {
- char* port_str = g_hash_table_lookup(options, "port");
- char* err_msg = NULL;
+ char *port_str = g_hash_table_lookup(options, "port");
+ char *err_msg = NULL;
gboolean res = strtoi_range(port_str, &port, 1, 65535, &err_msg);
if (!res) {
cons_show(err_msg);
@@ -384,8 +392,8 @@ cmd_connect(ProfWin* window, const char* const command, gchar** args)
}
}
- char* user = args[0];
- char* def = prefs_get_string(PREF_DEFAULT_ACCOUNT);
+ char *user = args[0];
+ char *def = prefs_get_string(PREF_DEFAULT_ACCOUNT);
if (!user) {
if (def) {
user = def;
@@ -397,12 +405,12 @@ cmd_connect(ProfWin* window, const char* const command, gchar** args)
}
}
- char* jid;
+ char *jid;
user = strdup(user);
g_free(def);
// connect with account
- ProfAccount* account = accounts_get_account(user);
+ ProfAccount *account = accounts_get_account(user);
if (account) {
// override account options with connect options
if (altdomain != NULL)
@@ -418,7 +426,7 @@ cmd_connect(ProfWin* window, const char* const command, gchar** args)
if (account->password) {
conn_status = cl_ev_connect_account(account);
- // use eval_password if set
+ // use eval_password if set
} else if (account->eval_password) {
gboolean res = account_eval_password(account);
if (res) {
@@ -433,7 +441,7 @@ cmd_connect(ProfWin* window, const char* const command, gchar** args)
return TRUE;
}
- // no account password setting, prompt
+ // no account password setting, prompt
} else {
account->password = ui_ask_password();
conn_status = cl_ev_connect_account(account);
@@ -444,10 +452,10 @@ cmd_connect(ProfWin* window, const char* const command, gchar** args)
jid = account_create_connect_jid(account);
account_free(account);
- // connect with JID
+ // connect with JID
} else {
jid = g_utf8_strdown(user, -1);
- char* passwd = ui_ask_password();
+ char *passwd = ui_ask_password();
conn_status = cl_ev_connect_jid(jid, passwd, altdomain, port, tls_policy, auth_policy);
free(passwd);
}
@@ -465,9 +473,9 @@ cmd_connect(ProfWin* window, const char* const command, gchar** args)
}
gboolean
-cmd_account_list(ProfWin* window, const char* const command, gchar** args)
+cmd_account_list(ProfWin *window, const char *const command, gchar **args)
{
- gchar** accounts = accounts_get_list();
+ gchar **accounts = accounts_get_list();
cons_show_account_list(accounts);
g_strfreev(accounts);
@@ -475,15 +483,15 @@ cmd_account_list(ProfWin* window, const char* const command, gchar** args)
}
gboolean
-cmd_account_show(ProfWin* window, const char* const command, gchar** args)
+cmd_account_show(ProfWin *window, const char *const command, gchar **args)
{
- char* account_name = args[1];
+ char *account_name = args[1];
if (account_name == NULL) {
cons_bad_cmd_usage(command);
return TRUE;
}
- ProfAccount* account = accounts_get_account(account_name);
+ ProfAccount *account = accounts_get_account(account_name);
if (account == NULL) {
cons_show("No such account.");
cons_show("");
@@ -496,9 +504,9 @@ cmd_account_show(ProfWin* window, const char* const command, gchar** args)
}
gboolean
-cmd_account_add(ProfWin* window, const char* const command, gchar** args)
+cmd_account_add(ProfWin *window, const char *const command, gchar **args)
{
- char* account_name = args[1];
+ char *account_name = args[1];
if (account_name == NULL) {
cons_bad_cmd_usage(command);
return TRUE;
@@ -512,18 +520,18 @@ cmd_account_add(ProfWin* window, const char* const command, gchar** args)
}
gboolean
-cmd_account_remove(ProfWin* window, const char* const command, gchar** args)
+cmd_account_remove(ProfWin *window, const char *const command, gchar **args)
{
- char* account_name = args[1];
- if (!account_name) {
+ char *account_name = args[1];
+ if(!account_name) {
cons_bad_cmd_usage(command);
return TRUE;
}
- char* def = prefs_get_string(PREF_DEFAULT_ACCOUNT);
- if (accounts_remove(account_name)) {
+ char *def = prefs_get_string(PREF_DEFAULT_ACCOUNT);
+ if(accounts_remove(account_name)){
cons_show("Account %s removed.", account_name);
- if (def && strcmp(def, account_name) == 0) {
+ if(def && strcmp(def, account_name) == 0){
prefs_set_string(PREF_DEFAULT_ACCOUNT, NULL);
cons_show("Default account removed because the corresponding account was removed.");
}
@@ -538,9 +546,9 @@ cmd_account_remove(ProfWin* window, const char* const command, gchar** args)
}
gboolean
-cmd_account_enable(ProfWin* window, const char* const command, gchar** args)
+cmd_account_enable(ProfWin *window, const char *const command, gchar **args)
{
- char* account_name = args[1];
+ char *account_name = args[1];
if (account_name == NULL) {
cons_bad_cmd_usage(command);
return TRUE;
@@ -557,9 +565,9 @@ cmd_account_enable(ProfWin* window, const char* const command, gchar** args)
return TRUE;
}
gboolean
-cmd_account_disable(ProfWin* window, const char* const command, gchar** args)
+cmd_account_disable(ProfWin *window, const char *const command, gchar **args)
{
- char* account_name = args[1];
+ char *account_name = args[1];
if (account_name == NULL) {
cons_bad_cmd_usage(command);
return TRUE;
@@ -577,15 +585,15 @@ cmd_account_disable(ProfWin* window, const char* const command, gchar** args)
}
gboolean
-cmd_account_rename(ProfWin* window, const char* const command, gchar** args)
+cmd_account_rename(ProfWin *window, const char *const command, gchar **args)
{
if (g_strv_length(args) != 3) {
cons_bad_cmd_usage(command);
return TRUE;
}
- char* account_name = args[1];
- char* new_name = args[2];
+ char *account_name = args[1];
+ char *new_name = args[2];
if (accounts_rename(account_name, new_name)) {
cons_show("Account renamed.");
@@ -599,10 +607,10 @@ cmd_account_rename(ProfWin* window, const char* const command, gchar** args)
}
gboolean
-cmd_account_default(ProfWin* window, const char* const command, gchar** args)
+cmd_account_default(ProfWin *window, const char *const command, gchar **args)
{
if (g_strv_length(args) == 1) {
- char* def = prefs_get_string(PREF_DEFAULT_ACCOUNT);
+ char *def = prefs_get_string(PREF_DEFAULT_ACCOUNT);
if (def) {
cons_show("The default account is %s.", def);
free(def);
@@ -618,7 +626,7 @@ cmd_account_default(ProfWin* window, const char* const command, gchar** args)
}
} else if (g_strv_length(args) == 3) {
if (strcmp(args[1], "set") == 0) {
- ProfAccount* account_p = accounts_get_account(args[2]);
+ ProfAccount *account_p = accounts_get_account(args[2]);
if (account_p) {
prefs_set_string(PREF_DEFAULT_ACCOUNT, args[2]);
cons_show("Default account set to %s.", args[2]);
@@ -637,9 +645,9 @@ cmd_account_default(ProfWin* window, const char* const command, gchar** args)
}
gboolean
-_account_set_jid(char* account_name, char* jid)
+_account_set_jid(char *account_name, char *jid)
{
- Jid* jidp = jid_create(jid);
+ Jid *jidp = jid_create(jid);
if (jidp == NULL) {
cons_show("Malformed jid: %s", jid);
} else {
@@ -657,7 +665,7 @@ _account_set_jid(char* account_name, char* jid)
}
gboolean
-_account_set_server(char* account_name, char* server)
+_account_set_server(char *account_name, char *server)
{
accounts_set_server(account_name, server);
cons_show("Updated server for account %s: %s", account_name, server);
@@ -666,10 +674,10 @@ _account_set_server(char* account_name, char* server)
}
gboolean
-_account_set_port(char* account_name, char* port)
+_account_set_port(char *account_name, char *port)
{
int porti;
- char* err_msg = NULL;
+ char *err_msg = NULL;
gboolean res = strtoi_range(port, &porti, 1, 65535, &err_msg);
if (!res) {
cons_show(err_msg);
@@ -684,7 +692,7 @@ _account_set_port(char* account_name, char* port)
}
gboolean
-_account_set_resource(char* account_name, char* resource)
+_account_set_resource(char *account_name, char *resource)
{
accounts_set_resource(account_name, resource);
if (connection_get_status() == JABBER_CONNECTED) {
@@ -697,9 +705,9 @@ _account_set_resource(char* account_name, char* resource)
}
gboolean
-_account_set_password(char* account_name, char* password)
+_account_set_password(char *account_name, char *password)
{
- ProfAccount* account = accounts_get_account(account_name);
+ ProfAccount *account = accounts_get_account(account_name);
if (account->eval_password) {
cons_show("Cannot set password when eval_password is set.");
} else {
@@ -712,10 +720,10 @@ _account_set_password(char* account_name, char* password)
}
gboolean
-_account_set_eval_password(char* account_name, char* eval_password)
+_account_set_eval_password(char *account_name, char *eval_password)
{
- ProfAccount* account = accounts_get_account(account_name);
- if (account->password) {
+ ProfAccount *account = accounts_get_account(account_name);
+ if(account->password) {
cons_show("Cannot set eval_password when password is set.");
} else {
accounts_set_eval_password(account_name, eval_password);
@@ -727,7 +735,7 @@ _account_set_eval_password(char* account_name, char* eval_password)
}
gboolean
-_account_set_muc(char* account_name, char* muc)
+_account_set_muc(char *account_name, char *muc)
{
accounts_set_muc_service(account_name, muc);
cons_show("Updated muc service for account %s: %s", account_name, muc);
@@ -736,7 +744,7 @@ _account_set_muc(char* account_name, char* muc)
}
gboolean
-_account_set_nick(char* account_name, char* nick)
+_account_set_nick(char *account_name, char *nick)
{
accounts_set_muc_nick(account_name, nick);
cons_show("Updated muc nick for account %s: %s", account_name, nick);
@@ -745,11 +753,11 @@ _account_set_nick(char* account_name, char* nick)
}
gboolean
-_account_set_otr(char* account_name, char* policy)
+_account_set_otr(char *account_name, char *policy)
{
if ((g_strcmp0(policy, "manual") != 0)
- && (g_strcmp0(policy, "opportunistic") != 0)
- && (g_strcmp0(policy, "always") != 0)) {
+ && (g_strcmp0(policy, "opportunistic") != 0)
+ && (g_strcmp0(policy, "always") != 0)) {
cons_show("OTR policy must be one of: manual, opportunistic or always.");
} else {
accounts_set_otr_policy(account_name, policy);
@@ -760,7 +768,7 @@ _account_set_otr(char* account_name, char* policy)
}
gboolean
-_account_set_status(char* account_name, char* status)
+_account_set_status(char *account_name, char *status)
{
if (!valid_resource_presence_string(status) && (strcmp(status, "last") != 0)) {
cons_show("Invalid status: %s", status);
@@ -773,10 +781,10 @@ _account_set_status(char* account_name, char* status)
}
gboolean
-_account_set_pgpkeyid(char* account_name, char* pgpkeyid)
+_account_set_pgpkeyid(char *account_name, char *pgpkeyid)
{
#ifdef HAVE_LIBGPGME
- char* err_str = NULL;
+ char *err_str = NULL;
if (!p_gpg_valid_key(pgpkeyid, &err_str)) {
cons_show("Invalid PGP key ID specified: %s, see /pgp keys", err_str);
} else {
@@ -792,7 +800,7 @@ _account_set_pgpkeyid(char* account_name, char* pgpkeyid)
}
gboolean
-_account_set_startscript(char* account_name, char* script)
+_account_set_startscript(char *account_name, char *script)
{
accounts_set_script_start(account_name, script);
cons_show("Updated start script for account %s: %s", account_name, script);
@@ -800,7 +808,7 @@ _account_set_startscript(char* account_name, char* script)
}
gboolean
-_account_set_theme(char* account_name, char* theme)
+_account_set_theme(char *account_name, char *theme)
{
if (!theme_exists(theme)) {
cons_show("Theme does not exist: %s", theme);
@@ -809,7 +817,7 @@ _account_set_theme(char* account_name, char* theme)
accounts_set_theme(account_name, theme);
if (connection_get_status() == JABBER_CONNECTED) {
- ProfAccount* account = accounts_get_account(session_get_account_name());
+ ProfAccount *account = accounts_get_account(session_get_account_name());
if (account) {
if (g_strcmp0(account->name, account_name) == 0) {
theme_load(theme, false);
@@ -834,13 +842,13 @@ _account_set_theme(char* account_name, char* theme)
}
gboolean
-_account_set_tls(char* account_name, char* policy)
+_account_set_tls(char *account_name, char *policy)
{
if ((g_strcmp0(policy, "force") != 0)
- && (g_strcmp0(policy, "allow") != 0)
- && (g_strcmp0(policy, "trust") != 0)
- && (g_strcmp0(policy, "disable") != 0)
- && (g_strcmp0(policy, "legacy") != 0)) {
+ && (g_strcmp0(policy, "allow") != 0)
+ && (g_strcmp0(policy, "trust") != 0)
+ && (g_strcmp0(policy, "disable") != 0)
+ && (g_strcmp0(policy, "legacy") != 0)) {
cons_show("TLS policy must be one of: force, allow, legacy or disable.");
} else {
accounts_set_tls_policy(account_name, policy);
@@ -851,10 +859,10 @@ _account_set_tls(char* account_name, char* policy)
}
gboolean
-_account_set_auth(char* account_name, char* policy)
+_account_set_auth(char *account_name, char *policy)
{
if ((g_strcmp0(policy, "default") != 0)
- && (g_strcmp0(policy, "legacy") != 0)) {
+ && (g_strcmp0(policy, "legacy") != 0)) {
cons_show("Auth policy must be either default or legacy.");
} else {
accounts_set_auth_policy(account_name, policy);
@@ -865,10 +873,10 @@ _account_set_auth(char* account_name, char* policy)
}
gboolean
-_account_set_presence_priority(char* account_name, char* presence, char* priority)
+_account_set_presence_priority(char *account_name, char *presence, char *priority)
{
int intval;
- char* err_msg = NULL;
+ char *err_msg = NULL;
gboolean res = strtoi_range(priority, &intval, -128, 127, &err_msg);
if (!res) {
cons_show(err_msg);
@@ -877,7 +885,8 @@ _account_set_presence_priority(char* account_name, char* presence, char* priorit
}
resource_presence_t presence_type = resource_presence_from_string(presence);
- switch (presence_type) {
+ switch (presence_type)
+ {
case (RESOURCE_ONLINE):
accounts_set_priority_online(account_name, intval);
break;
@@ -897,7 +906,7 @@ _account_set_presence_priority(char* account_name, char* presence, char* priorit
jabber_conn_status_t conn_status = connection_get_status();
if (conn_status == JABBER_CONNECTED) {
- char* connected_account = session_get_account_name();
+ char *connected_account = session_get_account_name();
resource_presence_t last_presence = accounts_get_last_presence(connected_account);
if (presence_type == last_presence) {
cl_ev_presence_send(last_presence, 0);
@@ -909,52 +918,37 @@ _account_set_presence_priority(char* account_name, char* presence, char* priorit
}
gboolean
-cmd_account_set(ProfWin* window, const char* const command, gchar** args)
+cmd_account_set(ProfWin *window, const char *const command, gchar **args)
{
if (g_strv_length(args) != 4) {
cons_bad_cmd_usage(command);
return TRUE;
}
- char* account_name = args[1];
+ char *account_name = args[1];
if (!accounts_account_exists(account_name)) {
cons_show("Account %s doesn't exist", account_name);
cons_show("");
return TRUE;
}
- char* property = args[2];
- char* value = args[3];
- if (strcmp(property, "jid") == 0)
- return _account_set_jid(account_name, value);
- if (strcmp(property, "server") == 0)
- return _account_set_server(account_name, value);
- if (strcmp(property, "port") == 0)
- return _account_set_port(account_name, value);
- if (strcmp(property, "resource") == 0)
- return _account_set_resource(account_name, value);
- if (strcmp(property, "password") == 0)
- return _account_set_password(account_name, value);
- if (strcmp(property, "eval_password") == 0)
- return _account_set_eval_password(account_name, value);
- if (strcmp(property, "muc") == 0)
- return _account_set_muc(account_name, value);
- if (strcmp(property, "nick") == 0)
- return _account_set_nick(account_name, value);
- if (strcmp(property, "otr") == 0)
- return _account_set_otr(account_name, value);
- if (strcmp(property, "status") == 0)
- return _account_set_status(account_name, value);
- if (strcmp(property, "pgpkeyid") == 0)
- return _account_set_pgpkeyid(account_name, value);
- if (strcmp(property, "startscript") == 0)
- return _account_set_startscript(account_name, value);
- if (strcmp(property, "theme") == 0)
- return _account_set_theme(account_name, value);
- if (strcmp(property, "tls") == 0)
- return _account_set_tls(account_name, value);
- if (strcmp(property, "auth") == 0)
- return _account_set_auth(account_name, value);
+ char *property = args[2];
+ char *value = args[3];
+ if (strcmp(property, "jid") == 0) return _account_set_jid(account_name, value);
+ if (strcmp(property, "server") == 0) return _account_set_server(account_name, value);
+ if (strcmp(property, "port") == 0) return _account_set_port(account_name, value);
+ if (strcmp(property, "resource") == 0) return _account_set_resource(account_name, value);
+ if (strcmp(property, "password") == 0) return _account_set_password(account_name, value);
+ if (strcmp(property, "eval_password") == 0) return _account_set_eval_password(account_name, value);
+ if (strcmp(property, "muc") == 0) return _account_set_muc(account_name, value);
+ if (strcmp(property, "nick") == 0) return _account_set_nick(account_name, value);
+ if (strcmp(property, "otr") == 0) return _account_set_otr(account_name, value);
+ if (strcmp(property, "status") == 0) return _account_set_status(account_name, value);
+ if (strcmp(property, "pgpkeyid") == 0) return _account_set_pgpkeyid(account_name, value);
+ if (strcmp(property, "startscript") == 0) return _account_set_startscript(account_name, value);
+ if (strcmp(property, "theme") == 0) return _account_set_theme(account_name, value);
+ if (strcmp(property, "tls") == 0) return _account_set_tls(account_name, value);
+ if (strcmp(property, "auth") == 0) return _account_set_auth(account_name, value);
if (valid_resource_presence_string(property)) {
return _account_set_presence_priority(account_name, property, value);
@@ -967,21 +961,21 @@ cmd_account_set(ProfWin* window, const char* const command, gchar** args)
}
gboolean
-cmd_account_clear(ProfWin* window, const char* const command, gchar** args)
+cmd_account_clear(ProfWin *window, const char *const command, gchar **args)
{
if (g_strv_length(args) != 3) {
cons_bad_cmd_usage(command);
return TRUE;
}
- char* account_name = args[1];
+ char *account_name = args[1];
if (!accounts_account_exists(account_name)) {
cons_show("Account %s doesn't exist", account_name);
cons_show("");
return TRUE;
}
- char* property = args[2];
+ char *property = args[2];
if (strcmp(property, "password") == 0) {
accounts_clear_password(account_name);
cons_show("Removed password for account %s", account_name);
@@ -1031,7 +1025,7 @@ cmd_account_clear(ProfWin* window, const char* const command, gchar** args)
}
gboolean
-cmd_account(ProfWin* window, const char* const command, gchar** args)
+cmd_account(ProfWin *window, const char *const command, gchar **args)
{
if (args[0] != NULL) {
cons_bad_cmd_usage(command);
@@ -1044,7 +1038,7 @@ cmd_account(ProfWin* window, const char* const command, gchar** args)
return TRUE;
}
- ProfAccount* account = accounts_get_account(session_get_account_name());
+ ProfAccount *account = accounts_get_account(session_get_account_name());
if (account) {
cons_show_account(account);
account_free(account);
@@ -1056,7 +1050,7 @@ cmd_account(ProfWin* window, const char* const command, gchar** args)
}
gboolean
-cmd_script(ProfWin* window, const char* const command, gchar** args)
+cmd_script(ProfWin *window, const char *const command, gchar **args)
{
if ((g_strcmp0(args[0], "run") == 0) && args[1]) {
gboolean res = scripts_exec(args[1]);
@@ -1064,11 +1058,11 @@ cmd_script(ProfWin* window, const char* const command, gchar** args)
cons_show("Could not find script %s", args[1]);
}
} else if (g_strcmp0(args[0], "list") == 0) {
- GSList* scripts = scripts_list();
+ GSList *scripts = scripts_list();
cons_show_scripts(scripts);
g_slist_free_full(scripts, g_free);
} else if ((g_strcmp0(args[0], "show") == 0) && args[1]) {
- GSList* commands = scripts_read(args[1]);
+ GSList *commands = scripts_read(args[1]);
cons_show_script(args[1], commands);
g_slist_free_full(commands, g_free);
} else {
@@ -1080,22 +1074,16 @@ cmd_script(ProfWin* window, const char* const command, gchar** args)
/* escape a string into csv and write it to the file descriptor */
static int
-_writecsv(int fd, const char* const str)
+_writecsv(int fd, const char *const str)
{
- if (!str)
- return 0;
+ if (!str) return 0;
size_t len = strlen(str);
- char* s = malloc(2 * len * sizeof(char));
- char* c = s;
+ char *s = malloc(2 * len * sizeof(char));
+ char *c = s;
int i = 0;
for (; i < strlen(str); i++) {
- if (str[i] != '"')
- *c++ = str[i];
- else {
- *c++ = '"';
- *c++ = '"';
- len++;
- }
+ if (str[i] != '"') *c++ = str[i];
+ else { *c++ = '"'; *c++ = '"'; len++; }
}
if (-1 == write(fd, s, len)) {
cons_show("error: failed to write '%s' to the requested file: %s", s, strerror(errno));
@@ -1106,7 +1094,7 @@ _writecsv(int fd, const char* const str)
}
gboolean
-cmd_export(ProfWin* window, const char* const command, gchar** args)
+cmd_export(ProfWin *window, const char *const command, gchar **args)
{
jabber_conn_status_t conn_status = connection_get_status();
@@ -1115,8 +1103,8 @@ cmd_export(ProfWin* window, const char* const command, gchar** args)
cons_show("");
return TRUE;
} else {
- GString* fname = g_string_new("");
- GSList* list = NULL;
+ GString *fname = g_string_new("");
+ GSList *list = NULL;
int fd;
/* deal with the ~ convention for $HOME */
@@ -1136,28 +1124,22 @@ cmd_export(ProfWin* window, const char* const command, gchar** args)
return TRUE;
}
- if (-1 == write(fd, "jid,name\n", strlen("jid,name\n")))
- goto write_error;
+ if (-1 == write(fd, "jid,name\n", strlen("jid,name\n"))) goto write_error;
list = roster_get_contacts(ROSTER_ORD_NAME);
if (list) {
- GSList* curr = list;
- while (curr) {
+ GSList *curr = list;
+ while (curr){
PContact contact = curr->data;
- const char* jid = p_contact_barejid(contact);
- const char* name = p_contact_name(contact);
+ const char *jid = p_contact_barejid(contact);
+ const char *name = p_contact_name(contact);
/* write the data to the file */
- if (-1 == write(fd, "\"", 1))
- goto write_error;
- if (-1 == _writecsv(fd, jid))
- goto write_error;
- if (-1 == write(fd, "\",\"", 3))
- goto write_error;
- if (-1 == _writecsv(fd, name))
- goto write_error;
- if (-1 == write(fd, "\"\n", 2))
- goto write_error;
+ if (-1 == write(fd, "\"", 1)) goto write_error;
+ if (-1 == _writecsv(fd, jid)) goto write_error;
+ if (-1 == write(fd, "\",\"", 3)) goto write_error;
+ if (-1 == _writecsv(fd, name)) goto write_error;
+ if (-1 == write(fd, "\"\n", 2)) goto write_error;
/* loop */
curr = g_slist_next(curr);
@@ -1172,7 +1154,7 @@ cmd_export(ProfWin* window, const char* const command, gchar** args)
g_slist_free(list);
close(fd);
return TRUE;
- write_error:
+write_error:
cons_show("error: write failed: %s", strerror(errno));
cons_show("");
g_slist_free(list);
@@ -1182,7 +1164,7 @@ cmd_export(ProfWin* window, const char* const command, gchar** args)
}
gboolean
-cmd_sub(ProfWin* window, const char* const command, gchar** args)
+cmd_sub(ProfWin *window, const char *const command, gchar **args)
{
jabber_conn_status_t conn_status = connection_get_status();
@@ -1216,12 +1198,12 @@ cmd_sub(ProfWin* window, const char* const command, gchar** args)
}
if (jid == NULL) {
- ProfChatWin* chatwin = (ProfChatWin*)window;
+ ProfChatWin *chatwin = (ProfChatWin*)window;
assert(chatwin->memcheck == PROFCHATWIN_MEMCHECK);
jid = chatwin->barejid;
}
- Jid* jidp = jid_create(jid);
+ Jid *jidp = jid_create(jid);
if (strcmp(subcmd, "allow") == 0) {
presence_subscription(jidp->barejid, PRESENCE_SUBSCRIBED);
@@ -1247,18 +1229,18 @@ cmd_sub(ProfWin* window, const char* const command, gchar** args)
if (window->type == WIN_CHAT) {
if (p_contact_pending_out(contact)) {
win_println(window, THEME_DEFAULT, "-", "%s subscription status: %s, request pending.",
- jidp->barejid, p_contact_subscription(contact));
+ jidp->barejid, p_contact_subscription(contact));
} else {
win_println(window, THEME_DEFAULT, "-", "%s subscription status: %s.", jidp->barejid,
- p_contact_subscription(contact));
+ p_contact_subscription(contact));
}
} else {
if (p_contact_pending_out(contact)) {
cons_show("%s subscription status: %s, request pending.",
- jidp->barejid, p_contact_subscription(contact));
+ jidp->barejid, p_contact_subscription(contact));
} else {
cons_show("%s subscription status: %s.", jidp->barejid,
- p_contact_subscription(contact));
+ p_contact_subscription(contact));
}
}
}
@@ -1272,7 +1254,7 @@ cmd_sub(ProfWin* window, const char* const command, gchar** args)
}
gboolean
-cmd_disconnect(ProfWin* window, const char* const command, gchar** args)
+cmd_disconnect(ProfWin *window, const char *const command, gchar **args)
{
if (connection_get_status() != JABBER_CONNECTED) {
cons_show("You are not currently connected.");
@@ -1281,7 +1263,7 @@ cmd_disconnect(ProfWin* window, const char* const command, gchar** args)
cl_ev_disconnect();
- char* theme = prefs_get_string(PREF_THEME);
+ char *theme = prefs_get_string(PREF_THEME);
if (theme) {
gboolean res = theme_load(theme, false);
g_free(theme);
@@ -1308,7 +1290,7 @@ cmd_disconnect(ProfWin* window, const char* const command, gchar** args)
}
gboolean
-cmd_quit(ProfWin* window, const char* const command, gchar** args)
+cmd_quit(ProfWin *window, const char *const command, gchar **args)
{
log_info("Profanity is shutting down...");
exit(0);
@@ -1316,21 +1298,21 @@ cmd_quit(ProfWin* window, const char* const command, gchar** args)
}
gboolean
-cmd_wins_unread(ProfWin* window, const char* const command, gchar** args)
+cmd_wins_unread(ProfWin *window, const char *const command, gchar **args)
{
cons_show_wins(TRUE);
return TRUE;
}
gboolean
-cmd_wins_prune(ProfWin* window, const char* const command, gchar** args)
+cmd_wins_prune(ProfWin *window, const char *const command, gchar **args)
{
ui_prune_wins();
return TRUE;
}
gboolean
-cmd_wins_swap(ProfWin* window, const char* const command, gchar** args)
+cmd_wins_swap(ProfWin *window, const char *const command, gchar **args)
{
if ((args[1] == NULL) || (args[2] == NULL)) {
cons_bad_cmd_usage(command);
@@ -1371,7 +1353,7 @@ cmd_wins_swap(ProfWin* window, const char* const command, gchar** args)
}
gboolean
-cmd_wins(ProfWin* window, const char* const command, gchar** args)
+cmd_wins(ProfWin *window, const char *const command, gchar **args)
{
if (args[0] != NULL) {
cons_bad_cmd_usage(command);
@@ -1383,7 +1365,7 @@ cmd_wins(ProfWin* window, const char* const command, gchar** args)
}
gboolean
-cmd_close(ProfWin* window, const char* const command, gchar** args)
+cmd_close(ProfWin *window, const char *const command, gchar **args)
{
jabber_conn_status_t conn_status = connection_get_status();
@@ -1442,7 +1424,7 @@ cmd_close(ProfWin* window, const char* const command, gchar** args)
return TRUE;
}
- ProfWin* toclose = wins_get_by_num(index);
+ ProfWin *toclose = wins_get_by_num(index);
if (!toclose) {
cons_show("Window is not open.");
return TRUE;
@@ -1472,7 +1454,7 @@ cmd_close(ProfWin* window, const char* const command, gchar** args)
return TRUE;
}
- ProfWin* toclose = wins_get_by_string(args[0]);
+ ProfWin *toclose = wins_get_by_string(args[0]);
if (!toclose) {
cons_show("Window \"%s\" does not exist.", args[0]);
return TRUE;
@@ -1501,7 +1483,7 @@ cmd_close(ProfWin* window, const char* const command, gchar** args)
}
gboolean
-cmd_win(ProfWin* window, const char* const command, gchar** args)
+cmd_win(ProfWin *window, const char *const command, gchar **args)
{
gboolean is_num = TRUE;
int i = 0;
@@ -1515,14 +1497,14 @@ cmd_win(ProfWin* window, const char* const command, gchar** args)
if (is_num) {
int num = atoi(args[0]);
- ProfWin* focuswin = wins_get_by_num(num);
+ ProfWin *focuswin = wins_get_by_num(num);
if (!focuswin) {
cons_show("Window %d does not exist.", num);
} else {
ui_focus_win(focuswin);
}
} else {
- ProfWin* focuswin = wins_get_by_string(args[0]);
+ ProfWin *focuswin = wins_get_by_string(args[0]);
if (!focuswin) {
cons_show("Window \"%s\" does not exist.", args[0]);
} else {
@@ -1534,23 +1516,21 @@ cmd_win(ProfWin* window, const char* const command, gchar** args)
}
static void
-_cmd_list_commands(GList* commands)
-{
+_cmd_list_commands(GList *commands) {
int maxlen = 0;
- GList* curr = commands;
+ GList *curr = commands;
while (curr) {
- gchar* cmd = curr->data;
+ gchar *cmd = curr->data;
int len = strlen(cmd);
- if (len > maxlen)
- maxlen = len;
+ if (len > maxlen) maxlen = len;
curr = g_list_next(curr);
}
- GString* cmds = g_string_new("");
+ GString *cmds = g_string_new("");
curr = commands;
int count = 0;
while (curr) {
- gchar* cmd = curr->data;
+ gchar *cmd = curr->data;
if (count == 5) {
cons_show(cmds->str);
g_string_free(cmds, TRUE);
@@ -1571,21 +1551,21 @@ _cmd_list_commands(GList* commands)
}
static void
-_cmd_help_cmd_list(const char* const tag)
+_cmd_help_cmd_list(const char *const tag)
{
cons_show("");
- ProfWin* console = wins_get_console();
+ ProfWin *console = wins_get_console();
if (tag) {
win_println(console, THEME_HELP_HEADER, "-", "%s commands", tag);
} else {
win_println(console, THEME_HELP_HEADER, "-", "All commands");
}
- GList* ordered_commands = NULL;
+ GList *ordered_commands = NULL;
if (g_strcmp0(tag, "plugins") == 0) {
- GList* plugins_cmds = plugins_get_command_names();
- GList* curr = plugins_cmds;
+ GList *plugins_cmds = plugins_get_command_names();
+ GList *curr = plugins_cmds;
while (curr) {
ordered_commands = g_list_insert_sorted(ordered_commands, curr->data, (GCompareFunc)g_strcmp0);
curr = g_list_next(curr);
@@ -1596,8 +1576,8 @@ _cmd_help_cmd_list(const char* const tag)
// add plugins if showing all commands
if (!tag) {
- GList* plugins_cmds = plugins_get_command_names();
- GList* curr = plugins_cmds;
+ GList *plugins_cmds = plugins_get_command_names();
+ GList *curr = plugins_cmds;
while (curr) {
ordered_commands = g_list_insert_sorted(ordered_commands, curr->data, (GCompareFunc)g_strcmp0);
curr = g_list_next(curr);
@@ -1611,7 +1591,7 @@ _cmd_help_cmd_list(const char* const tag)
}
gboolean
-cmd_help(ProfWin* window, const char* const command, gchar** args)
+cmd_help(ProfWin *window, const char *const command, gchar **args)
{
int num_args = g_strv_length(args);
if (num_args == 0) {
@@ -1620,12 +1600,12 @@ cmd_help(ProfWin* window, const char* const command, gchar** args)
if (args[1] == NULL) {
cons_bad_cmd_usage(command);
} else {
- GList* cmds = cmd_search_index_all(args[1]);
+ GList *cmds = cmd_search_index_all(args[1]);
if (cmds == NULL) {
cons_show("No commands found.");
} else {
- GList* curr = cmds;
- GList* results = NULL;
+ GList *curr = cmds;
+ GList *results = NULL;
while (curr) {
results = g_list_insert_sorted(results, curr->data, (GCompareFunc)g_strcmp0);
curr = g_list_next(curr);
@@ -1640,12 +1620,12 @@ cmd_help(ProfWin* window, const char* const command, gchar** args)
if (args[1] == NULL) {
cons_bad_cmd_usage(command);
} else {
- GList* cmds = cmd_search_index_any(args[1]);
+ GList *cmds = cmd_search_index_any(args[1]);
if (cmds == NULL) {
cons_show("No commands found.");
} else {
- GList* curr = cmds;
- GList* results = NULL;
+ GList *curr = cmds;
+ GList *results = NULL;
while (curr) {
results = g_list_insert_sorted(results, curr->data, (GCompareFunc)g_strcmp0);
curr = g_list_next(curr);
@@ -1669,15 +1649,15 @@ cmd_help(ProfWin* window, const char* const command, gchar** args)
} else if (strcmp(args[0], "navigation") == 0) {
cons_navigation_help();
} else {
- char* cmd = args[0];
+ char *cmd = args[0];
char cmd_with_slash[1 + strlen(cmd) + 1];
sprintf(cmd_with_slash, "/%s", cmd);
- Command* command = cmd_get(cmd_with_slash);
+ Command *command = cmd_get(cmd_with_slash);
if (command) {
cons_show_help(cmd_with_slash, &command->help);
} else {
- CommandHelp* commandHelp = plugins_get_help(cmd_with_slash);
+ CommandHelp *commandHelp = plugins_get_help(cmd_with_slash);
if (commandHelp) {
cons_show_help(cmd_with_slash, commandHelp);
} else {
@@ -1691,7 +1671,7 @@ cmd_help(ProfWin* window, const char* const command, gchar** args)
}
gboolean
-cmd_about(ProfWin* window, const char* const command, gchar** args)
+cmd_about(ProfWin *window, const char *const command, gchar **args)
{
cons_show("");
cons_about();
@@ -1699,7 +1679,7 @@ cmd_about(ProfWin* window, const char* const command, gchar** args)
}
gboolean
-cmd_prefs(ProfWin* window, const char* const command, gchar** args)
+cmd_prefs(ProfWin *window, const char *const command, gchar **args)
{
if (args[0] == NULL) {
cons_prefs();
@@ -1748,18 +1728,18 @@ cmd_prefs(ProfWin* window, const char* const command, gchar** args)
}
gboolean
-cmd_theme(ProfWin* window, const char* const command, gchar** args)
+cmd_theme(ProfWin *window, const char *const command, gchar **args)
{
// 'full-load' means to load the theme including the settings (not just [colours])
gboolean fullload = (g_strcmp0(args[0], "full-load") == 0);
// list themes
if (g_strcmp0(args[0], "list") == 0) {
- GSList* themes = theme_list();
+ GSList *themes = theme_list();
cons_show_themes(themes);
g_slist_free_full(themes, g_free);
- // load a theme
+ // load a theme
} else if (g_strcmp0(args[0], "load") == 0 || fullload) {
if (args[1] == NULL) {
cons_bad_cmd_usage(command);
@@ -1782,7 +1762,7 @@ cmd_theme(ProfWin* window, const char* const command, gchar** args)
cons_show("Couldn't find theme: %s", args[1]);
}
- // show colours
+ // show colours
} else if (g_strcmp0(args[0], "colours") == 0) {
cons_theme_colours();
} else if (g_strcmp0(args[0], "properties") == 0) {
@@ -1795,7 +1775,7 @@ cmd_theme(ProfWin* window, const char* const command, gchar** args)
}
static void
-_who_room(ProfWin* window, const char* const command, gchar** args)
+_who_room(ProfWin *window, const char *const command, gchar **args)
{
if ((g_strv_length(args) == 2) && args[1]) {
cons_show("Argument group is not applicable to chat rooms.");
@@ -1803,30 +1783,53 @@ _who_room(ProfWin* window, const char* const command, gchar** args)
}
// bad arg
- if (args[0] && (g_strcmp0(args[0], "online") != 0) && (g_strcmp0(args[0], "available") != 0) && (g_strcmp0(args[0], "unavailable") != 0) && (g_strcmp0(args[0], "away") != 0) && (g_strcmp0(args[0], "chat") != 0) && (g_strcmp0(args[0], "xa") != 0) && (g_strcmp0(args[0], "dnd") != 0) && (g_strcmp0(args[0], "any") != 0) && (g_strcmp0(args[0], "moderator") != 0) && (g_strcmp0(args[0], "participant") != 0) && (g_strcmp0(args[0], "visitor") != 0) && (g_strcmp0(args[0], "owner") != 0) && (g_strcmp0(args[0], "admin") != 0) && (g_strcmp0(args[0], "member") != 0) && (g_strcmp0(args[0], "outcast") != 0)) {
+ if (args[0] &&
+ (g_strcmp0(args[0], "online") != 0) &&
+ (g_strcmp0(args[0], "available") != 0) &&
+ (g_strcmp0(args[0], "unavailable") != 0) &&
+ (g_strcmp0(args[0], "away") != 0) &&
+ (g_strcmp0(args[0], "chat") != 0) &&
+ (g_strcmp0(args[0], "xa") != 0) &&
+ (g_strcmp0(args[0], "dnd") != 0) &&
+ (g_strcmp0(args[0], "any") != 0) &&
+ (g_strcmp0(args[0], "moderator") != 0) &&
+ (g_strcmp0(args[0], "participant") != 0) &&
+ (g_strcmp0(args[0], "visitor") != 0) &&
+ (g_strcmp0(args[0], "owner") != 0) &&
+ (g_strcmp0(args[0], "admin") != 0) &&
+ (g_strcmp0(args[0], "member") != 0) &&
+ (g_strcmp0(args[0], "outcast") != 0)) {
cons_bad_cmd_usage(command);
return;
}
- ProfMucWin* mucwin = (ProfMucWin*)window;
+ ProfMucWin *mucwin = (ProfMucWin*)window;
assert(mucwin->memcheck == PROFMUCWIN_MEMCHECK);
// presence filter
- if (args[0] == NULL || (g_strcmp0(args[0], "online") == 0) || (g_strcmp0(args[0], "available") == 0) || (g_strcmp0(args[0], "unavailable") == 0) || (g_strcmp0(args[0], "away") == 0) || (g_strcmp0(args[0], "chat") == 0) || (g_strcmp0(args[0], "xa") == 0) || (g_strcmp0(args[0], "dnd") == 0) || (g_strcmp0(args[0], "any") == 0)) {
-
- char* presence = args[0];
- GList* occupants = muc_roster(mucwin->roomjid);
+ if (args[0] == NULL ||
+ (g_strcmp0(args[0], "online") == 0) ||
+ (g_strcmp0(args[0], "available") == 0) ||
+ (g_strcmp0(args[0], "unavailable") == 0) ||
+ (g_strcmp0(args[0], "away") == 0) ||
+ (g_strcmp0(args[0], "chat") == 0) ||
+ (g_strcmp0(args[0], "xa") == 0) ||
+ (g_strcmp0(args[0], "dnd") == 0) ||
+ (g_strcmp0(args[0], "any") == 0)) {
+
+ char *presence = args[0];
+ GList *occupants = muc_roster(mucwin->roomjid);
// no arg, show all contacts
if ((presence == NULL) || (g_strcmp0(presence, "any") == 0)) {
mucwin_roster(mucwin, occupants, NULL);
- // available
+ // available
} else if (strcmp("available", presence) == 0) {
- GList* filtered = NULL;
+ GList *filtered = NULL;
while (occupants) {
- Occupant* occupant = occupants->data;
+ Occupant *occupant = occupants->data;
if (muc_occupant_available(occupant)) {
filtered = g_list_append(filtered, occupant);
}
@@ -1835,12 +1838,12 @@ _who_room(ProfWin* window, const char* const command, gchar** args)
mucwin_roster(mucwin, filtered, "available");
- // unavailable
+ // unavailable
} else if (strcmp("unavailable", presence) == 0) {
- GList* filtered = NULL;
+ GList *filtered = NULL;
while (occupants) {
- Occupant* occupant = occupants->data;
+ Occupant *occupant = occupants->data;
if (!muc_occupant_available(occupant)) {
filtered = g_list_append(filtered, occupant);
}
@@ -1849,13 +1852,13 @@ _who_room(ProfWin* window, const char* const command, gchar** args)
mucwin_roster(mucwin, filtered, "unavailable");
- // show specific status
+ // show specific status
} else {
- GList* filtered = NULL;
+ GList *filtered = NULL;
while (occupants) {
- Occupant* occupant = occupants->data;
- const char* presence_str = string_from_resource_presence(occupant->presence);
+ Occupant *occupant = occupants->data;
+ const char *presence_str = string_from_resource_presence(occupant->presence);
if (strcmp(presence_str, presence) == 0) {
filtered = g_list_append(filtered, occupant);
}
@@ -1867,7 +1870,7 @@ _who_room(ProfWin* window, const char* const command, gchar** args)
g_list_free(occupants);
- // role or affiliation filter
+ // role or affiliation filter
} else {
if (g_strcmp0(args[0], "moderator") == 0) {
mucwin_show_role_list(mucwin, MUC_ROLE_MODERATOR);
@@ -1902,32 +1905,32 @@ _who_room(ProfWin* window, const char* const command, gchar** args)
}
static void
-_who_roster(ProfWin* window, const char* const command, gchar** args)
+_who_roster(ProfWin *window, const char *const command, gchar **args)
{
- char* presence = args[0];
+ char *presence = args[0];
// bad arg
if (presence
- && (strcmp(presence, "online") != 0)
- && (strcmp(presence, "available") != 0)
- && (strcmp(presence, "unavailable") != 0)
- && (strcmp(presence, "offline") != 0)
- && (strcmp(presence, "away") != 0)
- && (strcmp(presence, "chat") != 0)
- && (strcmp(presence, "xa") != 0)
- && (strcmp(presence, "dnd") != 0)
- && (strcmp(presence, "any") != 0)) {
+ && (strcmp(presence, "online") != 0)
+ && (strcmp(presence, "available") != 0)
+ && (strcmp(presence, "unavailable") != 0)
+ && (strcmp(presence, "offline") != 0)
+ && (strcmp(presence, "away") != 0)
+ && (strcmp(presence, "chat") != 0)
+ && (strcmp(presence, "xa") != 0)
+ && (strcmp(presence, "dnd") != 0)
+ && (strcmp(presence, "any") != 0)) {
cons_bad_cmd_usage(command);
return;
}
- char* group = NULL;
+ char *group = NULL;
if ((g_strv_length(args) == 2) && args[1]) {
group = args[1];
}
cons_show("");
- GSList* list = NULL;
+ GSList *list = NULL;
if (group) {
list = roster_get_group(group, ROSTER_ORD_NAME);
if (list == NULL) {
@@ -1960,11 +1963,11 @@ _who_roster(ProfWin* window, const char* const command, gchar** args)
}
}
- // available
+ // available
} else if (strcmp("available", presence) == 0) {
- GSList* filtered = NULL;
+ GSList *filtered = NULL;
- GSList* curr = list;
+ GSList *curr = list;
while (curr) {
PContact contact = curr->data;
if (p_contact_is_available(contact)) {
@@ -1990,11 +1993,11 @@ _who_roster(ProfWin* window, const char* const command, gchar** args)
}
g_slist_free(filtered);
- // unavailable
+ // unavailable
} else if (strcmp("unavailable", presence) == 0) {
- GSList* filtered = NULL;
+ GSList *filtered = NULL;
- GSList* curr = list;
+ GSList *curr = list;
while (curr) {
PContact contact = curr->data;
if (!p_contact_is_available(contact)) {
@@ -2020,11 +2023,11 @@ _who_roster(ProfWin* window, const char* const command, gchar** args)
}
g_slist_free(filtered);
- // online, available resources
+ // online, available resources
} else if (strcmp("online", presence) == 0) {
- GSList* filtered = NULL;
+ GSList *filtered = NULL;
- GSList* curr = list;
+ GSList *curr = list;
while (curr) {
PContact contact = curr->data;
if (p_contact_has_available_resource(contact)) {
@@ -2050,11 +2053,11 @@ _who_roster(ProfWin* window, const char* const command, gchar** args)
}
g_slist_free(filtered);
- // offline, no available resources
+ // offline, no available resources
} else if (strcmp("offline", presence) == 0) {
- GSList* filtered = NULL;
+ GSList *filtered = NULL;
- GSList* curr = list;
+ GSList *curr = list;
while (curr) {
PContact contact = curr->data;
if (!p_contact_has_available_resource(contact)) {
@@ -2080,11 +2083,11 @@ _who_roster(ProfWin* window, const char* const command, gchar** args)
}
g_slist_free(filtered);
- // show specific status
+ // show specific status
} else {
- GSList* filtered = NULL;
+ GSList *filtered = NULL;
- GSList* curr = list;
+ GSList *curr = list;
while (curr) {
PContact contact = curr->data;
if (strcmp(p_contact_presence(contact), presence) == 0) {
@@ -2115,7 +2118,7 @@ _who_roster(ProfWin* window, const char* const command, gchar** args)
}
gboolean
-cmd_who(ProfWin* window, const char* const command, gchar** args)
+cmd_who(ProfWin *window, const char *const command, gchar **args)
{
jabber_conn_status_t conn_status = connection_get_status();
@@ -2135,10 +2138,10 @@ cmd_who(ProfWin* window, const char* const command, gchar** args)
}
gboolean
-cmd_msg(ProfWin* window, const char* const command, gchar** args)
+cmd_msg(ProfWin *window, const char *const command, gchar **args)
{
- char* usr = args[0];
- char* msg = args[1];
+ char *usr = args[0];
+ char *msg = args[1];
jabber_conn_status_t conn_status = connection_get_status();
@@ -2149,14 +2152,14 @@ cmd_msg(ProfWin* window, const char* const command, gchar** args)
// send private message when in MUC room
if (window->type == WIN_MUC) {
- ProfMucWin* mucwin = (ProfMucWin*)window;
+ ProfMucWin *mucwin = (ProfMucWin*)window;
assert(mucwin->memcheck == PROFMUCWIN_MEMCHECK);
if (muc_roster_contains_nick(mucwin->roomjid, usr)) {
- GString* full_jid = g_string_new(mucwin->roomjid);
+ GString *full_jid = g_string_new(mucwin->roomjid);
g_string_append(full_jid, "/");
g_string_append(full_jid, usr);
- ProfPrivateWin* privwin = wins_get_private(full_jid->str);
+ ProfPrivateWin *privwin = wins_get_private(full_jid->str);
if (!privwin) {
privwin = (ProfPrivateWin*)wins_new_private(full_jid->str);
}
@@ -2174,14 +2177,14 @@ cmd_msg(ProfWin* window, const char* const command, gchar** args)
return TRUE;
- // send chat message
+ // send chat message
} else {
- char* barejid = roster_barejid_from_name(usr);
+ char *barejid = roster_barejid_from_name(usr);
if (barejid == NULL) {
barejid = usr;
}
- ProfChatWin* chatwin = wins_get_chat(barejid);
+ ProfChatWin *chatwin = wins_get_chat(barejid);
if (!chatwin) {
chatwin = chatwin_new(barejid);
}
@@ -2218,7 +2221,7 @@ cmd_msg(ProfWin* window, const char* const command, gchar** args)
}
gboolean
-cmd_group(ProfWin* window, const char* const command, gchar** args)
+cmd_group(ProfWin *window, const char *const command, gchar **args)
{
jabber_conn_status_t conn_status = connection_get_status();
@@ -2229,8 +2232,8 @@ cmd_group(ProfWin* window, const char* const command, gchar** args)
// list all groups
if (args[1] == NULL) {
- GList* groups = roster_get_groups();
- GList* curr = groups;
+ GList *groups = roster_get_groups();
+ GList *curr = groups;
if (curr) {
cons_show("Groups:");
while (curr) {
@@ -2247,28 +2250,28 @@ cmd_group(ProfWin* window, const char* const command, gchar** args)
// show contacts in group
if (strcmp(args[1], "show") == 0) {
- char* group = args[2];
+ char *group = args[2];
if (group == NULL) {
cons_bad_cmd_usage(command);
return TRUE;
}
- GSList* list = roster_get_group(group, ROSTER_ORD_NAME);
+ GSList *list = roster_get_group(group, ROSTER_ORD_NAME);
cons_show_roster_group(group, list);
return TRUE;
}
// add contact to group
if (strcmp(args[1], "add") == 0) {
- char* group = args[2];
- char* contact = args[3];
+ char *group = args[2];
+ char *contact = args[3];
if ((group == NULL) || (contact == NULL)) {
cons_bad_cmd_usage(command);
return TRUE;
}
- char* barejid = roster_barejid_from_name(contact);
+ char *barejid = roster_barejid_from_name(contact);
if (barejid == NULL) {
barejid = contact;
}
@@ -2280,7 +2283,7 @@ cmd_group(ProfWin* window, const char* const command, gchar** args)
}
if (p_contact_in_group(pcontact, group)) {
- const char* display_name = p_contact_name_or_jid(pcontact);
+ const char *display_name = p_contact_name_or_jid(pcontact);
ui_contact_already_in_group(display_name, group);
} else {
roster_send_add_to_group(group, pcontact);
@@ -2291,15 +2294,15 @@ cmd_group(ProfWin* window, const char* const command, gchar** args)
// remove contact from group
if (strcmp(args[1], "remove") == 0) {
- char* group = args[2];
- char* contact = args[3];
+ char *group = args[2];
+ char *contact = args[3];
if ((group == NULL) || (contact == NULL)) {
cons_bad_cmd_usage(command);
return TRUE;
}
- char* barejid = roster_barejid_from_name(contact);
+ char *barejid = roster_barejid_from_name(contact);
if (barejid == NULL) {
barejid = contact;
}
@@ -2311,7 +2314,7 @@ cmd_group(ProfWin* window, const char* const command, gchar** args)
}
if (!p_contact_in_group(pcontact, group)) {
- const char* display_name = p_contact_name_or_jid(pcontact);
+ const char *display_name = p_contact_name_or_jid(pcontact);
ui_contact_not_in_group(display_name, group);
} else {
roster_send_remove_from_group(group, pcontact);
@@ -2325,7 +2328,7 @@ cmd_group(ProfWin* window, const char* const command, gchar** args)
}
gboolean
-cmd_roster(ProfWin* window, const char* const command, gchar** args)
+cmd_roster(ProfWin *window, const char *const command, gchar **args)
{
jabber_conn_status_t conn_status = connection_get_status();
@@ -2336,31 +2339,31 @@ cmd_roster(ProfWin* window, const char* const command, gchar** args)
return TRUE;
}
- GSList* list = roster_get_contacts(ROSTER_ORD_NAME);
+ GSList *list = roster_get_contacts(ROSTER_ORD_NAME);
cons_show_roster(list);
g_slist_free(list);
return TRUE;
- // show roster, only online contacts
- } else if (g_strcmp0(args[0], "online") == 0) {
+ // show roster, only online contacts
+ } else if(g_strcmp0(args[0], "online") == 0){
if (conn_status != JABBER_CONNECTED) {
cons_show("You are not currently connected.");
return TRUE;
}
- GSList* list = roster_get_contacts_online();
+ GSList *list = roster_get_contacts_online();
cons_show_roster(list);
g_slist_free(list);
return TRUE;
- // set roster size
+ // set roster size
} else if (g_strcmp0(args[0], "size") == 0) {
if (!args[1]) {
cons_bad_cmd_usage(command);
return TRUE;
}
int intval = 0;
- char* err_msg = NULL;
+ char *err_msg = NULL;
gboolean res = strtoi_range(args[1], &intval, 1, 99, &err_msg);
if (res) {
prefs_set_roster_size(intval);
@@ -2375,7 +2378,7 @@ cmd_roster(ProfWin* window, const char* const command, gchar** args)
return TRUE;
}
- // set line wrapping
+ // set line wrapping
} else if (g_strcmp0(args[0], "wrap") == 0) {
if (!args[1]) {
cons_bad_cmd_usage(command);
@@ -2386,7 +2389,7 @@ cmd_roster(ProfWin* window, const char* const command, gchar** args)
return TRUE;
}
- // header settings
+ // header settings
} else if (g_strcmp0(args[0], "header") == 0) {
if (g_strcmp0(args[1], "char") == 0) {
if (!args[2]) {
@@ -2405,7 +2408,7 @@ cmd_roster(ProfWin* window, const char* const command, gchar** args)
}
return TRUE;
- // contact settings
+ // contact settings
} else if (g_strcmp0(args[0], "contact") == 0) {
if (g_strcmp0(args[1], "char") == 0) {
if (!args[2]) {
@@ -2424,7 +2427,7 @@ cmd_roster(ProfWin* window, const char* const command, gchar** args)
cons_bad_cmd_usage(command);
} else {
int intval = 0;
- char* err_msg = NULL;
+ char *err_msg = NULL;
gboolean res = strtoi_range(args[2], &intval, 0, 10, &err_msg);
if (res) {
prefs_set_roster_contact_indent(intval);
@@ -2440,7 +2443,7 @@ cmd_roster(ProfWin* window, const char* const command, gchar** args)
}
return TRUE;
- // resource settings
+ // resource settings
} else if (g_strcmp0(args[0], "resource") == 0) {
if (g_strcmp0(args[1], "char") == 0) {
if (!args[2]) {
@@ -2459,7 +2462,7 @@ cmd_roster(ProfWin* window, const char* const command, gchar** args)
cons_bad_cmd_usage(command);
} else {
int intval = 0;
- char* err_msg = NULL;
+ char *err_msg = NULL;
gboolean res = strtoi_range(args[2], &intval, 0, 10, &err_msg);
if (res) {
prefs_set_roster_resource_indent(intval);
@@ -2479,14 +2482,14 @@ cmd_roster(ProfWin* window, const char* const command, gchar** args)
}
return TRUE;
- // presence settings
+ // presence settings
} else if (g_strcmp0(args[0], "presence") == 0) {
if (g_strcmp0(args[1], "indent") == 0) {
if (!args[2]) {
cons_bad_cmd_usage(command);
} else {
int intval = 0;
- char* err_msg = NULL;
+ char *err_msg = NULL;
gboolean res = strtoi_range(args[2], &intval, -1, 10, &err_msg);
if (res) {
prefs_set_roster_presence_indent(intval);
@@ -2502,10 +2505,10 @@ cmd_roster(ProfWin* window, const char* const command, gchar** args)
}
return TRUE;
- // show/hide roster
+ // show/hide roster
} else if ((g_strcmp0(args[0], "show") == 0) || (g_strcmp0(args[0], "hide") == 0)) {
preference_t pref;
- const char* pref_str;
+ const char *pref_str;
if (args[1] == NULL) {
pref = PREF_ROSTER;
pref_str = "";
@@ -2565,7 +2568,7 @@ cmd_roster(ProfWin* window, const char* const command, gchar** args)
}
return TRUE;
- // roster grouping
+ // roster grouping
} else if (g_strcmp0(args[0], "by") == 0) {
if (g_strcmp0(args[1], "group") == 0) {
cons_show("Grouping roster by roster group");
@@ -2593,7 +2596,7 @@ cmd_roster(ProfWin* window, const char* const command, gchar** args)
return TRUE;
}
- // roster item order
+ // roster item order
} else if (g_strcmp0(args[0], "order") == 0) {
if (g_strcmp0(args[1], "name") == 0) {
cons_show("Ordering roster by name");
@@ -2882,28 +2885,28 @@ cmd_roster(ProfWin* window, const char* const command, gchar** args)
return TRUE;
}
- // add contact
+ // add contact
} else if (strcmp(args[0], "add") == 0) {
if (conn_status != JABBER_CONNECTED) {
cons_show("You are not currently connected.");
return TRUE;
}
- char* jid = args[1];
+ char *jid = args[1];
if (jid == NULL) {
cons_bad_cmd_usage(command);
} else {
- char* name = args[2];
+ char *name = args[2];
roster_send_add_new(jid, name);
}
return TRUE;
- // remove contact
+ // remove contact
} else if (strcmp(args[0], "remove") == 0) {
if (conn_status != JABBER_CONNECTED) {
cons_show("You are not currently connected.");
return TRUE;
}
- char* jid = args[1];
+ char *jid = args[1];
if (jid == NULL) {
cons_bad_cmd_usage(command);
} else {
@@ -2921,8 +2924,8 @@ cmd_roster(ProfWin* window, const char* const command, gchar** args)
return TRUE;
}
- GSList* all = roster_get_contacts(ROSTER_ORD_NAME);
- GSList* curr = all;
+ GSList *all = roster_get_contacts(ROSTER_ORD_NAME);
+ GSList *curr = all;
while (curr) {
PContact contact = curr->data;
roster_send_remove(p_contact_barejid(contact));
@@ -2932,19 +2935,19 @@ cmd_roster(ProfWin* window, const char* const command, gchar** args)
g_slist_free(all);
return TRUE;
- // change nickname
+ // change nickname
} else if (strcmp(args[0], "nick") == 0) {
if (conn_status != JABBER_CONNECTED) {
cons_show("You are not currently connected.");
return TRUE;
}
- char* jid = args[1];
+ char *jid = args[1];
if (jid == NULL) {
cons_bad_cmd_usage(command);
return TRUE;
}
- char* name = args[2];
+ char *name = args[2];
if (name == NULL) {
cons_bad_cmd_usage(command);
return TRUE;
@@ -2957,26 +2960,27 @@ cmd_roster(ProfWin* window, const char* const command, gchar** args)
return TRUE;
}
- const char* barejid = p_contact_barejid(contact);
+ const char *barejid = p_contact_barejid(contact);
// TODO wait for result stanza before updating
- const char* oldnick = p_contact_name(contact);
+ const char *oldnick = p_contact_name(contact);
wins_change_nick(barejid, oldnick, name);
roster_change_name(contact, name);
- GSList* groups = p_contact_groups(contact);
+ GSList *groups = p_contact_groups(contact);
roster_send_name_change(barejid, name, groups);
+
cons_show("Nickname for %s set to: %s.", jid, name);
return TRUE;
- // remove nickname
+ // remove nickname
} else if (strcmp(args[0], "clearnick") == 0) {
if (conn_status != JABBER_CONNECTED) {
cons_show("You are not currently connected.");
return TRUE;
}
- char* jid = args[1];
+ char *jid = args[1];
if (jid == NULL) {
cons_bad_cmd_usage(command);
return TRUE;
@@ -2989,13 +2993,13 @@ cmd_roster(ProfWin* window, const char* const command, gchar** args)
return TRUE;
}
- const char* barejid = p_contact_barejid(contact);
+ const char *barejid = p_contact_barejid(contact);
// TODO wait for result stanza before updating
- const char* oldnick = p_contact_name(contact);
+ const char *oldnick = p_contact_name(contact);
wins_remove_nick(barejid, oldnick);
roster_change_name(contact, NULL);
- GSList* groups = p_contact_groups(contact);
+ GSList *groups = p_contact_groups(contact);
roster_send_name_change(barejid, NULL, groups);
cons_show("Nickname for %s removed.", jid);
@@ -3008,7 +3012,7 @@ cmd_roster(ProfWin* window, const char* const command, gchar** args)
}
gboolean
-cmd_blocked(ProfWin* window, const char* const command, gchar** args)
+cmd_blocked(ProfWin *window, const char *const command, gchar **args)
{
if (connection_get_status() != JABBER_CONNECTED) {
cons_show("You are not currently connected.");
@@ -3021,9 +3025,9 @@ cmd_blocked(ProfWin* window, const char* const command, gchar** args)
}
if (g_strcmp0(args[0], "add") == 0) {
- char* jid = args[1];
+ char *jid = args[1];
if (jid == NULL && (window->type == WIN_CHAT)) {
- ProfChatWin* chatwin = (ProfChatWin*)window;
+ ProfChatWin *chatwin = (ProfChatWin*)window;
jid = chatwin->barejid;
}
@@ -3054,8 +3058,8 @@ cmd_blocked(ProfWin* window, const char* const command, gchar** args)
return TRUE;
}
- GList* blocked = blocked_list();
- GList* curr = blocked;
+ GList *blocked = blocked_list();
+ GList *curr = blocked;
if (curr) {
cons_show("Blocked users:");
while (curr) {
@@ -3070,10 +3074,10 @@ cmd_blocked(ProfWin* window, const char* const command, gchar** args)
}
gboolean
-cmd_resource(ProfWin* window, const char* const command, gchar** args)
+cmd_resource(ProfWin *window, const char *const command, gchar **args)
{
- char* cmd = args[0];
- char* setting = NULL;
+ char *cmd = args[0];
+ char *setting = NULL;
if (g_strcmp0(cmd, "message") == 0) {
setting = args[1];
if (!setting) {
@@ -3105,10 +3109,10 @@ cmd_resource(ProfWin* window, const char* const command, gchar** args)
return TRUE;
}
- ProfChatWin* chatwin = (ProfChatWin*)window;
+ ProfChatWin *chatwin = (ProfChatWin*)window;
if (g_strcmp0(cmd, "set") == 0) {
- char* resource = args[1];
+ char *resource = args[1];
if (!resource) {
cons_bad_cmd_usage(command);
return TRUE;
@@ -3153,7 +3157,7 @@ cmd_resource(ProfWin* window, const char* const command, gchar** args)
static void
_cmd_status_show_status(char* usr)
{
- char* usr_jid = roster_barejid_from_name(usr);
+ char *usr_jid = roster_barejid_from_name(usr);
if (usr_jid == NULL) {
usr_jid = usr;
}
@@ -3161,9 +3165,9 @@ _cmd_status_show_status(char* usr)
}
gboolean
-cmd_status_set(ProfWin* window, const char* const command, gchar** args)
+cmd_status_set(ProfWin *window, const char *const command, gchar **args)
{
- char* state = args[1];
+ char *state = args[1];
if (g_strcmp0(state, "online") == 0) {
_update_presence(RESOURCE_ONLINE, "online", args);
@@ -3183,9 +3187,9 @@ cmd_status_set(ProfWin* window, const char* const command, gchar** args)
}
gboolean
-cmd_status_get(ProfWin* window, const char* const command, gchar** args)
+cmd_status_get(ProfWin *window, const char *const command, gchar **args)
{
- char* usr = args[1];
+ char *usr = args[1];
jabber_conn_status_t conn_status = connection_get_status();
@@ -3194,69 +3198,70 @@ cmd_status_get(ProfWin* window, const char* const command, gchar** args)
return TRUE;
}
- switch (window->type) {
- case WIN_MUC:
- if (usr) {
- ProfMucWin* mucwin = (ProfMucWin*)window;
- assert(mucwin->memcheck == PROFMUCWIN_MEMCHECK);
- Occupant* occupant = muc_roster_item(mucwin->roomjid, usr);
- if (occupant) {
- win_show_occupant(window, occupant);
+ switch (window->type)
+ {
+ case WIN_MUC:
+ if (usr) {
+ ProfMucWin *mucwin = (ProfMucWin*)window;
+ assert(mucwin->memcheck == PROFMUCWIN_MEMCHECK);
+ Occupant *occupant = muc_roster_item(mucwin->roomjid, usr);
+ if (occupant) {
+ win_show_occupant(window, occupant);
+ } else {
+ win_println(window, THEME_DEFAULT, "-", "No such participant \"%s\" in room.", usr);
+ }
} else {
- win_println(window, THEME_DEFAULT, "-", "No such participant \"%s\" in room.", usr);
+ win_println(window, THEME_DEFAULT, "-", "You must specify a nickname.");
}
- } else {
- win_println(window, THEME_DEFAULT, "-", "You must specify a nickname.");
- }
- break;
- case WIN_CHAT:
- if (usr) {
- _cmd_status_show_status(usr);
- } else {
- ProfChatWin* chatwin = (ProfChatWin*)window;
- assert(chatwin->memcheck == PROFCHATWIN_MEMCHECK);
- PContact pcontact = roster_get_contact(chatwin->barejid);
- if (pcontact) {
- win_show_contact(window, pcontact);
+ break;
+ case WIN_CHAT:
+ if (usr) {
+ _cmd_status_show_status(usr);
+ } else {
+ ProfChatWin *chatwin = (ProfChatWin*)window;
+ assert(chatwin->memcheck == PROFCHATWIN_MEMCHECK);
+ PContact pcontact = roster_get_contact(chatwin->barejid);
+ if (pcontact) {
+ win_show_contact(window, pcontact);
+ } else {
+ win_println(window, THEME_DEFAULT, "-", "Error getting contact info.");
+ }
+ }
+ break;
+ case WIN_PRIVATE:
+ if (usr) {
+ _cmd_status_show_status(usr);
} else {
- win_println(window, THEME_DEFAULT, "-", "Error getting contact info.");
+ ProfPrivateWin *privatewin = (ProfPrivateWin*)window;
+ assert(privatewin->memcheck == PROFPRIVATEWIN_MEMCHECK);
+ Jid *jid = jid_create(privatewin->fulljid);
+ Occupant *occupant = muc_roster_item(jid->barejid, jid->resourcepart);
+ if (occupant) {
+ win_show_occupant(window, occupant);
+ } else {
+ win_println(window, THEME_DEFAULT, "-", "Error getting contact info.");
+ }
+ jid_destroy(jid);
}
- }
- break;
- case WIN_PRIVATE:
- if (usr) {
- _cmd_status_show_status(usr);
- } else {
- ProfPrivateWin* privatewin = (ProfPrivateWin*)window;
- assert(privatewin->memcheck == PROFPRIVATEWIN_MEMCHECK);
- Jid* jid = jid_create(privatewin->fulljid);
- Occupant* occupant = muc_roster_item(jid->barejid, jid->resourcepart);
- if (occupant) {
- win_show_occupant(window, occupant);
+ break;
+ case WIN_CONSOLE:
+ if (usr) {
+ _cmd_status_show_status(usr);
} else {
- win_println(window, THEME_DEFAULT, "-", "Error getting contact info.");
+ cons_bad_cmd_usage(command);
}
- jid_destroy(jid);
- }
- break;
- case WIN_CONSOLE:
- if (usr) {
- _cmd_status_show_status(usr);
- } else {
- cons_bad_cmd_usage(command);
- }
- break;
- default:
- break;
+ break;
+ default:
+ break;
}
return TRUE;
}
static void
-_cmd_info_show_contact(char* usr)
+_cmd_info_show_contact(char *usr)
{
- char* usr_jid = roster_barejid_from_name(usr);
+ char *usr_jid = roster_barejid_from_name(usr);
if (usr_jid == NULL) {
usr_jid = usr;
}
@@ -3269,9 +3274,9 @@ _cmd_info_show_contact(char* usr)
}
gboolean
-cmd_info(ProfWin* window, const char* const command, gchar** args)
+cmd_info(ProfWin *window, const char *const command, gchar **args)
{
- char* usr = args[0];
+ char *usr = args[0];
jabber_conn_status_t conn_status = connection_get_status();
@@ -3280,148 +3285,150 @@ cmd_info(ProfWin* window, const char* const command, gchar** args)
return TRUE;
}
- switch (window->type) {
- case WIN_MUC:
- if (usr) {
- ProfMucWin* mucwin = (ProfMucWin*)window;
- assert(mucwin->memcheck == PROFMUCWIN_MEMCHECK);
- Occupant* occupant = muc_roster_item(mucwin->roomjid, usr);
- if (occupant) {
- win_show_occupant_info(window, mucwin->roomjid, occupant);
+ switch (window->type)
+ {
+ case WIN_MUC:
+ if (usr) {
+ ProfMucWin *mucwin = (ProfMucWin*)window;
+ assert(mucwin->memcheck == PROFMUCWIN_MEMCHECK);
+ Occupant *occupant = muc_roster_item(mucwin->roomjid, usr);
+ if (occupant) {
+ win_show_occupant_info(window, mucwin->roomjid, occupant);
+ } else {
+ win_println(window, THEME_DEFAULT, "-", "No such occupant \"%s\" in room.", usr);
+ }
} else {
- win_println(window, THEME_DEFAULT, "-", "No such occupant \"%s\" in room.", usr);
+ ProfMucWin *mucwin = (ProfMucWin*)window;
+ assert(mucwin->memcheck == PROFMUCWIN_MEMCHECK);
+ iq_room_info_request(mucwin->roomjid, TRUE);
+ mucwin_info(mucwin);
+ return TRUE;
}
- } else {
- ProfMucWin* mucwin = (ProfMucWin*)window;
- assert(mucwin->memcheck == PROFMUCWIN_MEMCHECK);
- iq_room_info_request(mucwin->roomjid, TRUE);
- mucwin_info(mucwin);
- return TRUE;
- }
- break;
- case WIN_CHAT:
- if (usr) {
- _cmd_info_show_contact(usr);
- } else {
- ProfChatWin* chatwin = (ProfChatWin*)window;
- assert(chatwin->memcheck == PROFCHATWIN_MEMCHECK);
- PContact pcontact = roster_get_contact(chatwin->barejid);
- if (pcontact) {
- win_show_info(window, pcontact);
+ break;
+ case WIN_CHAT:
+ if (usr) {
+ _cmd_info_show_contact(usr);
} else {
- win_println(window, THEME_DEFAULT, "-", "Error getting contact info.");
+ ProfChatWin *chatwin = (ProfChatWin*)window;
+ assert(chatwin->memcheck == PROFCHATWIN_MEMCHECK);
+ PContact pcontact = roster_get_contact(chatwin->barejid);
+ if (pcontact) {
+ win_show_info(window, pcontact);
+ } else {
+ win_println(window, THEME_DEFAULT, "-", "Error getting contact info.");
+ }
}
- }
- break;
- case WIN_PRIVATE:
- if (usr) {
- _cmd_info_show_contact(usr);
- } else {
- ProfPrivateWin* privatewin = (ProfPrivateWin*)window;
- assert(privatewin->memcheck == PROFPRIVATEWIN_MEMCHECK);
- Jid* jid = jid_create(privatewin->fulljid);
- Occupant* occupant = muc_roster_item(jid->barejid, jid->resourcepart);
- if (occupant) {
- win_show_occupant_info(window, jid->barejid, occupant);
+ break;
+ case WIN_PRIVATE:
+ if (usr) {
+ _cmd_info_show_contact(usr);
+ } else {
+ ProfPrivateWin *privatewin = (ProfPrivateWin*)window;
+ assert(privatewin->memcheck == PROFPRIVATEWIN_MEMCHECK);
+ Jid *jid = jid_create(privatewin->fulljid);
+ Occupant *occupant = muc_roster_item(jid->barejid, jid->resourcepart);
+ if (occupant) {
+ win_show_occupant_info(window, jid->barejid, occupant);
+ } else {
+ win_println(window, THEME_DEFAULT, "-", "Error getting contact info.");
+ }
+ jid_destroy(jid);
+ }
+ break;
+ case WIN_CONSOLE:
+ if (usr) {
+ _cmd_info_show_contact(usr);
} else {
- win_println(window, THEME_DEFAULT, "-", "Error getting contact info.");
+ cons_bad_cmd_usage(command);
}
- jid_destroy(jid);
- }
- break;
- case WIN_CONSOLE:
- if (usr) {
- _cmd_info_show_contact(usr);
- } else {
- cons_bad_cmd_usage(command);
- }
- break;
- default:
- break;
+ break;
+ default:
+ break;
}
return TRUE;
}
gboolean
-cmd_caps(ProfWin* window, const char* const command, gchar** args)
+cmd_caps(ProfWin *window, const char *const command, gchar **args)
{
jabber_conn_status_t conn_status = connection_get_status();
- Occupant* occupant = NULL;
+ Occupant *occupant = NULL;
if (conn_status != JABBER_CONNECTED) {
cons_show("You are not currently connected.");
return TRUE;
}
- switch (window->type) {
- case WIN_MUC:
- if (args[0]) {
- ProfMucWin* mucwin = (ProfMucWin*)window;
- assert(mucwin->memcheck == PROFMUCWIN_MEMCHECK);
- occupant = muc_roster_item(mucwin->roomjid, args[0]);
- if (occupant) {
- Jid* jidp = jid_create_from_bare_and_resource(mucwin->roomjid, args[0]);
- cons_show_caps(jidp->fulljid, occupant->presence);
- jid_destroy(jidp);
+ switch (window->type)
+ {
+ case WIN_MUC:
+ if (args[0]) {
+ ProfMucWin *mucwin = (ProfMucWin*)window;
+ assert(mucwin->memcheck == PROFMUCWIN_MEMCHECK);
+ occupant = muc_roster_item(mucwin->roomjid, args[0]);
+ if (occupant) {
+ Jid *jidp = jid_create_from_bare_and_resource(mucwin->roomjid, args[0]);
+ cons_show_caps(jidp->fulljid, occupant->presence);
+ jid_destroy(jidp);
+ } else {
+ cons_show("No such participant \"%s\" in room.", args[0]);
+ }
} else {
- cons_show("No such participant \"%s\" in room.", args[0]);
+ cons_show("No nickname supplied to /caps in chat room.");
}
- } else {
- cons_show("No nickname supplied to /caps in chat room.");
- }
- break;
- case WIN_CHAT:
- case WIN_CONSOLE:
- if (args[0]) {
- Jid* jid = jid_create(args[0]);
+ break;
+ case WIN_CHAT:
+ case WIN_CONSOLE:
+ if (args[0]) {
+ Jid *jid = jid_create(args[0]);
- if (jid->fulljid == NULL) {
- cons_show("You must provide a full jid to the /caps command.");
- } else {
- PContact pcontact = roster_get_contact(jid->barejid);
- if (pcontact == NULL) {
- cons_show("Contact not found in roster: %s", jid->barejid);
+ if (jid->fulljid == NULL) {
+ cons_show("You must provide a full jid to the /caps command.");
} else {
- Resource* resource = p_contact_get_resource(pcontact, jid->resourcepart);
- if (resource == NULL) {
- cons_show("Could not find resource %s, for contact %s", jid->barejid, jid->resourcepart);
+ PContact pcontact = roster_get_contact(jid->barejid);
+ if (pcontact == NULL) {
+ cons_show("Contact not found in roster: %s", jid->barejid);
} else {
- cons_show_caps(jid->fulljid, resource->presence);
+ Resource *resource = p_contact_get_resource(pcontact, jid->resourcepart);
+ if (resource == NULL) {
+ cons_show("Could not find resource %s, for contact %s", jid->barejid, jid->resourcepart);
+ } else {
+ cons_show_caps(jid->fulljid, resource->presence);
+ }
}
}
- }
- jid_destroy(jid);
- } else {
- cons_show("You must provide a jid to the /caps command.");
- }
- break;
- case WIN_PRIVATE:
- if (args[0]) {
- cons_show("No parameter needed to /caps when in private chat.");
- } else {
- ProfPrivateWin* privatewin = (ProfPrivateWin*)window;
- assert(privatewin->memcheck == PROFPRIVATEWIN_MEMCHECK);
- Jid* jid = jid_create(privatewin->fulljid);
- if (jid) {
- occupant = muc_roster_item(jid->barejid, jid->resourcepart);
- cons_show_caps(jid->resourcepart, occupant->presence);
jid_destroy(jid);
+ } else {
+ cons_show("You must provide a jid to the /caps command.");
}
- }
- break;
- default:
- break;
+ break;
+ case WIN_PRIVATE:
+ if (args[0]) {
+ cons_show("No parameter needed to /caps when in private chat.");
+ } else {
+ ProfPrivateWin *privatewin = (ProfPrivateWin*)window;
+ assert(privatewin->memcheck == PROFPRIVATEWIN_MEMCHECK);
+ Jid *jid = jid_create(privatewin->fulljid);
+ if (jid) {
+ occupant = muc_roster_item(jid->barejid, jid->resourcepart);
+ cons_show_caps(jid->resourcepart, occupant->presence);
+ jid_destroy(jid);
+ }
+ }
+ break;
+ default:
+ break;
}
return TRUE;
}
static void
-_send_software_version_iq_to_fulljid(char* request)
+_send_software_version_iq_to_fulljid(char *request)
{
- char* mybarejid = connection_get_barejid();
- Jid* jid = jid_create(request);
+ char *mybarejid = connection_get_barejid();
+ Jid *jid = jid_create(request);
if (jid == NULL || jid->fulljid == NULL) {
cons_show("You must provide a full jid to the /software command.");
@@ -3435,7 +3442,7 @@ _send_software_version_iq_to_fulljid(char* request)
}
gboolean
-cmd_software(ProfWin* window, const char* const command, gchar** args)
+cmd_software(ProfWin *window, const char *const command, gchar **args)
{
jabber_conn_status_t conn_status = connection_get_status();
@@ -3444,74 +3451,75 @@ cmd_software(ProfWin* window, const char* const command, gchar** args)
return TRUE;
}
- switch (window->type) {
- case WIN_MUC:
- if (args[0]) {
- ProfMucWin* mucwin = (ProfMucWin*)window;
- assert(mucwin->memcheck == PROFMUCWIN_MEMCHECK);
- Occupant* occupant = muc_roster_item(mucwin->roomjid, args[0]);
- if (occupant) {
- Jid* jid = jid_create_from_bare_and_resource(mucwin->roomjid, args[0]);
- iq_send_software_version(jid->fulljid);
- jid_destroy(jid);
+ switch (window->type)
+ {
+ case WIN_MUC:
+ if (args[0]) {
+ ProfMucWin *mucwin = (ProfMucWin*)window;
+ assert(mucwin->memcheck == PROFMUCWIN_MEMCHECK);
+ Occupant *occupant = muc_roster_item(mucwin->roomjid, args[0]);
+ if (occupant) {
+ Jid *jid = jid_create_from_bare_and_resource(mucwin->roomjid, args[0]);
+ iq_send_software_version(jid->fulljid);
+ jid_destroy(jid);
+ } else {
+ cons_show("No such participant \"%s\" in room.", args[0]);
+ }
} else {
- cons_show("No such participant \"%s\" in room.", args[0]);
+ cons_show("No nickname supplied to /software in chat room.");
}
- } else {
- cons_show("No nickname supplied to /software in chat room.");
- }
- break;
- case WIN_CHAT:
- if (args[0]) {
- _send_software_version_iq_to_fulljid(args[0]);
break;
- } else {
- ProfChatWin* chatwin = (ProfChatWin*)window;
- assert(chatwin->memcheck == PROFCHATWIN_MEMCHECK);
+ case WIN_CHAT:
+ if (args[0]) {
+ _send_software_version_iq_to_fulljid(args[0]);
+ break;
+ } else {
+ ProfChatWin *chatwin = (ProfChatWin*)window;
+ assert(chatwin->memcheck == PROFCHATWIN_MEMCHECK);
+
+ char *resource = NULL;
+ ChatSession *session = chat_session_get(chatwin->barejid);
+ if (chatwin->resource_override) {
+ resource = chatwin->resource_override;
+ } else if (session && session->resource) {
+ resource = session->resource;
+ }
- char* resource = NULL;
- ChatSession* session = chat_session_get(chatwin->barejid);
- if (chatwin->resource_override) {
- resource = chatwin->resource_override;
- } else if (session && session->resource) {
- resource = session->resource;
+ if (resource) {
+ GString *fulljid = g_string_new(chatwin->barejid);
+ g_string_append_printf(fulljid, "/%s", resource);
+ iq_send_software_version(fulljid->str);
+ g_string_free(fulljid, TRUE);
+ } else {
+ win_println(window, THEME_DEFAULT, "-", "Unknown resource for /software command. See /help resource.");
+ }
+ break;
}
-
- if (resource) {
- GString* fulljid = g_string_new(chatwin->barejid);
- g_string_append_printf(fulljid, "/%s", resource);
- iq_send_software_version(fulljid->str);
- g_string_free(fulljid, TRUE);
+ case WIN_CONSOLE:
+ if (args[0]) {
+ _send_software_version_iq_to_fulljid(args[0]);
} else {
- win_println(window, THEME_DEFAULT, "-", "Unknown resource for /software command. See /help resource.");
+ cons_show("You must provide a jid to the /software command.");
}
break;
- }
- case WIN_CONSOLE:
- if (args[0]) {
- _send_software_version_iq_to_fulljid(args[0]);
- } else {
- cons_show("You must provide a jid to the /software command.");
- }
- break;
- case WIN_PRIVATE:
- if (args[0]) {
- cons_show("No parameter needed to /software when in private chat.");
- } else {
- ProfPrivateWin* privatewin = (ProfPrivateWin*)window;
- assert(privatewin->memcheck == PROFPRIVATEWIN_MEMCHECK);
- iq_send_software_version(privatewin->fulljid);
- }
- break;
- default:
- break;
+ case WIN_PRIVATE:
+ if (args[0]) {
+ cons_show("No parameter needed to /software when in private chat.");
+ } else {
+ ProfPrivateWin *privatewin = (ProfPrivateWin*)window;
+ assert(privatewin->memcheck == PROFPRIVATEWIN_MEMCHECK);
+ iq_send_software_version(privatewin->fulljid);
+ }
+ break;
+ default:
+ break;
}
return TRUE;
}
gboolean
-cmd_serversoftware(ProfWin* window, const char* const command, gchar** args)
+cmd_serversoftware(ProfWin *window, const char *const command, gchar **args)
{
jabber_conn_status_t conn_status = connection_get_status();
@@ -3530,7 +3538,7 @@ cmd_serversoftware(ProfWin* window, const char* const command, gchar** args)
}
gboolean
-cmd_join(ProfWin* window, const char* const command, gchar** args)
+cmd_join(ProfWin *window, const char *const command, gchar **args)
{
jabber_conn_status_t conn_status = connection_get_status();
if (conn_status != JABBER_CONNECTED) {
@@ -3539,11 +3547,11 @@ cmd_join(ProfWin* window, const char* const command, gchar** args)
}
if (args[0] == NULL) {
- char* account_name = session_get_account_name();
- ProfAccount* account = accounts_get_account(account_name);
+ char *account_name = session_get_account_name();
+ ProfAccount *account = accounts_get_account(account_name);
if (account->muc_service) {
- GString* room_str = g_string_new("");
- char* uuid = connection_create_uuid();
+ GString *room_str = g_string_new("");
+ char *uuid = connection_create_uuid();
g_string_append_printf(room_str, "private-chat-%s@%s", uuid, account->muc_service);
connection_free_uuid(uuid);
@@ -3559,43 +3567,43 @@ cmd_join(ProfWin* window, const char* const command, gchar** args)
return TRUE;
}
- Jid* room_arg = jid_create(args[0]);
+ Jid *room_arg = jid_create(args[0]);
if (room_arg == NULL) {
cons_show_error("Specified room has incorrect format.");
cons_show("");
return TRUE;
}
- char* room = NULL;
- char* nick = NULL;
- char* passwd = NULL;
- char* account_name = session_get_account_name();
- ProfAccount* account = accounts_get_account(account_name);
+ char *room = NULL;
+ char *nick = NULL;
+ char *passwd = NULL;
+ char *account_name = session_get_account_name();
+ ProfAccount *account = accounts_get_account(account_name);
// full room jid supplied (room@server)
if (room_arg->localpart) {
room = g_strdup(args[0]);
- // server not supplied (room), use account preference
+ // server not supplied (room), use account preference
} else if (account->muc_service) {
- GString* room_str = g_string_new("");
+ GString *room_str = g_string_new("");
g_string_append(room_str, args[0]);
g_string_append(room_str, "@");
g_string_append(room_str, account->muc_service);
room = room_str->str;
g_string_free(room_str, FALSE);
- // no account preference
+ // no account preference
} else {
cons_show("Account MUC service property not found.");
return TRUE;
}
// Additional args supplied
- gchar* opt_keys[] = { "nick", "password", NULL };
+ gchar *opt_keys[] = { "nick", "password", NULL };
gboolean parsed;
- GHashTable* options = parse_options(&args[1], opt_keys, &parsed);
+ GHashTable *options = parse_options(&args[1], opt_keys, &parsed);
if (!parsed) {
cons_bad_cmd_usage(command);
cons_show("");
@@ -3637,7 +3645,7 @@ cmd_join(ProfWin* window, const char* const command, gchar** args)
}
gboolean
-cmd_invite(ProfWin* window, const char* const command, gchar** args)
+cmd_invite(ProfWin *window, const char *const command, gchar **args)
{
jabber_conn_status_t conn_status = connection_get_status();
@@ -3647,31 +3655,31 @@ cmd_invite(ProfWin* window, const char* const command, gchar** args)
}
if (g_strcmp0(args[0], "send") == 0) {
- char* contact = args[1];
- char* reason = args[2];
+ char *contact = args[1];
+ char *reason = args[2];
if (window->type != WIN_MUC) {
cons_show("You must be in a chat room to send an invite.");
return TRUE;
}
- char* usr_jid = roster_barejid_from_name(contact);
+ char *usr_jid = roster_barejid_from_name(contact);
if (usr_jid == NULL) {
usr_jid = contact;
}
- ProfMucWin* mucwin = (ProfMucWin*)window;
+ ProfMucWin *mucwin = (ProfMucWin*)window;
assert(mucwin->memcheck == PROFMUCWIN_MEMCHECK);
message_send_invite(mucwin->roomjid, usr_jid, reason);
if (reason) {
cons_show("Room invite sent, contact: %s, room: %s, reason: \"%s\".",
- contact, mucwin->roomjid, reason);
+ contact, mucwin->roomjid, reason);
} else {
cons_show("Room invite sent, contact: %s, room: %s.",
- contact, mucwin->roomjid);
+ contact, mucwin->roomjid);
}
} else if (g_strcmp0(args[0], "list") == 0) {
- GList* invites = muc_invites();
+ GList *invites = muc_invites();
cons_show_room_invites(invites);
g_list_free_full(invites, g_free);
} else if (g_strcmp0(args[0], "decline") == 0) {
@@ -3687,14 +3695,14 @@ cmd_invite(ProfWin* window, const char* const command, gchar** args)
}
gboolean
-cmd_form_field(ProfWin* window, char* tag, gchar** args)
+cmd_form_field(ProfWin *window, char *tag, gchar **args)
{
if (window->type != WIN_CONFIG) {
return TRUE;
}
- ProfConfWin* confwin = (ProfConfWin*)window;
- DataForm* form = confwin->form;
+ ProfConfWin *confwin = (ProfConfWin*)window;
+ DataForm *form = confwin->form;
if (form) {
if (!form_tag_exists(form, tag)) {
win_println(window, THEME_DEFAULT, "-", "Form does not contain a field with tag %s", tag);
@@ -3702,8 +3710,8 @@ cmd_form_field(ProfWin* window, char* tag, gchar** args)
}
form_field_type_t field_type = form_get_field_type(form, tag);
- char* cmd = NULL;
- char* value = NULL;
+ char *cmd = NULL;
+ char *value = NULL;
gboolean valid = FALSE;
gboolean added = FALSE;
gboolean removed = FALSE;
@@ -3905,7 +3913,7 @@ cmd_form_field(ProfWin* window, char* tag, gchar** args)
}
gboolean
-cmd_form(ProfWin* window, const char* const command, gchar** args)
+cmd_form(ProfWin *window, const char *const command, gchar **args)
{
jabber_conn_status_t conn_status = connection_get_status();
@@ -3919,12 +3927,15 @@ cmd_form(ProfWin* window, const char* const command, gchar** args)
return TRUE;
}
- if ((g_strcmp0(args[0], "submit") != 0) && (g_strcmp0(args[0], "cancel") != 0) && (g_strcmp0(args[0], "show") != 0) && (g_strcmp0(args[0], "help") != 0)) {
+ if ((g_strcmp0(args[0], "submit") != 0) &&
+ (g_strcmp0(args[0], "cancel") != 0) &&
+ (g_strcmp0(args[0], "show") != 0) &&
+ (g_strcmp0(args[0], "help") != 0)) {
cons_bad_cmd_usage(command);
return TRUE;
}
- ProfConfWin* confwin = (ProfConfWin*)window;
+ ProfConfWin *confwin = (ProfConfWin*)window;
assert(confwin->memcheck == PROFCONFWIN_MEMCHECK);
if (g_strcmp0(args[0], "show") == 0) {
@@ -3933,20 +3944,20 @@ cmd_form(ProfWin* window, const char* const command, gchar** args)
}
if (g_strcmp0(args[0], "help") == 0) {
- char* tag = args[1];
+ char *tag = args[1];
if (tag) {
confwin_field_help(confwin, tag);
} else {
confwin_form_help(confwin);
- gchar** help_text = NULL;
- Command* command = cmd_get("/form");
+ gchar **help_text = NULL;
+ Command *command = cmd_get("/form");
if (command) {
help_text = command->help.synopsis;
}
- ui_show_lines((ProfWin*)confwin, help_text);
+ ui_show_lines((ProfWin*) confwin, help_text);
}
win_println(window, THEME_DEFAULT, "-", "");
return TRUE;
@@ -3967,7 +3978,7 @@ cmd_form(ProfWin* window, const char* const command, gchar** args)
int num = wins_get_num(window);
- ProfWin* new_current = (ProfWin*)wins_get_muc(confwin->roomjid);
+ ProfWin *new_current = (ProfWin*)wins_get_muc(confwin->roomjid);
if (!new_current) {
new_current = wins_get_console();
}
@@ -3980,7 +3991,7 @@ cmd_form(ProfWin* window, const char* const command, gchar** args)
}
gboolean
-cmd_kick(ProfWin* window, const char* const command, gchar** args)
+cmd_kick(ProfWin *window, const char *const command, gchar **args)
{
jabber_conn_status_t conn_status = connection_get_status();
@@ -3994,13 +4005,13 @@ cmd_kick(ProfWin* window, const char* const command, gchar** args)
return TRUE;
}
- ProfMucWin* mucwin = (ProfMucWin*)window;
+ ProfMucWin *mucwin = (ProfMucWin*)window;
assert(mucwin->memcheck == PROFMUCWIN_MEMCHECK);
- char* nick = args[0];
+ char *nick = args[0];
if (nick) {
if (muc_roster_contains_nick(mucwin->roomjid, nick)) {
- char* reason = args[1];
+ char *reason = args[1];
iq_room_kick_occupant(mucwin->roomjid, nick, reason);
} else {
win_println(window, THEME_DEFAULT, "!", "Occupant does not exist: %s", nick);
@@ -4013,7 +4024,7 @@ cmd_kick(ProfWin* window, const char* const command, gchar** args)
}
gboolean
-cmd_ban(ProfWin* window, const char* const command, gchar** args)
+cmd_ban(ProfWin *window, const char *const command, gchar **args)
{
jabber_conn_status_t conn_status = connection_get_status();
@@ -4027,12 +4038,12 @@ cmd_ban(ProfWin* window, const char* const command, gchar** args)
return TRUE;
}
- ProfMucWin* mucwin = (ProfMucWin*)window;
+ ProfMucWin *mucwin = (ProfMucWin*)window;
assert(mucwin->memcheck == PROFMUCWIN_MEMCHECK);
- char* jid = args[0];
+ char *jid = args[0];
if (jid) {
- char* reason = args[1];
+ char *reason = args[1];
iq_room_affiliation_set(mucwin->roomjid, jid, "outcast", reason);
} else {
cons_bad_cmd_usage(command);
@@ -4041,7 +4052,7 @@ cmd_ban(ProfWin* window, const char* const command, gchar** args)
}
gboolean
-cmd_subject(ProfWin* window, const char* const command, gchar** args)
+cmd_subject(ProfWin *window, const char *const command, gchar **args)
{
jabber_conn_status_t conn_status = connection_get_status();
@@ -4055,11 +4066,11 @@ cmd_subject(ProfWin* window, const char* const command, gchar** args)
return TRUE;
}
- ProfMucWin* mucwin = (ProfMucWin*)window;
+ ProfMucWin *mucwin = (ProfMucWin*)window;
assert(mucwin->memcheck == PROFMUCWIN_MEMCHECK);
if (args[0] == NULL) {
- char* subject = muc_subject(mucwin->roomjid);
+ char *subject = muc_subject(mucwin->roomjid);
if (subject) {
win_print(window, THEME_ROOMINFO, "!", "Room subject: ");
win_appendln(window, THEME_DEFAULT, "%s", subject);
@@ -4089,9 +4100,9 @@ cmd_subject(ProfWin* window, const char* const command, gchar** args)
if (g_strcmp0(args[0], "prepend") == 0) {
if (args[1]) {
- char* old_subject = muc_subject(mucwin->roomjid);
+ char *old_subject = muc_subject(mucwin->roomjid);
if (old_subject) {
- GString* new_subject = g_string_new(args[1]);
+ GString *new_subject = g_string_new(args[1]);
g_string_append(new_subject, old_subject);
message_send_groupchat_subject(mucwin->roomjid, new_subject->str);
g_string_free(new_subject, TRUE);
@@ -4106,9 +4117,9 @@ cmd_subject(ProfWin* window, const char* const command, gchar** args)
if (g_strcmp0(args[0], "append") == 0) {
if (args[1]) {
- char* old_subject = muc_subject(mucwin->roomjid);
+ char *old_subject = muc_subject(mucwin->roomjid);
if (old_subject) {
- GString* new_subject = g_string_new(old_subject);
+ GString *new_subject = g_string_new(old_subject);
g_string_append(new_subject, args[1]);
message_send_groupchat_subject(mucwin->roomjid, new_subject->str);
g_string_free(new_subject, TRUE);
@@ -4131,7 +4142,7 @@ cmd_subject(ProfWin* window, const char* const command, gchar** args)
}
gboolean
-cmd_affiliation(ProfWin* window, const char* const command, gchar** args)
+cmd_affiliation(ProfWin *window, const char *const command, gchar **args)
{
jabber_conn_status_t conn_status = connection_get_status();
@@ -4145,19 +4156,24 @@ cmd_affiliation(ProfWin* window, const char* const command, gchar** args)
return TRUE;
}
- char* cmd = args[0];
+ char *cmd = args[0];
if (cmd == NULL) {
cons_bad_cmd_usage(command);
return TRUE;
}
- char* affiliation = args[1];
- if (affiliation && (g_strcmp0(affiliation, "owner") != 0) && (g_strcmp0(affiliation, "admin") != 0) && (g_strcmp0(affiliation, "member") != 0) && (g_strcmp0(affiliation, "none") != 0) && (g_strcmp0(affiliation, "outcast") != 0)) {
+ char *affiliation = args[1];
+ if (affiliation &&
+ (g_strcmp0(affiliation, "owner") != 0) &&
+ (g_strcmp0(affiliation, "admin") != 0) &&
+ (g_strcmp0(affiliation, "member") != 0) &&
+ (g_strcmp0(affiliation, "none") != 0) &&
+ (g_strcmp0(affiliation, "outcast") != 0)) {
cons_bad_cmd_usage(command);
return TRUE;
}
- ProfMucWin* mucwin = (ProfMucWin*)window;
+ ProfMucWin *mucwin = (ProfMucWin*)window;
assert(mucwin->memcheck == PROFMUCWIN_MEMCHECK);
if (g_strcmp0(cmd, "list") == 0) {
@@ -4180,12 +4196,12 @@ cmd_affiliation(ProfWin* window, const char* const command, gchar** args)
return TRUE;
}
- char* jid = args[2];
+ char *jid = args[2];
if (jid == NULL) {
cons_bad_cmd_usage(command);
return TRUE;
} else {
- char* reason = args[3];
+ char *reason = args[3];
iq_room_affiliation_set(mucwin->roomjid, jid, affiliation, reason);
return TRUE;
}
@@ -4196,7 +4212,7 @@ cmd_affiliation(ProfWin* window, const char* const command, gchar** args)
}
gboolean
-cmd_role(ProfWin* window, const char* const command, gchar** args)
+cmd_role(ProfWin *window, const char *const command, gchar **args)
{
jabber_conn_status_t conn_status = connection_get_status();
@@ -4210,19 +4226,23 @@ cmd_role(ProfWin* window, const char* const command, gchar** args)
return TRUE;
}
- char* cmd = args[0];
+ char *cmd = args[0];
if (cmd == NULL) {
cons_bad_cmd_usage(command);
return TRUE;
}
- char* role = args[1];
- if (role && (g_strcmp0(role, "visitor") != 0) && (g_strcmp0(role, "participant") != 0) && (g_strcmp0(role, "moderator") != 0) && (g_strcmp0(role, "none") != 0)) {
+ char *role = args[1];
+ if (role &&
+ (g_strcmp0(role, "visitor") != 0) &&
+ (g_strcmp0(role, "participant") != 0) &&
+ (g_strcmp0(role, "moderator") != 0) &&
+ (g_strcmp0(role, "none") != 0)) {
cons_bad_cmd_usage(command);
return TRUE;
}
- ProfMucWin* mucwin = (ProfMucWin*)window;
+ ProfMucWin *mucwin = (ProfMucWin*)window;
assert(mucwin->memcheck == PROFMUCWIN_MEMCHECK);
if (g_strcmp0(cmd, "list") == 0) {
@@ -4244,12 +4264,12 @@ cmd_role(ProfWin* window, const char* const command, gchar** args)
return TRUE;
}
- char* nick = args[2];
+ char *nick = args[2];
if (nick == NULL) {
cons_bad_cmd_usage(command);
return TRUE;
} else {
- char* reason = args[3];
+ char *reason = args[3];
iq_room_role_set(mucwin->roomjid, nick, role, reason);
return TRUE;
}
@@ -4260,7 +4280,7 @@ cmd_role(ProfWin* window, const char* const command, gchar** args)
}
gboolean
-cmd_room(ProfWin* window, const char* const command, gchar** args)
+cmd_room(ProfWin *window, const char *const command, gchar **args)
{
jabber_conn_status_t conn_status = connection_get_status();
@@ -4274,7 +4294,7 @@ cmd_room(ProfWin* window, const char* const command, gchar** args)
return TRUE;
}
- ProfMucWin* mucwin = (ProfMucWin*)window;
+ ProfMucWin *mucwin = (ProfMucWin*)window;
assert(mucwin->memcheck == PROFMUCWIN_MEMCHECK);
if (g_strcmp0(args[0], "accept") == 0) {
@@ -4292,7 +4312,7 @@ cmd_room(ProfWin* window, const char* const command, gchar** args)
iq_destroy_room(mucwin->roomjid);
return TRUE;
} else if (g_strcmp0(args[0], "config") == 0) {
- ProfConfWin* confwin = wins_get_conf(mucwin->roomjid);
+ ProfConfWin *confwin = wins_get_conf(mucwin->roomjid);
if (confwin) {
ui_focus_win((ProfWin*)confwin);
@@ -4308,7 +4328,7 @@ cmd_room(ProfWin* window, const char* const command, gchar** args)
}
gboolean
-cmd_occupants(ProfWin* window, const char* const command, gchar** args)
+cmd_occupants(ProfWin *window, const char *const command, gchar **args)
{
if (g_strcmp0(args[0], "size") == 0) {
if (!args[1]) {
@@ -4316,7 +4336,7 @@ cmd_occupants(ProfWin* window, const char* const command, gchar** args)
return TRUE;
} else {
int intval = 0;
- char* err_msg = NULL;
+ char *err_msg = NULL;
gboolean res = strtoi_range(args[1], &intval, 1, 99, &err_msg);
if (res) {
prefs_set_occupants_size(intval);
@@ -4337,7 +4357,7 @@ cmd_occupants(ProfWin* window, const char* const command, gchar** args)
return TRUE;
} else {
int intval = 0;
- char* err_msg = NULL;
+ char *err_msg = NULL;
gboolean res = strtoi_range(args[1], &intval, 0, 10, &err_msg);
if (res) {
prefs_set_occupants_indent(intval);
@@ -4358,7 +4378,7 @@ cmd_occupants(ProfWin* window, const char* const command, gchar** args)
return TRUE;
} else {
_cmd_set_boolean_preference(args[1], command, "Occupants panel line wrap", PREF_OCCUPANTS_WRAP);
- occupantswin_occupants_all();
+ occupantswin_occupants_all();
return TRUE;
}
}
@@ -4444,7 +4464,7 @@ cmd_occupants(ProfWin* window, const char* const command, gchar** args)
return TRUE;
}
- ProfMucWin* mucwin = (ProfMucWin*)window;
+ ProfMucWin *mucwin = (ProfMucWin*)window;
assert(mucwin->memcheck == PROFMUCWIN_MEMCHECK);
if (g_strcmp0(args[0], "show") == 0) {
@@ -4469,7 +4489,7 @@ cmd_occupants(ProfWin* window, const char* const command, gchar** args)
}
gboolean
-cmd_rooms(ProfWin* window, const char* const command, gchar** args)
+cmd_rooms(ProfWin *window, const char *const command, gchar **args)
{
jabber_conn_status_t conn_status = connection_get_status();
@@ -4478,8 +4498,8 @@ cmd_rooms(ProfWin* window, const char* const command, gchar** args)
return TRUE;
}
- gchar* service = NULL;
- gchar* filter = NULL;
+ gchar *service = NULL;
+ gchar *filter = NULL;
if (args[0] != NULL) {
if (g_strcmp0(args[0], "service") == 0) {
if (args[1] == NULL) {
@@ -4523,7 +4543,7 @@ cmd_rooms(ProfWin* window, const char* const command, gchar** args)
return TRUE;
}
}
- if (g_strv_length(args) >= 3) {
+ if (g_strv_length(args) >=3 ) {
if (g_strcmp0(args[2], "service") == 0) {
if (args[3] == NULL) {
cons_bad_cmd_usage(command);
@@ -4554,7 +4574,7 @@ cmd_rooms(ProfWin* window, const char* const command, gchar** args)
}
if (service == NULL) {
- ProfAccount* account = accounts_get_account(session_get_account_name());
+ ProfAccount *account = accounts_get_account(session_get_account_name());
if (account->muc_service) {
service = g_strdup(account->muc_service);
account_free(account);
@@ -4582,7 +4602,7 @@ cmd_rooms(ProfWin* window, const char* const command, gchar** args)
}
gboolean
-cmd_bookmark(ProfWin* window, const char* const command, gchar** args)
+cmd_bookmark(ProfWin *window, const char *const command, gchar **args)
{
jabber_conn_status_t conn_status = connection_get_status();
@@ -4593,15 +4613,15 @@ cmd_bookmark(ProfWin* window, const char* const command, gchar** args)
}
int num_args = g_strv_length(args);
- gchar* cmd = args[0];
+ gchar *cmd = args[0];
if (window->type == WIN_MUC
- && num_args < 2
- && (cmd == NULL || g_strcmp0(cmd, "add") == 0)) {
+ && num_args < 2
+ && (cmd == NULL || g_strcmp0(cmd, "add") == 0)) {
// default to current nickname, password, and autojoin "on"
- ProfMucWin* mucwin = (ProfMucWin*)window;
+ ProfMucWin *mucwin = (ProfMucWin*)window;
assert(mucwin->memcheck == PROFMUCWIN_MEMCHECK);
- char* nick = muc_nick(mucwin->roomjid);
- char* password = muc_password(mucwin->roomjid);
+ char *nick = muc_nick(mucwin->roomjid);
+ char *password = muc_password(mucwin->roomjid);
gboolean added = bookmark_add(mucwin->roomjid, nick, password, "on", NULL);
if (added) {
win_println(window, THEME_DEFAULT, "!", "Bookmark added for %s.", mucwin->roomjid);
@@ -4612,9 +4632,9 @@ cmd_bookmark(ProfWin* window, const char* const command, gchar** args)
}
if (window->type == WIN_MUC
- && num_args < 2
- && g_strcmp0(cmd, "remove") == 0) {
- ProfMucWin* mucwin = (ProfMucWin*)window;
+ && num_args < 2
+ && g_strcmp0(cmd, "remove") == 0) {
+ ProfMucWin *mucwin = (ProfMucWin*)window;
assert(mucwin->memcheck == PROFMUCWIN_MEMCHECK);
gboolean removed = bookmark_remove(mucwin->roomjid);
if (removed) {
@@ -4647,13 +4667,13 @@ cmd_bookmark(ProfWin* window, const char* const command, gchar** args)
}
if (strcmp(cmd, "list") == 0) {
- GList* bookmarks = bookmark_get_list();
+ GList *bookmarks = bookmark_get_list();
cons_show_bookmarks(bookmarks);
g_list_free(bookmarks);
return TRUE;
}
- char* jid = args[1];
+ char *jid = args[1];
if (jid == NULL) {
cons_bad_cmd_usage(command);
cons_show("");
@@ -4687,10 +4707,10 @@ cmd_bookmark(ProfWin* window, const char* const command, gchar** args)
return TRUE;
}
- gchar* opt_keys[] = { "autojoin", "nick", "password", "name", NULL };
+ gchar *opt_keys[] = { "autojoin", "nick", "password", "name", NULL };
gboolean parsed;
- GHashTable* options = parse_options(&args[2], opt_keys, &parsed);
+ GHashTable *options = parse_options(&args[2], opt_keys, &parsed);
if (!parsed) {
cons_bad_cmd_usage(command);
cons_show("");
@@ -4698,7 +4718,7 @@ cmd_bookmark(ProfWin* window, const char* const command, gchar** args)
return TRUE;
}
- char* autojoin = g_hash_table_lookup(options, "autojoin");
+ char *autojoin = g_hash_table_lookup(options, "autojoin");
if (autojoin && ((strcmp(autojoin, "on") != 0) && (strcmp(autojoin, "off") != 0))) {
cons_bad_cmd_usage(command);
@@ -4708,9 +4728,9 @@ cmd_bookmark(ProfWin* window, const char* const command, gchar** args)
return TRUE;
}
- char* nick = g_hash_table_lookup(options, "nick");
- char* password = g_hash_table_lookup(options, "password");
- char* name = g_hash_table_lookup(options, "name");
+ char *nick = g_hash_table_lookup(options, "nick");
+ char *password = g_hash_table_lookup(options, "password");
+ char *name = g_hash_table_lookup(options, "name");
if (strcmp(cmd, "add") == 0) {
gboolean added = bookmark_add(jid, nick, password, autojoin, name);
@@ -4744,7 +4764,7 @@ cmd_bookmark(ProfWin* window, const char* const command, gchar** args)
}
gboolean
-cmd_bookmark_ignore(ProfWin* window, const char* const command, gchar** args)
+cmd_bookmark_ignore(ProfWin *window, const char *const command, gchar **args)
{
jabber_conn_status_t conn_status = connection_get_status();
@@ -4757,7 +4777,7 @@ cmd_bookmark_ignore(ProfWin* window, const char* const command, gchar** args)
// `/bookmark ignore` lists them
if (args[1] == NULL) {
gsize len = 0;
- gchar** list = bookmark_ignore_list(&len);
+ gchar **list = bookmark_ignore_list(&len);
cons_show_bookmarks_ignore(list, len);
g_strfreev(list);
return TRUE;
@@ -4780,7 +4800,7 @@ cmd_bookmark_ignore(ProfWin* window, const char* const command, gchar** args)
}
gboolean
-cmd_disco(ProfWin* window, const char* const command, gchar** args)
+cmd_disco(ProfWin *window, const char *const command, gchar **args)
{
jabber_conn_status_t conn_status = connection_get_status();
@@ -4789,11 +4809,11 @@ cmd_disco(ProfWin* window, const char* const command, gchar** args)
return TRUE;
}
- GString* jid = g_string_new("");
+ GString *jid = g_string_new("");
if (args[1]) {
jid = g_string_append(jid, args[1]);
} else {
- Jid* jidp = jid_create(connection_get_fulljid());
+ Jid *jidp = jid_create(connection_get_fulljid());
jid = g_string_append(jid, jidp->domainpart);
jid_destroy(jidp);
}
@@ -4810,14 +4830,14 @@ cmd_disco(ProfWin* window, const char* const command, gchar** args)
}
gboolean
-cmd_sendfile(ProfWin* window, const char* const command, gchar** args)
+cmd_sendfile(ProfWin *window, const char *const command, gchar **args)
{
jabber_conn_status_t conn_status = connection_get_status();
- char* filename = args[0];
+ char *filename = args[0];
// expand ~ to $HOME
if (filename[0] == '~' && filename[1] == '/') {
- if (asprintf(&filename, "%s/%s", getenv("HOME"), filename + 2) == -1) {
+ if (asprintf(&filename, "%s/%s", getenv("HOME"), filename+2) == -1) {
return TRUE;
}
} else {
@@ -4837,45 +4857,45 @@ cmd_sendfile(ProfWin* window, const char* const command, gchar** args)
}
switch (window->type) {
- case WIN_MUC:
- {
- ProfMucWin* mucwin = (ProfMucWin*)window;
- assert(mucwin->memcheck == PROFMUCWIN_MEMCHECK);
+ case WIN_MUC:
+ {
+ ProfMucWin *mucwin = (ProfMucWin*)window;
+ assert(mucwin->memcheck == PROFMUCWIN_MEMCHECK);
- // only omemo, no pgp/otr available in MUCs
- if (mucwin->is_omemo && !prefs_get_boolean(PREF_OMEMO_SENDFILE)) {
- cons_show_error("Uploading unencrypted files disabled. See /omemo sendfile, /otr sendfile, /pgp sendfile.");
- win_println(window, THEME_ERROR, "-", "Sending encrypted files via http_upload is not possible yet.");
- free(filename);
- return TRUE;
+ // only omemo, no pgp/otr available in MUCs
+ if (mucwin->is_omemo && !prefs_get_boolean(PREF_OMEMO_SENDFILE)) {
+ cons_show_error("Uploading unencrypted files disabled. See /omemo sendfile, /otr sendfile, /pgp sendfile.");
+ win_println(window, THEME_ERROR, "-", "Sending encrypted files via http_upload is not possible yet.");
+ free(filename);
+ return TRUE;
+ }
+ break;
}
- break;
- }
- case WIN_CHAT:
- {
- ProfChatWin* chatwin = (ProfChatWin*)window;
- assert(chatwin->memcheck == PROFCHATWIN_MEMCHECK);
+ case WIN_CHAT:
+ {
+ ProfChatWin *chatwin = (ProfChatWin*)window;
+ assert(chatwin->memcheck == PROFCHATWIN_MEMCHECK);
- if ((chatwin->is_omemo && !prefs_get_boolean(PREF_OMEMO_SENDFILE))
- || (chatwin->pgp_send && !prefs_get_boolean(PREF_PGP_SENDFILE))
- || (chatwin->is_otr && !prefs_get_boolean(PREF_OTR_SENDFILE))) {
- cons_show_error("Uploading unencrypted files disabled. See /omemo sendfile, /otr sendfile, /pgp sendfile.");
- win_println(window, THEME_ERROR, "-", "Sending encrypted files via http_upload is not possible yet.");
- free(filename);
- return TRUE;
+ if ((chatwin->is_omemo && !prefs_get_boolean(PREF_OMEMO_SENDFILE))
+ || (chatwin->pgp_send && !prefs_get_boolean(PREF_PGP_SENDFILE))
+ || (chatwin->is_otr && !prefs_get_boolean(PREF_OTR_SENDFILE))) {
+ cons_show_error("Uploading unencrypted files disabled. See /omemo sendfile, /otr sendfile, /pgp sendfile.");
+ win_println(window, THEME_ERROR, "-", "Sending encrypted files via http_upload is not possible yet.");
+ free(filename);
+ return TRUE;
+ }
+ break;
+ }
+ case WIN_PRIVATE:
+ {
+ //we don't support encryption in private muc windows
+ break;
+ }
+ default:
+ cons_show_error("Unsupported window for file transmission.");
+ free(filename);
+ return TRUE;
}
- break;
- }
- case WIN_PRIVATE:
- {
- //we don't support encryption in private muc windows
- break;
- }
- default:
- cons_show_error("Unsupported window for file transmission.");
- free(filename);
- return TRUE;
- }
if (access(filename, R_OK) != 0) {
cons_show_error("Uploading '%s' failed: File not found!", filename);
@@ -4889,7 +4909,7 @@ cmd_sendfile(ProfWin* window, const char* const command, gchar** args)
return TRUE;
}
- HTTPUpload* upload = malloc(sizeof(HTTPUpload));
+ HTTPUpload *upload = malloc(sizeof(HTTPUpload));
upload->window = window;
upload->filename = filename;
@@ -4902,7 +4922,7 @@ cmd_sendfile(ProfWin* window, const char* const command, gchar** args)
}
gboolean
-cmd_lastactivity(ProfWin* window, const char* const command, gchar** args)
+cmd_lastactivity(ProfWin *window, const char *const command, gchar **args)
{
if ((g_strcmp0(args[0], "on") == 0) || (g_strcmp0(args[0], "off") == 0)) {
_cmd_set_boolean_preference(args[0], command, "Last activity", PREF_LASTACTIVITY);
@@ -4923,8 +4943,8 @@ cmd_lastactivity(ProfWin* window, const char* const command, gchar** args)
}
if (args[0] == NULL) {
- Jid* jidp = jid_create(connection_get_fulljid());
- GString* jid = g_string_new(jidp->domainpart);
+ Jid *jidp = jid_create(connection_get_fulljid());
+ GString *jid = g_string_new(jidp->domainpart);
iq_last_activity_request(jid->str);
@@ -4939,7 +4959,7 @@ cmd_lastactivity(ProfWin* window, const char* const command, gchar** args)
}
gboolean
-cmd_nick(ProfWin* window, const char* const command, gchar** args)
+cmd_nick(ProfWin *window, const char *const command, gchar **args)
{
jabber_conn_status_t conn_status = connection_get_status();
@@ -4952,27 +4972,27 @@ cmd_nick(ProfWin* window, const char* const command, gchar** args)
return TRUE;
}
- ProfMucWin* mucwin = (ProfMucWin*)window;
+ ProfMucWin *mucwin = (ProfMucWin*)window;
assert(mucwin->memcheck == PROFMUCWIN_MEMCHECK);
- char* nick = args[0];
+ char *nick = args[0];
presence_change_room_nick(mucwin->roomjid, nick);
return TRUE;
}
gboolean
-cmd_alias(ProfWin* window, const char* const command, gchar** args)
+cmd_alias(ProfWin *window, const char *const command, gchar **args)
{
- char* subcmd = args[0];
+ char *subcmd = args[0];
if (strcmp(subcmd, "add") == 0) {
- char* alias = args[1];
+ char *alias = args[1];
if (alias == NULL) {
cons_bad_cmd_usage(command);
return TRUE;
} else {
- char* alias_p = alias;
- GString* ac_value = g_string_new("");
+ char *alias_p = alias;
+ GString *ac_value = g_string_new("");
if (alias[0] == '/') {
g_string_append(ac_value, alias);
alias_p = &alias[1];
@@ -4981,7 +5001,7 @@ cmd_alias(ProfWin* window, const char* const command, gchar** args)
g_string_append(ac_value, alias);
}
- char* value = args[2];
+ char *value = args[2];
if (value == NULL) {
cons_bad_cmd_usage(command);
g_string_free(ac_value, TRUE);
@@ -5000,7 +5020,7 @@ cmd_alias(ProfWin* window, const char* const command, gchar** args)
}
}
} else if (strcmp(subcmd, "remove") == 0) {
- char* alias = args[1];
+ char *alias = args[1];
if (alias == NULL) {
cons_bad_cmd_usage(command);
return TRUE;
@@ -5012,7 +5032,7 @@ cmd_alias(ProfWin* window, const char* const command, gchar** args)
if (!removed) {
cons_show("No such command alias /%s", alias);
} else {
- GString* ac_value = g_string_new("/");
+ GString *ac_value = g_string_new("/");
g_string_append(ac_value, alias);
cmd_ac_remove(ac_value->str);
cmd_ac_remove_alias_value(alias);
@@ -5022,7 +5042,7 @@ cmd_alias(ProfWin* window, const char* const command, gchar** args)
return TRUE;
}
} else if (strcmp(subcmd, "list") == 0) {
- GList* aliases = prefs_get_aliases();
+ GList *aliases = prefs_get_aliases();
cons_show_aliases(aliases);
prefs_free_aliases(aliases);
return TRUE;
@@ -5033,9 +5053,9 @@ cmd_alias(ProfWin* window, const char* const command, gchar** args)
}
gboolean
-cmd_tiny(ProfWin* window, const char* const command, gchar** args)
+cmd_tiny(ProfWin *window, const char *const command, gchar **args)
{
- char* url = args[0];
+ char *url = args[0];
if (window->type != WIN_CHAT && window->type != WIN_MUC && window->type != WIN_PRIVATE) {
cons_show("/tiny can only be used in chat windows");
@@ -5047,30 +5067,30 @@ cmd_tiny(ProfWin* window, const char* const command, gchar** args)
return TRUE;
}
- char* tiny = tinyurl_get(url);
+ char *tiny = tinyurl_get(url);
if (!tiny) {
win_println(window, THEME_ERROR, "-", "Couldn't create tinyurl.");
return TRUE;
}
- switch (window->type) {
+ switch (window->type){
case WIN_CHAT:
{
- ProfChatWin* chatwin = (ProfChatWin*)window;
+ ProfChatWin *chatwin = (ProfChatWin*)window;
assert(chatwin->memcheck == PROFCHATWIN_MEMCHECK);
cl_ev_send_msg(chatwin, tiny, NULL);
break;
}
case WIN_PRIVATE:
{
- ProfPrivateWin* privatewin = (ProfPrivateWin*)window;
+ ProfPrivateWin *privatewin = (ProfPrivateWin*)window;
assert(privatewin->memcheck == PROFPRIVATEWIN_MEMCHECK);
cl_ev_send_priv_msg(privatewin, tiny, NULL);
break;
}
case WIN_MUC:
{
- ProfMucWin* mucwin = (ProfMucWin*)window;
+ ProfMucWin *mucwin = (ProfMucWin*)window;
assert(mucwin->memcheck == PROFMUCWIN_MEMCHECK);
cl_ev_send_muc_msg(mucwin, tiny, NULL);
break;
@@ -5085,13 +5105,13 @@ cmd_tiny(ProfWin* window, const char* const command, gchar** args)
}
gboolean
-cmd_clear(ProfWin* window, const char* const command, gchar** args)
+cmd_clear(ProfWin *window, const char *const command, gchar **args)
{
if (args[0] == NULL) {
win_clear(window);
return TRUE;
} else {
- if ((g_strcmp0(args[0], "persist_history") == 0)) {
+ if ((g_strcmp0(args[0], "persist_history") == 0) ) {
if (args[1] != NULL) {
if ((g_strcmp0(args[1], "on") == 0) || (g_strcmp0(args[1], "off") == 0)) {
@@ -5114,7 +5134,7 @@ cmd_clear(ProfWin* window, const char* const command, gchar** args)
}
gboolean
-cmd_privileges(ProfWin* window, const char* const command, gchar** args)
+cmd_privileges(ProfWin *window, const char *const command, gchar **args)
{
_cmd_set_boolean_preference(args[0], command, "MUC privileges", PREF_MUC_PRIVILEGES);
@@ -5124,10 +5144,10 @@ cmd_privileges(ProfWin* window, const char* const command, gchar** args)
}
gboolean
-cmd_charset(ProfWin* window, const char* const command, gchar** args)
+cmd_charset(ProfWin *window, const char *const command, gchar **args)
{
- char* codeset = nl_langinfo(CODESET);
- char* lang = getenv("LANG");
+ char *codeset = nl_langinfo(CODESET);
+ char *lang = getenv("LANG");
cons_show("Charset information:");
@@ -5137,28 +5157,28 @@ cmd_charset(ProfWin* window, const char* const command, gchar** args)
if (codeset) {
cons_show(" CODESET: %s", codeset);
}
- cons_show(" MB_CUR_MAX: %d", MB_CUR_MAX);
- cons_show(" MB_LEN_MAX: %d", MB_LEN_MAX);
+ cons_show(" MB_CUR_MAX: %d", MB_CUR_MAX);
+ cons_show(" MB_LEN_MAX: %d", MB_LEN_MAX);
return TRUE;
}
gboolean
-cmd_beep(ProfWin* window, const char* const command, gchar** args)
+cmd_beep(ProfWin *window, const char *const command, gchar **args)
{
_cmd_set_boolean_preference(args[0], command, "Sound", PREF_BEEP);
return TRUE;
}
gboolean
-cmd_console(ProfWin* window, const char* const command, gchar** args)
+cmd_console(ProfWin *window, const char *const command, gchar **args)
{
if ((g_strcmp0(args[0], "chat") != 0) && (g_strcmp0(args[0], "muc") != 0) && (g_strcmp0(args[0], "private") != 0)) {
cons_bad_cmd_usage(command);
return TRUE;
}
- char* setting = args[1];
+ char *setting = args[1];
if ((g_strcmp0(setting, "all") != 0) && (g_strcmp0(setting, "first") != 0) && (g_strcmp0(setting, "none") != 0)) {
cons_bad_cmd_usage(command);
return TRUE;
@@ -5186,9 +5206,12 @@ cmd_console(ProfWin* window, const char* const command, gchar** args)
}
gboolean
-cmd_presence(ProfWin* window, const char* const command, gchar** args)
+cmd_presence(ProfWin *window, const char *const command, gchar **args)
{
- if (strcmp(args[0], "console") != 0 && strcmp(args[0], "chat") != 0 && strcmp(args[0], "room") != 0 && strcmp(args[0], "titlebar") != 0) {
+ if (strcmp(args[0], "console") != 0 &&
+ strcmp(args[0], "chat") != 0 &&
+ strcmp(args[0], "room") != 0 &&
+ strcmp(args[0], "titlebar") != 0) {
cons_bad_cmd_usage(command);
return TRUE;
}
@@ -5198,7 +5221,9 @@ cmd_presence(ProfWin* window, const char* const command, gchar** args)
return TRUE;
}
- if (strcmp(args[1], "all") != 0 && strcmp(args[1], "online") != 0 && strcmp(args[1], "none") != 0) {
+ if (strcmp(args[1], "all") != 0 &&
+ strcmp(args[1], "online") != 0 &&
+ strcmp(args[1], "none") != 0) {
cons_bad_cmd_usage(command);
return TRUE;
}
@@ -5240,7 +5265,7 @@ cmd_presence(ProfWin* window, const char* const command, gchar** args)
}
gboolean
-cmd_wrap(ProfWin* window, const char* const command, gchar** args)
+cmd_wrap(ProfWin *window, const char *const command, gchar **args)
{
_cmd_set_boolean_preference(args[0], command, "Word wrap", PREF_WRAP);
@@ -5250,11 +5275,11 @@ cmd_wrap(ProfWin* window, const char* const command, gchar** args)
}
gboolean
-cmd_time(ProfWin* window, const char* const command, gchar** args)
+cmd_time(ProfWin *window, const char *const command, gchar **args)
{
if (g_strcmp0(args[0], "lastactivity") == 0) {
if (args[1] == NULL) {
- char* format = prefs_get_string(PREF_TIME_LASTACTIVITY);
+ char *format = prefs_get_string(PREF_TIME_LASTACTIVITY);
cons_show("Last activity time format: '%s'.", format);
g_free(format);
return TRUE;
@@ -5273,7 +5298,7 @@ cmd_time(ProfWin* window, const char* const command, gchar** args)
}
} else if (g_strcmp0(args[0], "statusbar") == 0) {
if (args[1] == NULL) {
- char* format = prefs_get_string(PREF_TIME_STATUSBAR);
+ char *format = prefs_get_string(PREF_TIME_STATUSBAR);
cons_show("Status bar time format: '%s'.", format);
g_free(format);
return TRUE;
@@ -5293,7 +5318,7 @@ cmd_time(ProfWin* window, const char* const command, gchar** args)
}
} else if (g_strcmp0(args[0], "console") == 0) {
if (args[1] == NULL) {
- char* format = prefs_get_string(PREF_TIME_CONSOLE);
+ char *format = prefs_get_string(PREF_TIME_CONSOLE);
cons_show("Console time format: '%s'.", format);
g_free(format);
return TRUE;
@@ -5313,7 +5338,7 @@ cmd_time(ProfWin* window, const char* const command, gchar** args)
}
} else if (g_strcmp0(args[0], "chat") == 0) {
if (args[1] == NULL) {
- char* format = prefs_get_string(PREF_TIME_CHAT);
+ char *format = prefs_get_string(PREF_TIME_CHAT);
cons_show("Chat time format: '%s'.", format);
g_free(format);
return TRUE;
@@ -5333,7 +5358,7 @@ cmd_time(ProfWin* window, const char* const command, gchar** args)
}
} else if (g_strcmp0(args[0], "muc") == 0) {
if (args[1] == NULL) {
- char* format = prefs_get_string(PREF_TIME_MUC);
+ char *format = prefs_get_string(PREF_TIME_MUC);
cons_show("MUC time format: '%s'.", format);
g_free(format);
return TRUE;
@@ -5353,7 +5378,7 @@ cmd_time(ProfWin* window, const char* const command, gchar** args)
}
} else if (g_strcmp0(args[0], "config") == 0) {
if (args[1] == NULL) {
- char* format = prefs_get_string(PREF_TIME_CONFIG);
+ char *format = prefs_get_string(PREF_TIME_CONFIG);
cons_show("config time format: '%s'.", format);
g_free(format);
return TRUE;
@@ -5373,7 +5398,7 @@ cmd_time(ProfWin* window, const char* const command, gchar** args)
}
} else if (g_strcmp0(args[0], "private") == 0) {
if (args[1] == NULL) {
- char* format = prefs_get_string(PREF_TIME_PRIVATE);
+ char *format = prefs_get_string(PREF_TIME_PRIVATE);
cons_show("Private chat time format: '%s'.", format);
g_free(format);
return TRUE;
@@ -5393,7 +5418,7 @@ cmd_time(ProfWin* window, const char* const command, gchar** args)
}
} else if (g_strcmp0(args[0], "xml") == 0) {
if (args[1] == NULL) {
- char* format = prefs_get_string(PREF_TIME_XMLCONSOLE);
+ char *format = prefs_get_string(PREF_TIME_XMLCONSOLE);
cons_show("XML Console time format: '%s'.", format);
g_free(format);
return TRUE;
@@ -5456,7 +5481,7 @@ cmd_time(ProfWin* window, const char* const command, gchar** args)
}
gboolean
-cmd_states(ProfWin* window, const char* const command, gchar** args)
+cmd_states(ProfWin *window, const char *const command, gchar **args)
{
if (args[0] == NULL) {
return FALSE;
@@ -5474,7 +5499,7 @@ cmd_states(ProfWin* window, const char* const command, gchar** args)
}
gboolean
-cmd_wintitle(ProfWin* window, const char* const command, gchar** args)
+cmd_wintitle(ProfWin *window, const char *const command, gchar **args)
{
if (g_strcmp0(args[0], "show") != 0 && g_strcmp0(args[0], "goodbye") != 0) {
cons_bad_cmd_usage(command);
@@ -5493,7 +5518,7 @@ cmd_wintitle(ProfWin* window, const char* const command, gchar** args)
}
gboolean
-cmd_outtype(ProfWin* window, const char* const command, gchar** args)
+cmd_outtype(ProfWin *window, const char *const command, gchar **args)
{
if (args[0] == NULL) {
return FALSE;
@@ -5510,9 +5535,9 @@ cmd_outtype(ProfWin* window, const char* const command, gchar** args)
}
gboolean
-cmd_gone(ProfWin* window, const char* const command, gchar** args)
+cmd_gone(ProfWin *window, const char *const command, gchar **args)
{
- char* value = args[0];
+ char *value = args[0];
gint period = atoi(value);
prefs_set_gone(period);
@@ -5532,14 +5557,15 @@ cmd_gone(ProfWin* window, const char* const command, gchar** args)
return TRUE;
}
+
gboolean
-cmd_notify(ProfWin* window, const char* const command, gchar** args)
+cmd_notify(ProfWin *window, const char *const command, gchar **args)
{
if (!args[0]) {
- ProfWin* current = wins_get_current();
+ ProfWin *current = wins_get_current();
if (current->type == WIN_MUC) {
win_println(current, THEME_DEFAULT, "-", "");
- ProfMucWin* mucwin = (ProfMucWin*)current;
+ ProfMucWin *mucwin = (ProfMucWin *)current;
win_println(window, THEME_DEFAULT, "!", "Notification settings for %s:", mucwin->roomjid);
if (prefs_has_room_notify(mucwin->roomjid)) {
@@ -5586,6 +5612,7 @@ cmd_notify(ProfWin* window, const char* const command, gchar** args)
cons_show("");
cons_notify_setting();
cons_bad_cmd_usage(command);
+
}
return TRUE;
}
@@ -5620,7 +5647,7 @@ cmd_notify(ProfWin* window, const char* const command, gchar** args)
}
}
- // chat room settings
+ // chat room settings
} else if (g_strcmp0(args[0], "room") == 0) {
if (g_strcmp0(args[1], "on") == 0) {
cons_show("Room notifications enabled.");
@@ -5694,8 +5721,8 @@ cmd_notify(ProfWin* window, const char* const command, gchar** args)
}
}
} else if (g_strcmp0(args[2], "list") == 0) {
- GList* triggers = prefs_get_room_notify_triggers();
- GList* curr = triggers;
+ GList *triggers = prefs_get_room_notify_triggers();
+ GList *curr = triggers;
if (curr) {
cons_show("Room notification triggers:");
} else {
@@ -5719,7 +5746,7 @@ cmd_notify(ProfWin* window, const char* const command, gchar** args)
cons_show("Usage: /notify room on|off|mention");
}
- // typing settings
+ // typing settings
} else if (g_strcmp0(args[0], "typing") == 0) {
if (g_strcmp0(args[1], "on") == 0) {
cons_show("Typing notifications enabled.");
@@ -5741,7 +5768,7 @@ cmd_notify(ProfWin* window, const char* const command, gchar** args)
cons_show("Usage: /notify typing on|off");
}
- // invite settings
+ // invite settings
} else if (g_strcmp0(args[0], "invite") == 0) {
if (g_strcmp0(args[1], "on") == 0) {
cons_show("Chat room invite notifications enabled.");
@@ -5753,7 +5780,7 @@ cmd_notify(ProfWin* window, const char* const command, gchar** args)
cons_show("Usage: /notify invite on|off");
}
- // subscription settings
+ // subscription settings
} else if (g_strcmp0(args[0], "sub") == 0) {
if (g_strcmp0(args[1], "on") == 0) {
cons_show("Subscription notifications enabled.");
@@ -5765,7 +5792,7 @@ cmd_notify(ProfWin* window, const char* const command, gchar** args)
cons_show("Usage: /notify sub on|off");
}
- // remind settings
+ // remind settings
} else if (g_strcmp0(args[0], "remind") == 0) {
if (!args[1]) {
cons_bad_cmd_usage(command);
@@ -5781,18 +5808,18 @@ cmd_notify(ProfWin* window, const char* const command, gchar** args)
}
}
- // current chat room settings
+ // current chat room settings
} else if (g_strcmp0(args[0], "on") == 0) {
jabber_conn_status_t conn_status = connection_get_status();
if (conn_status != JABBER_CONNECTED) {
cons_show("You are not currently connected.");
} else {
- ProfWin* window = wins_get_current();
+ ProfWin *window = wins_get_current();
if (window->type != WIN_MUC) {
cons_show("You must be in a chat room.");
} else {
- ProfMucWin* mucwin = (ProfMucWin*)window;
+ ProfMucWin *mucwin = (ProfMucWin*)window;
prefs_set_room_notify(mucwin->roomjid, TRUE);
win_println(window, THEME_DEFAULT, "!", "Notifications enabled for %s", mucwin->roomjid);
}
@@ -5803,11 +5830,11 @@ cmd_notify(ProfWin* window, const char* const command, gchar** args)
if (conn_status != JABBER_CONNECTED) {
cons_show("You are not currently connected.");
} else {
- ProfWin* window = wins_get_current();
+ ProfWin *window = wins_get_current();
if (window->type != WIN_MUC) {
cons_show("You must be in a chat room.");
} else {
- ProfMucWin* mucwin = (ProfMucWin*)window;
+ ProfMucWin *mucwin = (ProfMucWin*)window;
prefs_set_room_notify(mucwin->roomjid, FALSE);
win_println(window, THEME_DEFAULT, "!", "Notifications disabled for %s", mucwin->roomjid);
}
@@ -5819,20 +5846,20 @@ cmd_notify(ProfWin* window, const char* const command, gchar** args)
cons_show("You are not currently connected.");
} else {
if (g_strcmp0(args[1], "on") == 0) {
- ProfWin* window = wins_get_current();
+ ProfWin *window = wins_get_current();
if (window->type != WIN_MUC) {
cons_show("You must be in a chat room.");
} else {
- ProfMucWin* mucwin = (ProfMucWin*)window;
+ ProfMucWin *mucwin = (ProfMucWin*)window;
prefs_set_room_notify_mention(mucwin->roomjid, TRUE);
win_println(window, THEME_DEFAULT, "!", "Mention notifications enabled for %s", mucwin->roomjid);
}
} else if (g_strcmp0(args[1], "off") == 0) {
- ProfWin* window = wins_get_current();
+ ProfWin *window = wins_get_current();
if (window->type != WIN_MUC) {
cons_show("You must be in a chat rooms.");
} else {
- ProfMucWin* mucwin = (ProfMucWin*)window;
+ ProfMucWin *mucwin = (ProfMucWin*)window;
prefs_set_room_notify_mention(mucwin->roomjid, FALSE);
win_println(window, THEME_DEFAULT, "!", "Mention notifications disabled for %s", mucwin->roomjid);
}
@@ -5847,20 +5874,20 @@ cmd_notify(ProfWin* window, const char* const command, gchar** args)
cons_show("You are not currently connected.");
} else {
if (g_strcmp0(args[1], "on") == 0) {
- ProfWin* window = wins_get_current();
+ ProfWin *window = wins_get_current();
if (window->type != WIN_MUC) {
cons_show("You must be in a chat room.");
} else {
- ProfMucWin* mucwin = (ProfMucWin*)window;
+ ProfMucWin *mucwin = (ProfMucWin*)window;
prefs_set_room_notify_trigger(mucwin->roomjid, TRUE);
win_println(window, THEME_DEFAULT, "!", "Custom trigger notifications enabled for %s", mucwin->roomjid);
}
} else if (g_strcmp0(args[1], "off") == 0) {
- ProfWin* window = wins_get_current();
+ ProfWin *window = wins_get_current();
if (window->type != WIN_MUC) {
cons_show("You must be in a chat rooms.");
} else {
- ProfMucWin* mucwin = (ProfMucWin*)window;
+ ProfMucWin *mucwin = (ProfMucWin*)window;
prefs_set_room_notify_trigger(mucwin->roomjid, FALSE);
win_println(window, THEME_DEFAULT, "!", "Custom trigger notifications disabled for %s", mucwin->roomjid);
}
@@ -5874,11 +5901,11 @@ cmd_notify(ProfWin* window, const char* const command, gchar** args)
if (conn_status != JABBER_CONNECTED) {
cons_show("You are not currently connected.");
} else {
- ProfWin* window = wins_get_current();
+ ProfWin *window = wins_get_current();
if (window->type != WIN_MUC) {
cons_show("You must be in a chat room.");
} else {
- ProfMucWin* mucwin = (ProfMucWin*)window;
+ ProfMucWin *mucwin = (ProfMucWin*)window;
gboolean res = prefs_reset_room_notify(mucwin->roomjid);
if (res) {
win_println(window, THEME_DEFAULT, "!", "Notification settings set to global defaults for %s", mucwin->roomjid);
@@ -5895,10 +5922,10 @@ cmd_notify(ProfWin* window, const char* const command, gchar** args)
}
gboolean
-cmd_inpblock(ProfWin* window, const char* const command, gchar** args)
+cmd_inpblock(ProfWin *window, const char *const command, gchar **args)
{
- char* subcmd = args[0];
- char* value = args[1];
+ char *subcmd = args[0];
+ char *value = args[1];
if (g_strcmp0(subcmd, "timeout") == 0) {
if (value == NULL) {
@@ -5907,7 +5934,7 @@ cmd_inpblock(ProfWin* window, const char* const command, gchar** args)
}
int intval = 0;
- char* err_msg = NULL;
+ char *err_msg = NULL;
gboolean res = strtoi_range(value, &intval, 1, 1000, &err_msg);
if (res) {
cons_show("Input blocking set to %d milliseconds.", intval);
@@ -5942,7 +5969,7 @@ cmd_inpblock(ProfWin* window, const char* const command, gchar** args)
}
gboolean
-cmd_titlebar(ProfWin* window, const char* const command, gchar** args)
+cmd_titlebar(ProfWin *window, const char *const command, gchar **args)
{
if (g_strcmp0(args[0], "up") == 0) {
gboolean result = prefs_titlebar_pos_up();
@@ -5973,7 +6000,7 @@ cmd_titlebar(ProfWin* window, const char* const command, gchar** args)
}
gboolean
-cmd_titlebar_show_hide(ProfWin* window, const char* const command, gchar** args)
+cmd_titlebar_show_hide(ProfWin *window, const char *const command, gchar **args)
{
if (args[1] != NULL) {
if (g_strcmp0(args[0], "show") == 0) {
@@ -5986,10 +6013,10 @@ cmd_titlebar_show_hide(ProfWin* window, const char* const command, gchar** args)
prefs_set_boolean(PREF_ENC_WARN, TRUE);
} else if (g_strcmp0(args[1], "resource") == 0) {
cons_show("Showing resource in titlebar enabled.");
- prefs_set_boolean(PREF_RESOURCE_TITLE, TRUE);
+ prefs_set_boolean(PREF_RESOURCE_TITLE , TRUE);
} else if (g_strcmp0(args[1], "presence") == 0) {
cons_show("Showing contact presence in titlebar enabled.");
- prefs_set_boolean(PREF_PRESENCE, TRUE);
+ prefs_set_boolean(PREF_PRESENCE , TRUE);
} else if (g_strcmp0(args[1], "jid") == 0) {
cons_show("Showing MUC JID in titlebar as title enabled.");
prefs_set_boolean(PREF_TITLEBAR_MUC_TITLE_JID, TRUE);
@@ -6009,10 +6036,10 @@ cmd_titlebar_show_hide(ProfWin* window, const char* const command, gchar** args)
prefs_set_boolean(PREF_ENC_WARN, FALSE);
} else if (g_strcmp0(args[1], "resource") == 0) {
cons_show("Showing resource in titlebar disabled.");
- prefs_set_boolean(PREF_RESOURCE_TITLE, FALSE);
+ prefs_set_boolean(PREF_RESOURCE_TITLE , FALSE);
} else if (g_strcmp0(args[1], "presence") == 0) {
cons_show("Showing contact presence in titlebar disabled.");
- prefs_set_boolean(PREF_PRESENCE, FALSE);
+ prefs_set_boolean(PREF_PRESENCE , FALSE);
} else if (g_strcmp0(args[1], "jid") == 0) {
cons_show("Showing MUC JID in titlebar as title disabled.");
prefs_set_boolean(PREF_TITLEBAR_MUC_TITLE_JID, FALSE);
@@ -6031,7 +6058,7 @@ cmd_titlebar_show_hide(ProfWin* window, const char* const command, gchar** args)
}
gboolean
-cmd_mainwin(ProfWin* window, const char* const command, gchar** args)
+cmd_mainwin(ProfWin *window, const char *const command, gchar **args)
{
if (g_strcmp0(args[0], "up") == 0) {
gboolean result = prefs_mainwin_pos_up();
@@ -6062,7 +6089,7 @@ cmd_mainwin(ProfWin* window, const char* const command, gchar** args)
}
gboolean
-cmd_statusbar(ProfWin* window, const char* const command, gchar** args)
+cmd_statusbar(ProfWin *window, const char *const command, gchar **args)
{
if (g_strcmp0(args[0], "show") == 0) {
if (g_strcmp0(args[1], "name") == 0) {
@@ -6126,9 +6153,9 @@ cmd_statusbar(ProfWin* window, const char* const command, gchar** args)
return TRUE;
}
- char* value = args[1];
+ char *value = args[1];
int intval = 0;
- char* err_msg = NULL;
+ char *err_msg = NULL;
gboolean res = strtoi_range(value, &intval, 0, INT_MAX, &err_msg);
if (res) {
if (intval < 0 || intval > 10) {
@@ -6158,9 +6185,9 @@ cmd_statusbar(ProfWin* window, const char* const command, gchar** args)
return TRUE;
}
- char* value = args[1];
+ char *value = args[1];
int intval = 0;
- char* err_msg = NULL;
+ char *err_msg = NULL;
gboolean res = strtoi_range(value, &intval, 0, INT_MAX, &err_msg);
if (res) {
if (intval < 0) {
@@ -6276,7 +6303,7 @@ cmd_statusbar(ProfWin* window, const char* const command, gchar** args)
}
gboolean
-cmd_inputwin(ProfWin* window, const char* const command, gchar** args)
+cmd_inputwin(ProfWin *window, const char *const command, gchar **args)
{
if (g_strcmp0(args[0], "up") == 0) {
gboolean result = prefs_inputwin_pos_up();
@@ -6307,10 +6334,10 @@ cmd_inputwin(ProfWin* window, const char* const command, gchar** args)
}
gboolean
-cmd_log(ProfWin* window, const char* const command, gchar** args)
+cmd_log(ProfWin *window, const char *const command, gchar **args)
{
- char* subcmd = args[0];
- char* value = args[1];
+ char *subcmd = args[0];
+ char *value = args[1];
if (strcmp(subcmd, "maxsize") == 0) {
if (value == NULL) {
@@ -6319,7 +6346,7 @@ cmd_log(ProfWin* window, const char* const command, gchar** args)
}
int intval = 0;
- char* err_msg = NULL;
+ char *err_msg = NULL;
gboolean res = strtoi_range(value, &intval, PREFS_MIN_LOG_SIZE, INT_MAX, &err_msg);
if (res) {
prefs_set_max_log_size(intval);
@@ -6363,12 +6390,12 @@ cmd_log(ProfWin* window, const char* const command, gchar** args)
}
gboolean
-cmd_reconnect(ProfWin* window, const char* const command, gchar** args)
+cmd_reconnect(ProfWin *window, const char *const command, gchar **args)
{
- char* value = args[0];
+ char *value = args[0];
int intval = 0;
- char* err_msg = NULL;
+ char *err_msg = NULL;
gboolean res = strtoi_range(value, &intval, 0, INT_MAX, &err_msg);
if (res) {
prefs_set_reconnect(intval);
@@ -6387,14 +6414,14 @@ cmd_reconnect(ProfWin* window, const char* const command, gchar** args)
}
gboolean
-cmd_autoping(ProfWin* window, const char* const command, gchar** args)
+cmd_autoping(ProfWin *window, const char *const command, gchar **args)
{
- char* cmd = args[0];
- char* value = args[1];
+ char *cmd = args[0];
+ char *value = args[1];
if (g_strcmp0(cmd, "set") == 0) {
int intval = 0;
- char* err_msg = NULL;
+ char *err_msg = NULL;
gboolean res = strtoi_range(value, &intval, 0, INT_MAX, &err_msg);
if (res) {
prefs_set_autoping(intval);
@@ -6412,7 +6439,7 @@ cmd_autoping(ProfWin* window, const char* const command, gchar** args)
} else if (g_strcmp0(cmd, "timeout") == 0) {
int intval = 0;
- char* err_msg = NULL;
+ char *err_msg = NULL;
gboolean res = strtoi_range(value, &intval, 0, INT_MAX, &err_msg);
if (res) {
prefs_set_autoping_timeout(intval);
@@ -6435,7 +6462,7 @@ cmd_autoping(ProfWin* window, const char* const command, gchar** args)
}
gboolean
-cmd_ping(ProfWin* window, const char* const command, gchar** args)
+cmd_ping(ProfWin *window, const char *const command, gchar **args)
{
jabber_conn_status_t conn_status = connection_get_status();
@@ -6465,15 +6492,17 @@ cmd_ping(ProfWin* window, const char* const command, gchar** args)
}
gboolean
-cmd_autoaway(ProfWin* window, const char* const command, gchar** args)
+cmd_autoaway(ProfWin *window, const char *const command, gchar **args)
{
- if ((strcmp(args[0], "mode") != 0) && (strcmp(args[0], "time") != 0) && (strcmp(args[0], "message") != 0) && (strcmp(args[0], "check") != 0)) {
+ if ((strcmp(args[0], "mode") != 0) && (strcmp(args[0], "time") != 0) &&
+ (strcmp(args[0], "message") != 0) && (strcmp(args[0], "check") != 0)) {
cons_show("Setting must be one of 'mode', 'time', 'message' or 'check'");
return TRUE;
}
if (strcmp(args[0], "mode") == 0) {
- if ((strcmp(args[1], "idle") != 0) && (strcmp(args[1], "away") != 0) && (strcmp(args[1], "off") != 0)) {
+ if ((strcmp(args[1], "idle") != 0) && (strcmp(args[1], "away") != 0) &&
+ (strcmp(args[1], "off") != 0)) {
cons_show("Mode must be one of 'idle', 'away' or 'off'");
} else {
prefs_set_string(PREF_AUTOAWAY_MODE, args[1]);
@@ -6486,7 +6515,7 @@ cmd_autoaway(ProfWin* window, const char* const command, gchar** args)
if (strcmp(args[0], "time") == 0) {
if (g_strcmp0(args[1], "away") == 0) {
int minutesval = 0;
- char* err_msg = NULL;
+ char *err_msg = NULL;
gboolean res = strtoi_range(args[2], &minutesval, 1, INT_MAX, &err_msg);
if (res) {
prefs_set_autoaway_time(minutesval);
@@ -6503,7 +6532,7 @@ cmd_autoaway(ProfWin* window, const char* const command, gchar** args)
return TRUE;
} else if (g_strcmp0(args[1], "xa") == 0) {
int minutesval = 0;
- char* err_msg = NULL;
+ char *err_msg = NULL;
gboolean res = strtoi_range(args[2], &minutesval, 0, INT_MAX, &err_msg);
if (res) {
int away_time = prefs_get_autoaway_time();
@@ -6567,7 +6596,7 @@ cmd_autoaway(ProfWin* window, const char* const command, gchar** args)
}
gboolean
-cmd_priority(ProfWin* window, const char* const command, gchar** args)
+cmd_priority(ProfWin *window, const char *const command, gchar **args)
{
jabber_conn_status_t conn_status = connection_get_status();
@@ -6576,10 +6605,10 @@ cmd_priority(ProfWin* window, const char* const command, gchar** args)
return TRUE;
}
- char* value = args[0];
+ char *value = args[0];
int intval = 0;
- char* err_msg = NULL;
+ char *err_msg = NULL;
gboolean res = strtoi_range(value, &intval, -128, 127, &err_msg);
if (res) {
accounts_set_priority_all(session_get_account_name(), intval);
@@ -6595,7 +6624,7 @@ cmd_priority(ProfWin* window, const char* const command, gchar** args)
}
gboolean
-cmd_vercheck(ProfWin* window, const char* const command, gchar** args)
+cmd_vercheck(ProfWin *window, const char *const command, gchar **args)
{
int num_args = g_strv_length(args);
@@ -6609,13 +6638,13 @@ cmd_vercheck(ProfWin* window, const char* const command, gchar** args)
}
gboolean
-cmd_xmlconsole(ProfWin* window, const char* const command, gchar** args)
+cmd_xmlconsole(ProfWin *window, const char *const command, gchar **args)
{
- ProfXMLWin* xmlwin = wins_get_xmlconsole();
+ ProfXMLWin *xmlwin = wins_get_xmlconsole();
if (xmlwin) {
ui_focus_win((ProfWin*)xmlwin);
} else {
- ProfWin* window = wins_new_xmlconsole();
+ ProfWin *window = wins_new_xmlconsole();
ui_focus_win(window);
}
@@ -6623,14 +6652,14 @@ cmd_xmlconsole(ProfWin* window, const char* const command, gchar** args)
}
gboolean
-cmd_flash(ProfWin* window, const char* const command, gchar** args)
+cmd_flash(ProfWin *window, const char *const command, gchar **args)
{
_cmd_set_boolean_preference(args[0], command, "Screen flash", PREF_FLASH);
return TRUE;
}
gboolean
-cmd_tray(ProfWin* window, const char* const command, gchar** args)
+cmd_tray(ProfWin *window, const char *const command, gchar **args)
{
#ifdef HAVE_GTK
if (g_strcmp0(args[0], "timer") == 0) {
@@ -6645,7 +6674,7 @@ cmd_tray(ProfWin* window, const char* const command, gchar** args)
}
int intval = 0;
- char* err_msg = NULL;
+ char *err_msg = NULL;
gboolean res = strtoi_range(args[1], &intval, 1, 10, &err_msg);
if (res) {
if (intval == 1) {
@@ -6698,21 +6727,21 @@ cmd_tray(ProfWin* window, const char* const command, gchar** args)
}
gboolean
-cmd_intype(ProfWin* window, const char* const command, gchar** args)
+cmd_intype(ProfWin *window, const char *const command, gchar **args)
{
_cmd_set_boolean_preference(args[0], command, "Show contact typing", PREF_INTYPE);
return TRUE;
}
gboolean
-cmd_splash(ProfWin* window, const char* const command, gchar** args)
+cmd_splash(ProfWin *window, const char *const command, gchar **args)
{
_cmd_set_boolean_preference(args[0], command, "Splash screen", PREF_SPLASH);
return TRUE;
}
gboolean
-cmd_autoconnect(ProfWin* window, const char* const command, gchar** args)
+cmd_autoconnect(ProfWin *window, const char *const command, gchar **args)
{
if (strcmp(args[0], "off") == 0) {
prefs_set_string(PREF_CONNECT_ACCOUNT, NULL);
@@ -6735,13 +6764,14 @@ cmd_autoconnect(ProfWin* window, const char* const command, gchar** args)
}
gboolean
-cmd_logging(ProfWin* window, const char* const command, gchar** args)
+cmd_logging(ProfWin *window, const char *const command, gchar **args)
{
if (args[0] == NULL) {
cons_logging_setting();
return TRUE;
}
+
if (strcmp(args[0], "chat") == 0 && args[1] != NULL) {
_cmd_set_boolean_preference(args[1], command, "Chat logging", PREF_CHLOG);
@@ -6763,7 +6793,7 @@ cmd_logging(ProfWin* window, const char* const command, gchar** args)
}
gboolean
-cmd_history(ProfWin* window, const char* const command, gchar** args)
+cmd_history(ProfWin *window, const char *const command, gchar **args)
{
if (args[0] == NULL) {
return FALSE;
@@ -6780,7 +6810,7 @@ cmd_history(ProfWin* window, const char* const command, gchar** args)
}
gboolean
-cmd_carbons(ProfWin* window, const char* const command, gchar** args)
+cmd_carbons(ProfWin *window, const char *const command, gchar **args)
{
if (args[0] == NULL) {
return FALSE;
@@ -6794,7 +6824,8 @@ cmd_carbons(ProfWin* window, const char* const command, gchar** args)
// enable carbons
if (strcmp(args[0], "on") == 0) {
iq_enable_carbons();
- } else if (strcmp(args[0], "off") == 0) {
+ }
+ else if (strcmp(args[0], "off") == 0){
iq_disable_carbons();
}
}
@@ -6803,7 +6834,7 @@ cmd_carbons(ProfWin* window, const char* const command, gchar** args)
}
gboolean
-cmd_receipts(ProfWin* window, const char* const command, gchar** args)
+cmd_receipts(ProfWin *window, const char *const command, gchar **args)
{
if (g_strcmp0(args[0], "send") == 0) {
_cmd_set_boolean_preference(args[1], command, "Send delivery receipts", PREF_RECEIPTS_SEND);
@@ -6823,10 +6854,10 @@ cmd_receipts(ProfWin* window, const char* const command, gchar** args)
}
gboolean
-cmd_plugins_sourcepath(ProfWin* window, const char* const command, gchar** args)
+cmd_plugins_sourcepath(ProfWin *window, const char *const command, gchar **args)
{
if (args[1] == NULL) {
- char* sourcepath = prefs_get_string(PREF_PLUGINS_SOURCEPATH);
+ char *sourcepath = prefs_get_string(PREF_PLUGINS_SOURCEPATH);
if (sourcepath) {
cons_show("Current plugins sourcepath: %s", sourcepath);
g_free(sourcepath);
@@ -6843,7 +6874,7 @@ cmd_plugins_sourcepath(ProfWin* window, const char* const command, gchar** args)
}
if (g_strcmp0(args[1], "set") == 0) {
- char* path = args[2];
+ char *path = args[2];
if (path == NULL) {
cons_bad_cmd_usage(command);
return TRUE;
@@ -6851,7 +6882,7 @@ cmd_plugins_sourcepath(ProfWin* window, const char* const command, gchar** args)
// expand ~ to $HOME
if (path[0] == '~' && path[1] == '/') {
- if (asprintf(&path, "%s/%s", getenv("HOME"), path + 2) == -1) {
+ if (asprintf(&path, "%s/%s", getenv("HOME"), path+2) == -1) {
return TRUE;
}
} else {
@@ -6875,9 +6906,9 @@ cmd_plugins_sourcepath(ProfWin* window, const char* const command, gchar** args)
}
gboolean
-cmd_plugins_install(ProfWin* window, const char* const command, gchar** args)
+cmd_plugins_install(ProfWin *window, const char *const command, gchar **args)
{
- char* path = args[1];
+ char *path = args[1];
if (path == NULL) {
char* sourcepath = prefs_get_string(PREF_PLUGINS_SOURCEPATH);
if (sourcepath) {
@@ -6888,7 +6919,7 @@ cmd_plugins_install(ProfWin* window, const char* const command, gchar** args)
return TRUE;
}
} else if (path[0] == '~' && path[1] == '/') {
- if (asprintf(&path, "%s/%s", getenv("HOME"), path + 2) == -1) {
+ if (asprintf(&path, "%s/%s", getenv("HOME"), path+2) == -1) {
return TRUE;
}
} else {
@@ -6903,7 +6934,7 @@ cmd_plugins_install(ProfWin* window, const char* const command, gchar** args)
}
GString* error_message = g_string_new(NULL);
- gchar* plugin_name = g_path_get_basename(path);
+ gchar *plugin_name = g_path_get_basename(path);
gboolean result = plugins_install(plugin_name, path, error_message);
if (result) {
cons_show("Plugin installed: %s", plugin_name);
@@ -6920,7 +6951,7 @@ cmd_plugins_install(ProfWin* window, const char* const command, gchar** args)
if (result->installed) {
cons_show("");
cons_show("Installed plugins:");
- GSList* curr = result->installed;
+ GSList *curr = result->installed;
while (curr) {
cons_show(" %s", curr->data);
curr = g_slist_next(curr);
@@ -6929,7 +6960,7 @@ cmd_plugins_install(ProfWin* window, const char* const command, gchar** args)
if (result->failed) {
cons_show("");
cons_show("Failed installs:");
- GSList* curr = result->failed;
+ GSList *curr = result->failed;
while (curr) {
cons_show(" %s", curr->data);
curr = g_slist_next(curr);
@@ -6950,9 +6981,9 @@ cmd_plugins_install(ProfWin* window, const char* const command, gchar** args)
}
gboolean
-cmd_plugins_update(ProfWin* window, const char* const command, gchar** args)
+cmd_plugins_update(ProfWin *window, const char *const command, gchar **args)
{
- char* path = args[1];
+ char *path = args[1];
if (path == NULL) {
char* sourcepath = prefs_get_string(PREF_PLUGINS_SOURCEPATH);
if (sourcepath) {
@@ -6963,7 +6994,7 @@ cmd_plugins_update(ProfWin* window, const char* const command, gchar** args)
return TRUE;
}
} else if (path[0] == '~' && path[1] == '/') {
- if (asprintf(&path, "%s/%s", getenv("HOME"), path + 2) == -1) {
+ if (asprintf(&path, "%s/%s", getenv("HOME"), path+2) == -1) {
return TRUE;
}
} else {
@@ -6984,7 +7015,7 @@ cmd_plugins_update(ProfWin* window, const char* const command, gchar** args)
}
GString* error_message = g_string_new(NULL);
- gchar* plugin_name = g_path_get_basename(path);
+ gchar *plugin_name = g_path_get_basename(path);
if (plugins_unload(plugin_name)) {
if (plugins_uninstall(plugin_name)) {
if (plugins_install(plugin_name, path, error_message)) {
@@ -7015,7 +7046,7 @@ cmd_plugins_update(ProfWin* window, const char* const command, gchar** args)
}
gboolean
-cmd_plugins_uninstall(ProfWin* window, const char* const command, gchar** args)
+cmd_plugins_uninstall(ProfWin *window, const char *const command, gchar **args)
{
if (args[1] == NULL) {
return FALSE;
@@ -7032,13 +7063,13 @@ cmd_plugins_uninstall(ProfWin* window, const char* const command, gchar** args)
}
gboolean
-cmd_plugins_load(ProfWin* window, const char* const command, gchar** args)
+cmd_plugins_load(ProfWin *window, const char *const command, gchar **args)
{
if (args[1] == NULL) {
- GSList* loaded = plugins_load_all();
+ GSList *loaded = plugins_load_all();
if (loaded) {
cons_show("Loaded plugins:");
- GSList* curr = loaded;
+ GSList *curr = loaded;
while (curr) {
cons_show(" %s", curr->data);
curr = g_slist_next(curr);
@@ -7063,7 +7094,7 @@ cmd_plugins_load(ProfWin* window, const char* const command, gchar** args)
}
gboolean
-cmd_plugins_unload(ProfWin* window, const char* const command, gchar** args)
+cmd_plugins_unload(ProfWin *window, const char *const command, gchar **args)
{
if (args[1] == NULL) {
gboolean res = plugins_unload_all();
@@ -7086,7 +7117,7 @@ cmd_plugins_unload(ProfWin* window, const char* const command, gchar** args)
}
gboolean
-cmd_plugins_reload(ProfWin* window, const char* const command, gchar** args)
+cmd_plugins_reload(ProfWin *window, const char *const command, gchar **args)
{
if (args[1] == NULL) {
plugins_reload_all();
@@ -7107,10 +7138,10 @@ cmd_plugins_reload(ProfWin* window, const char* const command, gchar** args)
}
gboolean
-cmd_plugins_python_version(ProfWin* window, const char* const command, gchar** args)
+cmd_plugins_python_version(ProfWin *window, const char *const command, gchar **args)
{
#ifdef HAVE_PYTHON
- const char* version = python_get_version_string();
+ const char *version = python_get_version_string();
cons_show("Python version:");
cons_show("%s", version);
#else
@@ -7120,15 +7151,15 @@ cmd_plugins_python_version(ProfWin* window, const char* const command, gchar** a
}
gboolean
-cmd_plugins(ProfWin* window, const char* const command, gchar** args)
+cmd_plugins(ProfWin *window, const char *const command, gchar **args)
{
- GList* plugins = plugins_loaded_list();
+ GList *plugins = plugins_loaded_list();
if (plugins == NULL) {
cons_show("No plugins installed.");
return TRUE;
}
- GList* curr = plugins;
+ GList *curr = plugins;
cons_show("Installed plugins:");
while (curr) {
cons_show(" %s", curr->data);
@@ -7140,7 +7171,7 @@ cmd_plugins(ProfWin* window, const char* const command, gchar** args)
}
gboolean
-cmd_pgp(ProfWin* window, const char* const command, gchar** args)
+cmd_pgp(ProfWin *window, const char *const command, gchar **args)
{
#ifdef HAVE_LIBGPGME
if (args[0] == NULL) {
@@ -7163,7 +7194,7 @@ cmd_pgp(ProfWin* window, const char* const command, gchar** args)
cons_bad_cmd_usage(command);
return TRUE;
} else if (g_strcmp0(args[0], "log") == 0) {
- char* choice = args[1];
+ char *choice = args[1];
if (g_strcmp0(choice, "on") == 0) {
prefs_set_string(PREF_PGP_LOG, "on");
cons_show("PGP messages will be logged as plaintext.");
@@ -7186,20 +7217,20 @@ cmd_pgp(ProfWin* window, const char* const command, gchar** args)
}
if (g_strcmp0(args[0], "keys") == 0) {
- GHashTable* keys = p_gpg_list_keys();
+ GHashTable *keys = p_gpg_list_keys();
if (!keys || g_hash_table_size(keys) == 0) {
cons_show("No keys found");
return TRUE;
}
cons_show("PGP keys:");
- GList* keylist = g_hash_table_get_keys(keys);
- GList* curr = keylist;
+ GList *keylist = g_hash_table_get_keys(keys);
+ GList *curr = keylist;
while (curr) {
- ProfPGPKey* key = g_hash_table_lookup(keys, curr->data);
+ ProfPGPKey *key = g_hash_table_lookup(keys, curr->data);
cons_show(" %s", key->name);
cons_show(" ID : %s", key->id);
- char* format_fp = p_gpg_format_fp_str(key->fp);
+ char *format_fp = p_gpg_format_fp_str(key->fp);
cons_show(" Fingerprint : %s", format_fp);
free(format_fp);
if (key->secret) {
@@ -7221,13 +7252,13 @@ cmd_pgp(ProfWin* window, const char* const command, gchar** args)
return TRUE;
}
- char* jid = args[1];
+ char *jid = args[1];
if (!args[1]) {
cons_bad_cmd_usage(command);
return TRUE;
}
- char* keyid = args[2];
+ char *keyid = args[2];
if (!args[2]) {
cons_bad_cmd_usage(command);
return TRUE;
@@ -7249,18 +7280,18 @@ cmd_pgp(ProfWin* window, const char* const command, gchar** args)
cons_show("You are not currently connected.");
return TRUE;
}
- GHashTable* pubkeys = p_gpg_pubkeys();
- GList* jids = g_hash_table_get_keys(pubkeys);
+ GHashTable *pubkeys = p_gpg_pubkeys();
+ GList *jids = g_hash_table_get_keys(pubkeys);
if (!jids) {
cons_show("No contacts found with PGP public keys assigned.");
return TRUE;
}
cons_show("Assigned PGP public keys:");
- GList* curr = jids;
+ GList *curr = jids;
while (curr) {
- char* jid = curr->data;
- ProfPGPPubKeyId* pubkeyid = g_hash_table_lookup(pubkeys, jid);
+ char *jid = curr->data;
+ ProfPGPPubKeyId *pubkeyid = g_hash_table_lookup(pubkeys, jid);
if (pubkeyid->received) {
cons_show(" %s: %s (received)", jid, pubkeyid->id);
} else {
@@ -7273,13 +7304,13 @@ cmd_pgp(ProfWin* window, const char* const command, gchar** args)
}
if (g_strcmp0(args[0], "libver") == 0) {
- const char* libver = p_gpg_libver();
+ const char *libver = p_gpg_libver();
if (!libver) {
cons_show("Could not get libgpgme version");
return TRUE;
}
- GString* fullstr = g_string_new("Using libgpgme version ");
+ GString *fullstr = g_string_new("Using libgpgme version ");
g_string_append(fullstr, libver);
cons_show("%s", fullstr->str);
g_string_free(fullstr, TRUE);
@@ -7299,11 +7330,11 @@ cmd_pgp(ProfWin* window, const char* const command, gchar** args)
return TRUE;
}
- ProfChatWin* chatwin = NULL;
+ ProfChatWin *chatwin = NULL;
if (args[1]) {
- char* contact = args[1];
- char* barejid = roster_barejid_from_name(contact);
+ char *contact = args[1];
+ char *barejid = roster_barejid_from_name(contact);
if (barejid == NULL) {
barejid = contact;
}
@@ -7333,8 +7364,8 @@ cmd_pgp(ProfWin* window, const char* const command, gchar** args)
return TRUE;
}
- ProfAccount* account = accounts_get_account(session_get_account_name());
- char* err_str = NULL;
+ ProfAccount *account = accounts_get_account(session_get_account_name());
+ char *err_str = NULL;
if (!p_gpg_valid_key(account->pgp_keyid, &err_str)) {
win_println(window, THEME_DEFAULT, "!", "Invalid PGP key ID %s: %s, cannot start PGP encryption.", account->pgp_keyid, err_str);
free(err_str);
@@ -7366,7 +7397,7 @@ cmd_pgp(ProfWin* window, const char* const command, gchar** args)
return TRUE;
}
- ProfChatWin* chatwin = (ProfChatWin*)window;
+ ProfChatWin *chatwin = (ProfChatWin*)window;
if (chatwin->pgp_send == FALSE) {
win_println(window, THEME_DEFAULT, "!", "PGP encryption is not currently enabled.");
return TRUE;
@@ -7398,7 +7429,7 @@ cmd_pgp(ProfWin* window, const char* const command, gchar** args)
*/
gboolean
-cmd_ox(ProfWin* window, const char* const command, gchar** args)
+cmd_ox(ProfWin *window, const char *const command, gchar **args)
{
if (args[0] == NULL) {
cons_bad_cmd_usage(command);
@@ -7409,20 +7440,20 @@ cmd_ox(ProfWin* window, const char* const command, gchar** args)
// Should we move this to a common command
// e.g. '/openpgp keys'?.
else if (g_strcmp0(args[0], "keys") == 0) {
- GHashTable* keys = p_gpg_list_keys();
+ GHashTable *keys = p_gpg_list_keys();
if (!keys || g_hash_table_size(keys) == 0) {
cons_show("No keys found");
return TRUE;
}
cons_show("OpenPGP keys:");
- GList* keylist = g_hash_table_get_keys(keys);
- GList* curr = keylist;
+ GList *keylist = g_hash_table_get_keys(keys);
+ GList *curr = keylist;
while (curr) {
- ProfPGPKey* key = g_hash_table_lookup(keys, curr->data);
+ ProfPGPKey *key = g_hash_table_lookup(keys, curr->data);
cons_show(" %s", key->name);
cons_show(" ID : %s", key->id);
- char* format_fp = p_gpg_format_fp_str(key->fp);
+ char *format_fp = p_gpg_format_fp_str(key->fp);
cons_show(" Fingerprint : %s", format_fp);
free(format_fp);
if (key->secret) {
@@ -7438,12 +7469,13 @@ cmd_ox(ProfWin* window, const char* const command, gchar** args)
}
else if (g_strcmp0(args[0], "contacts") == 0) {
- GHashTable* keys = ox_gpg_public_keys();
+ GHashTable *keys = ox_gpg_public_keys();
cons_show("OpenPGP keys:");
- GList* keylist = g_hash_table_get_keys(keys);
- GList* curr = keylist;
+ GList *keylist = g_hash_table_get_keys(keys);
+ GList *curr = keylist;
+
- GSList* roster_list = NULL;
+ GSList *roster_list = NULL;
jabber_conn_status_t conn_status = connection_get_status();
if (conn_status != JABBER_CONNECTED) {
cons_show("You are not currently connected.");
@@ -7452,23 +7484,23 @@ cmd_ox(ProfWin* window, const char* const command, gchar** args)
}
while (curr) {
- ProfPGPKey* key = g_hash_table_lookup(keys, curr->data);
+ ProfPGPKey *key = g_hash_table_lookup(keys, curr->data);
PContact contact = NULL;
if (roster_list) {
- GSList* curr_c = roster_list;
- while (!contact && curr_c) {
+ GSList *curr_c = roster_list;
+ while ( !contact && curr_c){
contact = curr_c->data;
- const char* jid = p_contact_barejid(contact);
+ const char *jid = p_contact_barejid(contact);
GString* xmppuri = g_string_new("xmpp:");
g_string_append(xmppuri, jid);
- if (g_strcmp0(key->name, xmppuri->str)) {
+ if( g_strcmp0(key->name, xmppuri->str)) {
contact = NULL;
}
curr_c = g_slist_next(curr_c);
}
}
- if (contact) {
+ if(contact) {
cons_show("%s - %s", key->fp, key->name);
} else {
cons_show("%s - %s (not in roster)", key->fp, key->name);
@@ -7488,11 +7520,11 @@ cmd_ox(ProfWin* window, const char* const command, gchar** args)
return TRUE;
}
- ProfChatWin* chatwin = NULL;
+ ProfChatWin *chatwin = NULL;
if (args[1]) {
- char* contact = args[1];
- char* barejid = roster_barejid_from_name(contact);
+ char *contact = args[1];
+ char *barejid = roster_barejid_from_name(contact);
if (barejid == NULL) {
barejid = contact;
}
@@ -7522,9 +7554,9 @@ cmd_ox(ProfWin* window, const char* const command, gchar** args)
return TRUE;
}
- ProfAccount* account = accounts_get_account(session_get_account_name());
+ ProfAccount *account = accounts_get_account(session_get_account_name());
- if (!ox_is_private_key_available(account->jid)) {
+ if ( !ox_is_private_key_available(account->jid) ) {
win_println(window, THEME_DEFAULT, "!", "No private OpenPGP found, cannot start OX encryption.");
account_free(account);
return TRUE;
@@ -7540,8 +7572,8 @@ cmd_ox(ProfWin* window, const char* const command, gchar** args)
win_println(window, THEME_DEFAULT, "!", "OX encryption enabled.");
return TRUE;
} else if (g_strcmp0(args[0], "announce") == 0) {
- if (args[1]) {
- ox_announce_public_key(args[1]);
+ if( args[1] ) {
+ ox_announce_public_key( args[1] );
} else {
cons_show("Filename is required");
}
@@ -7553,7 +7585,7 @@ cmd_ox(ProfWin* window, const char* const command, gchar** args)
#endif // HAVE_LIBGPGME
gboolean
-cmd_otr_char(ProfWin* window, const char* const command, gchar** args)
+cmd_otr_char(ProfWin *window, const char *const command, gchar **args)
{
#ifdef HAVE_LIBOTR
if (args[1] == NULL) {
@@ -7575,10 +7607,10 @@ cmd_otr_char(ProfWin* window, const char* const command, gchar** args)
}
gboolean
-cmd_otr_log(ProfWin* window, const char* const command, gchar** args)
+cmd_otr_log(ProfWin *window, const char *const command, gchar **args)
{
#ifdef HAVE_LIBOTR
- char* choice = args[1];
+ char *choice = args[1];
if (g_strcmp0(choice, "on") == 0) {
prefs_set_string(PREF_OTR_LOG, "on");
cons_show("OTR messages will be logged as plaintext.");
@@ -7605,10 +7637,10 @@ cmd_otr_log(ProfWin* window, const char* const command, gchar** args)
}
gboolean
-cmd_otr_libver(ProfWin* window, const char* const command, gchar** args)
+cmd_otr_libver(ProfWin *window, const char *const command, gchar **args)
{
#ifdef HAVE_LIBOTR
- char* version = otr_libotr_version();
+ char *version = otr_libotr_version();
cons_show("Using libotr version %s", version);
return TRUE;
#else
@@ -7618,23 +7650,25 @@ cmd_otr_libver(ProfWin* window, const char* const command, gchar** args)
}
gboolean
-cmd_otr_policy(ProfWin* window, const char* const command, gchar** args)
+cmd_otr_policy(ProfWin *window, const char *const command, gchar **args)
{
#ifdef HAVE_LIBOTR
if (args[1] == NULL) {
- char* policy = prefs_get_string(PREF_OTR_POLICY);
+ char *policy = prefs_get_string(PREF_OTR_POLICY);
cons_show("OTR policy is now set to: %s", policy);
g_free(policy);
return TRUE;
}
- char* choice = args[1];
- if ((g_strcmp0(choice, "manual") != 0) && (g_strcmp0(choice, "opportunistic") != 0) && (g_strcmp0(choice, "always") != 0)) {
+ char *choice = args[1];
+ if ((g_strcmp0(choice, "manual") != 0) &&
+ (g_strcmp0(choice, "opportunistic") != 0) &&
+ (g_strcmp0(choice, "always") != 0)) {
cons_show("OTR policy can be set to: manual, opportunistic or always.");
return TRUE;
}
- char* contact = args[2];
+ char *contact = args[2];
if (contact == NULL) {
prefs_set_string(PREF_OTR_POLICY, choice);
cons_show("OTR policy is now set to: %s", choice);
@@ -7646,7 +7680,7 @@ cmd_otr_policy(ProfWin* window, const char* const command, gchar** args)
return TRUE;
}
- char* contact_jid = roster_barejid_from_name(contact);
+ char *contact_jid = roster_barejid_from_name(contact);
if (contact_jid == NULL) {
contact_jid = contact;
}
@@ -7660,7 +7694,7 @@ cmd_otr_policy(ProfWin* window, const char* const command, gchar** args)
}
gboolean
-cmd_otr_gen(ProfWin* window, const char* const command, gchar** args)
+cmd_otr_gen(ProfWin *window, const char *const command, gchar **args)
{
#ifdef HAVE_LIBOTR
if (connection_get_status() != JABBER_CONNECTED) {
@@ -7668,7 +7702,7 @@ cmd_otr_gen(ProfWin* window, const char* const command, gchar** args)
return TRUE;
}
- ProfAccount* account = accounts_get_account(session_get_account_name());
+ ProfAccount *account = accounts_get_account(session_get_account_name());
otr_keygen(account);
account_free(account);
return TRUE;
@@ -7679,7 +7713,7 @@ cmd_otr_gen(ProfWin* window, const char* const command, gchar** args)
}
gboolean
-cmd_otr_myfp(ProfWin* window, const char* const command, gchar** args)
+cmd_otr_myfp(ProfWin *window, const char *const command, gchar **args)
{
#ifdef HAVE_LIBOTR
if (connection_get_status() != JABBER_CONNECTED) {
@@ -7692,7 +7726,7 @@ cmd_otr_myfp(ProfWin* window, const char* const command, gchar** args)
return TRUE;
}
- char* fingerprint = otr_get_my_fingerprint();
+ char *fingerprint = otr_get_my_fingerprint();
win_println(window, THEME_DEFAULT, "!", "Your OTR fingerprint: %s", fingerprint);
free(fingerprint);
return TRUE;
@@ -7703,7 +7737,7 @@ cmd_otr_myfp(ProfWin* window, const char* const command, gchar** args)
}
gboolean
-cmd_otr_theirfp(ProfWin* window, const char* const command, gchar** args)
+cmd_otr_theirfp(ProfWin *window, const char *const command, gchar **args)
{
#ifdef HAVE_LIBOTR
if (connection_get_status() != JABBER_CONNECTED) {
@@ -7716,14 +7750,14 @@ cmd_otr_theirfp(ProfWin* window, const char* const command, gchar** args)
return TRUE;
}
- ProfChatWin* chatwin = (ProfChatWin*)window;
+ ProfChatWin *chatwin = (ProfChatWin*)window;
assert(chatwin->memcheck == PROFCHATWIN_MEMCHECK);
if (chatwin->is_otr == FALSE) {
win_println(window, THEME_DEFAULT, "!", "You are not currently in an OTR session.");
return TRUE;
}
- char* fingerprint = otr_get_their_fingerprint(chatwin->barejid);
+ char *fingerprint = otr_get_their_fingerprint(chatwin->barejid);
win_println(window, THEME_DEFAULT, "!", "%s's OTR fingerprint: %s", chatwin->barejid, fingerprint);
free(fingerprint);
return TRUE;
@@ -7734,7 +7768,7 @@ cmd_otr_theirfp(ProfWin* window, const char* const command, gchar** args)
}
gboolean
-cmd_otr_start(ProfWin* window, const char* const command, gchar** args)
+cmd_otr_start(ProfWin *window, const char *const command, gchar **args)
{
#ifdef HAVE_LIBOTR
if (connection_get_status() != JABBER_CONNECTED) {
@@ -7744,13 +7778,13 @@ cmd_otr_start(ProfWin* window, const char* const command, gchar** args)
// recipient supplied
if (args[1]) {
- char* contact = args[1];
- char* barejid = roster_barejid_from_name(contact);
+ char *contact = args[1];
+ char *barejid = roster_barejid_from_name(contact);
if (barejid == NULL) {
barejid = contact;
}
- ProfChatWin* chatwin = wins_get_chat(barejid);
+ ProfChatWin *chatwin = wins_get_chat(barejid);
if (!chatwin) {
chatwin = chatwin_new(barejid);
}
@@ -7777,8 +7811,8 @@ cmd_otr_start(ProfWin* window, const char* const command, gchar** args)
}
if (!otr_is_secure(barejid)) {
- char* otr_query_message = otr_start_query();
- char* id = message_send_chat_otr(barejid, otr_query_message, FALSE, NULL);
+ char *otr_query_message = otr_start_query();
+ char *id = message_send_chat_otr(barejid, otr_query_message, FALSE, NULL);
free(id);
return TRUE;
}
@@ -7786,14 +7820,14 @@ cmd_otr_start(ProfWin* window, const char* const command, gchar** args)
chatwin_otr_secured(chatwin, otr_is_trusted(barejid));
return TRUE;
- // no recipient, use current chat
+ // no recipient, use current chat
} else {
if (window->type != WIN_CHAT) {
win_println(window, THEME_DEFAULT, "-", "You must be in a regular chat window to start an OTR session.");
return TRUE;
}
- ProfChatWin* chatwin = (ProfChatWin*)window;
+ ProfChatWin *chatwin = (ProfChatWin*)window;
assert(chatwin->memcheck == PROFCHATWIN_MEMCHECK);
if (chatwin->pgp_send) {
win_println(window, THEME_DEFAULT, "!", "You must disable PGP encryption before starting an OTR session.");
@@ -7810,8 +7844,8 @@ cmd_otr_start(ProfWin* window, const char* const command, gchar** args)
return TRUE;
}
- char* otr_query_message = otr_start_query();
- char* id = message_send_chat_otr(chatwin->barejid, otr_query_message, FALSE, NULL);
+ char *otr_query_message = otr_start_query();
+ char *id = message_send_chat_otr(chatwin->barejid, otr_query_message, FALSE, NULL);
free(id);
return TRUE;
@@ -7823,7 +7857,7 @@ cmd_otr_start(ProfWin* window, const char* const command, gchar** args)
}
gboolean
-cmd_otr_end(ProfWin* window, const char* const command, gchar** args)
+cmd_otr_end(ProfWin *window, const char *const command, gchar **args)
{
#ifdef HAVE_LIBOTR
if (connection_get_status() != JABBER_CONNECTED) {
@@ -7836,7 +7870,7 @@ cmd_otr_end(ProfWin* window, const char* const command, gchar** args)
return TRUE;
}
- ProfChatWin* chatwin = (ProfChatWin*)window;
+ ProfChatWin *chatwin = (ProfChatWin*)window;
assert(chatwin->memcheck == PROFCHATWIN_MEMCHECK);
if (chatwin->is_otr == FALSE) {
win_println(window, THEME_DEFAULT, "!", "You are not currently in an OTR session.");
@@ -7853,7 +7887,7 @@ cmd_otr_end(ProfWin* window, const char* const command, gchar** args)
}
gboolean
-cmd_otr_trust(ProfWin* window, const char* const command, gchar** args)
+cmd_otr_trust(ProfWin *window, const char *const command, gchar **args)
{
#ifdef HAVE_LIBOTR
if (connection_get_status() != JABBER_CONNECTED) {
@@ -7866,7 +7900,7 @@ cmd_otr_trust(ProfWin* window, const char* const command, gchar** args)
return TRUE;
}
- ProfChatWin* chatwin = (ProfChatWin*)window;
+ ProfChatWin *chatwin = (ProfChatWin*)window;
assert(chatwin->memcheck == PROFCHATWIN_MEMCHECK);
if (chatwin->is_otr == FALSE) {
win_println(window, THEME_DEFAULT, "!", "You are not currently in an OTR session.");
@@ -7883,7 +7917,7 @@ cmd_otr_trust(ProfWin* window, const char* const command, gchar** args)
}
gboolean
-cmd_otr_untrust(ProfWin* window, const char* const command, gchar** args)
+cmd_otr_untrust(ProfWin *window, const char *const command, gchar **args)
{
#ifdef HAVE_LIBOTR
if (connection_get_status() != JABBER_CONNECTED) {
@@ -7896,7 +7930,7 @@ cmd_otr_untrust(ProfWin* window, const char* const command, gchar** args)
return TRUE;
}
- ProfChatWin* chatwin = (ProfChatWin*)window;
+ ProfChatWin *chatwin = (ProfChatWin*)window;
assert(chatwin->memcheck == PROFCHATWIN_MEMCHECK);
if (chatwin->is_otr == FALSE) {
win_println(window, THEME_DEFAULT, "!", "You are not currently in an OTR session.");
@@ -7913,7 +7947,7 @@ cmd_otr_untrust(ProfWin* window, const char* const command, gchar** args)
}
gboolean
-cmd_otr_secret(ProfWin* window, const char* const command, gchar** args)
+cmd_otr_secret(ProfWin *window, const char *const command, gchar **args)
{
#ifdef HAVE_LIBOTR
if (connection_get_status() != JABBER_CONNECTED) {
@@ -7926,14 +7960,14 @@ cmd_otr_secret(ProfWin* window, const char* const command, gchar** args)
return TRUE;
}
- ProfChatWin* chatwin = (ProfChatWin*)window;
+ ProfChatWin *chatwin = (ProfChatWin*)window;
assert(chatwin->memcheck == PROFCHATWIN_MEMCHECK);
if (chatwin->is_otr == FALSE) {
win_println(window, THEME_DEFAULT, "!", "You are not currently in an OTR session.");
return TRUE;
}
- char* secret = args[1];
+ char *secret = args[1];
if (secret == NULL) {
cons_bad_cmd_usage(command);
return TRUE;
@@ -7948,7 +7982,7 @@ cmd_otr_secret(ProfWin* window, const char* const command, gchar** args)
}
gboolean
-cmd_otr_question(ProfWin* window, const char* const command, gchar** args)
+cmd_otr_question(ProfWin *window, const char *const command, gchar **args)
{
#ifdef HAVE_LIBOTR
if (connection_get_status() != JABBER_CONNECTED) {
@@ -7956,8 +7990,8 @@ cmd_otr_question(ProfWin* window, const char* const command, gchar** args)
return TRUE;
}
- char* question = args[1];
- char* answer = args[2];
+ char *question = args[1];
+ char *answer = args[2];
if (question == NULL || answer == NULL) {
cons_bad_cmd_usage(command);
return TRUE;
@@ -7968,7 +8002,7 @@ cmd_otr_question(ProfWin* window, const char* const command, gchar** args)
return TRUE;
}
- ProfChatWin* chatwin = (ProfChatWin*)window;
+ ProfChatWin *chatwin = (ProfChatWin*)window;
assert(chatwin->memcheck == PROFCHATWIN_MEMCHECK);
if (chatwin->is_otr == FALSE) {
win_println(window, THEME_DEFAULT, "!", "You are not currently in an OTR session.");
@@ -7984,7 +8018,7 @@ cmd_otr_question(ProfWin* window, const char* const command, gchar** args)
}
gboolean
-cmd_otr_answer(ProfWin* window, const char* const command, gchar** args)
+cmd_otr_answer(ProfWin *window, const char *const command, gchar **args)
{
#ifdef HAVE_LIBOTR
if (connection_get_status() != JABBER_CONNECTED) {
@@ -7997,14 +8031,14 @@ cmd_otr_answer(ProfWin* window, const char* const command, gchar** args)
return TRUE;
}
- ProfChatWin* chatwin = (ProfChatWin*)window;
+ ProfChatWin *chatwin = (ProfChatWin*)window;
assert(chatwin->memcheck == PROFCHATWIN_MEMCHECK);
if (chatwin->is_otr == FALSE) {
win_println(window, THEME_DEFAULT, "!", "You are not currently in an OTR session.");
return TRUE;
}
- char* answer = args[1];
+ char *answer = args[1];
if (answer == NULL) {
cons_bad_cmd_usage(command);
return TRUE;
@@ -8019,7 +8053,7 @@ cmd_otr_answer(ProfWin* window, const char* const command, gchar** args)
}
gboolean
-cmd_otr_sendfile(ProfWin* window, const char* const command, gchar** args)
+cmd_otr_sendfile(ProfWin *window, const char *const command, gchar **args)
{
#ifdef HAVE_LIBOTR
_cmd_set_boolean_preference(args[1], command, "Sending unencrypted files in an OTR session via /sendfile", PREF_OTR_SENDFILE);
@@ -8032,7 +8066,7 @@ cmd_otr_sendfile(ProfWin* window, const char* const command, gchar** args)
}
gboolean
-cmd_command_list(ProfWin* window, const char* const command, gchar** args)
+cmd_command_list(ProfWin *window, const char *const command, gchar **args)
{
jabber_conn_status_t conn_status = connection_get_status();
@@ -8046,26 +8080,26 @@ cmd_command_list(ProfWin* window, const char* const command, gchar** args)
return TRUE;
}
- char* jid = args[1];
+ char *jid = args[1];
if (jid == NULL) {
switch (window->type) {
case WIN_MUC:
{
- ProfMucWin* mucwin = (ProfMucWin*)window;
+ ProfMucWin *mucwin = (ProfMucWin*)window;
assert(mucwin->memcheck == PROFMUCWIN_MEMCHECK);
jid = mucwin->roomjid;
break;
}
case WIN_CHAT:
{
- ProfChatWin* chatwin = (ProfChatWin*)window;
+ ProfChatWin *chatwin = (ProfChatWin*)window;
assert(chatwin->memcheck == PROFCHATWIN_MEMCHECK);
jid = chatwin->barejid;
break;
}
case WIN_PRIVATE:
{
- ProfPrivateWin* privatewin = (ProfPrivateWin*)window;
+ ProfPrivateWin *privatewin = (ProfPrivateWin*)window;
assert(privatewin->memcheck == PROFPRIVATEWIN_MEMCHECK);
jid = privatewin->fulljid;
break;
@@ -8088,7 +8122,7 @@ cmd_command_list(ProfWin* window, const char* const command, gchar** args)
}
gboolean
-cmd_command_exec(ProfWin* window, const char* const command, gchar** args)
+cmd_command_exec(ProfWin *window, const char *const command, gchar **args)
{
jabber_conn_status_t conn_status = connection_get_status();
@@ -8107,26 +8141,26 @@ cmd_command_exec(ProfWin* window, const char* const command, gchar** args)
return TRUE;
}
- char* jid = args[2];
+ char *jid = args[2];
if (jid == NULL) {
switch (window->type) {
case WIN_MUC:
{
- ProfMucWin* mucwin = (ProfMucWin*)window;
+ ProfMucWin *mucwin = (ProfMucWin*)window;
assert(mucwin->memcheck == PROFMUCWIN_MEMCHECK);
jid = mucwin->roomjid;
break;
}
case WIN_CHAT:
{
- ProfChatWin* chatwin = (ProfChatWin*)window;
+ ProfChatWin *chatwin = (ProfChatWin*)window;
assert(chatwin->memcheck == PROFCHATWIN_MEMCHECK);
jid = chatwin->barejid;
break;
}
case WIN_PRIVATE:
{
- ProfPrivateWin* privatewin = (ProfPrivateWin*)window;
+ ProfPrivateWin *privatewin = (ProfPrivateWin*)window;
assert(privatewin->memcheck == PROFPRIVATEWIN_MEMCHECK);
jid = privatewin->fulljid;
break;
@@ -8149,17 +8183,17 @@ cmd_command_exec(ProfWin* window, const char* const command, gchar** args)
}
static gboolean
-_cmd_execute(ProfWin* window, const char* const command, const char* const inp)
+_cmd_execute(ProfWin *window, const char *const command, const char *const inp)
{
if (g_str_has_prefix(command, "/field") && window->type == WIN_CONFIG) {
gboolean result = FALSE;
- gchar** args = parse_args_with_freetext(inp, 1, 2, &result);
+ gchar **args = parse_args_with_freetext(inp, 1, 2, &result);
if (!result) {
win_println(window, THEME_DEFAULT, "!", "Invalid command, see /form help");
result = TRUE;
} else {
- gchar** tokens = g_strsplit(inp, " ", 2);
- char* field = tokens[0] + 1;
+ gchar **tokens = g_strsplit(inp, " ", 2);
+ char *field = tokens[0] + 1;
result = cmd_form_field(window, field, args);
g_strfreev(tokens);
}
@@ -8168,11 +8202,11 @@ _cmd_execute(ProfWin* window, const char* const command, const char* const inp)
return result;
}
- Command* cmd = cmd_get(command);
+ Command *cmd = cmd_get(command);
gboolean result = FALSE;
if (cmd) {
- gchar** args = cmd->parser(inp, cmd->min_args, cmd->max_args, &result);
+ gchar **args = cmd->parser(inp, cmd->min_args, cmd->max_args, &result);
if (result == FALSE) {
ui_invalid_command_usage(cmd->cmd, cmd->setting_func);
return TRUE;
@@ -8181,7 +8215,7 @@ _cmd_execute(ProfWin* window, const char* const command, const char* const inp)
int i = 0;
while (cmd->sub_funcs[i][0]) {
if (g_strcmp0(args[0], (char*)cmd->sub_funcs[i][0]) == 0) {
- gboolean (*func)(ProfWin * window, const char* const command, gchar** args) = cmd->sub_funcs[i][1];
+ gboolean (*func)(ProfWin *window, const char *const command, gchar **args) = cmd->sub_funcs[i][1];
gboolean result = func(window, command, args);
g_strfreev(args);
return result;
@@ -8210,13 +8244,13 @@ _cmd_execute(ProfWin* window, const char* const command, const char* const inp)
}
static gboolean
-_cmd_execute_default(ProfWin* window, const char* inp)
+_cmd_execute_default(ProfWin *window, const char *inp)
{
// handle escaped commands - treat as normal message
if (g_str_has_prefix(inp, "//")) {
inp++;
- // handle unknown commands
+ // handle unknown commands
} else if ((inp[0] == '/') && (!g_str_has_prefix(inp, "/me "))) {
cons_show("Unknown command: %s", inp);
cons_alert();
@@ -8231,7 +8265,7 @@ _cmd_execute_default(ProfWin* window, const char* inp)
// handle plugin window
if (window->type == WIN_PLUGIN) {
- ProfPluginWin* pluginwin = (ProfPluginWin*)window;
+ ProfPluginWin *pluginwin = (ProfPluginWin*)window;
plugins_win_process_line(pluginwin->tag, inp);
return TRUE;
}
@@ -8245,21 +8279,21 @@ _cmd_execute_default(ProfWin* window, const char* inp)
switch (window->type) {
case WIN_CHAT:
{
- ProfChatWin* chatwin = (ProfChatWin*)window;
+ ProfChatWin *chatwin = (ProfChatWin*)window;
assert(chatwin->memcheck == PROFCHATWIN_MEMCHECK);
cl_ev_send_msg(chatwin, inp, NULL);
break;
}
case WIN_PRIVATE:
{
- ProfPrivateWin* privatewin = (ProfPrivateWin*)window;
+ ProfPrivateWin *privatewin = (ProfPrivateWin*)window;
assert(privatewin->memcheck == PROFPRIVATEWIN_MEMCHECK);
cl_ev_send_priv_msg(privatewin, inp, NULL);
break;
}
case WIN_MUC:
{
- ProfMucWin* mucwin = (ProfMucWin*)window;
+ ProfMucWin *mucwin = (ProfMucWin*)window;
assert(mucwin->memcheck == PROFMUCWIN_MEMCHECK);
cl_ev_send_muc_msg(mucwin, inp, NULL);
break;
@@ -8277,15 +8311,15 @@ _cmd_execute_default(ProfWin* window, const char* inp)
}
static gboolean
-_cmd_execute_alias(ProfWin* window, const char* const inp, gboolean* ran)
+_cmd_execute_alias(ProfWin *window, const char *const inp, gboolean *ran)
{
if (inp[0] != '/') {
*ran = FALSE;
return TRUE;
}
- char* alias = strdup(inp + 1);
- char* value = prefs_get_alias(alias);
+ char *alias = strdup(inp+1);
+ char *value = prefs_get_alias(alias);
free(alias);
if (value) {
*ran = TRUE;
@@ -8301,9 +8335,9 @@ _cmd_execute_alias(ProfWin* window, const char* const inp, gboolean* ran)
// helper function for status change commands
static void
_update_presence(const resource_presence_t resource_presence,
- const char* const show, gchar** args)
+ const char *const show, gchar **args)
{
- char* msg = NULL;
+ char *msg = NULL;
int num_args = g_strv_length(args);
// if no message, use status as message
@@ -8326,13 +8360,13 @@ _update_presence(const resource_presence_t resource_presence,
// helper function for boolean preference commands
static void
-_cmd_set_boolean_preference(gchar* arg, const char* const command,
- const char* const display, preference_t pref)
+_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);
+ GString *enabled = g_string_new(display);
g_string_append(enabled, " enabled.");
cons_show(enabled->str);
@@ -8340,7 +8374,7 @@ _cmd_set_boolean_preference(gchar* arg, const char* const command,
g_string_free(enabled, TRUE);
} else if (strcmp(arg, "off") == 0) {
- GString* disabled = g_string_new(display);
+ GString *disabled = g_string_new(display);
g_string_append(disabled, " disabled.");
cons_show(disabled->str);
@@ -8353,7 +8387,7 @@ _cmd_set_boolean_preference(gchar* arg, const char* const command,
}
gboolean
-cmd_omemo_gen(ProfWin* window, const char* const command, gchar** args)
+cmd_omemo_gen(ProfWin *window, const char *const command, gchar **args)
{
#ifdef HAVE_OMEMO
if (connection_get_status() != JABBER_CONNECTED) {
@@ -8368,7 +8402,7 @@ cmd_omemo_gen(ProfWin* window, const char* const command, gchar** args)
cons_show("Generating OMEMO crytographic materials, it may take a while...");
ui_update();
- ProfAccount* account = accounts_get_account(session_get_account_name());
+ ProfAccount *account = accounts_get_account(session_get_account_name());
omemo_generate_crypto_materials(account);
cons_show("OMEMO crytographic materials generated.");
return TRUE;
@@ -8379,7 +8413,7 @@ cmd_omemo_gen(ProfWin* window, const char* const command, gchar** args)
}
gboolean
-cmd_omemo_start(ProfWin* window, const char* const command, gchar** args)
+cmd_omemo_start(ProfWin *window, const char *const command, gchar **args)
{
#ifdef HAVE_OMEMO
if (connection_get_status() != JABBER_CONNECTED) {
@@ -8392,12 +8426,12 @@ cmd_omemo_start(ProfWin* window, const char* const command, gchar** args)
return TRUE;
}
- ProfChatWin* chatwin = NULL;
+ ProfChatWin *chatwin = NULL;
// recipient supplied
if (args[1]) {
- char* contact = args[1];
- char* barejid = roster_barejid_from_name(contact);
+ char *contact = args[1];
+ char *barejid = roster_barejid_from_name(contact);
if (barejid == NULL) {
barejid = contact;
}
@@ -8408,10 +8442,10 @@ cmd_omemo_start(ProfWin* window, const char* const command, gchar** args)
}
ui_focus_win((ProfWin*)chatwin);
} else {
- if (window->type == WIN_CHAT) {
- chatwin = (ProfChatWin*)window;
- assert(chatwin->memcheck == PROFCHATWIN_MEMCHECK);
- }
+ if (window->type == WIN_CHAT) {
+ chatwin = (ProfChatWin*)window;
+ assert(chatwin->memcheck == PROFCHATWIN_MEMCHECK);
+ }
}
if (chatwin) {
@@ -8434,11 +8468,11 @@ cmd_omemo_start(ProfWin* window, const char* const command, gchar** args)
omemo_start_session(chatwin->barejid);
chatwin->is_omemo = TRUE;
} else if (window->type == WIN_MUC) {
- ProfMucWin* mucwin = (ProfMucWin*)window;
+ ProfMucWin *mucwin = (ProfMucWin*)window;
assert(mucwin->memcheck == PROFMUCWIN_MEMCHECK);
if (muc_anonymity_type(mucwin->roomjid) == MUC_ANONYMITY_TYPE_NONANONYMOUS
- && muc_member_type(mucwin->roomjid) == MUC_MEMBER_TYPE_MEMBERS_ONLY) {
+ && muc_member_type(mucwin->roomjid) == MUC_MEMBER_TYPE_MEMBERS_ONLY) {
accounts_add_omemo_state(session_get_account_name(), mucwin->roomjid, TRUE);
omemo_start_muc_sessions(mucwin->roomjid);
mucwin->is_omemo = TRUE;
@@ -8457,7 +8491,7 @@ cmd_omemo_start(ProfWin* window, const char* const command, gchar** args)
}
gboolean
-cmd_omemo_char(ProfWin* window, const char* const command, gchar** args)
+cmd_omemo_char(ProfWin *window, const char *const command, gchar **args)
{
#ifdef HAVE_OMEMO
if (args[1] == NULL) {
@@ -8479,10 +8513,10 @@ cmd_omemo_char(ProfWin* window, const char* const command, gchar** args)
}
gboolean
-cmd_omemo_log(ProfWin* window, const char* const command, gchar** args)
+cmd_omemo_log(ProfWin *window, const char *const command, gchar **args)
{
#ifdef HAVE_OMEMO
- char* choice = args[1];
+ char *choice = args[1];
if (g_strcmp0(choice, "on") == 0) {
prefs_set_string(PREF_OMEMO_LOG, "on");
cons_show("OMEMO messages will be logged as plaintext.");
@@ -8509,7 +8543,7 @@ cmd_omemo_log(ProfWin* window, const char* const command, gchar** args)
}
gboolean
-cmd_omemo_end(ProfWin* window, const char* const command, gchar** args)
+cmd_omemo_end(ProfWin *window, const char *const command, gchar **args)
{
#ifdef HAVE_OMEMO
if (connection_get_status() != JABBER_CONNECTED) {
@@ -8518,7 +8552,7 @@ cmd_omemo_end(ProfWin* window, const char* const command, gchar** args)
}
if (window->type == WIN_CHAT) {
- ProfChatWin* chatwin = (ProfChatWin*)window;
+ ProfChatWin *chatwin = (ProfChatWin*)window;
assert(chatwin->memcheck == PROFCHATWIN_MEMCHECK);
if (!chatwin->is_omemo) {
@@ -8529,7 +8563,7 @@ cmd_omemo_end(ProfWin* window, const char* const command, gchar** args)
chatwin->is_omemo = FALSE;
accounts_add_omemo_state(session_get_account_name(), chatwin->barejid, FALSE);
} else if (window->type == WIN_MUC) {
- ProfMucWin* mucwin = (ProfMucWin*)window;
+ ProfMucWin *mucwin = (ProfMucWin*)window;
assert(mucwin->memcheck == PROFMUCWIN_MEMCHECK);
if (!mucwin->is_omemo) {
@@ -8552,7 +8586,7 @@ cmd_omemo_end(ProfWin* window, const char* const command, gchar** args)
}
gboolean
-cmd_omemo_fingerprint(ProfWin* window, const char* const command, gchar** args)
+cmd_omemo_fingerprint(ProfWin *window, const char *const command, gchar **args)
{
#ifdef HAVE_OMEMO
if (connection_get_status() != JABBER_CONNECTED) {
@@ -8565,22 +8599,22 @@ cmd_omemo_fingerprint(ProfWin* window, const char* const command, gchar** args)
return TRUE;
}
- Jid* jid;
+ Jid *jid;
if (!args[1]) {
if (window->type == WIN_CONSOLE) {
- char* fingerprint = omemo_own_fingerprint(TRUE);
+ char *fingerprint = omemo_own_fingerprint(TRUE);
cons_show("Your OMEMO fingerprint: %s", fingerprint);
free(fingerprint);
jid = jid_create(connection_get_fulljid());
} else if (window->type == WIN_CHAT) {
- ProfChatWin* chatwin = (ProfChatWin*)window;
+ ProfChatWin *chatwin = (ProfChatWin*)window;
jid = jid_create(chatwin->barejid);
} else {
win_println(window, THEME_DEFAULT, "-", "You must be in a regular chat window to print fingerprint without providing the contact.");
return TRUE;
}
} else {
- char* barejid = roster_barejid_from_name(args[1]);
+ char *barejid = roster_barejid_from_name(args[1]);
if (barejid) {
jid = jid_create(barejid);
} else {
@@ -8592,8 +8626,8 @@ cmd_omemo_fingerprint(ProfWin* window, const char* const command, gchar** args)
}
}
- GList* fingerprints = omemo_known_device_identities(jid->barejid);
- GList* fingerprint;
+ GList *fingerprints = omemo_known_device_identities(jid->barejid);
+ GList *fingerprint;
if (!fingerprints) {
win_println(window, THEME_DEFAULT, "-", "There is no known fingerprints for %s", jid->barejid);
@@ -8601,7 +8635,7 @@ cmd_omemo_fingerprint(ProfWin* window, const char* const command, gchar** args)
}
for (fingerprint = fingerprints; fingerprint != NULL; fingerprint = fingerprint->next) {
- char* formatted_fingerprint = omemo_format_fingerprint(fingerprint->data);
+ char *formatted_fingerprint = omemo_format_fingerprint(fingerprint->data);
gboolean trusted = omemo_is_trusted_identity(jid->barejid, fingerprint->data);
win_println(window, THEME_DEFAULT, "-", "%s's OMEMO fingerprint: %s%s", jid->barejid, formatted_fingerprint, trusted ? " (trusted)" : "");
@@ -8622,7 +8656,7 @@ cmd_omemo_fingerprint(ProfWin* window, const char* const command, gchar** args)
}
gboolean
-cmd_omemo_trust(ProfWin* window, const char* const command, gchar** args)
+cmd_omemo_trust(ProfWin *window, const char *const command, gchar **args)
{
#ifdef HAVE_OMEMO
if (connection_get_status() != JABBER_CONNECTED) {
@@ -8640,8 +8674,8 @@ cmd_omemo_trust(ProfWin* window, const char* const command, gchar** args)
return TRUE;
}
- char* fingerprint;
- char* barejid;
+ char *fingerprint;
+ char *barejid;
/* Contact not provided */
if (!args[2]) {
@@ -8652,12 +8686,12 @@ cmd_omemo_trust(ProfWin* window, const char* const command, gchar** args)
return TRUE;
}
- ProfChatWin* chatwin = (ProfChatWin*)window;
+ ProfChatWin *chatwin = (ProfChatWin*)window;
assert(chatwin->memcheck == PROFCHATWIN_MEMCHECK);
barejid = chatwin->barejid;
} else {
fingerprint = args[2];
- char* contact = args[1];
+ char *contact = args[1];
barejid = roster_barejid_from_name(contact);
if (barejid == NULL) {
barejid = contact;
@@ -8666,7 +8700,7 @@ cmd_omemo_trust(ProfWin* window, const char* const command, gchar** args)
omemo_trust(barejid, fingerprint);
- char* unformatted_fingerprint = malloc(strlen(fingerprint));
+ char *unformatted_fingerprint = malloc(strlen(fingerprint));
int i;
int j;
for (i = 0, j = 0; fingerprint[i] != '\0'; i++) {
@@ -8691,7 +8725,7 @@ cmd_omemo_trust(ProfWin* window, const char* const command, gchar** args)
}
gboolean
-cmd_omemo_untrust(ProfWin* window, const char* const command, gchar** args)
+cmd_omemo_untrust(ProfWin *window, const char *const command, gchar **args)
{
#ifdef HAVE_OMEMO
if (connection_get_status() != JABBER_CONNECTED) {
@@ -8709,8 +8743,8 @@ cmd_omemo_untrust(ProfWin* window, const char* const command, gchar** args)
return TRUE;
}
- char* fingerprint;
- char* barejid;
+ char *fingerprint;
+ char *barejid;
/* Contact not provided */
if (!args[2]) {
@@ -8721,12 +8755,12 @@ cmd_omemo_untrust(ProfWin* window, const char* const command, gchar** args)
return TRUE;
}
- ProfChatWin* chatwin = (ProfChatWin*)window;
+ ProfChatWin *chatwin = (ProfChatWin*)window;
assert(chatwin->memcheck == PROFCHATWIN_MEMCHECK);
barejid = chatwin->barejid;
} else {
fingerprint = args[2];
- char* contact = args[1];
+ char *contact = args[1];
barejid = roster_barejid_from_name(contact);
if (barejid == NULL) {
barejid = contact;
@@ -8735,7 +8769,7 @@ cmd_omemo_untrust(ProfWin* window, const char* const command, gchar** args)
omemo_untrust(barejid, fingerprint);
- char* unformatted_fingerprint = malloc(strlen(fingerprint));
+ char *unformatted_fingerprint = malloc(strlen(fingerprint));
int i;
int j;
for (i = 0, j = 0; fingerprint[i] != '\0'; i++) {
@@ -8760,7 +8794,7 @@ cmd_omemo_untrust(ProfWin* window, const char* const command, gchar** args)
}
gboolean
-cmd_omemo_clear_device_list(ProfWin* window, const char* const command, gchar** args)
+cmd_omemo_clear_device_list(ProfWin *window, const char *const command, gchar **args)
{
#ifdef HAVE_OMEMO
if (connection_get_status() != JABBER_CONNECTED) {
@@ -8778,18 +8812,20 @@ cmd_omemo_clear_device_list(ProfWin* window, const char* const command, gchar**
}
gboolean
-cmd_omemo_policy(ProfWin* window, const char* const command, gchar** args)
+cmd_omemo_policy(ProfWin *window, const char *const command, gchar **args)
{
#ifdef HAVE_OMEMO
if (args[1] == NULL) {
- char* policy = prefs_get_string(PREF_OMEMO_POLICY);
+ char *policy = prefs_get_string(PREF_OMEMO_POLICY);
cons_show("OMEMO policy is now set to: %s", policy);
g_free(policy);
return TRUE;
}
- char* choice = args[1];
- if ((g_strcmp0(choice, "manual") != 0) && (g_strcmp0(choice, "automatic") != 0) && (g_strcmp0(choice, "always") != 0)) {
+ char *choice = args[1];
+ if ((g_strcmp0(choice, "manual") != 0) &&
+ (g_strcmp0(choice, "automatic") != 0) &&
+ (g_strcmp0(choice, "always") != 0)) {
cons_show("OMEMO policy can be set to: manual, automatic or always.");
return TRUE;
}
@@ -8804,7 +8840,7 @@ cmd_omemo_policy(ProfWin* window, const char* const command, gchar** args)
}
gboolean
-cmd_omemo_sendfile(ProfWin* window, const char* const command, gchar** args)
+cmd_omemo_sendfile(ProfWin *window, const char *const command, gchar **args)
{
#ifdef HAVE_OMEMO
_cmd_set_boolean_preference(args[1], command, "Sending unencrypted files in an OMEMO session via /sendfile", PREF_OMEMO_SENDFILE);
@@ -8817,7 +8853,7 @@ cmd_omemo_sendfile(ProfWin* window, const char* const command, gchar** args)
}
gboolean
-cmd_save(ProfWin* window, const char* const command, gchar** args)
+cmd_save(ProfWin *window, const char *const command, gchar **args)
{
log_info("Saving preferences to configuration file");
cons_show("Saving preferences.");
@@ -8826,7 +8862,7 @@ cmd_save(ProfWin* window, const char* const command, gchar** args)
}
gboolean
-cmd_reload(ProfWin* window, const char* const command, gchar** args)
+cmd_reload(ProfWin *window, const char *const command, gchar **args)
{
log_info("Reloading preferences");
cons_show("Reloading preferences.");
@@ -8835,39 +8871,39 @@ cmd_reload(ProfWin* window, const char* const command, gchar** args)
}
gboolean
-cmd_paste(ProfWin* window, const char* const command, gchar** args)
+cmd_paste(ProfWin *window, const char *const command, gchar **args)
{
#ifdef HAVE_GTK
- char* clipboard_buffer = clipboard_get();
+ char *clipboard_buffer = clipboard_get();
if (clipboard_buffer) {
switch (window->type) {
- case WIN_MUC:
- {
- ProfMucWin* mucwin = (ProfMucWin*)window;
- assert(mucwin->memcheck == PROFMUCWIN_MEMCHECK);
- cl_ev_send_muc_msg(mucwin, clipboard_buffer, NULL);
- break;
- }
- case WIN_CHAT:
- {
- ProfChatWin* chatwin = (ProfChatWin*)window;
- assert(chatwin->memcheck == PROFCHATWIN_MEMCHECK);
- cl_ev_send_msg(chatwin, clipboard_buffer, NULL);
- break;
- }
- case WIN_PRIVATE:
- {
- ProfPrivateWin* privatewin = (ProfPrivateWin*)window;
- assert(privatewin->memcheck == PROFPRIVATEWIN_MEMCHECK);
- cl_ev_send_priv_msg(privatewin, clipboard_buffer, NULL);
- break;
- }
- case WIN_CONSOLE:
- case WIN_XML:
- default:
- cons_bad_cmd_usage(command);
- break;
+ case WIN_MUC:
+ {
+ ProfMucWin *mucwin = (ProfMucWin*)window;
+ assert(mucwin->memcheck == PROFMUCWIN_MEMCHECK);
+ cl_ev_send_muc_msg(mucwin, clipboard_buffer, NULL);
+ break;
+ }
+ case WIN_CHAT:
+ {
+ ProfChatWin *chatwin = (ProfChatWin*)window;
+ assert(chatwin->memcheck == PROFCHATWIN_MEMCHECK);
+ cl_ev_send_msg(chatwin, clipboard_buffer, NULL);
+ break;
+ }
+ case WIN_PRIVATE:
+ {
+ ProfPrivateWin *privatewin = (ProfPrivateWin*)window;
+ assert(privatewin->memcheck == PROFPRIVATEWIN_MEMCHECK);
+ cl_ev_send_priv_msg(privatewin, clipboard_buffer, NULL);
+ break;
+ }
+ case WIN_CONSOLE:
+ case WIN_XML:
+ default:
+ cons_bad_cmd_usage(command);
+ break;
}
free(clipboard_buffer);
@@ -8880,16 +8916,16 @@ cmd_paste(ProfWin* window, const char* const command, gchar** args)
}
gboolean
-cmd_color(ProfWin* window, const char* const command, gchar** args)
+cmd_color(ProfWin *window, const char *const command, gchar **args)
{
if (g_strcmp0(args[0], "on") == 0) {
- prefs_set_string(PREF_COLOR_NICK, "true");
+ prefs_set_string(PREF_COLOR_NICK, "true");
} else if (g_strcmp0(args[0], "off") == 0) {
- prefs_set_string(PREF_COLOR_NICK, "false");
+ prefs_set_string(PREF_COLOR_NICK, "false");
} else if (g_strcmp0(args[0], "redgreen") == 0) {
- prefs_set_string(PREF_COLOR_NICK, "redgreen");
+ prefs_set_string(PREF_COLOR_NICK, "redgreen");
} else if (g_strcmp0(args[0], "blue") == 0) {
- prefs_set_string(PREF_COLOR_NICK, "blue");
+ prefs_set_string(PREF_COLOR_NICK, "blue");
} else if (g_strcmp0(args[0], "own") == 0) {
if (g_strcmp0(args[1], "on") == 0) {
_cmd_set_boolean_preference(args[1], command, "Color generation for own nick", PREF_COLOR_NICK_OWN);
@@ -8901,7 +8937,7 @@ cmd_color(ProfWin* window, const char* const command, gchar** args)
cons_show("Consistent color generation for nicks set to: %s", args[0]);
- char* theme = prefs_get_string(PREF_THEME);
+ char *theme = prefs_get_string(PREF_THEME);
if (theme) {
gboolean res = theme_load(theme, false);
@@ -8918,7 +8954,7 @@ cmd_color(ProfWin* window, const char* const command, gchar** args)
}
gboolean
-cmd_avatar(ProfWin* window, const char* const command, gchar** args)
+cmd_avatar(ProfWin *window, const char *const command, gchar **args)
{
if (args[1] == NULL) {
cons_bad_cmd_usage(command);
@@ -8938,7 +8974,7 @@ cmd_avatar(ProfWin* window, const char* const command, gchar** args)
}
gboolean
-cmd_os(ProfWin* window, const char* const command, gchar** args)
+cmd_os(ProfWin *window, const char *const command, gchar **args)
{
_cmd_set_boolean_preference(args[0], command, "Revealing OS name", PREF_REVEAL_OS);
@@ -8946,7 +8982,7 @@ cmd_os(ProfWin* window, const char* const command, gchar** args)
}
gboolean
-cmd_correction(ProfWin* window, const char* const command, gchar** args)
+cmd_correction(ProfWin *window, const char *const command, gchar **args)
{
// enable/disable
if (g_strcmp0(args[0], "on") == 0) {
@@ -8975,7 +9011,7 @@ cmd_correction(ProfWin* window, const char* const command, gchar** args)
}
gboolean
-cmd_correct(ProfWin* window, const char* const command, gchar** args)
+cmd_correct(ProfWin *window, const char *const command, gchar **args)
{
jabber_conn_status_t conn_status = connection_get_status();
if (conn_status != JABBER_CONNECTED) {
@@ -8989,7 +9025,7 @@ cmd_correct(ProfWin* window, const char* const command, gchar** args)
}
if (window->type == WIN_CHAT) {
- ProfChatWin* chatwin = (ProfChatWin*)window;
+ ProfChatWin *chatwin = (ProfChatWin*)window;
assert(chatwin->memcheck == PROFCHATWIN_MEMCHECK);
if (chatwin->last_msg_id == NULL || chatwin->last_message == NULL) {
@@ -8998,13 +9034,13 @@ cmd_correct(ProfWin* window, const char* const command, gchar** args)
}
// send message again, with replace flag
- gchar* message = g_strjoinv(" ", args);
+ gchar *message = g_strjoinv(" ", args);
cl_ev_send_msg_correct(chatwin, message, FALSE, TRUE);
free(message);
return TRUE;
} else if (window->type == WIN_MUC) {
- ProfMucWin* mucwin = (ProfMucWin*)window;
+ ProfMucWin *mucwin = (ProfMucWin*)window;
assert(mucwin->memcheck == PROFMUCWIN_MEMCHECK);
if (mucwin->last_msg_id == NULL || mucwin->last_message == NULL) {
@@ -9013,7 +9049,7 @@ cmd_correct(ProfWin* window, const char* const command, gchar** args)
}
// send message again, with replace flag
- gchar* message = g_strjoinv(" ", args);
+ gchar *message = g_strjoinv(" ", args);
cl_ev_send_muc_msg_corrected(mucwin, message, FALSE, TRUE);
free(message);
@@ -9025,7 +9061,7 @@ cmd_correct(ProfWin* window, const char* const command, gchar** args)
}
gboolean
-cmd_slashguard(ProfWin* window, const char* const command, gchar** args)
+cmd_slashguard(ProfWin *window, const char *const command, gchar **args)
{
if (args[0] == NULL) {
return FALSE;
@@ -9037,9 +9073,11 @@ cmd_slashguard(ProfWin* window, const char* const command, gchar** args)
}
gboolean
-cmd_url_open(ProfWin* window, const char* const command, gchar** args)
+cmd_url_open(ProfWin *window, const char *const command, gchar **args)
{
- if (window->type != WIN_CHAT && window->type != WIN_MUC && window->type != WIN_PRIVATE) {
+ if (window->type != WIN_CHAT &&
+ window->type != WIN_MUC &&
+ window->type != WIN_PRIVATE) {
cons_show("url open not supported in this window");
return TRUE;
}
@@ -9051,35 +9089,37 @@ cmd_url_open(ProfWin* window, const char* const command, gchar** args)
gboolean require_save = false;
- gchar* fileStart = g_strrstr(args[1], "/");
+ gchar *fileStart = g_strrstr(args[1], "/");
if (fileStart == NULL) {
cons_show("URL '%s' is not valid.", args[1]);
return TRUE;
}
fileStart++;
- if (((char*)(fileStart - 2))[0] == '/' && ((char*)(fileStart - 3))[0] == ':') {
- // If the '/' is last character of the '://' string, there will be no suffix
- // Therefore, it is considered that there is no file name in the URL and
- // fileStart is set to the end of the URL.
- fileStart = args[1] + strlen(args[1]);
+ if (((char*)(fileStart - 2))[0] == '/' &&
+ ((char*)(fileStart - 3))[0] == ':'
+ ){
+ // If the '/' is last character of the '://' string, there will be no suffix
+ // Therefore, it is considered that there is no file name in the URL and
+ // fileStart is set to the end of the URL.
+ fileStart = args[1] + strlen(args[1]);
}
- gchar* suffix = NULL;
- gchar* suffixStart = g_strrstr(fileStart, ".");
+ gchar *suffix = NULL;
+ gchar *suffixStart = g_strrstr(fileStart, ".");
if (suffixStart != NULL) {
suffixStart++;
- gchar* suffixEnd = g_strrstr(suffixStart, "#");
- if (suffixEnd == NULL) {
+ gchar *suffixEnd = g_strrstr(suffixStart, "#");
+ if(suffixEnd == NULL) {
suffix = g_strdup(suffixStart);
} else {
suffix = g_strndup(suffixStart, suffixEnd - suffixStart);
}
}
- gchar** suffix_cmd_pref = prefs_get_string_list_with_option(PREF_URL_OPEN_CMD, NULL);
+ gchar **suffix_cmd_pref = prefs_get_string_list_with_option(PREF_URL_OPEN_CMD, NULL);
if (suffix != NULL) {
- gchar* lowercase_suffix = g_ascii_strdown(suffix, -1);
+ gchar *lowercase_suffix = g_ascii_strdown(suffix, -1);
g_strfreev(suffix_cmd_pref);
suffix_cmd_pref = prefs_get_string_list_with_option(PREF_URL_OPEN_CMD, lowercase_suffix);
g_free(lowercase_suffix);
@@ -9090,21 +9130,21 @@ cmd_url_open(ProfWin* window, const char* const command, gchar** args)
require_save = true;
}
- gchar* suffix_cmd = g_strdup(suffix_cmd_pref[1]);
+ gchar *suffix_cmd = g_strdup(suffix_cmd_pref[1]);
g_strfreev(suffix_cmd_pref);
- gchar* scheme = g_uri_parse_scheme(args[1]);
- if (0 == g_strcmp0(scheme, "aesgcm")) {
+ gchar *scheme = g_uri_parse_scheme(args[1]);
+ if( 0 == g_strcmp0(scheme, "aesgcm")) {
require_save = true;
}
g_free(scheme);
if (require_save) {
- gchar* save_args[] = { "open", args[1], "/tmp/profanity.tmp", NULL };
+ gchar *save_args[] = { "open", args[1], "/tmp/profanity.tmp", NULL};
cmd_url_save(window, command, save_args);
}
- gchar** argv = g_strsplit(suffix_cmd, " ", 0);
+ gchar **argv = g_strsplit(suffix_cmd, " ", 0);
guint num_args = 0;
while (argv[num_args]) {
if (0 == g_strcmp0(argv[num_args], "%u")) {
@@ -9134,9 +9174,11 @@ cmd_url_open(ProfWin* window, const char* const command, gchar** args)
}
gboolean
-cmd_url_save(ProfWin* window, const char* const command, gchar** args)
+cmd_url_save(ProfWin *window, const char *const command, gchar **args)
{
- if (window->type != WIN_CHAT && window->type != WIN_MUC && window->type != WIN_PRIVATE) {
+ if (window->type != WIN_CHAT &&
+ window->type != WIN_MUC &&
+ window->type != WIN_PRIVATE) {
cons_show("url save not supported in this window");
return TRUE;
}
@@ -9146,25 +9188,27 @@ cmd_url_save(ProfWin* window, const char* const command, gchar** args)
return TRUE;
}
- gchar* uri = args[1];
- gchar* target_path = g_strdup(args[2]);
+ gchar *uri = args[1];
+ gchar *target_path = g_strdup(args[2]);
- GFile* file = g_file_new_for_uri(uri);
+ GFile *file = g_file_new_for_uri(uri);
- gchar* target_dir = NULL;
- gchar* base_name = NULL;
+ gchar *target_dir = NULL;
+ gchar *base_name = NULL;
if (target_path == NULL) {
target_dir = g_strdup("./");
base_name = g_file_get_basename(file);
if (0 == g_strcmp0(base_name, ".")) {
- g_free(base_name);
- base_name = g_strdup("saved_url_content.html");
+ g_free(base_name);
+ base_name = g_strdup("saved_url_content.html");
}
target_path = g_strconcat(target_dir, base_name, NULL);
}
- if (g_file_test(target_path, G_FILE_TEST_EXISTS) && g_file_test(target_path, G_FILE_TEST_IS_DIR)) {
+ if (g_file_test(target_path, G_FILE_TEST_EXISTS) &&
+ g_file_test(target_path, G_FILE_TEST_IS_DIR)
+ ) {
target_dir = g_strdup(target_path);
base_name = g_file_get_basename(file);
g_free(target_path);
@@ -9179,7 +9223,8 @@ cmd_url_save(ProfWin* window, const char* const command, gchar** args)
target_dir = g_path_get_dirname(target_path);
}
- if (!g_file_test(target_dir, G_FILE_TEST_EXISTS) || !g_file_test(target_dir, G_FILE_TEST_IS_DIR)) {
+ if (!g_file_test(target_dir, G_FILE_TEST_EXISTS) ||
+ !g_file_test(target_dir, G_FILE_TEST_IS_DIR)) {
cons_show("%s does not exist or is not a directory.", target_dir);
g_free(target_path);
g_free(target_dir);
@@ -9187,7 +9232,7 @@ cmd_url_save(ProfWin* window, const char* const command, gchar** args)
return TRUE;
}
- gchar* scheme = g_uri_parse_scheme(uri);
+ gchar *scheme = g_uri_parse_scheme(uri);
if (scheme == NULL) {
cons_show("URL '%s' is not valid.", uri);
g_free(target_path);
@@ -9196,17 +9241,18 @@ cmd_url_save(ProfWin* window, const char* const command, gchar** args)
return TRUE;
}
- gchar* scheme_cmd = NULL;
+ gchar *scheme_cmd = NULL;
if (0 == g_strcmp0(scheme, "http")
|| 0 == g_strcmp0(scheme, "https")
- || 0 == g_strcmp0(scheme, "aesgcm")) {
+ || 0 == g_strcmp0(scheme, "aesgcm")
+ ) {
scheme_cmd = prefs_get_string_with_option(PREF_URL_SAVE_CMD, scheme);
}
g_free(scheme);
- gchar** argv = g_strsplit(scheme_cmd, " ", 0);
+ gchar **argv = g_strsplit(scheme_cmd, " ", 0);
g_free(scheme_cmd);
guint num_args = 0;
@@ -9235,7 +9281,7 @@ cmd_url_save(ProfWin* window, const char* const command, gchar** args)
}
gboolean
-cmd_executable(ProfWin* window, const char* const command, gchar** args)
+cmd_executable(ProfWin *window, const char *const command, gchar **args)
{
if (g_strcmp0(args[0], "avatar") == 0) {
prefs_set_string(PREF_AVATAR_CMD, args[1]);
@@ -9246,8 +9292,8 @@ cmd_executable(ProfWin* window, const char* const command, gchar** args)
return TRUE;
}
- gchar* str = g_strjoinv(" ", &args[3]);
- const gchar* const list[] = { args[2], str, NULL };
+ gchar *str = g_strjoinv(" ", &args[3]);
+ const gchar* const list[] = {args[2], str, NULL};
prefs_set_string_list_with_option(PREF_URL_OPEN_CMD, args[1], list);
cons_show("`url open` command set to: %s for %s files", str, args[1]);
g_free(str);
@@ -9257,7 +9303,7 @@ cmd_executable(ProfWin* window, const char* const command, gchar** args)
return TRUE;
}
- gchar* str = g_strjoinv(" ", &args[2]);
+ gchar *str = g_strjoinv(" ", &args[2]);
prefs_set_string_with_option(PREF_URL_SAVE_CMD, args[1], str);
cons_show("`url save` command set to: %s for scheme %s", str, args[1]);
g_free(str);
diff --git a/src/command/cmd_funcs.h b/src/command/cmd_funcs.h
index 30059fc2..955a2e39 100644
--- a/src/command/cmd_funcs.h
+++ b/src/command/cmd_funcs.h
@@ -40,13 +40,12 @@
#include "ui/win_types.h"
// Command help strings
-typedef struct cmd_help_t
-{
- gchar* tags[20];
- gchar* synopsis[50];
- gchar* desc;
- gchar* args[128][2];
- gchar* examples[20];
+typedef struct cmd_help_t {
+ gchar *tags[20];
+ gchar *synopsis[50];
+ gchar *desc;
+ gchar *args[128][2];
+ gchar *examples[20];
} CommandHelp;
/*
@@ -61,184 +60,184 @@ typedef struct cmd_help_t
* func - Main function to call when no arguments, or sub_funcs not implemented
* help - A help struct containing usage info etc
*/
-typedef struct cmd_t
-{
- gchar* cmd;
- gchar** (*parser)(const char* const inp, int min, int max, gboolean* result);
+typedef struct cmd_t {
+ gchar *cmd;
+ gchar** (*parser)(const char *const inp, int min, int max, gboolean *result);
int min_args;
int max_args;
void (*setting_func)(void);
- void* sub_funcs[50][2];
- gboolean (*func)(ProfWin* window, const char* const command, gchar** args);
+ void *sub_funcs[50][2];
+ gboolean (*func)(ProfWin *window, const char *const command, gchar **args);
CommandHelp help;
} Command;
-gboolean cmd_process_input(ProfWin* window, char* inp);
-void cmd_execute_connect(ProfWin* window, const char* const account);
-
-gboolean cmd_about(ProfWin* window, const char* const command, gchar** args);
-gboolean cmd_autoaway(ProfWin* window, const char* const command, gchar** args);
-gboolean cmd_autoconnect(ProfWin* window, const char* const command, gchar** args);
-gboolean cmd_autoping(ProfWin* window, const char* const command, gchar** args);
-gboolean cmd_beep(ProfWin* window, const char* const command, gchar** args);
-gboolean cmd_caps(ProfWin* window, const char* const command, gchar** args);
-gboolean cmd_logging(ProfWin* window, const char* const command, gchar** args);
-gboolean cmd_clear(ProfWin* window, const char* const command, gchar** args);
-gboolean cmd_close(ProfWin* window, const char* const command, gchar** args);
-gboolean cmd_connect(ProfWin* window, const char* const command, gchar** args);
-gboolean cmd_disco(ProfWin* window, const char* const command, gchar** args);
-gboolean cmd_sendfile(ProfWin* window, const char* const command, gchar** args);
-gboolean cmd_lastactivity(ProfWin* window, const char* const command, gchar** args);
-gboolean cmd_disconnect(ProfWin* window, const char* const command, gchar** args);
-gboolean cmd_flash(ProfWin* window, const char* const command, gchar** args);
-gboolean cmd_tray(ProfWin* window, const char* const command, gchar** args);
-gboolean cmd_gone(ProfWin* window, const char* const command, gchar** args);
-gboolean cmd_group(ProfWin* window, const char* const command, gchar** args);
-gboolean cmd_help(ProfWin* window, const char* const command, gchar** args);
-gboolean cmd_history(ProfWin* window, const char* const command, gchar** args);
-gboolean cmd_carbons(ProfWin* window, const char* const command, gchar** args);
-gboolean cmd_receipts(ProfWin* window, const char* const command, gchar** args);
-gboolean cmd_info(ProfWin* window, const char* const command, gchar** args);
-gboolean cmd_intype(ProfWin* window, const char* const command, gchar** args);
-gboolean cmd_invite(ProfWin* window, const char* const command, gchar** args);
-gboolean cmd_join(ProfWin* window, const char* const command, gchar** args);
-gboolean cmd_leave(ProfWin* window, const char* const command, gchar** args);
-gboolean cmd_log(ProfWin* window, const char* const command, gchar** args);
-gboolean cmd_msg(ProfWin* window, const char* const command, gchar** args);
-gboolean cmd_nick(ProfWin* window, const char* const command, gchar** args);
-gboolean cmd_notify(ProfWin* window, const char* const command, gchar** args);
-gboolean cmd_pgp(ProfWin* window, const char* const command, gchar** args);
+
+gboolean cmd_process_input(ProfWin *window, char *inp);
+void cmd_execute_connect(ProfWin *window, const char *const account);
+
+gboolean cmd_about(ProfWin *window, const char *const command, gchar **args);
+gboolean cmd_autoaway(ProfWin *window, const char *const command, gchar **args);
+gboolean cmd_autoconnect(ProfWin *window, const char *const command, gchar **args);
+gboolean cmd_autoping(ProfWin *window, const char *const command, gchar **args);
+gboolean cmd_beep(ProfWin *window, const char *const command, gchar **args);
+gboolean cmd_caps(ProfWin *window, const char *const command, gchar **args);
+gboolean cmd_logging(ProfWin *window, const char *const command, gchar **args);
+gboolean cmd_clear(ProfWin *window, const char *const command, gchar **args);
+gboolean cmd_close(ProfWin *window, const char *const command, gchar **args);
+gboolean cmd_connect(ProfWin *window, const char *const command, gchar **args);
+gboolean cmd_disco(ProfWin *window, const char *const command, gchar **args);
+gboolean cmd_sendfile(ProfWin *window, const char *const command, gchar **args);
+gboolean cmd_lastactivity(ProfWin *window, const char *const command, gchar **args);
+gboolean cmd_disconnect(ProfWin *window, const char *const command, gchar **args);
+gboolean cmd_flash(ProfWin *window, const char *const command, gchar **args);
+gboolean cmd_tray(ProfWin *window, const char *const command, gchar **args);
+gboolean cmd_gone(ProfWin *window, const char *const command, gchar **args);
+gboolean cmd_group(ProfWin *window, const char *const command, gchar **args);
+gboolean cmd_help(ProfWin *window, const char *const command, gchar **args);
+gboolean cmd_history(ProfWin *window, const char *const command, gchar **args);
+gboolean cmd_carbons(ProfWin *window, const char *const command, gchar **args);
+gboolean cmd_receipts(ProfWin *window, const char *const command, gchar **args);
+gboolean cmd_info(ProfWin *window, const char *const command, gchar **args);
+gboolean cmd_intype(ProfWin *window, const char *const command, gchar **args);
+gboolean cmd_invite(ProfWin *window, const char *const command, gchar **args);
+gboolean cmd_join(ProfWin *window, const char *const command, gchar **args);
+gboolean cmd_leave(ProfWin *window, const char *const command, gchar **args);
+gboolean cmd_log(ProfWin *window, const char *const command, gchar **args);
+gboolean cmd_msg(ProfWin *window, const char *const command, gchar **args);
+gboolean cmd_nick(ProfWin *window, const char *const command, gchar **args);
+gboolean cmd_notify(ProfWin *window, const char *const command, gchar **args);
+gboolean cmd_pgp(ProfWin *window, const char *const command, gchar **args);
#ifdef HAVE_LIBGPGME
-gboolean cmd_ox(ProfWin* window, const char* const command, gchar** args);
+gboolean cmd_ox(ProfWin *window, const char *const command, gchar **args);
#endif // HAVE_LIBGPGME
-gboolean cmd_outtype(ProfWin* window, const char* const command, gchar** args);
-gboolean cmd_prefs(ProfWin* window, const char* const command, gchar** args);
-gboolean cmd_priority(ProfWin* window, const char* const command, gchar** args);
-gboolean cmd_quit(ProfWin* window, const char* const command, gchar** args);
-gboolean cmd_reconnect(ProfWin* window, const char* const command, gchar** args);
-gboolean cmd_room(ProfWin* window, const char* const command, gchar** args);
-gboolean cmd_rooms(ProfWin* window, const char* const command, gchar** args);
-gboolean cmd_bookmark(ProfWin* window, const char* const command, gchar** args);
-gboolean cmd_bookmark_ignore(ProfWin* window, const char* const command, gchar** args);
-gboolean cmd_roster(ProfWin* window, const char* const command, gchar** args);
-gboolean cmd_software(ProfWin* window, const char* const command, gchar** args);
-gboolean cmd_splash(ProfWin* window, const char* const command, gchar** args);
-gboolean cmd_states(ProfWin* window, const char* const command, gchar** args);
-gboolean cmd_status_get(ProfWin* window, const char* const command, gchar** args);
-gboolean cmd_status_set(ProfWin* window, const char* const command, gchar** args);
-gboolean cmd_sub(ProfWin* window, const char* const command, gchar** args);
-gboolean cmd_theme(ProfWin* window, const char* const command, gchar** args);
-gboolean cmd_tiny(ProfWin* window, const char* const command, gchar** args);
-gboolean cmd_wintitle(ProfWin* window, const char* const command, gchar** args);
-gboolean cmd_vercheck(ProfWin* window, const char* const command, gchar** args);
-gboolean cmd_who(ProfWin* window, const char* const command, gchar** args);
-gboolean cmd_win(ProfWin* window, const char* const command, gchar** args);
-gboolean cmd_alias(ProfWin* window, const char* const command, gchar** args);
-gboolean cmd_xmlconsole(ProfWin* window, const char* const command, gchar** args);
-gboolean cmd_ping(ProfWin* window, const char* const command, gchar** args);
-gboolean cmd_form(ProfWin* window, const char* const command, gchar** args);
-gboolean cmd_occupants(ProfWin* window, const char* const command, gchar** args);
-gboolean cmd_kick(ProfWin* window, const char* const command, gchar** args);
-gboolean cmd_ban(ProfWin* window, const char* const command, gchar** args);
-gboolean cmd_subject(ProfWin* window, const char* const command, gchar** args);
-gboolean cmd_affiliation(ProfWin* window, const char* const command, gchar** args);
-gboolean cmd_role(ProfWin* window, const char* const command, gchar** args);
-gboolean cmd_privileges(ProfWin* window, const char* const command, gchar** args);
-gboolean cmd_presence(ProfWin* window, const char* const command, gchar** args);
-gboolean cmd_wrap(ProfWin* window, const char* const command, gchar** args);
-gboolean cmd_time(ProfWin* window, const char* const command, gchar** args);
-gboolean cmd_resource(ProfWin* window, const char* const command, gchar** args);
-gboolean cmd_inpblock(ProfWin* window, const char* const command, gchar** args);
-gboolean cmd_titlebar(ProfWin* window, const char* const command, gchar** args);
-gboolean cmd_titlebar_show_hide(ProfWin* window, const char* const command, gchar** args);
-gboolean cmd_mainwin(ProfWin* window, const char* const command, gchar** args);
-gboolean cmd_statusbar(ProfWin* window, const char* const command, gchar** args);
-gboolean cmd_inputwin(ProfWin* window, const char* const command, gchar** args);
-gboolean cmd_script(ProfWin* window, const char* const command, gchar** args);
-gboolean cmd_export(ProfWin* window, const char* const command, gchar** args);
-gboolean cmd_charset(ProfWin* window, const char* const command, gchar** args);
-gboolean cmd_console(ProfWin* window, const char* const command, gchar** args);
-gboolean cmd_command_list(ProfWin* window, const char* const command, gchar** args);
-gboolean cmd_command_exec(ProfWin* window, const char* const command, gchar** args);
-
-gboolean cmd_plugins(ProfWin* window, const char* const command, gchar** args);
-gboolean cmd_plugins_sourcepath(ProfWin* window, const char* const command, gchar** args);
-gboolean cmd_plugins_install(ProfWin* window, const char* const command, gchar** args);
-gboolean cmd_plugins_update(ProfWin* window, const char* const command, gchar** args);
-gboolean cmd_plugins_uninstall(ProfWin* window, const char* const command, gchar** args);
-gboolean cmd_plugins_load(ProfWin* window, const char* const command, gchar** args);
-gboolean cmd_plugins_unload(ProfWin* window, const char* const command, gchar** args);
-gboolean cmd_plugins_reload(ProfWin* window, const char* const command, gchar** args);
-gboolean cmd_plugins_python_version(ProfWin* window, const char* const command, gchar** args);
-
-gboolean cmd_blocked(ProfWin* window, const char* const command, gchar** args);
-
-gboolean cmd_account(ProfWin* window, const char* const command, gchar** args);
-gboolean cmd_account_list(ProfWin* window, const char* const command, gchar** args);
-gboolean cmd_account_show(ProfWin* window, const char* const command, gchar** args);
-gboolean cmd_account_add(ProfWin* window, const char* const command, gchar** args);
-gboolean cmd_account_remove(ProfWin* window, const char* const command, gchar** args);
-gboolean cmd_account_enable(ProfWin* window, const char* const command, gchar** args);
-gboolean cmd_account_disable(ProfWin* window, const char* const command, gchar** args);
-gboolean cmd_account_rename(ProfWin* window, const char* const command, gchar** args);
-gboolean cmd_account_default(ProfWin* window, const char* const command, gchar** args);
-gboolean cmd_account_set(ProfWin* window, const char* const command, gchar** args);
-gboolean cmd_account_clear(ProfWin* window, const char* const command, gchar** args);
-
-gboolean cmd_tls_certpath(ProfWin* window, const char* const command, gchar** args);
-gboolean cmd_tls_trust(ProfWin* window, const char* const command, gchar** args);
-gboolean cmd_tls_trusted(ProfWin* window, const char* const command, gchar** args);
-gboolean cmd_tls_revoke(ProfWin* window, const char* const command, gchar** args);
-gboolean cmd_tls_cert(ProfWin* window, const char* const command, gchar** args);
-
-gboolean cmd_otr_char(ProfWin* window, const char* const command, gchar** args);
-gboolean cmd_otr_log(ProfWin* window, const char* const command, gchar** args);
-gboolean cmd_otr_libver(ProfWin* window, const char* const command, gchar** args);
-gboolean cmd_otr_policy(ProfWin* window, const char* const command, gchar** args);
-gboolean cmd_otr_gen(ProfWin* window, const char* const command, gchar** args);
-gboolean cmd_otr_myfp(ProfWin* window, const char* const command, gchar** args);
-gboolean cmd_otr_theirfp(ProfWin* window, const char* const command, gchar** args);
-gboolean cmd_otr_start(ProfWin* window, const char* const command, gchar** args);
-gboolean cmd_otr_end(ProfWin* window, const char* const command, gchar** args);
-gboolean cmd_otr_trust(ProfWin* window, const char* const command, gchar** args);
-gboolean cmd_otr_untrust(ProfWin* window, const char* const command, gchar** args);
-gboolean cmd_otr_secret(ProfWin* window, const char* const command, gchar** args);
-gboolean cmd_otr_question(ProfWin* window, const char* const command, gchar** args);
-gboolean cmd_otr_answer(ProfWin* window, const char* const command, gchar** args);
-gboolean cmd_otr_sendfile(ProfWin* window, const char* const command, gchar** args);
-
-gboolean cmd_wins(ProfWin* window, const char* const command, gchar** args);
-gboolean cmd_wins_unread(ProfWin* window, const char* const command, gchar** args);
-gboolean cmd_wins_prune(ProfWin* window, const char* const command, gchar** args);
-gboolean cmd_wins_swap(ProfWin* window, const char* const command, gchar** args);
-
-gboolean cmd_form_field(ProfWin* window, char* tag, gchar** args);
-
-gboolean cmd_omemo_gen(ProfWin* window, const char* const command, gchar** args);
-gboolean cmd_omemo_char(ProfWin* window, const char* const command, gchar** args);
-gboolean cmd_omemo_log(ProfWin* window, const char* const command, gchar** args);
-gboolean cmd_omemo_start(ProfWin* window, const char* const command, gchar** args);
-gboolean cmd_omemo_end(ProfWin* window, const char* const command, gchar** args);
-gboolean cmd_omemo_fingerprint(ProfWin* window, const char* const command, gchar** args);
-gboolean cmd_omemo_trust(ProfWin* window, const char* const command, gchar** args);
-gboolean cmd_omemo_untrust(ProfWin* window, const char* const command, gchar** args);
-gboolean cmd_omemo_policy(ProfWin* window, const char* const command, gchar** args);
-gboolean cmd_omemo_clear_device_list(ProfWin* window, const char* const command, gchar** args);
-gboolean cmd_omemo_sendfile(ProfWin* window, const char* const command, gchar** args);
-
-gboolean cmd_save(ProfWin* window, const char* const command, gchar** args);
-gboolean cmd_reload(ProfWin* window, const char* const command, gchar** args);
-
-gboolean cmd_paste(ProfWin* window, const char* const command, gchar** args);
-gboolean cmd_color(ProfWin* window, const char* const command, gchar** args);
-gboolean cmd_avatar(ProfWin* window, const char* const command, gchar** args);
-gboolean cmd_os(ProfWin* window, const char* const command, gchar** args);
-gboolean cmd_correction(ProfWin* window, const char* const command, gchar** args);
-gboolean cmd_correct(ProfWin* window, const char* const command, gchar** args);
-gboolean cmd_slashguard(ProfWin* window, const char* const command, gchar** args);
-gboolean cmd_serversoftware(ProfWin* window, const char* const command, gchar** args);
-gboolean cmd_url_open(ProfWin* window, const char* const command, gchar** args);
-gboolean cmd_url_save(ProfWin* window, const char* const command, gchar** args);
-gboolean cmd_executable(ProfWin* window, const char* const command, gchar** args);
+gboolean cmd_outtype(ProfWin *window, const char *const command, gchar **args);
+gboolean cmd_prefs(ProfWin *window, const char *const command, gchar **args);
+gboolean cmd_priority(ProfWin *window, const char *const command, gchar **args);
+gboolean cmd_quit(ProfWin *window, const char *const command, gchar **args);
+gboolean cmd_reconnect(ProfWin *window, const char *const command, gchar **args);
+gboolean cmd_room(ProfWin *window, const char *const command, gchar **args);
+gboolean cmd_rooms(ProfWin *window, const char *const command, gchar **args);
+gboolean cmd_bookmark(ProfWin *window, const char *const command, gchar **args);
+gboolean cmd_bookmark_ignore(ProfWin *window, const char *const command, gchar **args);
+gboolean cmd_roster(ProfWin *window, const char *const command, gchar **args);
+gboolean cmd_software(ProfWin *window, const char *const command, gchar **args);
+gboolean cmd_splash(ProfWin *window, const char *const command, gchar **args);
+gboolean cmd_states(ProfWin *window, const char *const command, gchar **args);
+gboolean cmd_status_get(ProfWin *window, const char *const command, gchar **args);
+gboolean cmd_status_set(ProfWin *window, const char *const command, gchar **args);
+gboolean cmd_sub(ProfWin *window, const char *const command, gchar **args);
+gboolean cmd_theme(ProfWin *window, const char *const command, gchar **args);
+gboolean cmd_tiny(ProfWin *window, const char *const command, gchar **args);
+gboolean cmd_wintitle(ProfWin *window, const char *const command, gchar **args);
+gboolean cmd_vercheck(ProfWin *window, const char *const command, gchar **args);
+gboolean cmd_who(ProfWin *window, const char *const command, gchar **args);
+gboolean cmd_win(ProfWin *window, const char *const command, gchar **args);
+gboolean cmd_alias(ProfWin *window, const char *const command, gchar **args);
+gboolean cmd_xmlconsole(ProfWin *window, const char *const command, gchar **args);
+gboolean cmd_ping(ProfWin *window, const char *const command, gchar **args);
+gboolean cmd_form(ProfWin *window, const char *const command, gchar **args);
+gboolean cmd_occupants(ProfWin *window, const char *const command, gchar **args);
+gboolean cmd_kick(ProfWin *window, const char *const command, gchar **args);
+gboolean cmd_ban(ProfWin *window, const char *const command, gchar **args);
+gboolean cmd_subject(ProfWin *window, const char *const command, gchar **args);
+gboolean cmd_affiliation(ProfWin *window, const char *const command, gchar **args);
+gboolean cmd_role(ProfWin *window, const char *const command, gchar **args);
+gboolean cmd_privileges(ProfWin *window, const char *const command, gchar **args);
+gboolean cmd_presence(ProfWin *window, const char *const command, gchar **args);
+gboolean cmd_wrap(ProfWin *window, const char *const command, gchar **args);
+gboolean cmd_time(ProfWin *window, const char *const command, gchar **args);
+gboolean cmd_resource(ProfWin *window, const char *const command, gchar **args);
+gboolean cmd_inpblock(ProfWin *window, const char *const command, gchar **args);
+gboolean cmd_titlebar(ProfWin *window, const char *const command, gchar **args);
+gboolean cmd_titlebar_show_hide(ProfWin *window, const char *const command, gchar **args);
+gboolean cmd_mainwin(ProfWin *window, const char *const command, gchar **args);
+gboolean cmd_statusbar(ProfWin *window, const char *const command, gchar **args);
+gboolean cmd_inputwin(ProfWin *window, const char *const command, gchar **args);
+gboolean cmd_script(ProfWin *window, const char *const command, gchar **args);
+gboolean cmd_export(ProfWin *window, const char *const command, gchar **args);
+gboolean cmd_charset(ProfWin *window, const char *const command, gchar **args);
+gboolean cmd_console(ProfWin *window, const char *const command, gchar **args);
+gboolean cmd_command_list(ProfWin *window, const char *const command, gchar **args);
+gboolean cmd_command_exec(ProfWin *window, const char *const command, gchar **args);
+
+gboolean cmd_plugins(ProfWin *window, const char *const command, gchar **args);
+gboolean cmd_plugins_sourcepath(ProfWin *window, const char *const command, gchar **args);
+gboolean cmd_plugins_install(ProfWin *window, const char *const command, gchar **args);
+gboolean cmd_plugins_update(ProfWin *window, const char *const command, gchar **args);
+gboolean cmd_plugins_uninstall(ProfWin *window, const char *const command, gchar **args);
+gboolean cmd_plugins_load(ProfWin *window, const char *const command, gchar **args);
+gboolean cmd_plugins_unload(ProfWin *window, const char *const command, gchar **args);
+gboolean cmd_plugins_reload(ProfWin *window, const char *const command, gchar **args);
+gboolean cmd_plugins_python_version(ProfWin *window, const char *const command, gchar **args);
+
+gboolean cmd_blocked(ProfWin *window, const char *const command, gchar **args);
+
+gboolean cmd_account(ProfWin *window, const char *const command, gchar **args);
+gboolean cmd_account_list(ProfWin *window, const char *const command, gchar **args);
+gboolean cmd_account_show(ProfWin *window, const char *const command, gchar **args);
+gboolean cmd_account_add(ProfWin *window, const char *const command, gchar **args);
+gboolean cmd_account_remove(ProfWin *window, const char *const command, gchar **args);
+gboolean cmd_account_enable(ProfWin *window, const char *const command, gchar **args);
+gboolean cmd_account_disable(ProfWin *window, const char *const command, gchar **args);
+gboolean cmd_account_rename(ProfWin *window, const char *const command, gchar **args);
+gboolean cmd_account_default(ProfWin *window, const char *const command, gchar **args);
+gboolean cmd_account_set(ProfWin *window, const char *const command, gchar **args);
+gboolean cmd_account_clear(ProfWin *window, const char *const command, gchar **args);
+
+gboolean cmd_tls_certpath(ProfWin *window, const char *const command, gchar **args);
+gboolean cmd_tls_trust(ProfWin *window, const char *const command, gchar **args);
+gboolean cmd_tls_trusted(ProfWin *window, const char *const command, gchar **args);
+gboolean cmd_tls_revoke(ProfWin *window, const char *const command, gchar **args);
+gboolean cmd_tls_cert(ProfWin *window, const char *const command, gchar **args);
+
+gboolean cmd_otr_char(ProfWin *window, const char *const command, gchar **args);
+gboolean cmd_otr_log(ProfWin *window, const char *const command, gchar **args);
+gboolean cmd_otr_libver(ProfWin *window, const char *const command, gchar **args);
+gboolean cmd_otr_policy(ProfWin *window, const char *const command, gchar **args);
+gboolean cmd_otr_gen(ProfWin *window, const char *const command, gchar **args);
+gboolean cmd_otr_myfp(ProfWin *window, const char *const command, gchar **args);
+gboolean cmd_otr_theirfp(ProfWin *window, const char *const command, gchar **args);
+gboolean cmd_otr_start(ProfWin *window, const char *const command, gchar **args);
+gboolean cmd_otr_end(ProfWin *window, const char *const command, gchar **args);
+gboolean cmd_otr_trust(ProfWin *window, const char *const command, gchar **args);
+gboolean cmd_otr_untrust(ProfWin *window, const char *const command, gchar **args);
+gboolean cmd_otr_secret(ProfWin *window, const char *const command, gchar **args);
+gboolean cmd_otr_question(ProfWin *window, const char *const command, gchar **args);
+gboolean cmd_otr_answer(ProfWin *window, const char *const command, gchar **args);
+gboolean cmd_otr_sendfile(ProfWin *window, const char *const command, gchar **args);
+
+gboolean cmd_wins(ProfWin *window, const char *const command, gchar **args);
+gboolean cmd_wins_unread(ProfWin *window, const char *const command, gchar **args);
+gboolean cmd_wins_prune(ProfWin *window, const char *const command, gchar **args);
+gboolean cmd_wins_swap(ProfWin *window, const char *const command, gchar **args);
+
+gboolean cmd_form_field(ProfWin *window, char *tag, gchar **args);
+
+gboolean cmd_omemo_gen(ProfWin *window, const char *const command, gchar **args);
+gboolean cmd_omemo_char(ProfWin *window, const char *const command, gchar **args);
+gboolean cmd_omemo_log(ProfWin *window, const char *const command, gchar **args);
+gboolean cmd_omemo_start(ProfWin *window, const char *const command, gchar **args);
+gboolean cmd_omemo_end(ProfWin *window, const char *const command, gchar **args);
+gboolean cmd_omemo_fingerprint(ProfWin *window, const char *const command, gchar **args);
+gboolean cmd_omemo_trust(ProfWin *window, const char *const command, gchar **args);
+gboolean cmd_omemo_untrust(ProfWin *window, const char *const command, gchar **args);
+gboolean cmd_omemo_policy(ProfWin *window, const char *const command, gchar **args);
+gboolean cmd_omemo_clear_device_list(ProfWin *window, const char *const command, gchar **args);
+gboolean cmd_omemo_sendfile(ProfWin *window, const char *const command, gchar **args);
+
+gboolean cmd_save(ProfWin *window, const char *const command, gchar **args);
+gboolean cmd_reload(ProfWin *window, const char *const command, gchar **args);
+
+gboolean cmd_paste(ProfWin *window, const char *const command, gchar **args);
+gboolean cmd_color(ProfWin *window, const char *const command, gchar **args);
+gboolean cmd_avatar(ProfWin *window, const char *const command, gchar **args);
+gboolean cmd_os(ProfWin *window, const char *const command, gchar **args);
+gboolean cmd_correction(ProfWin *window, const char *const command, gchar **args);
+gboolean cmd_correct(ProfWin *window, const char *const command, gchar **args);
+gboolean cmd_slashguard(ProfWin *window, const char *const command, gchar **args);
+gboolean cmd_serversoftware(ProfWin *window, const char *const command, gchar **args);
+gboolean cmd_url_open(ProfWin *window, const char *const command, gchar **args);
+gboolean cmd_url_save(ProfWin *window, const char *const command, gchar **args);
+gboolean cmd_executable(ProfWin *window, const char *const command, gchar **args);
#endif