mirror of
https://github.com/profanity-im/profanity.git
synced 2024-12-04 14:46:46 -05:00
Merge branch 'master' into osx-functional
This commit is contained in:
commit
57886c347a
10
Makefile.am
10
Makefile.am
@ -30,8 +30,9 @@ core_sources = \
|
|||||||
src/ui/privwin.c \
|
src/ui/privwin.c \
|
||||||
src/ui/mucconfwin.c \
|
src/ui/mucconfwin.c \
|
||||||
src/ui/xmlwin.c \
|
src/ui/xmlwin.c \
|
||||||
src/command/command.h src/command/command.c \
|
src/command/cmd_defs.h src/command/cmd_defs.c \
|
||||||
src/command/commands.h src/command/commands.c \
|
src/command/cmd_funcs.h src/command/cmd_funcs.c \
|
||||||
|
src/command/cmd_ac.h src/command/cmd_ac.c \
|
||||||
src/tools/parser.c \
|
src/tools/parser.c \
|
||||||
src/tools/parser.h \
|
src/tools/parser.h \
|
||||||
src/tools/http_upload.c \
|
src/tools/http_upload.c \
|
||||||
@ -67,8 +68,9 @@ unittest_sources = \
|
|||||||
src/ui/ui.h \
|
src/ui/ui.h \
|
||||||
src/otr/otr.h \
|
src/otr/otr.h \
|
||||||
src/pgp/gpg.h \
|
src/pgp/gpg.h \
|
||||||
src/command/command.h src/command/command.c \
|
src/command/cmd_defs.h src/command/cmd_defs.c \
|
||||||
src/command/commands.h src/command/commands.c \
|
src/command/cmd_funcs.h src/command/cmd_funcs.c \
|
||||||
|
src/command/cmd_ac.h src/command/cmd_ac.c \
|
||||||
src/tools/parser.c \
|
src/tools/parser.c \
|
||||||
src/tools/parser.h \
|
src/tools/parser.h \
|
||||||
src/tools/p_sha1.h src/tools/p_sha1.c \
|
src/tools/p_sha1.h src/tools/p_sha1.c \
|
||||||
|
2918
src/command/cmd_ac.c
Normal file
2918
src/command/cmd_ac.c
Normal file
File diff suppressed because it is too large
Load Diff
62
src/command/cmd_ac.h
Normal file
62
src/command/cmd_ac.h
Normal file
@ -0,0 +1,62 @@
|
|||||||
|
/*
|
||||||
|
* cmd_ac.h
|
||||||
|
*
|
||||||
|
* Copyright (C) 2012 - 2016 James Booth <boothj5@gmail.com>
|
||||||
|
*
|
||||||
|
* This file is part of Profanity.
|
||||||
|
*
|
||||||
|
* Profanity is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* Profanity is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with Profanity. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
|
* In addition, as a special exception, the copyright holders give permission to
|
||||||
|
* link the code of portions of this program with the OpenSSL library under
|
||||||
|
* certain conditions as described in each individual source file, and
|
||||||
|
* distribute linked combinations including the two.
|
||||||
|
*
|
||||||
|
* You must obey the GNU General Public License in all respects for all of the
|
||||||
|
* code used other than OpenSSL. If you modify file(s) with this exception, you
|
||||||
|
* may extend this exception to your version of the file(s), but you are not
|
||||||
|
* obligated to do so. If you do not wish to do so, delete this exception
|
||||||
|
* statement from your version. If you delete this exception statement from all
|
||||||
|
* source files in the program, then also delete it here.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef CMD_AC_H
|
||||||
|
#define CMD_AC_H
|
||||||
|
|
||||||
|
#include "config/preferences.h"
|
||||||
|
#include "command/cmd_funcs.h"
|
||||||
|
|
||||||
|
void cmd_ac_init(void);
|
||||||
|
void cmd_ac_uninit(void);
|
||||||
|
|
||||||
|
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_alias_value(char *value);
|
||||||
|
|
||||||
|
gboolean cmd_ac_exists(char *cmd);
|
||||||
|
|
||||||
|
void cmd_ac_add_form_fields(DataForm *form);
|
||||||
|
void cmd_ac_remove_form_fields(DataForm *form);
|
||||||
|
|
||||||
|
char* cmd_ac_complete(ProfWin *window, const char *const input);
|
||||||
|
|
||||||
|
void cmd_ac_reset(ProfWin *window);
|
||||||
|
|
||||||
|
#endif
|
2367
src/command/cmd_defs.c
Normal file
2367
src/command/cmd_defs.c
Normal file
File diff suppressed because it is too large
Load Diff
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* command.h
|
* cmd_defs.h
|
||||||
*
|
*
|
||||||
* Copyright (C) 2012 - 2016 James Booth <boothj5@gmail.com>
|
* Copyright (C) 2012 - 2016 James Booth <boothj5@gmail.com>
|
||||||
*
|
*
|
||||||
@ -32,43 +32,20 @@
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef COMMAND_H
|
#ifndef CMD_DEFS_H
|
||||||
#define COMMAND_H
|
#define CMD_DEFS_H
|
||||||
|
|
||||||
#include <glib.h>
|
#include <glib.h>
|
||||||
|
|
||||||
#include "ui/ui.h"
|
#include "ui/ui.h"
|
||||||
|
|
||||||
GHashTable *commands;
|
|
||||||
|
|
||||||
void cmd_init(void);
|
void cmd_init(void);
|
||||||
void cmd_uninit(void);
|
void cmd_uninit(void);
|
||||||
|
|
||||||
char* cmd_autocomplete(ProfWin *window, const char *const input);
|
Command* cmd_get(const char *const command);
|
||||||
void cmd_reset_autocomplete(ProfWin *window);
|
GList* cmd_get_ordered(const char *const tag);
|
||||||
void cmd_help_autocomplete_add(const char *const value);
|
|
||||||
void cmd_autocomplete_add(const char *const value);
|
|
||||||
void cmd_autocomplete_remove(const char *const value);
|
|
||||||
void cmd_autocomplete_add_form_fields(DataForm *form);
|
|
||||||
void cmd_autocomplete_remove_form_fields(DataForm *form);
|
|
||||||
void cmd_alias_add(char *value);
|
|
||||||
void cmd_alias_remove(char *value);
|
|
||||||
|
|
||||||
gboolean cmd_valid_tag(const char *const str);
|
gboolean cmd_valid_tag(const char *const str);
|
||||||
gboolean cmd_has_tag(Command *pcmd, const char *const tag);
|
|
||||||
|
|
||||||
gboolean cmd_process_input(ProfWin *window, char *inp);
|
|
||||||
void cmd_execute_connect(ProfWin *window, const char *const account);
|
|
||||||
|
|
||||||
gboolean cmd_exists(char *cmd);
|
|
||||||
|
|
||||||
GSList* cmd_get_basic_help(void);
|
|
||||||
GSList* cmd_get_settings_help(void);
|
|
||||||
GSList* cmd_get_presence_help(void);
|
|
||||||
|
|
||||||
void cmd_history_append(char *inp);
|
|
||||||
char* cmd_history_previous(char *inp);
|
|
||||||
char* cmd_history_next(char *inp);
|
|
||||||
|
|
||||||
void command_docgen(void);
|
void command_docgen(void);
|
||||||
|
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* commands.c
|
* cmd_funcs.c
|
||||||
*
|
*
|
||||||
* Copyright (C) 2012 - 2016 James Booth <boothj5@gmail.com>
|
* Copyright (C) 2012 - 2016 James Booth <boothj5@gmail.com>
|
||||||
*
|
*
|
||||||
@ -50,8 +50,9 @@
|
|||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
|
|
||||||
#include "chat_session.h"
|
#include "chat_session.h"
|
||||||
#include "command/commands.h"
|
#include "command/cmd_funcs.h"
|
||||||
#include "command/command.h"
|
#include "command/cmd_defs.h"
|
||||||
|
#include "command/cmd_ac.h"
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
#include "config/accounts.h"
|
#include "config/accounts.h"
|
||||||
#include "config/account.h"
|
#include "config/account.h"
|
||||||
@ -90,96 +91,59 @@ static void _cmd_set_boolean_preference(gchar *arg, const char *const command,
|
|||||||
const char *const display, preference_t pref);
|
const char *const display, preference_t pref);
|
||||||
static void _who_room(ProfWin *window, const char *const command, gchar **args);
|
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 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);
|
||||||
|
|
||||||
extern GHashTable *commands;
|
/*
|
||||||
|
* Take a line of input and process it, return TRUE if profanity is to
|
||||||
|
* continue, FALSE otherwise
|
||||||
|
*/
|
||||||
gboolean
|
gboolean
|
||||||
cmd_execute_default(ProfWin *window, const char *inp)
|
cmd_process_input(ProfWin *window, char *inp)
|
||||||
{
|
{
|
||||||
// handle escaped commands - treat as normal message
|
log_debug("Input received: %s", inp);
|
||||||
if (g_str_has_prefix(inp, "//")) {
|
gboolean result = FALSE;
|
||||||
inp++;
|
g_strchomp(inp);
|
||||||
|
|
||||||
// handle unknown commands
|
// just carry on if no input
|
||||||
} else if ((inp[0] == '/') && (!g_str_has_prefix(inp, "/me "))) {
|
if (strlen(inp) == 0) {
|
||||||
cons_show("Unknown command: %s", inp);
|
result = TRUE;
|
||||||
cons_alert();
|
|
||||||
return TRUE;
|
// 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, '?');
|
||||||
|
if (question_mark) {
|
||||||
|
*question_mark = '\0';
|
||||||
|
char *fakeinp;
|
||||||
|
if (asprintf(&fakeinp, "/help %s", command+1)) {
|
||||||
|
result = _cmd_execute(window, "/help", fakeinp);
|
||||||
|
free(fakeinp);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
result = _cmd_execute(window, command, inp);
|
||||||
|
}
|
||||||
|
free(inp_cpy);
|
||||||
|
|
||||||
|
// call a default handler if input didn't start with '/'
|
||||||
|
} else {
|
||||||
|
result = _cmd_execute_default(window, inp);
|
||||||
}
|
}
|
||||||
|
|
||||||
// handle non commands in non chat or plugin windows
|
|
||||||
if (window->type != WIN_CHAT && window->type != WIN_MUC && window->type != WIN_PRIVATE && window->type != WIN_PLUGIN && window->type != WIN_XML) {
|
|
||||||
cons_show("Unknown command: %s", inp);
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
// handle plugin window
|
|
||||||
if (window->type == WIN_PLUGIN) {
|
|
||||||
ProfPluginWin *pluginwin = (ProfPluginWin*)window;
|
|
||||||
plugins_win_process_line(pluginwin->tag, inp);
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
jabber_conn_status_t status = connection_get_status();
|
|
||||||
if (status != JABBER_CONNECTED) {
|
|
||||||
ui_current_print_line("You are not currently connected.");
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
switch (window->type) {
|
|
||||||
case WIN_CHAT:
|
|
||||||
{
|
|
||||||
ProfChatWin *chatwin = (ProfChatWin*)window;
|
|
||||||
assert(chatwin->memcheck == PROFCHATWIN_MEMCHECK);
|
|
||||||
cl_ev_send_msg(chatwin, inp, NULL);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case WIN_PRIVATE:
|
|
||||||
{
|
|
||||||
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;
|
|
||||||
assert(mucwin->memcheck == PROFMUCWIN_MEMCHECK);
|
|
||||||
cl_ev_send_muc_msg(mucwin, inp, NULL);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case WIN_XML:
|
|
||||||
{
|
|
||||||
connection_send_stanza(inp);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
gboolean
|
|
||||||
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);
|
|
||||||
free(alias);
|
|
||||||
if (value) {
|
|
||||||
*ran = TRUE;
|
|
||||||
gboolean result = cmd_process_input(window, value);
|
|
||||||
prefs_free_string(value);
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
*ran = FALSE;
|
// Command execution
|
||||||
return TRUE;
|
|
||||||
|
void
|
||||||
|
cmd_execute_connect(ProfWin *window, const char *const account)
|
||||||
|
{
|
||||||
|
GString *command = g_string_new("/connect ");
|
||||||
|
g_string_append(command, account);
|
||||||
|
cmd_process_input(window, command->str);
|
||||||
|
g_string_free(command, TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
gboolean
|
gboolean
|
||||||
@ -1522,21 +1486,7 @@ _cmd_help_cmd_list(const char *const tag)
|
|||||||
}
|
}
|
||||||
g_list_free(plugins_cmds);
|
g_list_free(plugins_cmds);
|
||||||
} else {
|
} else {
|
||||||
GHashTableIter iter;
|
ordered_commands = cmd_get_ordered(tag);
|
||||||
gpointer key;
|
|
||||||
gpointer value;
|
|
||||||
|
|
||||||
g_hash_table_iter_init(&iter, commands);
|
|
||||||
while (g_hash_table_iter_next(&iter, &key, &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);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
ordered_commands = g_list_insert_sorted(ordered_commands, pcmd->cmd, (GCompareFunc)g_strcmp0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// add plugins if showing all commands
|
// add plugins if showing all commands
|
||||||
if (!tag) {
|
if (!tag) {
|
||||||
@ -1607,7 +1557,7 @@ cmd_help(ProfWin *window, const char *const command, gchar **args)
|
|||||||
char cmd_with_slash[1 + strlen(cmd) + 1];
|
char cmd_with_slash[1 + strlen(cmd) + 1];
|
||||||
sprintf(cmd_with_slash, "/%s", cmd);
|
sprintf(cmd_with_slash, "/%s", cmd);
|
||||||
|
|
||||||
Command *command = g_hash_table_lookup(commands, cmd_with_slash);
|
Command *command = cmd_get(cmd_with_slash);
|
||||||
if (command) {
|
if (command) {
|
||||||
cons_show_help(cmd_with_slash, &command->help);
|
cons_show_help(cmd_with_slash, &command->help);
|
||||||
} else {
|
} else {
|
||||||
@ -3860,7 +3810,7 @@ cmd_form(ProfWin *window, const char *const command, gchar **args)
|
|||||||
mucconfwin_form_help(confwin);
|
mucconfwin_form_help(confwin);
|
||||||
|
|
||||||
const gchar **help_text = NULL;
|
const gchar **help_text = NULL;
|
||||||
Command *command = g_hash_table_lookup(commands, "/form");
|
Command *command = cmd_get("/form");
|
||||||
|
|
||||||
if (command) {
|
if (command) {
|
||||||
help_text = command->help.synopsis;
|
help_text = command->help.synopsis;
|
||||||
@ -3882,7 +3832,7 @@ cmd_form(ProfWin *window, const char *const command, gchar **args)
|
|||||||
|
|
||||||
if ((g_strcmp0(args[0], "submit") == 0) || (g_strcmp0(args[0], "cancel") == 0)) {
|
if ((g_strcmp0(args[0], "submit") == 0) || (g_strcmp0(args[0], "cancel") == 0)) {
|
||||||
if (confwin->form) {
|
if (confwin->form) {
|
||||||
cmd_autocomplete_remove_form_fields(confwin->form);
|
cmd_ac_remove_form_fields(confwin->form);
|
||||||
}
|
}
|
||||||
|
|
||||||
int num = wins_get_num(window);
|
int num = wins_get_num(window);
|
||||||
@ -4627,14 +4577,14 @@ cmd_alias(ProfWin *window, const char *const command, gchar **args)
|
|||||||
cons_bad_cmd_usage(command);
|
cons_bad_cmd_usage(command);
|
||||||
g_string_free(ac_value, TRUE);
|
g_string_free(ac_value, TRUE);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
} else if (cmd_exists(ac_value->str)) {
|
} else if (cmd_ac_exists(ac_value->str)) {
|
||||||
cons_show("Command or alias '%s' already exists.", ac_value->str);
|
cons_show("Command or alias '%s' already exists.", ac_value->str);
|
||||||
g_string_free(ac_value, TRUE);
|
g_string_free(ac_value, TRUE);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
} else {
|
} else {
|
||||||
prefs_add_alias(alias_p, value);
|
prefs_add_alias(alias_p, value);
|
||||||
cmd_autocomplete_add(ac_value->str);
|
cmd_ac_add(ac_value->str);
|
||||||
cmd_alias_add(alias_p);
|
cmd_ac_add_alias_value(alias_p);
|
||||||
cons_show("Command alias added %s -> %s", ac_value->str, value);
|
cons_show("Command alias added %s -> %s", ac_value->str, value);
|
||||||
g_string_free(ac_value, TRUE);
|
g_string_free(ac_value, TRUE);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
@ -4655,8 +4605,8 @@ cmd_alias(ProfWin *window, const char *const command, gchar **args)
|
|||||||
} else {
|
} else {
|
||||||
GString *ac_value = g_string_new("/");
|
GString *ac_value = g_string_new("/");
|
||||||
g_string_append(ac_value, alias);
|
g_string_append(ac_value, alias);
|
||||||
cmd_autocomplete_remove(ac_value->str);
|
cmd_ac_remove(ac_value->str);
|
||||||
cmd_alias_remove(alias);
|
cmd_ac_remove_alias_value(alias);
|
||||||
g_string_free(ac_value, TRUE);
|
g_string_free(ac_value, TRUE);
|
||||||
cons_show("Command alias removed -> /%s", alias);
|
cons_show("Command alias removed -> /%s", alias);
|
||||||
}
|
}
|
||||||
@ -6800,6 +6750,156 @@ cmd_encwarn(ProfWin *window, const char *const command, gchar **args)
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static gboolean
|
||||||
|
_cmd_execute(ProfWin *window, const char *const command, const char *const inp)
|
||||||
|
{
|
||||||
|
if (g_str_has_prefix(command, "/field") && window->type == WIN_MUC_CONFIG) {
|
||||||
|
gboolean result = FALSE;
|
||||||
|
gchar **args = parse_args_with_freetext(inp, 1, 2, &result);
|
||||||
|
if (!result) {
|
||||||
|
ui_current_print_formatted_line('!', 0, "Invalid command, see /form help");
|
||||||
|
result = TRUE;
|
||||||
|
} else {
|
||||||
|
gchar **tokens = g_strsplit(inp, " ", 2);
|
||||||
|
char *field = tokens[0] + 1;
|
||||||
|
result = cmd_form_field(window, field, args);
|
||||||
|
g_strfreev(tokens);
|
||||||
|
}
|
||||||
|
|
||||||
|
g_strfreev(args);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
Command *cmd = cmd_get(command);
|
||||||
|
gboolean result = FALSE;
|
||||||
|
|
||||||
|
if (cmd) {
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
if (args[0] && cmd->sub_funcs[0][0]) {
|
||||||
|
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 result = func(window, command, args);
|
||||||
|
g_strfreev(args);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!cmd->func) {
|
||||||
|
ui_invalid_command_usage(cmd->cmd, cmd->setting_func);
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
gboolean result = cmd->func(window, command, args);
|
||||||
|
g_strfreev(args);
|
||||||
|
return result;
|
||||||
|
} else if (plugins_run_command(inp)) {
|
||||||
|
return TRUE;
|
||||||
|
} else {
|
||||||
|
gboolean ran_alias = FALSE;
|
||||||
|
gboolean alias_result = _cmd_execute_alias(window, inp, &ran_alias);
|
||||||
|
if (!ran_alias) {
|
||||||
|
return _cmd_execute_default(window, inp);
|
||||||
|
} else {
|
||||||
|
return alias_result;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static gboolean
|
||||||
|
_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
|
||||||
|
} else if ((inp[0] == '/') && (!g_str_has_prefix(inp, "/me "))) {
|
||||||
|
cons_show("Unknown command: %s", inp);
|
||||||
|
cons_alert();
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
// handle non commands in non chat or plugin windows
|
||||||
|
if (window->type != WIN_CHAT && window->type != WIN_MUC && window->type != WIN_PRIVATE && window->type != WIN_PLUGIN && window->type != WIN_XML) {
|
||||||
|
cons_show("Unknown command: %s", inp);
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
// handle plugin window
|
||||||
|
if (window->type == WIN_PLUGIN) {
|
||||||
|
ProfPluginWin *pluginwin = (ProfPluginWin*)window;
|
||||||
|
plugins_win_process_line(pluginwin->tag, inp);
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
jabber_conn_status_t status = connection_get_status();
|
||||||
|
if (status != JABBER_CONNECTED) {
|
||||||
|
ui_current_print_line("You are not currently connected.");
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
switch (window->type) {
|
||||||
|
case WIN_CHAT:
|
||||||
|
{
|
||||||
|
ProfChatWin *chatwin = (ProfChatWin*)window;
|
||||||
|
assert(chatwin->memcheck == PROFCHATWIN_MEMCHECK);
|
||||||
|
cl_ev_send_msg(chatwin, inp, NULL);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case WIN_PRIVATE:
|
||||||
|
{
|
||||||
|
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;
|
||||||
|
assert(mucwin->memcheck == PROFMUCWIN_MEMCHECK);
|
||||||
|
cl_ev_send_muc_msg(mucwin, inp, NULL);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case WIN_XML:
|
||||||
|
{
|
||||||
|
connection_send_stanza(inp);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
static gboolean
|
||||||
|
_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);
|
||||||
|
free(alias);
|
||||||
|
if (value) {
|
||||||
|
*ran = TRUE;
|
||||||
|
gboolean result = cmd_process_input(window, value);
|
||||||
|
prefs_free_string(value);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
*ran = FALSE;
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
// helper function for status change commands
|
// helper function for status change commands
|
||||||
static void
|
static void
|
||||||
_update_presence(const resource_presence_t resource_presence,
|
_update_presence(const resource_presence_t resource_presence,
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* commands.h
|
* cmd_funcs.h
|
||||||
*
|
*
|
||||||
* Copyright (C) 2012 - 2016 James Booth <boothj5@gmail.com>
|
* Copyright (C) 2012 - 2016 James Booth <boothj5@gmail.com>
|
||||||
*
|
*
|
||||||
@ -32,8 +32,8 @@
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef COMMANDS_H
|
#ifndef CMD_FUNCS_H
|
||||||
#define COMMANDS_H
|
#define CMD_FUNCS_H
|
||||||
|
|
||||||
#include "ui/win_types.h"
|
#include "ui/win_types.h"
|
||||||
|
|
||||||
@ -69,22 +69,11 @@ typedef struct cmd_t {
|
|||||||
CommandHelp help;
|
CommandHelp help;
|
||||||
} Command;
|
} Command;
|
||||||
|
|
||||||
gboolean cmd_execute_alias(ProfWin *window, const char *const inp, gboolean *ran);
|
|
||||||
gboolean cmd_execute_default(ProfWin *window, const char *inp);
|
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_about(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_autoaway(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_autoconnect(ProfWin *window, const char *const command, gchar **args);
|
||||||
gboolean cmd_autoping(ProfWin *window, const char *const command, gchar **args);
|
gboolean cmd_autoping(ProfWin *window, const char *const command, gchar **args);
|
||||||
@ -96,14 +85,6 @@ gboolean cmd_chlog(ProfWin *window, const char *const command, gchar **args);
|
|||||||
gboolean cmd_clear(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_close(ProfWin *window, const char *const command, gchar **args);
|
||||||
gboolean cmd_connect(ProfWin *window, const char *const command, gchar **args);
|
gboolean cmd_connect(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_show(ProfWin *window, const char *const command, gchar **args);
|
|
||||||
gboolean cmd_tls_cert(ProfWin *window, const char *const command, gchar **args);
|
|
||||||
|
|
||||||
gboolean cmd_decline(ProfWin *window, const char *const command, gchar **args);
|
gboolean cmd_decline(ProfWin *window, const char *const command, gchar **args);
|
||||||
gboolean cmd_disco(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_sendfile(ProfWin *window, const char *const command, gchar **args);
|
||||||
@ -130,22 +111,6 @@ gboolean cmd_msg(ProfWin *window, const char *const command, gchar **args);
|
|||||||
gboolean cmd_nick(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_notify(ProfWin *window, const char *const command, gchar **args);
|
||||||
gboolean cmd_online(ProfWin *window, const char *const command, gchar **args);
|
gboolean cmd_online(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_pgp(ProfWin *window, const char *const command, gchar **args);
|
gboolean cmd_pgp(ProfWin *window, const char *const command, gchar **args);
|
||||||
gboolean cmd_outtype(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_prefs(ProfWin *window, const char *const command, gchar **args);
|
||||||
@ -168,14 +133,6 @@ gboolean cmd_titlebar(ProfWin *window, const char *const command, gchar **args);
|
|||||||
gboolean cmd_vercheck(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_who(ProfWin *window, const char *const command, gchar **args);
|
||||||
gboolean cmd_win(ProfWin *window, const char *const command, gchar **args);
|
gboolean cmd_win(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_tidy(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_wins_autotidy(ProfWin *window, const char *const command, gchar **args);
|
|
||||||
|
|
||||||
gboolean cmd_xa(ProfWin *window, const char *const command, gchar **args);
|
gboolean cmd_xa(ProfWin *window, const char *const command, gchar **args);
|
||||||
gboolean cmd_alias(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_xmlconsole(ProfWin *window, const char *const command, gchar **args);
|
||||||
@ -201,6 +158,47 @@ gboolean cmd_console(ProfWin *window, const char *const command, gchar **args);
|
|||||||
gboolean cmd_plugins(ProfWin *window, const char *const command, gchar **args);
|
gboolean cmd_plugins(ProfWin *window, const char *const command, gchar **args);
|
||||||
gboolean cmd_blocked(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_show(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_wins(ProfWin *window, const char *const command, gchar **args);
|
||||||
|
gboolean cmd_wins_unread(ProfWin *window, const char *const command, gchar **args);
|
||||||
|
gboolean cmd_wins_tidy(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_wins_autotidy(ProfWin *window, const char *const command, gchar **args);
|
||||||
|
|
||||||
gboolean cmd_form_field(ProfWin *window, char *tag, gchar **args);
|
gboolean cmd_form_field(ProfWin *window, char *tag, gchar **args);
|
||||||
|
|
||||||
#endif
|
#endif
|
File diff suppressed because it is too large
Load Diff
@ -43,7 +43,7 @@
|
|||||||
#include "common.h"
|
#include "common.h"
|
||||||
#include "log.h"
|
#include "log.h"
|
||||||
#include "window_list.h"
|
#include "window_list.h"
|
||||||
#include "command/command.h"
|
#include "command/cmd_defs.h"
|
||||||
#include "ui/ui.h"
|
#include "ui/ui.h"
|
||||||
#include "xmpp/xmpp.h"
|
#include "xmpp/xmpp.h"
|
||||||
|
|
||||||
|
@ -43,7 +43,7 @@
|
|||||||
|
|
||||||
#include "profanity.h"
|
#include "profanity.h"
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
#include "command/command.h"
|
#include "command/cmd_defs.h"
|
||||||
|
|
||||||
static gboolean version = FALSE;
|
static gboolean version = FALSE;
|
||||||
static char *log = "INFO";
|
static char *log = "INFO";
|
||||||
|
@ -49,7 +49,7 @@
|
|||||||
#include "profanity.h"
|
#include "profanity.h"
|
||||||
#include "ui/ui.h"
|
#include "ui/ui.h"
|
||||||
#include "config/theme.h"
|
#include "config/theme.h"
|
||||||
#include "command/command.h"
|
#include "command/cmd_defs.h"
|
||||||
#include "window_list.h"
|
#include "window_list.h"
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
|
|
||||||
|
@ -35,7 +35,8 @@
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
#include "command/command.h"
|
#include "command/cmd_defs.h"
|
||||||
|
#include "command/cmd_ac.h"
|
||||||
#include "plugins/callbacks.h"
|
#include "plugins/callbacks.h"
|
||||||
#include "plugins/plugins.h"
|
#include "plugins/plugins.h"
|
||||||
#include "tools/autocomplete.h"
|
#include "tools/autocomplete.h"
|
||||||
@ -72,9 +73,8 @@ void
|
|||||||
callbacks_add_command(PluginCommand *command)
|
callbacks_add_command(PluginCommand *command)
|
||||||
{
|
{
|
||||||
p_commands = g_slist_append(p_commands, command);
|
p_commands = g_slist_append(p_commands, command);
|
||||||
cmd_autocomplete_add(command->command_name);
|
cmd_ac_add(command->command_name);
|
||||||
cmd_help_autocomplete_add(&command->command_name[1]);
|
cmd_ac_add_help(&command->command_name[1]);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -37,7 +37,7 @@
|
|||||||
|
|
||||||
#include <glib.h>
|
#include <glib.h>
|
||||||
|
|
||||||
#include "command/command.h"
|
#include "command/cmd_defs.h"
|
||||||
|
|
||||||
typedef struct p_command {
|
typedef struct p_command {
|
||||||
const char *command_name;
|
const char *command_name;
|
||||||
|
@ -35,7 +35,7 @@
|
|||||||
#ifndef PLUGINS_H
|
#ifndef PLUGINS_H
|
||||||
#define PLUGINS_H
|
#define PLUGINS_H
|
||||||
|
|
||||||
#include "command/command.h"
|
#include "command/cmd_defs.h"
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
LANG_PYTHON,
|
LANG_PYTHON,
|
||||||
|
@ -55,7 +55,7 @@
|
|||||||
#include "config/preferences.h"
|
#include "config/preferences.h"
|
||||||
#include "config/theme.h"
|
#include "config/theme.h"
|
||||||
#include "config/scripts.h"
|
#include "config/scripts.h"
|
||||||
#include "command/command.h"
|
#include "command/cmd_defs.h"
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
#include "contact.h"
|
#include "contact.h"
|
||||||
#include "roster_list.h"
|
#include "roster_list.h"
|
||||||
|
@ -43,7 +43,7 @@
|
|||||||
#include <ncurses.h>
|
#include <ncurses.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "command/command.h"
|
#include "command/cmd_defs.h"
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
#include "log.h"
|
#include "log.h"
|
||||||
#include "muc.h"
|
#include "muc.h"
|
||||||
@ -825,7 +825,8 @@ cons_show_room_invite(const char *const invitor, const char * const room, const
|
|||||||
cons_show(" Message: %s", reason);
|
cons_show(" Message: %s", reason);
|
||||||
}
|
}
|
||||||
|
|
||||||
cons_show("Use /join or /decline");
|
cons_show("Use '/join %s' to accept the invitation", room);
|
||||||
|
cons_show("Use '/decline %s' to decline the invitation", room);
|
||||||
|
|
||||||
if (prefs_get_boolean(PREF_NOTIFY_INVITE)) {
|
if (prefs_get_boolean(PREF_NOTIFY_INVITE)) {
|
||||||
notify_invite(display_from, room, reason);
|
notify_invite(display_from, room, reason);
|
||||||
|
@ -55,7 +55,8 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "chat_session.h"
|
#include "chat_session.h"
|
||||||
#include "command/command.h"
|
#include "command/cmd_defs.h"
|
||||||
|
#include "command/cmd_ac.h"
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
#include "config/preferences.h"
|
#include "config/preferences.h"
|
||||||
#include "config/theme.h"
|
#include "config/theme.h"
|
||||||
@ -651,12 +652,12 @@ ui_focus_win(ProfWin *window)
|
|||||||
ProfWin *old_current = wins_get_current();
|
ProfWin *old_current = wins_get_current();
|
||||||
if (old_current->type == WIN_MUC_CONFIG) {
|
if (old_current->type == WIN_MUC_CONFIG) {
|
||||||
ProfMucConfWin *confwin = (ProfMucConfWin*)old_current;
|
ProfMucConfWin *confwin = (ProfMucConfWin*)old_current;
|
||||||
cmd_autocomplete_remove_form_fields(confwin->form);
|
cmd_ac_remove_form_fields(confwin->form);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (window->type == WIN_MUC_CONFIG) {
|
if (window->type == WIN_MUC_CONFIG) {
|
||||||
ProfMucConfWin *confwin = (ProfMucConfWin*)window;
|
ProfMucConfWin *confwin = (ProfMucConfWin*)window;
|
||||||
cmd_autocomplete_add_form_fields(confwin->form);
|
cmd_ac_add_form_fields(confwin->form);
|
||||||
}
|
}
|
||||||
|
|
||||||
int i = wins_get_num(window);
|
int i = wins_get_num(window);
|
||||||
@ -679,7 +680,7 @@ ui_close_win(int index)
|
|||||||
if (window && window->type == WIN_MUC_CONFIG) {
|
if (window && window->type == WIN_MUC_CONFIG) {
|
||||||
ProfMucConfWin *confwin = (ProfMucConfWin*)window;
|
ProfMucConfWin *confwin = (ProfMucConfWin*)window;
|
||||||
if (confwin->form) {
|
if (confwin->form) {
|
||||||
cmd_autocomplete_remove_form_fields(confwin->form);
|
cmd_ac_remove_form_fields(confwin->form);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -53,7 +53,7 @@
|
|||||||
#include <ncurses.h>
|
#include <ncurses.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "command/command.h"
|
#include "command/cmd_ac.h"
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
#include "config/accounts.h"
|
#include "config/accounts.h"
|
||||||
#include "config/preferences.h"
|
#include "config/preferences.h"
|
||||||
@ -452,7 +452,7 @@ _inp_rl_getc(FILE *stream)
|
|||||||
int ch = rl_getc(stream);
|
int ch = rl_getc(stream);
|
||||||
if (_inp_printable(ch)) {
|
if (_inp_printable(ch)) {
|
||||||
ProfWin *window = wins_get_current();
|
ProfWin *window = wins_get_current();
|
||||||
cmd_reset_autocomplete(window);
|
cmd_ac_reset(window);
|
||||||
}
|
}
|
||||||
return ch;
|
return ch;
|
||||||
}
|
}
|
||||||
@ -482,7 +482,7 @@ _inp_rl_tab_handler(int count, int key)
|
|||||||
}
|
}
|
||||||
} else if (strncmp(rl_line_buffer, "/", 1) == 0) {
|
} else if (strncmp(rl_line_buffer, "/", 1) == 0) {
|
||||||
ProfWin *window = wins_get_current();
|
ProfWin *window = wins_get_current();
|
||||||
char *result = cmd_autocomplete(window, rl_line_buffer);
|
char *result = cmd_ac_complete(window, rl_line_buffer);
|
||||||
if (result) {
|
if (result) {
|
||||||
rl_replace_line(result, 1);
|
rl_replace_line(result, 1);
|
||||||
rl_point = rl_end;
|
rl_point = rl_end;
|
||||||
|
@ -37,7 +37,7 @@
|
|||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
#include "command/commands.h"
|
#include "command/cmd_funcs.h"
|
||||||
#include "ui/win_types.h"
|
#include "ui/win_types.h"
|
||||||
#include "muc.h"
|
#include "muc.h"
|
||||||
#include "config/tlscerts.h"
|
#include "config/tlscerts.h"
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
|
|
||||||
#include "config/accounts.h"
|
#include "config/accounts.h"
|
||||||
|
|
||||||
#include "command/commands.h"
|
#include "command/cmd_funcs.h"
|
||||||
|
|
||||||
#define CMD_ACCOUNT "/account"
|
#define CMD_ACCOUNT "/account"
|
||||||
|
|
||||||
|
@ -13,8 +13,9 @@
|
|||||||
|
|
||||||
#include "config/preferences.h"
|
#include "config/preferences.h"
|
||||||
|
|
||||||
#include "command/command.h"
|
#include "command/cmd_defs.h"
|
||||||
#include "command/commands.h"
|
#include "command/cmd_funcs.h"
|
||||||
|
#include "command/cmd_ac.h"
|
||||||
|
|
||||||
#define CMD_ALIAS "/alias"
|
#define CMD_ALIAS "/alias"
|
||||||
|
|
||||||
@ -77,7 +78,7 @@ void cmd_alias_add_shows_message_when_exists(void **state)
|
|||||||
|
|
||||||
cmd_init();
|
cmd_init();
|
||||||
prefs_add_alias("hc", "/help commands");
|
prefs_add_alias("hc", "/help commands");
|
||||||
cmd_autocomplete_add("/hc");
|
cmd_ac_add("/hc");
|
||||||
|
|
||||||
expect_cons_show("Command or alias '/hc' already exists.");
|
expect_cons_show("Command or alias '/hc' already exists.");
|
||||||
|
|
||||||
|
@ -14,7 +14,7 @@
|
|||||||
#include "muc.h"
|
#include "muc.h"
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
|
|
||||||
#include "command/commands.h"
|
#include "command/cmd_funcs.h"
|
||||||
|
|
||||||
#include "xmpp/bookmark.h"
|
#include "xmpp/bookmark.h"
|
||||||
|
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
#include "ui/ui.h"
|
#include "ui/ui.h"
|
||||||
#include "ui/stub_ui.h"
|
#include "ui/stub_ui.h"
|
||||||
|
|
||||||
#include "command/commands.h"
|
#include "command/cmd_funcs.h"
|
||||||
#include "config/accounts.h"
|
#include "config/accounts.h"
|
||||||
|
|
||||||
#define CMD_CONNECT "/connect"
|
#define CMD_CONNECT "/connect"
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#include "chat_session.h"
|
#include "chat_session.h"
|
||||||
#include "command/commands.h"
|
#include "command/cmd_funcs.h"
|
||||||
#include "xmpp/xmpp.h"
|
#include "xmpp/xmpp.h"
|
||||||
#include "roster_list.h"
|
#include "roster_list.h"
|
||||||
|
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
|
|
||||||
#include "config/accounts.h"
|
#include "config/accounts.h"
|
||||||
|
|
||||||
#include "command/commands.h"
|
#include "command/cmd_funcs.h"
|
||||||
#include "muc.h"
|
#include "muc.h"
|
||||||
|
|
||||||
#define CMD_JOIN "/join"
|
#define CMD_JOIN "/join"
|
||||||
|
@ -15,8 +15,8 @@
|
|||||||
|
|
||||||
#include "config/preferences.h"
|
#include "config/preferences.h"
|
||||||
|
|
||||||
#include "command/command.h"
|
#include "command/cmd_defs.h"
|
||||||
#include "command/commands.h"
|
#include "command/cmd_funcs.h"
|
||||||
#include "window_list.h"
|
#include "window_list.h"
|
||||||
#include "xmpp/xmpp.h"
|
#include "xmpp/xmpp.h"
|
||||||
|
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
#include "command/commands.h"
|
#include "command/cmd_funcs.h"
|
||||||
#include "xmpp/xmpp.h"
|
#include "xmpp/xmpp.h"
|
||||||
|
|
||||||
#include "ui/stub_ui.h"
|
#include "ui/stub_ui.h"
|
||||||
|
@ -12,7 +12,7 @@
|
|||||||
#include "ui/stub_ui.h"
|
#include "ui/stub_ui.h"
|
||||||
|
|
||||||
#include "config/accounts.h"
|
#include "config/accounts.h"
|
||||||
#include "command/commands.h"
|
#include "command/cmd_funcs.h"
|
||||||
|
|
||||||
#define CMD_ROOMS "/rooms"
|
#define CMD_ROOMS "/rooms"
|
||||||
|
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
|
|
||||||
#include "xmpp/xmpp.h"
|
#include "xmpp/xmpp.h"
|
||||||
#include "roster_list.h"
|
#include "roster_list.h"
|
||||||
#include "command/commands.h"
|
#include "command/cmd_funcs.h"
|
||||||
|
|
||||||
#define CMD_ROSTER "/roster"
|
#define CMD_ROSTER "/roster"
|
||||||
|
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
#include "ui/ui.h"
|
#include "ui/ui.h"
|
||||||
#include "ui/stub_ui.h"
|
#include "ui/stub_ui.h"
|
||||||
|
|
||||||
#include "command/commands.h"
|
#include "command/cmd_funcs.h"
|
||||||
|
|
||||||
#define CMD_STATUSES "/statuses"
|
#define CMD_STATUSES "/statuses"
|
||||||
|
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
#include "ui/ui.h"
|
#include "ui/ui.h"
|
||||||
#include "ui/stub_ui.h"
|
#include "ui/stub_ui.h"
|
||||||
|
|
||||||
#include "command/commands.h"
|
#include "command/cmd_funcs.h"
|
||||||
|
|
||||||
#define CMD_SUB "/sub"
|
#define CMD_SUB "/sub"
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user