1
0
mirror of https://github.com/weechat/weechat.git synced 2026-07-08 02:33:12 +02:00

Fixed bugs: buffer detection in plugins/scripts commands, and /history command

This commit is contained in:
Sebastien Helleu
2006-01-22 21:30:19 +00:00
parent 1cbdbffa40
commit 8cd8410448
38 changed files with 3146 additions and 2278 deletions
+21 -6
View File
@@ -288,13 +288,28 @@ weechat_plugin_exec_command (t_weechat_plugin *plugin,
if (!plugin || !command)
return;
plugin_find_server_channel (server, channel, &ptr_server, &ptr_channel);
if (ptr_server && ptr_channel)
user_command (ptr_channel->buffer, ptr_server, command);
else if (ptr_server && (ptr_server->buffer))
user_command (ptr_server->buffer, ptr_server, command);
if (plugin_find_server_channel (server, channel, &ptr_server, &ptr_channel) < 0)
{
irc_display_prefix (NULL, NULL, PREFIX_ERROR);
gui_printf (NULL,
_("%s server/channel (%s/%s) not found for plugin "
"exec command\n"),
WEECHAT_ERROR,
(server) ? server : "", (channel) ? channel : "");
}
else
user_command (gui_buffers, NULL, command);
{
if (ptr_server && ptr_channel)
user_command (ptr_server, ptr_channel, command);
else if (ptr_server && (ptr_server->buffer))
user_command (ptr_server, NULL, command);
else
{
irc_display_prefix (NULL, NULL, PREFIX_ERROR);
gui_printf (NULL, _("%s server not found for plugin exec command\n"),
WEECHAT_ERROR);
}
}
}
/*
+8 -1
View File
@@ -51,7 +51,7 @@ t_weechat_plugin *last_weechat_plugin = NULL;
* plugin_find_server_channel: find server/channel for command execution
*/
void
int
plugin_find_server_channel (char *server, char *channel,
t_irc_server **ptr_server,
t_irc_channel **ptr_channel)
@@ -70,7 +70,11 @@ plugin_find_server_channel (char *server, char *channel,
else
{
if (server && server[0])
{
(*ptr_server) = server_search (server);
if (!(*ptr_server))
return -1;
}
else
{
(*ptr_server) = SERVER(gui_current_window->buffer);
@@ -82,8 +86,11 @@ plugin_find_server_channel (char *server, char *channel,
{
if ((*ptr_server))
(*ptr_channel) = channel_search ((*ptr_server), channel);
if (!(*ptr_channel))
return -1;
}
}
return 0;
}
/*
+2 -2
View File
@@ -31,8 +31,8 @@ typedef void (t_weechat_end_func) (t_weechat_plugin *);
extern t_weechat_plugin *weechat_plugins;
extern t_weechat_plugin *last_weechat_plugin;
extern void plugin_find_server_channel (char *, char *,
t_irc_server **, t_irc_channel **);
extern int plugin_find_server_channel (char *, char *,
t_irc_server **, t_irc_channel **);
extern void plugin_exec_on_files (t_weechat_plugin *, char *,
int (*)(t_weechat_plugin *, char *));
extern t_weechat_plugin *plugin_search (char *);