summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog.asciidoc1
-rw-r--r--src/core/wee-command.c23
2 files changed, 19 insertions, 5 deletions
diff --git a/ChangeLog.asciidoc b/ChangeLog.asciidoc
index 71c7ed291..eb15dd8f2 100644
--- a/ChangeLog.asciidoc
+++ b/ChangeLog.asciidoc
@@ -25,6 +25,7 @@ http://weechat.org/files/releasenotes/ReleaseNotes-devel.html[release notes]
=== Bugs fixed
+* core: fix window/buffer pointers used in command /eval
* core: fix modifier "weechat_print": discard only one line when several lines
are displayed in same message (closes #171)
* core: fix translation of message displayed after /upgrade
diff --git a/src/core/wee-command.c b/src/core/wee-command.c
index 5f22d82c4..2d20ba499 100644
--- a/src/core/wee-command.c
+++ b/src/core/wee-command.c
@@ -1835,10 +1835,9 @@ COMMAND_CALLBACK(eval)
{
int i, print_only, condition;
char *result, *ptr_args, *expr, **commands;
- struct t_hashtable *options;
+ struct t_hashtable *pointers, *options;
/* make C compiler happy */
- (void) buffer;
(void) data;
(void) argv;
@@ -1870,12 +1869,24 @@ COMMAND_CALLBACK(eval)
if (ptr_args)
{
+ pointers = hashtable_new (32,
+ WEECHAT_HASHTABLE_STRING,
+ WEECHAT_HASHTABLE_POINTER,
+ NULL,
+ NULL);
+ if (pointers)
+ {
+ hashtable_set (pointers, "window",
+ gui_window_search_with_buffer (buffer));
+ hashtable_set (pointers, "buffer", buffer);
+ }
+
options = NULL;
if (condition)
{
options = hashtable_new (32,
WEECHAT_HASHTABLE_STRING,
- WEECHAT_HASHTABLE_POINTER,
+ WEECHAT_HASHTABLE_STRING,
NULL,
NULL);
if (options)
@@ -1888,7 +1899,7 @@ COMMAND_CALLBACK(eval)
expr = string_remove_quotes (ptr_args, "\"");
if (expr)
{
- result = eval_expression (expr, NULL, NULL, options);
+ result = eval_expression (expr, pointers, NULL, options);
gui_chat_printf_date_tags (NULL, 0, "no_log", "\t>> %s", ptr_args);
if (result)
{
@@ -1911,7 +1922,7 @@ COMMAND_CALLBACK(eval)
}
else
{
- result = eval_expression (ptr_args, NULL, NULL, options);
+ result = eval_expression (ptr_args, pointers, NULL, options);
if (result)
{
commands = string_split_command (result, ';');
@@ -1933,6 +1944,8 @@ COMMAND_CALLBACK(eval)
}
if (result)
free (result);
+ if (pointers)
+ hashtable_free (pointers);
if (options)
hashtable_free (options);
}