mirror of
https://github.com/weechat/weechat.git
synced 2026-07-09 19:23:13 +02:00
Reintroduce option "irc.network.send_unknown_commands", save extra data for buffers with /upgrade (title, input data, text search)
This commit is contained in:
+36
-21
@@ -57,8 +57,27 @@ input_is_command (const char *line)
|
||||
}
|
||||
|
||||
/*
|
||||
* input_exec_command: executes a command (WeeChat internal or a
|
||||
* plugin command)
|
||||
* input_exec_data: send data to buffer input callbackr
|
||||
*/
|
||||
|
||||
void
|
||||
input_exec_data (struct t_gui_buffer *buffer, const char *data)
|
||||
{
|
||||
if (buffer->input_callback)
|
||||
{
|
||||
(void)(buffer->input_callback) (buffer->input_callback_data,
|
||||
buffer,
|
||||
data);
|
||||
}
|
||||
else
|
||||
gui_chat_printf (buffer,
|
||||
_("%sYou can not write text in this "
|
||||
"buffer"),
|
||||
gui_chat_prefix[GUI_CHAT_PREFIX_ERROR]);
|
||||
}
|
||||
|
||||
/*
|
||||
* input_exec_command: execute a command (WeeChat internal or a plugin command)
|
||||
* if only_builtin == 1, then try only
|
||||
* WeeChat commands (not plugins neither aliases)
|
||||
* returns: 1 if command was executed succesfully
|
||||
@@ -120,11 +139,20 @@ input_exec_command (struct t_gui_buffer *buffer,
|
||||
command + 1);
|
||||
break;
|
||||
default: /* no command hooked */
|
||||
gui_chat_printf (NULL,
|
||||
_("%sError: unknown command \"%s\" (type /help "
|
||||
"for help)"),
|
||||
gui_chat_prefix[GUI_CHAT_PREFIX_ERROR],
|
||||
command + 1);
|
||||
/* if unknown commands are accepted by this buffer, just send
|
||||
input text as data to buffer, otherwise display error */
|
||||
if (buffer->input_get_unknown_commands)
|
||||
{
|
||||
input_exec_data (buffer, string);
|
||||
}
|
||||
else
|
||||
{
|
||||
gui_chat_printf (NULL,
|
||||
_("%sError: unknown command \"%s\" (type /help "
|
||||
"for help)"),
|
||||
gui_chat_prefix[GUI_CHAT_PREFIX_ERROR],
|
||||
command + 1);
|
||||
}
|
||||
break;
|
||||
}
|
||||
free (command);
|
||||
@@ -175,20 +203,7 @@ input_data (struct t_gui_buffer *buffer, const char *data)
|
||||
}
|
||||
else
|
||||
{
|
||||
if ((ptr_data[0] == '/') && (ptr_data[1] == '/'))
|
||||
ptr_data++;
|
||||
|
||||
if (buffer->input_callback)
|
||||
{
|
||||
(void)(buffer->input_callback) (buffer->input_callback_data,
|
||||
buffer,
|
||||
ptr_data);
|
||||
}
|
||||
else
|
||||
gui_chat_printf (buffer,
|
||||
_("%sYou can not write text in this "
|
||||
"buffer"),
|
||||
gui_chat_prefix[GUI_CHAT_PREFIX_ERROR]);
|
||||
input_exec_data (buffer, ptr_data);
|
||||
}
|
||||
|
||||
if (pos)
|
||||
|
||||
+43
-2
@@ -325,16 +325,57 @@ upgrade_weechat_read_cb (int object_id,
|
||||
{
|
||||
if (infolist_integer (infolist, "current_buffer"))
|
||||
upgrade_set_current_buffer = upgrade_current_buffer;
|
||||
upgrade_current_buffer->plugin_name_for_upgrade =
|
||||
strdup (infolist_string (infolist, "plugin_name"));
|
||||
upgrade_current_buffer->short_name =
|
||||
(infolist_string (infolist, "short_name")) ?
|
||||
strdup (infolist_string (infolist, "short_name")) :
|
||||
strdup (infolist_string (infolist, "name"));
|
||||
upgrade_current_buffer->plugin_name_for_upgrade =
|
||||
strdup (infolist_string (infolist, "plugin_name"));
|
||||
upgrade_current_buffer->type =
|
||||
infolist_integer (infolist, "type");
|
||||
upgrade_current_buffer->notify =
|
||||
infolist_integer (infolist, "notify");
|
||||
upgrade_current_buffer->nicklist_case_sensitive =
|
||||
infolist_integer (infolist, "nicklist_case_sensitive");
|
||||
upgrade_current_buffer->nicklist_display_groups =
|
||||
infolist_integer (infolist, "nicklist_display_groups");
|
||||
upgrade_current_buffer->title =
|
||||
(infolist_string (infolist, "title")) ?
|
||||
strdup (infolist_string (infolist, "title")) : NULL;
|
||||
upgrade_current_buffer->input =
|
||||
infolist_integer (infolist, "input");
|
||||
upgrade_current_buffer->input_get_unknown_commands =
|
||||
infolist_integer (infolist, "input_get_unknown_commands");
|
||||
if (infolist_integer (infolist, "input_buffer_alloc") > 0)
|
||||
{
|
||||
upgrade_current_buffer->input_buffer =
|
||||
malloc (infolist_integer (infolist, "input_buffer_alloc"));
|
||||
if (upgrade_current_buffer->input_buffer)
|
||||
{
|
||||
upgrade_current_buffer->input_buffer_size =
|
||||
infolist_integer (infolist, "input_buffer_size");
|
||||
upgrade_current_buffer->input_buffer_length =
|
||||
infolist_integer (infolist, "input_buffer_length");
|
||||
upgrade_current_buffer->input_buffer_pos =
|
||||
infolist_integer (infolist, "input_buffer_pos");
|
||||
upgrade_current_buffer->input_buffer_1st_display =
|
||||
infolist_integer (infolist, "input_buffer_1st_display");
|
||||
if (infolist_string (infolist, "input_buffer"))
|
||||
strcpy (upgrade_current_buffer->input_buffer,
|
||||
infolist_string (infolist, "input_buffer"));
|
||||
else
|
||||
upgrade_current_buffer->input_buffer[0] = '\0';
|
||||
}
|
||||
}
|
||||
upgrade_current_buffer->text_search =
|
||||
infolist_integer (infolist, "text_search");
|
||||
upgrade_current_buffer->text_search_exact =
|
||||
infolist_integer (infolist, "text_search_exact");
|
||||
upgrade_current_buffer->text_search_found =
|
||||
infolist_integer (infolist, "text_search_found");
|
||||
if (infolist_string (infolist, "text_search_input"))
|
||||
upgrade_current_buffer->text_search_input =
|
||||
strdup (infolist_string (infolist, "text_search_input"));
|
||||
gui_buffer_set_highlight_words (upgrade_current_buffer,
|
||||
infolist_string (infolist, "highlight_words"));
|
||||
gui_buffer_set_highlight_tags (upgrade_current_buffer,
|
||||
|
||||
Reference in New Issue
Block a user