summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastien Helleu <flashcode@flashtux.org>2010-10-15 16:06:17 +0200
committerSebastien Helleu <flashcode@flashtux.org>2010-10-15 16:06:17 +0200
commit79c8c90256f184be8c1a7313e946cd64c2a8e065 (patch)
treef42980eda3ddb3b1496dd7fa0a50622491404cbb
parent3412b71959977ca65b29e43eb741e652f5292e3e (diff)
downloadweechat-79c8c90256f184be8c1a7313e946cd64c2a8e065.zip
Fix bug with buffer name in "/bar scroll" command
-rw-r--r--ChangeLog3
-rw-r--r--src/core/wee-command.c17
-rw-r--r--src/gui/gui-buffer.c28
-rw-r--r--src/gui/gui-buffer.h1
4 files changed, 34 insertions, 15 deletions
diff --git a/ChangeLog b/ChangeLog
index e500a0734..4e86070ff 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,12 +1,13 @@
WeeChat ChangeLog
=================
Sébastien Helleu <flashcode@flashtux.org>
-v0.3.4-dev, 2010-10-13
+v0.3.4-dev, 2010-10-15
Version 0.3.4 (under dev!)
--------------------------
+* core: fix bug with buffer name in "/bar scroll" command
* core: add new option weechat.look.hotlist_unique_numbers (task #10691)
* core: add property "no_highlight_nicks" in buffers to disable highlight
for some nicks in buffer
diff --git a/src/core/wee-command.c b/src/core/wee-command.c
index b46217f14..a973e897b 100644
--- a/src/core/wee-command.c
+++ b/src/core/wee-command.c
@@ -468,7 +468,7 @@ command_bar (void *data, struct t_gui_buffer *buffer,
if (strcmp (argv[3], "*") == 0)
ptr_buffer = buffer;
else
- ptr_buffer = gui_buffer_search_by_name (NULL, argv[3]);
+ ptr_buffer = gui_buffer_search_by_full_name (argv[3]);
if (!ptr_buffer)
{
gui_chat_printf (NULL,
@@ -2565,7 +2565,7 @@ command_mute (void *data, struct t_gui_buffer *buffer,
int argc, char **argv, char **argv_eol)
{
int length, mute_mode;
- char *command, *ptr_command, *buffer_name, *pos;
+ char *command, *ptr_command;
struct t_gui_buffer *mute_buffer, *ptr_buffer;
/* make C compiler happy */
@@ -2584,20 +2584,9 @@ command_mute (void *data, struct t_gui_buffer *buffer,
}
else if (string_strcasecmp (argv[1], "-buffer") == 0)
{
- ptr_buffer = NULL;
if (argc < 3)
return WEECHAT_RC_ERROR;
- buffer_name = strdup (argv[2]);
- if (!buffer_name)
- return WEECHAT_RC_ERROR;
- pos = strchr (buffer_name, '.');
- if (pos)
- {
- pos[0] = '\0';
- pos++;
- ptr_buffer = gui_buffer_search_by_name (buffer_name, pos);
- }
- free (buffer_name);
+ ptr_buffer = gui_buffer_search_by_full_name (argv[2]);
if (ptr_buffer)
mute_buffer = ptr_buffer;
ptr_command = argv_eol[3];
diff --git a/src/gui/gui-buffer.c b/src/gui/gui-buffer.c
index 4462458b8..f62fc4b2c 100644
--- a/src/gui/gui-buffer.c
+++ b/src/gui/gui-buffer.c
@@ -1562,6 +1562,34 @@ gui_buffer_search_by_name (const char *plugin, const char *name)
}
/*
+ * gui_buffer_search_by_full_name: search a buffer by full name
+ * (example: "irc.freenode.#weechat")
+ */
+
+struct t_gui_buffer *
+gui_buffer_search_by_full_name (const char *full_name)
+{
+ struct t_gui_buffer *ptr_buffer;
+ char *name, *pos;
+
+ ptr_buffer = NULL;
+
+ name = strdup (full_name);
+ if (name)
+ {
+ pos = strchr (name, '.');
+ if (pos)
+ {
+ pos[0] = '\0';
+ ptr_buffer = gui_buffer_search_by_name (name, pos + 1);
+ }
+ free (name);
+ }
+
+ return ptr_buffer;
+}
+
+/*
* gui_buffer_search_by_partial_name: search a buffer by name (may be partial)
*/
diff --git a/src/gui/gui-buffer.h b/src/gui/gui-buffer.h
index fbe8c4afb..b296d2d58 100644
--- a/src/gui/gui-buffer.h
+++ b/src/gui/gui-buffer.h
@@ -244,6 +244,7 @@ extern void gui_buffer_add_value_num_displayed (struct t_gui_buffer *buffer,
extern struct t_gui_buffer *gui_buffer_search_main ();
extern struct t_gui_buffer *gui_buffer_search_by_name (const char *plugin,
const char *name);
+extern struct t_gui_buffer *gui_buffer_search_by_full_name (const char *full_name);
extern struct t_gui_buffer *gui_buffer_search_by_partial_name (const char *plugin,
const char *name);
extern struct t_gui_buffer *gui_buffer_search_by_number (int number);