diff options
author | Sebastien Helleu <flashcode@flashtux.org> | 2007-11-05 18:51:53 +0100 |
---|---|---|
committer | Sebastien Helleu <flashcode@flashtux.org> | 2007-11-05 18:51:53 +0100 |
commit | b64b0fe6ca4c3d890cafc397b9e1f3021043fe72 (patch) | |
tree | fa6ea56641a2c2a70be9f0995d4dae76907a1e6d /src/gui | |
parent | 0d66286efe2ca1ee3375cef499a7a629883dc21c (diff) | |
download | weechat-b64b0fe6ca4c3d890cafc397b9e1f3021043fe72.zip |
Added string_remove_quotes() function, use of argv and argv_eol for WeeChat commands arguments
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/gui-buffer.c | 23 | ||||
-rw-r--r-- | src/gui/gui-buffer.h | 1 | ||||
-rw-r--r-- | src/gui/gui-chat.c | 2 |
3 files changed, 24 insertions, 2 deletions
diff --git a/src/gui/gui-buffer.c b/src/gui/gui-buffer.c index cb0051574..60f0b57f8 100644 --- a/src/gui/gui-buffer.c +++ b/src/gui/gui-buffer.c @@ -70,7 +70,7 @@ gui_buffer_new (void *plugin, char *category, char *name) weechat_log_printf ("Creating new buffer\n"); #endif - if (!name) + if (!category || !name) return NULL; /* create new buffer */ @@ -277,6 +277,27 @@ gui_buffer_set_nick (struct t_gui_buffer *buffer, char *new_nick) } /* + * gui_buffer_search_main: get main buffer (weechat one, created at startup) + * return first buffer if not found + */ + +struct t_gui_buffer * +gui_buffer_search_main () +{ + struct t_gui_buffer *ptr_buffer; + + for (ptr_buffer = gui_buffers; ptr_buffer; + ptr_buffer = ptr_buffer->next_buffer) + { + if (!ptr_buffer->plugin) + return ptr_buffer; + } + + /* buffer not found, return first buffer by default */ + return gui_buffers; +} + +/* * gui_buffer_search_by_category_name: search a buffer by category and/or name */ diff --git a/src/gui/gui-buffer.h b/src/gui/gui-buffer.h index 3b5840272..5380a54f3 100644 --- a/src/gui/gui-buffer.h +++ b/src/gui/gui-buffer.h @@ -151,6 +151,7 @@ extern void gui_buffer_set_log (struct t_gui_buffer *, char *); extern void gui_buffer_set_title (struct t_gui_buffer *, char *); extern void gui_buffer_set_nick_case_sensitive (struct t_gui_buffer *, int); extern void gui_buffer_set_nick (struct t_gui_buffer *, char *); +extern struct t_gui_buffer *gui_buffer_search_main (); extern struct t_gui_buffer *gui_buffer_search_by_category_name (char *, char *); extern struct t_gui_buffer *gui_buffer_search_by_number (int); diff --git a/src/gui/gui-chat.c b/src/gui/gui-chat.c index 4ae1c57a9..c709b2e1a 100644 --- a/src/gui/gui-chat.c +++ b/src/gui/gui-chat.c @@ -463,7 +463,7 @@ gui_chat_printf_date (struct t_gui_buffer *buffer, time_t date, if (gui_init_ok) { if (buffer == NULL) - buffer = gui_buffers; + buffer = gui_buffer_search_main (); if (buffer->type == GUI_BUFFER_TYPE_FREE) buffer = gui_buffers; |