diff options
author | Sebastien Helleu <flashcode@flashtux.org> | 2007-12-07 13:12:46 +0100 |
---|---|---|
committer | Sebastien Helleu <flashcode@flashtux.org> | 2007-12-07 13:12:46 +0100 |
commit | 495e6bd5df9163148676821d610c9ef863326f70 (patch) | |
tree | 024adc4a159a888e779dd92520f38b22c1d08ec4 /src/gui | |
parent | 3c8276bc5752a607f3a16e1a4a683b5f73b3db37 (diff) | |
download | weechat-495e6bd5df9163148676821d610c9ef863326f70.zip |
Many changes in IRC plugin and plugins API
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/curses/gui-curses-window.c | 14 | ||||
-rw-r--r-- | src/gui/gtk/gui-gtk-window.c | 10 | ||||
-rw-r--r-- | src/gui/gui-buffer.c | 128 | ||||
-rw-r--r-- | src/gui/gui-chat.c | 2 | ||||
-rw-r--r-- | src/gui/gui-color.c | 3 | ||||
-rw-r--r-- | src/gui/gui-completion.c | 204 | ||||
-rw-r--r-- | src/gui/gui-completion.h | 1 | ||||
-rw-r--r-- | src/gui/gui-hotlist.c | 23 | ||||
-rw-r--r-- | src/gui/gui-infobar.c | 2 | ||||
-rw-r--r-- | src/gui/gui-keyboard.c | 6 | ||||
-rw-r--r-- | src/gui/gui-window.c | 100 |
11 files changed, 241 insertions, 252 deletions
diff --git a/src/gui/curses/gui-curses-window.c b/src/gui/curses/gui-curses-window.c index 004a0ef7e..8fce32f39 100644 --- a/src/gui/curses/gui-curses-window.c +++ b/src/gui/curses/gui-curses-window.c @@ -1428,11 +1428,11 @@ gui_window_title_reset () void gui_window_objects_print_log (struct t_gui_window *window) { - log_printf (" win_title . . . . . : 0x%X\n", GUI_CURSES(window)->win_title); - log_printf (" win_chat. . . . . . : 0x%X\n", GUI_CURSES(window)->win_chat); - log_printf (" win_nick. . . . . . : 0x%X\n", GUI_CURSES(window)->win_nick); - log_printf (" win_status. . . . . : 0x%X\n", GUI_CURSES(window)->win_status); - log_printf (" win_infobar . . . . : 0x%X\n", GUI_CURSES(window)->win_infobar); - log_printf (" win_input . . . . . : 0x%X\n", GUI_CURSES(window)->win_input); - log_printf (" win_separator . . . : 0x%X\n", GUI_CURSES(window)->win_separator); + log_printf (" win_title . . . . . : 0x%X", GUI_CURSES(window)->win_title); + log_printf (" win_chat. . . . . . : 0x%X", GUI_CURSES(window)->win_chat); + log_printf (" win_nick. . . . . . : 0x%X", GUI_CURSES(window)->win_nick); + log_printf (" win_status. . . . . : 0x%X", GUI_CURSES(window)->win_status); + log_printf (" win_infobar . . . . : 0x%X", GUI_CURSES(window)->win_infobar); + log_printf (" win_input . . . . . : 0x%X", GUI_CURSES(window)->win_input); + log_printf (" win_separator . . . : 0x%X", GUI_CURSES(window)->win_separator); } diff --git a/src/gui/gtk/gui-gtk-window.c b/src/gui/gtk/gui-gtk-window.c index 73c310bf8..c00813f3a 100644 --- a/src/gui/gtk/gui-gtk-window.c +++ b/src/gui/gtk/gui-gtk-window.c @@ -918,9 +918,9 @@ gui_window_title_reset () void gui_window_objects_print_log (struct t_gui_window *window) { - log_printf (" textview_chat . . . : 0x%X\n", GUI_GTK(window)->textview_chat); - log_printf (" textbuffer_chat . . : 0x%X\n", GUI_GTK(window)->textbuffer_chat); - log_printf (" texttag_chat. . . . : 0x%X\n", GUI_GTK(window)->texttag_chat); - log_printf (" textview_nicklist . : 0x%X\n", GUI_GTK(window)->textview_nicklist); - log_printf (" textbuffer_nicklist : 0x%X\n", GUI_GTK(window)->textbuffer_nicklist); + log_printf (" textview_chat . . . : 0x%X", GUI_GTK(window)->textview_chat); + log_printf (" textbuffer_chat . . : 0x%X", GUI_GTK(window)->textbuffer_chat); + log_printf (" texttag_chat. . . . : 0x%X", GUI_GTK(window)->texttag_chat); + log_printf (" textview_nicklist . : 0x%X", GUI_GTK(window)->textview_nicklist); + log_printf (" textbuffer_nicklist : 0x%X", GUI_GTK(window)->textbuffer_nicklist); } diff --git a/src/gui/gui-buffer.c b/src/gui/gui-buffer.c index d9776b440..cf6e77388 100644 --- a/src/gui/gui-buffer.c +++ b/src/gui/gui-buffer.c @@ -72,7 +72,7 @@ gui_buffer_new (void *plugin, char *category, char *name, struct t_gui_completion *new_completion; #ifdef DEBUG - weechat_log_printf ("Creating new buffer\n"); + log_printf ("Creating new buffer"); #endif if (!category || !name) @@ -284,7 +284,7 @@ gui_buffer_set_nick (struct t_gui_buffer *buffer, char *new_nick) } /* - * gui_buffer_set: set a property for a buffer + * gui_buffer_set: set a buffer property */ void @@ -883,15 +883,15 @@ gui_buffer_dump_hexa (struct t_gui_buffer *buffer) char hexa[(16 * 3) + 1], ascii[(16 * 2) + 1]; int hexa_pos, ascii_pos; - log_printf ("[buffer dump hexa (addr:0x%X)]\n", buffer); + log_printf ("[buffer dump hexa (addr:0x%X)]", buffer); num_line = 1; for (ptr_line = buffer->lines; ptr_line; ptr_line = ptr_line->next_line) { /* display line without colors */ message_without_colors = (ptr_line->message) ? (char *)gui_color_decode ((unsigned char *)ptr_line->message) : NULL; - log_printf ("\n"); - log_printf (" line %d: %s\n", + log_printf (""); + log_printf (" line %d: %s", num_line, (message_without_colors) ? message_without_colors : "(null)"); @@ -901,8 +901,8 @@ gui_buffer_dump_hexa (struct t_gui_buffer *buffer) /* display raw message for line */ if (ptr_line->message) { - log_printf ("\n"); - log_printf (" raw data for line %d (with color codes):\n", + log_printf (""); + log_printf (" raw data for line %d (with color codes):", num_line); msg_pos = 0; hexa_pos = 0; @@ -919,14 +919,14 @@ gui_buffer_dump_hexa (struct t_gui_buffer *buffer) ascii_pos += 2; if (ascii_pos == 32) { - log_printf (" %-48s %s\n", hexa, ascii); + log_printf (" %-48s %s", hexa, ascii); hexa_pos = 0; ascii_pos = 0; } msg_pos++; } if (ascii_pos > 0) - log_printf (" %-48s %s\n", hexa, ascii); + log_printf (" %-48s %s", hexa, ascii); } num_line++; @@ -948,64 +948,64 @@ gui_buffer_print_log () for (ptr_buffer = gui_buffers; ptr_buffer; ptr_buffer = ptr_buffer->next_buffer) { - log_printf ("\n"); - log_printf ("[buffer (addr:0x%X)]\n", ptr_buffer); - log_printf (" plugin . . . . . . . . : 0x%X\n", ptr_buffer->plugin); - log_printf (" number . . . . . . . . : %d\n", ptr_buffer->number); - log_printf (" category . . . . . . . : '%s'\n", ptr_buffer->category); - log_printf (" name . . . . . . . . . : '%s'\n", ptr_buffer->name); - log_printf (" type . . . . . . . . . : %d\n", ptr_buffer->type); - log_printf (" notify_level . . . . . : %d\n", ptr_buffer->notify_level); - log_printf (" num_displayed. . . . . : %d\n", ptr_buffer->num_displayed); - log_printf (" title. . . . . . . . . : '%s'\n", ptr_buffer->title); - log_printf (" lines. . . . . . . . . : 0x%X\n", ptr_buffer->lines); - log_printf (" last_line. . . . . . . : 0x%X\n", ptr_buffer->last_line); - log_printf (" last_read_line . . . . : 0x%X\n", ptr_buffer->last_read_line); - log_printf (" lines_count. . . . . . : %d\n", ptr_buffer->lines_count); - log_printf (" prefix_max_length. . . : %d\n", ptr_buffer->prefix_max_length); - log_printf (" chat_refresh_needed. . : %d\n", ptr_buffer->chat_refresh_needed); - log_printf (" nicklist . . . . . . . : %d\n", ptr_buffer->nicklist); - log_printf (" nick_case_sensitive. . : %d\n", ptr_buffer->nick_case_sensitive); - log_printf (" nicks. . . . . . . . . : 0x%X\n", ptr_buffer->nicks); - log_printf (" last_nick. . . . . . . : 0x%X\n", ptr_buffer->last_nick); - log_printf (" nicks_count. . . . . . : %d\n", ptr_buffer->nicks_count); - log_printf (" input. . . . . . . . . : %d\n", ptr_buffer->input); - log_printf (" input_data_cb. . . . . : 0x%X\n", ptr_buffer->input_data_cb); - log_printf (" input_nick . . . . . . : '%s'\n", ptr_buffer->input_nick); - log_printf (" input_buffer . . . . . : '%s'\n", ptr_buffer->input_buffer); - log_printf (" input_buffer_color_mask: '%s'\n", ptr_buffer->input_buffer_color_mask); - log_printf (" input_buffer_alloc . . : %d\n", ptr_buffer->input_buffer_alloc); - log_printf (" input_buffer_size. . . : %d\n", ptr_buffer->input_buffer_size); - log_printf (" input_buffer_length. . : %d\n", ptr_buffer->input_buffer_length); - log_printf (" input_buffer_pos . . . : %d\n", ptr_buffer->input_buffer_pos); - log_printf (" input_buffer_1st_disp. : %d\n", ptr_buffer->input_buffer_1st_display); - log_printf (" completion . . . . . . : 0x%X\n", ptr_buffer->completion); - log_printf (" history. . . . . . . . : 0x%X\n", ptr_buffer->history); - log_printf (" last_history . . . . . : 0x%X\n", ptr_buffer->last_history); - log_printf (" ptr_history. . . . . . : 0x%X\n", ptr_buffer->ptr_history); - log_printf (" num_history. . . . . . : %d\n", ptr_buffer->num_history); - log_printf (" text_search. . . . . . : %d\n", ptr_buffer->text_search); - log_printf (" text_search_exact. . . : %d\n", ptr_buffer->text_search_exact); - log_printf (" text_search_found. . . : %d\n", ptr_buffer->text_search_found); - log_printf (" text_search_input. . . : '%s'\n", ptr_buffer->text_search_input); - log_printf (" prev_buffer. . . . . . : 0x%X\n", ptr_buffer->prev_buffer); - log_printf (" next_buffer. . . . . . : 0x%X\n", ptr_buffer->next_buffer); + log_printf (""); + log_printf ("[buffer (addr:0x%X)]", ptr_buffer); + log_printf (" plugin . . . . . . . . : 0x%X", ptr_buffer->plugin); + log_printf (" number . . . . . . . . : %d", ptr_buffer->number); + log_printf (" category . . . . . . . : '%s'", ptr_buffer->category); + log_printf (" name . . . . . . . . . : '%s'", ptr_buffer->name); + log_printf (" type . . . . . . . . . : %d", ptr_buffer->type); + log_printf (" notify_level . . . . . : %d", ptr_buffer->notify_level); + log_printf (" num_displayed. . . . . : %d", ptr_buffer->num_displayed); + log_printf (" title. . . . . . . . . : '%s'", ptr_buffer->title); + log_printf (" lines. . . . . . . . . : 0x%X", ptr_buffer->lines); + log_printf (" last_line. . . . . . . : 0x%X", ptr_buffer->last_line); + log_printf (" last_read_line . . . . : 0x%X", ptr_buffer->last_read_line); + log_printf (" lines_count. . . . . . : %d", ptr_buffer->lines_count); + log_printf (" prefix_max_length. . . : %d", ptr_buffer->prefix_max_length); + log_printf (" chat_refresh_needed. . : %d", ptr_buffer->chat_refresh_needed); + log_printf (" nicklist . . . . . . . : %d", ptr_buffer->nicklist); + log_printf (" nick_case_sensitive. . : %d", ptr_buffer->nick_case_sensitive); + log_printf (" nicks. . . . . . . . . : 0x%X", ptr_buffer->nicks); + log_printf (" last_nick. . . . . . . : 0x%X", ptr_buffer->last_nick); + log_printf (" nicks_count. . . . . . : %d", ptr_buffer->nicks_count); + log_printf (" input. . . . . . . . . : %d", ptr_buffer->input); + log_printf (" input_data_cb. . . . . : 0x%X", ptr_buffer->input_data_cb); + log_printf (" input_nick . . . . . . : '%s'", ptr_buffer->input_nick); + log_printf (" input_buffer . . . . . : '%s'", ptr_buffer->input_buffer); + log_printf (" input_buffer_color_mask: '%s'", ptr_buffer->input_buffer_color_mask); + log_printf (" input_buffer_alloc . . : %d", ptr_buffer->input_buffer_alloc); + log_printf (" input_buffer_size. . . : %d", ptr_buffer->input_buffer_size); + log_printf (" input_buffer_length. . : %d", ptr_buffer->input_buffer_length); + log_printf (" input_buffer_pos . . . : %d", ptr_buffer->input_buffer_pos); + log_printf (" input_buffer_1st_disp. : %d", ptr_buffer->input_buffer_1st_display); + log_printf (" completion . . . . . . : 0x%X", ptr_buffer->completion); + log_printf (" history. . . . . . . . : 0x%X", ptr_buffer->history); + log_printf (" last_history . . . . . : 0x%X", ptr_buffer->last_history); + log_printf (" ptr_history. . . . . . : 0x%X", ptr_buffer->ptr_history); + log_printf (" num_history. . . . . . : %d", ptr_buffer->num_history); + log_printf (" text_search. . . . . . : %d", ptr_buffer->text_search); + log_printf (" text_search_exact. . . : %d", ptr_buffer->text_search_exact); + log_printf (" text_search_found. . . : %d", ptr_buffer->text_search_found); + log_printf (" text_search_input. . . : '%s'", ptr_buffer->text_search_input); + log_printf (" prev_buffer. . . . . . : 0x%X", ptr_buffer->prev_buffer); + log_printf (" next_buffer. . . . . . : 0x%X", ptr_buffer->next_buffer); for (ptr_nick = ptr_buffer->nicks; ptr_nick; ptr_nick = ptr_nick->next_nick) { - log_printf ("\n"); - log_printf (" => nick %s (addr:0x%X):\n", ptr_nick->nick, ptr_nick); - log_printf (" sort_index. . . . . . : %d\n", ptr_nick->sort_index); - log_printf (" color_nick. . . . . . : %d\n", ptr_nick->color_nick); - log_printf (" prefix. . . . . . . . : '%c'\n", ptr_nick->prefix); - log_printf (" color_prefix. . . . . : %d\n", ptr_nick->color_prefix); - log_printf (" prev_nick . . . . . . : 0x%X\n", ptr_nick->prev_nick); - log_printf (" next_nick . . . . . . : 0x%X\n", ptr_nick->next_nick); + log_printf (""); + log_printf (" => nick %s (addr:0x%X):", ptr_nick->nick, ptr_nick); + log_printf (" sort_index. . . . . . : %d", ptr_nick->sort_index); + log_printf (" color_nick. . . . . . : %d", ptr_nick->color_nick); + log_printf (" prefix. . . . . . . . : '%c'", ptr_nick->prefix); + log_printf (" color_prefix. . . . . : %d", ptr_nick->color_prefix); + log_printf (" prev_nick . . . . . . : 0x%X", ptr_nick->prev_nick); + log_printf (" next_nick . . . . . . : 0x%X", ptr_nick->next_nick); } - log_printf ("\n"); - log_printf (" => last 100 lines:\n"); + log_printf (""); + log_printf (" => last 100 lines:"); num = 0; ptr_line = ptr_buffer->last_line; while (ptr_line && (num < 100)) @@ -1021,9 +1021,9 @@ gui_buffer_print_log () while (ptr_line) { num--; - log_printf (" line N-%05d: str_time:'%s', prefix:'%s'\n", + log_printf (" line N-%05d: str_time:'%s', prefix:'%s'", num, ptr_line->str_time, ptr_line->prefix); - log_printf (" data: '%s'\n", + log_printf (" data: '%s'", ptr_line->message); ptr_line = ptr_line->next_line; @@ -1031,7 +1031,7 @@ gui_buffer_print_log () if (ptr_buffer->completion) { - log_printf ("\n"); + log_printf (""); gui_completion_print_log (ptr_buffer->completion); } } diff --git a/src/gui/gui-chat.c b/src/gui/gui-chat.c index 911946c90..f2d0b462e 100644 --- a/src/gui/gui-chat.c +++ b/src/gui/gui-chat.c @@ -411,7 +411,7 @@ gui_chat_line_add (struct t_gui_buffer *buffer, time_t date, new_line = (struct t_gui_line *) malloc (sizeof (struct t_gui_line)); if (!new_line) { - log_printf (_("Not enough memory for new line\n")); + log_printf (_("Not enough memory for new line")); return; } diff --git a/src/gui/gui-color.c b/src/gui/gui-color.c index 09fa063e7..6f8758d3f 100644 --- a/src/gui/gui-color.c +++ b/src/gui/gui-color.c @@ -52,7 +52,8 @@ gui_color_search_config (char *color_name) if (color_name) { - ptr_section = config_file_search_section (weechat_config, "colors"); + ptr_section = config_file_search_section (weechat_config_file, + "colors"); if (ptr_section) { for (ptr_option = ptr_section->options; ptr_option; diff --git a/src/gui/gui-completion.c b/src/gui/gui-completion.c index 420ef43fb..6598d8c3d 100644 --- a/src/gui/gui-completion.c +++ b/src/gui/gui-completion.c @@ -65,8 +65,7 @@ gui_completion_init (struct t_gui_completion *completion, completion->direction = 0; completion->add_space = 1; - completion->completion_list = NULL; - completion->last_completion = NULL; + completion->completion_list = weelist_new (); completion->word_found = NULL; completion->position_replace = 0; @@ -92,12 +91,13 @@ gui_completion_free_data (struct t_gui_completion *completion) if (completion->args) free (completion->args); completion->args = NULL; - - weelist_remove_all (&completion->completion_list, - &completion->last_completion); - completion->completion_list = NULL; - completion->last_completion = NULL; + if (completion->completion_list) + { + weelist_free (completion->completion_list); + completion->completion_list = NULL; + } + if (completion->word_found) free (completion->word_found); completion->word_found = NULL; @@ -243,10 +243,8 @@ gui_completion_list_add (struct t_gui_completion *completion, char *word, || (!nick_completion && (string_strncasecmp (completion->base_word, word, strlen (completion->base_word)) == 0))) { - weelist_add (&completion->completion_list, - &completion->last_completion, - word, - position); + weelist_add (completion->completion_list, + word, position); } } @@ -619,7 +617,7 @@ gui_completion_list_add_option (struct t_gui_completion *completion) struct t_config_section *ptr_section; struct t_config_option *ptr_option; - for (ptr_section = weechat_config->sections; ptr_section; + for (ptr_section = weechat_config_file->sections; ptr_section; ptr_section = ptr_section->next_section) { for (ptr_option = ptr_section->options; ptr_option; @@ -766,7 +764,7 @@ gui_completion_list_add_option_value (struct t_gui_completion *completion) pos = strchr (completion->args, ' '); if (pos) pos[0] = '\0'; - ptr_option = config_file_search_option (weechat_config, + ptr_option = config_file_search_option (weechat_config_file, NULL, completion->args); if (ptr_option) @@ -886,10 +884,8 @@ gui_completion_build_list_template (struct t_gui_completion *completion, char *t if (word_offset > 0) { word[word_offset] = '\0'; - weelist_add (&completion->completion_list, - &completion->last_completion, - word, - WEELIST_POS_SORT); + weelist_add (completion->completion_list, + word, WEELIST_POS_SORT); } word_offset = 0; break; @@ -1170,12 +1166,12 @@ gui_completion_command (struct t_gui_completion *completion) { int length, word_found_seen, other_completion; struct t_hook *ptr_hook; - struct t_weelist *ptr_weelist, *ptr_weelist2; + struct t_weelist_item *ptr_item, *ptr_item2; length = strlen (completion->base_word); word_found_seen = 0; other_completion = 0; - if (!completion->completion_list) + if (!completion->completion_list->items) { for (ptr_hook = weechat_hooks; ptr_hook; ptr_hook = ptr_hook->next_hook) @@ -1192,34 +1188,35 @@ gui_completion_command (struct t_gui_completion *completion) } } if (completion->direction < 0) - ptr_weelist = completion->last_completion; + ptr_item = completion->completion_list->last_item; else - ptr_weelist = completion->completion_list; - while (ptr_weelist) + ptr_item = completion->completion_list->items; + + while (ptr_item) { - if (string_strncasecmp (ptr_weelist->data, completion->base_word, length) == 0) + if (string_strncasecmp (ptr_item->data, completion->base_word, length) == 0) { if ((!completion->word_found) || word_found_seen) { if (completion->word_found) free (completion->word_found); - completion->word_found = strdup (ptr_weelist->data); - + completion->word_found = strdup (ptr_item->data); + if (completion->direction < 0) - ptr_weelist2 = ptr_weelist->prev_weelist; + ptr_item2 = ptr_item->prev_item; else - ptr_weelist2 = ptr_weelist->next_weelist; + ptr_item2 = ptr_item->next_item; - while (ptr_weelist2) + while (ptr_item2) { - if (string_strncasecmp (ptr_weelist2->data, + if (string_strncasecmp (ptr_item2->data, completion->base_word, length) == 0) other_completion++; if (completion->direction < 0) - ptr_weelist2 = ptr_weelist2->prev_weelist; + ptr_item2 = ptr_item2->prev_item; else - ptr_weelist2 = ptr_weelist2->next_weelist; + ptr_item2 = ptr_item2->next_item; } if (other_completion == 0) @@ -1232,13 +1229,13 @@ gui_completion_command (struct t_gui_completion *completion) other_completion++; } if (completion->word_found && - (string_strcasecmp (ptr_weelist->data, completion->word_found) == 0)) + (string_strcasecmp (ptr_item->data, completion->word_found) == 0)) word_found_seen = 1; - + if (completion->direction < 0) - ptr_weelist = ptr_weelist->prev_weelist; + ptr_item = ptr_item->prev_item; else - ptr_weelist = ptr_weelist->next_weelist; + ptr_item = ptr_item->next_item; } if (completion->word_found) { @@ -1256,44 +1253,44 @@ void gui_completion_command_arg (struct t_gui_completion *completion, int nick_completion) { int length, word_found_seen, other_completion; - struct t_weelist *ptr_weelist, *ptr_weelist2; + struct t_weelist_item *ptr_item, *ptr_item2; length = strlen (completion->base_word); word_found_seen = 0; other_completion = 0; if (completion->direction < 0) - ptr_weelist = completion->last_completion; + ptr_item = completion->completion_list->last_item; else - ptr_weelist = completion->completion_list; + ptr_item = completion->completion_list->items; - while (ptr_weelist) + while (ptr_item) { - if ((nick_completion && (gui_completion_nickncmp (completion->base_word, ptr_weelist->data, length) == 0)) - || ((!nick_completion) && (string_strncasecmp (completion->base_word, ptr_weelist->data, length) == 0))) + if ((nick_completion && (gui_completion_nickncmp (completion->base_word, ptr_item->data, length) == 0)) + || ((!nick_completion) && (string_strncasecmp (completion->base_word, ptr_item->data, length) == 0))) { if ((!completion->word_found) || word_found_seen) { if (completion->word_found) free (completion->word_found); - completion->word_found = strdup (ptr_weelist->data); + completion->word_found = strdup (ptr_item->data); if (completion->direction < 0) - ptr_weelist2 = ptr_weelist->prev_weelist; + ptr_item2 = ptr_item->prev_item; else - ptr_weelist2 = ptr_weelist->next_weelist; + ptr_item2 = ptr_item->next_item; - while (ptr_weelist2) + while (ptr_item2) { if ((nick_completion - && (gui_completion_nickncmp (completion->base_word, ptr_weelist2->data, length) == 0)) + && (gui_completion_nickncmp (completion->base_word, ptr_item2->data, length) == 0)) || ((!nick_completion) - && (string_strncasecmp (completion->base_word, ptr_weelist2->data, length) == 0))) + && (string_strncasecmp (completion->base_word, ptr_item2->data, length) == 0))) other_completion++; if (completion->direction < 0) - ptr_weelist2 = ptr_weelist2->prev_weelist; + ptr_item2 = ptr_item2->prev_item; else - ptr_weelist2 = ptr_weelist2->next_weelist; + ptr_item2 = ptr_item2->next_item; } if (other_completion == 0) @@ -1306,13 +1303,13 @@ gui_completion_command_arg (struct t_gui_completion *completion, int nick_comple other_completion++; } if (completion->word_found && - (string_strcasecmp (ptr_weelist->data, completion->word_found) == 0)) + (string_strcasecmp (ptr_item->data, completion->word_found) == 0)) word_found_seen = 1; if (completion->direction < 0) - ptr_weelist = ptr_weelist->prev_weelist; + ptr_item = ptr_item->prev_item; else - ptr_weelist = ptr_weelist->next_weelist; + ptr_item = ptr_item->next_item; } if (completion->word_found) { @@ -1332,7 +1329,7 @@ gui_completion_nick (struct t_gui_completion *completion) (void) completion; /*int length, word_found_seen, other_completion; t_irc_nick *ptr_nick; - struct t_weelist *ptr_weelist, *ptr_weelist2; + struct t_weelist_item *ptr_item, *ptr_item2; if (!completion->channel) return; @@ -1342,14 +1339,12 @@ gui_completion_nick (struct t_gui_completion *completion) if ((((t_irc_channel *)(completion->channel))->type == IRC_CHANNEL_TYPE_PRIVATE) || (((t_irc_channel *)(completion->channel))->type == IRC_CHANNEL_TYPE_DCC_CHAT)) { - if (!(completion->completion_list)) + if (!(completion->completion_list->items)) { - weelist_add (&completion->completion_list, - &completion->last_completion, + weelist_add (completion->completion_list, ((t_irc_channel *)(completion->channel))->name, WEELIST_POS_SORT); - weelist_add (&completion->completion_list, - &completion->last_completion, + weelist_add (completion->completion_list, ((t_irc_server *)(completion->server))->nick, WEELIST_POS_SORT); } @@ -1359,13 +1354,12 @@ gui_completion_nick (struct t_gui_completion *completion) // rebuild nick list for completion, with nicks speaking at beginning of list if ((((t_irc_channel *)(completion->channel))->nick_completion_reset) - || (!(completion->completion_list))) + || (!(completion->completion_list->items))) { // empty completion list if (completion->completion_list) { - weelist_remove_all (&(completion->completion_list), - &(completion->last_completion)); + weelist_free (completion->completion_list); completion->completion_list = NULL; completion->last_completion = NULL; } @@ -1374,8 +1368,7 @@ gui_completion_nick (struct t_gui_completion *completion) for (ptr_nick = ((t_irc_channel *)(completion->channel))->nicks; ptr_nick; ptr_nick = ptr_nick->next_nick) { - weelist_add (&(completion->completion_list), - &(completion->last_completion), + weelist_add (completion->completion_list, ptr_nick->nick, WEELIST_POS_SORT); } @@ -1383,22 +1376,20 @@ gui_completion_nick (struct t_gui_completion *completion) // add nicks speaking recently on this channel if (CONFIG_BOOLEAN(config_look_nick_completion_smart)) { - for (ptr_weelist = ((t_irc_channel *)(completion->channel))->nicks_speaking; - ptr_weelist; ptr_weelist = ptr_weelist->next_weelist) + for (ptr_item = ((t_irc_channel *)(completion->channel))->nicks_speaking->items; + ptr_item; ptr_item = ptr_item->next_item) { if (irc_nick_search ((t_irc_channel *)(completion->channel), - ptr_weelist->data)) - weelist_add (&(completion->completion_list), - &(completion->last_completion), - ptr_weelist->data, + ptr_item->data)) + weelist_add (completion->completion_list, + ptr_item->data, WEELIST_POS_BEGINNING); } } // add self nick at the end if (completion->server) - weelist_add (&(completion->completion_list), - &(completion->last_completion), + weelist_add (completion->completion_list, ((t_irc_server *)(completion->server))->nick, WEELIST_POS_END); @@ -1410,19 +1401,19 @@ gui_completion_nick (struct t_gui_completion *completion) other_completion = 0; if (completion->direction < 0) - ptr_weelist = completion->last_completion; + ptr_item = completion->completion_list->last_item; else - ptr_weelist = completion->completion_list; + ptr_item = completion->completion_list->items; - while (ptr_weelist) + while (ptr_item) { - if (gui_completion_nickncmp (completion->base_word, ptr_weelist->data, length) == 0) + if (gui_completion_nickncmp (completion->base_word, ptr_item->data, length) == 0) { if ((!completion->word_found) || word_found_seen) { if (completion->word_found) free (completion->word_found); - completion->word_found = strdup (ptr_weelist->data); + completion->word_found = strdup (ptr_item->data); if (CONFIG_BOOLEAN(config_look_nick_complete_first)) { completion->position = -1; @@ -1430,21 +1421,21 @@ gui_completion_nick (struct t_gui_completion *completion) } if (completion->direction < 0) - ptr_weelist2 = ptr_weelist->prev_weelist; + ptr_item2 = ptr_item->prev_item; else - ptr_weelist2 = ptr_weelist->next_weelist; + ptr_item2 = ptr_item->next_item; - while (ptr_weelist2) + while (ptr_item2) { if (gui_completion_nickncmp (completion->base_word, - ptr_weelist2->data, + ptr_item2->data, length) == 0) other_completion++; if (completion->direction < 0) - ptr_weelist2 = ptr_weelist2->prev_weelist; + ptr_item2 = ptr_item2->prev_item; else - ptr_weelist2 = ptr_weelist2->next_weelist; + ptr_item2 = ptr_item2->next_item; } if (other_completion == 0) @@ -1459,13 +1450,13 @@ gui_completion_nick (struct t_gui_completion *completion) other_completion++; } if (completion->word_found && - (string_strcasecmp (ptr_weelist->data, completion->word_found) == 0)) + (string_strcasecmp (ptr_item->data, completion->word_found) == 0)) word_found_seen = 1; if (completion->direction < 0) - ptr_weelist = ptr_weelist->prev_weelist; + ptr_item = ptr_item->prev_item; else - ptr_weelist = ptr_weelist->next_weelist; + ptr_item = ptr_item->next_item; } if (completion->word_found) { @@ -1488,7 +1479,7 @@ gui_completion_auto (struct t_gui_completion *completion) if ((completion->base_word[0] == '/') || (completion->base_word[0] == '~')) { - if (!completion->completion_list) + if (!completion->completion_list->items) gui_completion_list_add_filename (completion); gui_completion_command_arg (completion, 0); return; @@ -1497,7 +1488,7 @@ gui_completion_auto (struct t_gui_completion *completion) // channel completion if (irc_channel_is_channel (completion->base_word)) { - if (!completion->completion_list) + if (!completion->completion_list->items) gui_completion_list_add_channels (completion); gui_completion_command_arg (completion, 0); return; @@ -1547,7 +1538,7 @@ gui_completion_search (struct t_gui_completion *completion, int direction, gui_completion_command (completion); break; case GUI_COMPLETION_COMMAND_ARG: - if (completion->completion_list) + if (completion->completion_list->items) gui_completion_command_arg (completion, completion->arg_is_nick); else { @@ -1587,27 +1578,26 @@ gui_completion_search (struct t_gui_completion *completion, int direction, void gui_completion_print_log (struct t_gui_completion *completion) { - log_printf ("[completion (addr:0x%X)]\n", completion); - log_printf (" buffer . . . . . . . . : 0x%X\n", completion->buffer); - log_printf (" context. . . . . . . . : %d\n", completion->context); - log_printf (" base_command . . . . . : '%s'\n", completion->base_command); - log_printf (" base_command_arg . . . : %d\n", completion->base_command_arg); - log_printf (" arg_is_nick. . . . . . : %d\n", completion->arg_is_nick); - log_printf (" base_word. . . . . . . : '%s'\n", completion->base_word); - log_printf (" base_word_pos. . . . . : %d\n", completion->base_word_pos); - log_printf (" position . . . . . . . : %d\n", completion->position); - log_printf (" args . . . . . . . . . : '%s'\n", completion->args); - log_printf (" direction. . . . . . . : %d\n", completion->direction); - log_printf (" add_space. . . . . . . : %d\n", completion->add_space); - log_printf (" completion_list. . . . : 0x%X\n", completion->completion_list); - log_printf (" last_completion. . . . : 0x%X\n", completion->last_completion); - log_printf (" word_found . . . . . . : '%s'\n", completion->word_found); - log_printf (" position_replace . . . : %d\n", completion->position_replace); - log_printf (" diff_size. . . . . . . : %d\n", completion->diff_size); - log_printf (" diff_length. . . . . . : %d\n", completion->diff_length); + log_printf ("[completion (addr:0x%X)]", completion); + log_printf (" buffer . . . . . . . . : 0x%X", completion->buffer); + log_printf (" context. . . . . . . . : %d", completion->context); + log_printf (" base_command . . . . . : '%s'", completion->base_command); + log_printf (" base_command_arg . . . : %d", completion->base_command_arg); + log_printf (" arg_is_nick. . . . . . : %d", completion->arg_is_nick); + log_printf (" base_word. . . . . . . : '%s'", completion->base_word); + log_printf (" base_word_pos. . . . . : %d", completion->base_word_pos); + log_printf (" position . . . . . . . : %d", completion->position); + log_printf (" args . . . . . . . . . : '%s'", completion->args); + log_printf (" direction. . . . . . . : %d", completion->direction); + log_printf (" add_space. . . . . . . : %d", completion->add_space); + log_printf (" completion_list. . . . : 0x%X", completion->completion_list); + log_printf (" word_found . . . . . . : '%s'", completion->word_found); + log_printf (" position_replace . . . : %d", completion->position_replace); + log_printf (" diff_size. . . . . . . : %d", completion->diff_size); + log_printf (" diff_length. . . . . . : %d", completion->diff_length); if (completion->completion_list) { - log_printf ("\n"); + log_printf (""); weelist_print_log (completion->completion_list, "completion list element"); } diff --git a/src/gui/gui-completion.h b/src/gui/gui-completion.h index d8adcb77b..e66c16ce7 100644 --- a/src/gui/gui-completion.h +++ b/src/gui/gui-completion.h @@ -43,7 +43,6 @@ struct t_gui_completion /* for command argument completion */ struct t_weelist *completion_list; /* data list for completion */ - struct t_weelist *last_completion; /* last data element for completion */ /* completion found */ char *word_found; /* word found (to replace base word) */ diff --git a/src/gui/gui-hotlist.c b/src/gui/gui-hotlist.c index f0c2c3c46..0e541beec 100644 --- a/src/gui/gui-hotlist.c +++ b/src/gui/gui-hotlist.c @@ -79,8 +79,8 @@ gui_hotlist_find_pos (struct t_gui_hotlist *hotlist, struct t_gui_hotlist *new_h { if ((new_hotlist->priority > ptr_hotlist->priority) || ((new_hotlist->priority == ptr_hotlist->priority) - && (util_get_timeval_diff (&(new_hotlist->creation_time), - &(ptr_hotlist->creation_time)) > 0))) + && (util_timeval_diff (&(new_hotlist->creation_time), + &(ptr_hotlist->creation_time)) > 0))) return ptr_hotlist; } break; @@ -90,7 +90,7 @@ gui_hotlist_find_pos (struct t_gui_hotlist *hotlist, struct t_gui_hotlist *new_h { if ((new_hotlist->priority > ptr_hotlist->priority) || ((new_hotlist->priority == ptr_hotlist->priority) - && (util_get_timeval_diff (&(new_hotlist->creation_time), + && (util_timeval_diff (&(new_hotlist->creation_time), &(ptr_hotlist->creation_time)) < 0))) return ptr_hotlist; } @@ -209,9 +209,8 @@ gui_hotlist_add (struct t_gui_buffer *buffer, int priority, if ((new_hotlist = (struct t_gui_hotlist *) malloc (sizeof (struct t_gui_hotlist))) == NULL) { - log_printf (NULL, - _("Error: not enough memory to add a buffer to " - "hotlist\n")); + log_printf (_("Error: not enough memory to add a buffer to " + "hotlist")); return; } @@ -346,13 +345,13 @@ gui_hotlist_print_log () for (ptr_hotlist = gui_hotlist; ptr_hotlist; ptr_hotlist = ptr_hotlist->next_hotlist) { - log_printf ("[hotlist (addr:0x%X)]\n", ptr_hotlist); - log_printf (" priority . . . . . . . : %d\n", ptr_hotlist->priority); - log_printf (" creation_time. . . . . : tv_sec:%d, tv_usec:%d\n", + log_printf ("[hotlist (addr:0x%X)]", ptr_hotlist); + log_printf (" priority . . . . . . . : %d", ptr_hotlist->priority); + log_printf (" creation_time. . . . . : tv_sec:%d, tv_usec:%d", ptr_hotlist->creation_time.tv_sec, ptr_hotlist->creation_time.tv_usec); - log_printf (" buffer . . . . . . . . : 0x%X\n", ptr_hotlist->buffer); - log_printf (" prev_hotlist . . . . . : 0x%X\n", ptr_hotlist->prev_hotlist); - log_printf (" next_hotlist . . . . . : 0x%X\n", ptr_hotlist->next_hotlist); + log_printf (" buffer . . . . . . . . : 0x%X", ptr_hotlist->buffer); + log_printf (" prev_hotlist . . . . . : 0x%X", ptr_hotlist->prev_hotlist); + log_printf (" next_hotlist . . . . . : 0x%X", ptr_hotlist->next_hotlist); } } diff --git a/src/gui/gui-infobar.c b/src/gui/gui-infobar.c index 66d211637..8e3d78815 100644 --- a/src/gui/gui-infobar.c +++ b/src/gui/gui-infobar.c @@ -72,7 +72,7 @@ gui_infobar_printf (int time_displayed, int color, char *message, ...) free (buf2); } else - log_printf (_("Error: not enough memory for infobar message\n")); + log_printf (_("Error: not enough memory for infobar message")); } /* diff --git a/src/gui/gui-keyboard.c b/src/gui/gui-keyboard.c index c31252d2b..d80b7a670 100644 --- a/src/gui/gui-keyboard.c +++ b/src/gui/gui-keyboard.c @@ -518,7 +518,7 @@ gui_keyboard_bind (char *key, char *command) if (!key || !command) { - log_printf (_("Error: unable to bind key \"%s\"\n"), key); + log_printf (_("Error: unable to bind key \"%s\""), key); return NULL; } @@ -546,7 +546,7 @@ gui_keyboard_bind (char *key, char *command) if (!ptr_function) { log_printf (_("Error: unable to bind key \"%s\" " - "(invalid function name: \"%s\")\n"), + "(invalid function name: \"%s\")"), key, command); return NULL; } @@ -560,7 +560,7 @@ gui_keyboard_bind (char *key, char *command) ptr_args); if (!new_key) { - log_printf (_("Error: not enough memory for key binding\n")); + log_printf (_("Error: not enough memory for key binding")); return NULL; } diff --git a/src/gui/gui-window.c b/src/gui/gui-window.c index df62cf72e..258a7154d 100644 --- a/src/gui/gui-window.c +++ b/src/gui/gui-window.c @@ -128,8 +128,8 @@ gui_window_new (struct t_gui_window *parent, int x, int y, int width, int height struct t_gui_window_tree *ptr_tree, *child1, *child2, *ptr_leaf; #ifdef DEBUG - weechat_log_printf ("Creating new window (x:%d, y:%d, width:%d, height:%d)\n", - x, y, width, height); + log_printf ("Creating new window (x:%d, y:%d, width:%d, height:%d)", + x, y, width, height); #endif if (parent) @@ -769,57 +769,57 @@ gui_window_print_log () { struct t_gui_window *ptr_window; - log_printf ("\n"); - log_printf ("current window = 0x%X\n", gui_current_window); + log_printf (""); + log_printf ("current window = 0x%X", gui_current_window); for (ptr_window = gui_windows; ptr_window; ptr_window = ptr_window->next_window) { - log_printf ("\n"); - log_printf ("[window (addr:0x%X)]\n", ptr_window); - log_printf (" win_x . . . . . . . : %d\n", ptr_window->win_x); - log_printf (" win_y . . . . . . . : %d\n", ptr_window->win_y); - log_printf (" win_width . . . . . : %d\n", ptr_window->win_width); - log_printf (" win_height. . . . . : %d\n", ptr_window->win_height); - log_printf (" win_width_pct . . . : %d\n", ptr_window->win_width_pct); - log_printf (" win_height_pct. . . : %d\n", ptr_window->win_height_pct); - log_printf (" win_chat_x. . . . . : %d\n", ptr_window->win_chat_x); - log_printf (" win_chat_y. . . . . : %d\n", ptr_window->win_chat_y); - log_printf (" win_chat_width. . . : %d\n", ptr_window->win_chat_width); - log_printf (" win_chat_height . . : %d\n", ptr_window->win_chat_height); - log_printf (" win_chat_cursor_x . : %d\n", ptr_window->win_chat_cursor_x); - log_printf (" win_chat_cursor_y . : %d\n", ptr_window->win_chat_cursor_y); - log_printf (" win_nick_x. . . . . : %d\n", ptr_window->win_nick_x); - log_printf (" win_nick_y. . . . . : %d\n", ptr_window->win_nick_y); - log_printf (" win_nick_width. . . : %d\n", ptr_window->win_nick_width); - log_printf (" win_nick_height . . : %d\n", ptr_window->win_nick_height); - log_printf (" win_nick_start. . . : %d\n", ptr_window->win_nick_start); - log_printf (" win_title_x . . . . : %d\n", ptr_window->win_title_x); - log_printf (" win_title_y . . . . : %d\n", ptr_window->win_title_y); - log_printf (" win_title_width . . : %d\n", ptr_window->win_title_width); - log_printf (" win_title_height. . : %d\n", ptr_window->win_title_height); - log_printf (" win_title_start . . : %d\n", ptr_window->win_title_start); - log_printf (" win_status_x. . . . : %d\n", ptr_window->win_status_x); - log_printf (" win_status_y. . . . : %d\n", ptr_window->win_status_y); - log_printf (" win_status_width. . : %d\n", ptr_window->win_status_width); - log_printf (" win_status_height . : %d\n", ptr_window->win_status_height); - log_printf (" win_infobar_x . . . : %d\n", ptr_window->win_infobar_x); - log_printf (" win_infobar_y . . . : %d\n", ptr_window->win_infobar_y); - log_printf (" win_infobar_width . : %d\n", ptr_window->win_infobar_width); - log_printf (" win_infobar_height. : %d\n", ptr_window->win_infobar_height); - log_printf (" win_input_x . . . . : %d\n", ptr_window->win_input_x); - log_printf (" win_input_y . . . . : %d\n", ptr_window->win_input_y); - log_printf (" win_input_width . . : %d\n", ptr_window->win_input_width); - log_printf (" win_input_height. . : %d\n", ptr_window->win_input_height); - log_printf (" win_input_cursor_x. : %d\n", ptr_window->win_input_cursor_x); + log_printf (""); + log_printf ("[window (addr:0x%X)]", ptr_window); + log_printf (" win_x . . . . . . . : %d", ptr_window->win_x); + log_printf (" win_y . . . . . . . : %d", ptr_window->win_y); + log_printf (" win_width . . . . . : %d", ptr_window->win_width); + log_printf (" win_height. . . . . : %d", ptr_window->win_height); + log_printf (" win_width_pct . . . : %d", ptr_window->win_width_pct); + log_printf (" win_height_pct. . . : %d", ptr_window->win_height_pct); + log_printf (" win_chat_x. . . . . : %d", ptr_window->win_chat_x); + log_printf (" win_chat_y. . . . . : %d", ptr_window->win_chat_y); + log_printf (" win_chat_width. . . : %d", ptr_window->win_chat_width); + log_printf (" win_chat_height . . : %d", ptr_window->win_chat_height); + log_printf (" win_chat_cursor_x . : %d", ptr_window->win_chat_cursor_x); + log_printf (" win_chat_cursor_y . : %d", ptr_window->win_chat_cursor_y); + log_printf (" win_nick_x. . . . . : %d", ptr_window->win_nick_x); + log_printf (" win_nick_y. . . . . : %d", ptr_window->win_nick_y); + log_printf (" win_nick_width. . . : %d", ptr_window->win_nick_width); + log_printf (" win_nick_height . . : %d", ptr_window->win_nick_height); + log_printf (" win_nick_start. . . : %d", ptr_window->win_nick_start); + log_printf (" win_title_x . . . . : %d", ptr_window->win_title_x); + log_printf (" win_title_y . . . . : %d", ptr_window->win_title_y); + log_printf (" win_title_width . . : %d", ptr_window->win_title_width); + log_printf (" win_title_height. . : %d", ptr_window->win_title_height); + log_printf (" win_title_start . . : %d", ptr_window->win_title_start); + log_printf (" win_status_x. . . . : %d", ptr_window->win_status_x); + log_printf (" win_status_y. . . . : %d", ptr_window->win_status_y); + log_printf (" win_status_width. . : %d", ptr_window->win_status_width); + log_printf (" win_status_height . : %d", ptr_window->win_status_height); + log_printf (" win_infobar_x . . . : %d", ptr_window->win_infobar_x); + log_printf (" win_infobar_y . . . : %d", ptr_window->win_infobar_y); + log_printf (" win_infobar_width . : %d", ptr_window->win_infobar_width); + log_printf (" win_infobar_height. : %d", ptr_window->win_infobar_height); + log_printf (" win_input_x . . . . : %d", ptr_window->win_input_x); + log_printf (" win_input_y . . . . : %d", ptr_window->win_input_y); + log_printf (" win_input_width . . : %d", ptr_window->win_input_width); + log_printf (" win_input_height. . : %d", ptr_window->win_input_height); + log_printf (" win_input_cursor_x. : %d", ptr_window->win_input_cursor_x); gui_window_objects_print_log (ptr_window); - log_printf (" dcc_first . . . . . : 0x%X\n", ptr_window->dcc_first); - log_printf (" dcc_selected. . . . : 0x%X\n", ptr_window->dcc_selected); - log_printf (" dcc_last_displayed. : 0x%X\n", ptr_window->dcc_last_displayed); - log_printf (" buffer. . . . . . . : 0x%X\n", ptr_window->buffer); - log_printf (" first_line_displayed: %d\n", ptr_window->first_line_displayed); - log_printf (" start_line. . . . . : 0x%X\n", ptr_window->start_line); - log_printf (" start_line_pos. . . : %d\n", ptr_window->start_line_pos); - log_printf (" prev_window . . . . : 0x%X\n", ptr_window->prev_window); - log_printf (" next_window . . . . : 0x%X\n", ptr_window->next_window); + log_printf (" dcc_first . . . . . : 0x%X", ptr_window->dcc_first); + log_printf (" dcc_selected. . . . : 0x%X", ptr_window->dcc_selected); + log_printf (" dcc_last_displayed. : 0x%X", ptr_window->dcc_last_displayed); + log_printf (" buffer. . . . . . . : 0x%X", ptr_window->buffer); + log_printf (" first_line_displayed: %d", ptr_window->first_line_displayed); + log_printf (" start_line. . . . . : 0x%X", ptr_window->start_line); + log_printf (" start_line_pos. . . : %d", ptr_window->start_line_pos); + log_printf (" prev_window . . . . : 0x%X", ptr_window->prev_window); + log_printf (" next_window . . . . : 0x%X", ptr_window->next_window); } } |