1
0
mirror of https://github.com/weechat/weechat.git synced 2026-06-29 14:26:39 +02:00

Aspell plugin is born again

This commit is contained in:
Sebastien Helleu
2008-10-18 16:03:16 +02:00
parent 1f10ee141a
commit ac107802fd
41 changed files with 2357 additions and 1655 deletions
+6 -5
View File
@@ -1126,11 +1126,11 @@ command_help (void *data, struct t_gui_buffer *buffer,
_("type"), _("string"));
gui_chat_printf (NULL, " %s: %s",
_("values"), string);
gui_chat_printf (NULL, " %s: '%s'",
gui_chat_printf (NULL, " %s: \"%s\"",
_("default value"),
ptr_option->string_values[CONFIG_INTEGER_DEFAULT(ptr_option)]);
gui_chat_printf (NULL,
" %s: '%s%s%s'",
" %s: \"%s%s%s\"",
_("current value"),
GUI_COLOR(GUI_COLOR_CHAT_HOST),
ptr_option->string_values[CONFIG_INTEGER(ptr_option)],
@@ -1178,10 +1178,10 @@ command_help (void *data, struct t_gui_buffer *buffer,
ptr_option->max);
break;
}
gui_chat_printf (NULL, " %s: '%s'",
gui_chat_printf (NULL, " %s: \"%s\"",
_("default value"),
CONFIG_STRING_DEFAULT(ptr_option));
gui_chat_printf (NULL, " %s: '%s%s%s'",
gui_chat_printf (NULL, " %s: \"%s%s%s\"",
_("current value"),
GUI_COLOR(GUI_COLOR_CHAT_HOST),
CONFIG_STRING(ptr_option),
@@ -1516,7 +1516,8 @@ command_layout_display_tree (struct t_gui_layout_window *layout_window,
/* leaf */
snprintf (format, sizeof (format), "%%-%ds%s",
indent * 2,
_("leaf: id: %d, parent: %d, plugin: '%s', buffer: '%s'"));
_("leaf: id: %d, parent: %d, plugin: \"%s\", "
"buffer: \"%s\""));
gui_chat_printf (NULL, format,
" ",
layout_window->internal_id,
+6 -6
View File
@@ -2393,8 +2393,8 @@ config_file_print_stdout (struct t_config_file *config_file)
{
case CONFIG_OPTION_TYPE_BOOLEAN:
string_iconv_fprintf (stdout, _(" . type: boolean\n"));
string_iconv_fprintf (stdout, _(" . values: 'on' or 'off'\n"));
string_iconv_fprintf (stdout, _(" . default value: '%s'\n"),
string_iconv_fprintf (stdout, _(" . values: \"on\" or \"off\"\n"));
string_iconv_fprintf (stdout, _(" . default value: \"%s\"\n"),
(CONFIG_BOOLEAN_DEFAULT(ptr_option) == CONFIG_BOOLEAN_TRUE) ?
"on" : "off");
break;
@@ -2406,14 +2406,14 @@ config_file_print_stdout (struct t_config_file *config_file)
i = 0;
while (ptr_option->string_values[i])
{
string_iconv_fprintf (stdout, "'%s'",
string_iconv_fprintf (stdout, "\"%s\"",
ptr_option->string_values[i]);
if (ptr_option->string_values[i + 1])
string_iconv_fprintf (stdout, ", ");
i++;
}
string_iconv_fprintf (stdout, "\n");
string_iconv_fprintf (stdout, _(" . default value: '%s'\n"),
string_iconv_fprintf (stdout, _(" . default value: \"%s\"\n"),
ptr_option->string_values[CONFIG_INTEGER_DEFAULT(ptr_option)]);
}
else
@@ -2443,14 +2443,14 @@ config_file_print_stdout (struct t_config_file *config_file)
ptr_option->max);
break;
}
string_iconv_fprintf (stdout, _(" . default value: '%s'\n"),
string_iconv_fprintf (stdout, _(" . default value: \"%s\"\n"),
CONFIG_STRING_DEFAULT(ptr_option));
break;
case CONFIG_OPTION_TYPE_COLOR:
color_name = gui_color_get_name (CONFIG_COLOR_DEFAULT(ptr_option));
string_iconv_fprintf (stdout, _(" . type: color\n"));
string_iconv_fprintf (stdout, _(" . values: color (depends on GUI used)\n"));
string_iconv_fprintf (stdout, _(" . default value: '%s'\n"),
string_iconv_fprintf (stdout, _(" . default value: \"%s\"\n"),
color_name);
break;
case CONFIG_NUM_OPTION_TYPES:
+2 -2
View File
@@ -176,14 +176,14 @@ hook_remove_from_list (struct t_hook *hook)
last_weechat_hook[hook->type] = hook->prev_hook;
if (hook->prev_hook)
{
hook->prev_hook->next_hook = hook->next_hook;
(hook->prev_hook)->next_hook = hook->next_hook;
new_hooks = weechat_hooks[hook->type];
}
else
new_hooks = hook->next_hook;
if (hook->next_hook)
hook->next_hook->prev_hook = hook->prev_hook;
(hook->next_hook)->prev_hook = hook->prev_hook;
free (hook);
+1 -1
View File
@@ -54,7 +54,7 @@ upgrade_file_error (struct t_upgrade_file *upgrade_file, char *message1,
char *message2, char *file, int line)
{
gui_chat_printf (NULL,
_("%sError upgrading WeeChat with file '%s':"),
_("%sError upgrading WeeChat with file \"%s\":"),
gui_chat_prefix[GUI_CHAT_PREFIX_ERROR],
upgrade_file->filename);
gui_chat_printf (NULL,
+15 -2
View File
@@ -570,9 +570,9 @@ gui_bar_item_free (struct t_gui_bar_item *item)
{
/* remove bar item from bar items list */
if (item->prev_item)
item->prev_item->next_item = item->next_item;
(item->prev_item)->next_item = item->next_item;
if (item->next_item)
item->next_item->prev_item = item->prev_item;
(item->next_item)->prev_item = item->prev_item;
if (gui_bar_items == item)
gui_bar_items = item->next_item;
if (last_gui_bar_item == item)
@@ -751,6 +751,8 @@ gui_bar_item_default_input_text (void *data, struct t_gui_bar_item *item,
struct t_gui_window *window,
int max_width, int max_height)
{
char *new_input, str_buffer[128];
/* make C compiler happy */
(void) data;
(void) item;
@@ -759,6 +761,17 @@ gui_bar_item_default_input_text (void *data, struct t_gui_bar_item *item,
if (!window)
window = gui_current_window;
snprintf (str_buffer, sizeof (str_buffer),
"0x%x", (unsigned int)(window->buffer));
new_input = hook_modifier_exec (NULL,
"weechat_input_text_display",
str_buffer,
(window->buffer->input_buffer) ?
window->buffer->input_buffer : "");
if (new_input)
return new_input;
return (window->buffer->input_buffer) ?
strdup (window->buffer->input_buffer) : NULL;
+3 -8
View File
@@ -118,12 +118,12 @@ gui_buffer_insert (struct t_gui_buffer *buffer)
/* add buffer to the end */
buffer->number = (last_gui_buffer) ? last_gui_buffer->number + 1 : 1;
buffer->prev_buffer = last_gui_buffer;
buffer->next_buffer = NULL;
if (gui_buffers)
last_gui_buffer->next_buffer = buffer;
else
gui_buffers = buffer;
last_gui_buffer = buffer;
buffer->next_buffer = NULL;
}
}
@@ -205,9 +205,7 @@ gui_buffer_new (struct t_weechat_plugin *plugin,
new_buffer->input_nick = NULL;
new_buffer->input_buffer_alloc = GUI_BUFFER_INPUT_BLOCK_SIZE;
new_buffer->input_buffer = malloc (GUI_BUFFER_INPUT_BLOCK_SIZE);
new_buffer->input_buffer_color_mask = malloc (GUI_BUFFER_INPUT_BLOCK_SIZE);
new_buffer->input_buffer[0] = '\0';
new_buffer->input_buffer_color_mask[0] = '\0';
new_buffer->input_buffer_size = 0;
new_buffer->input_buffer_length = 0;
new_buffer->input_buffer_pos = 0;
@@ -994,8 +992,6 @@ gui_buffer_close (struct t_gui_buffer *buffer, int switch_to_another)
free (buffer->name);
if (buffer->input_buffer)
free (buffer->input_buffer);
if (buffer->input_buffer_color_mask)
free (buffer->input_buffer_color_mask);
if (buffer->completion)
gui_completion_free (buffer->completion);
gui_history_buffer_free (buffer);
@@ -1011,9 +1007,9 @@ gui_buffer_close (struct t_gui_buffer *buffer, int switch_to_another)
/* remove buffer from buffers list */
if (buffer->prev_buffer)
buffer->prev_buffer->next_buffer = buffer->next_buffer;
(buffer->prev_buffer)->next_buffer = buffer->next_buffer;
if (buffer->next_buffer)
buffer->next_buffer->prev_buffer = buffer->prev_buffer;
(buffer->next_buffer)->prev_buffer = buffer->prev_buffer;
if (gui_buffers == buffer)
gui_buffers = buffer->next_buffer;
if (last_gui_buffer == buffer)
@@ -1449,7 +1445,6 @@ gui_buffer_print_log ()
log_printf (" input_callback_data. . : 0x%x", ptr_buffer->input_callback_data);
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);
-1
View File
@@ -121,7 +121,6 @@ struct t_gui_buffer
/* to this buffer */
char *input_nick; /* self nick */
char *input_buffer; /* input buffer */
char *input_buffer_color_mask; /* color mask for input buffer */
int input_buffer_alloc; /* input buffer: allocated size */
int input_buffer_size; /* buffer size in bytes */
int input_buffer_length; /* number of chars in buffer */
+2 -2
View File
@@ -680,9 +680,9 @@ gui_chat_line_free (struct t_gui_buffer *buffer, struct t_gui_line *line)
/* remove line from lines list */
if (line->prev_line)
line->prev_line->next_line = line->next_line;
(line->prev_line)->next_line = line->next_line;
if (line->next_line)
line->next_line->prev_line = line->prev_line;
(line->next_line)->prev_line = line->prev_line;
if (buffer->lines == line)
buffer->lines = line->next_line;
if (buffer->last_line == line)
+2 -2
View File
@@ -156,9 +156,9 @@ gui_completion_partial_list_free (struct t_gui_completion_partial *item)
{
/* remove partial completion item from list */
if (item->prev_item)
item->prev_item->next_item = item->next_item;
(item->prev_item)->next_item = item->next_item;
if (item->next_item)
item->next_item->prev_item = item->prev_item;
(item->next_item)->prev_item = item->prev_item;
if (gui_completion_partial_list == item)
gui_completion_partial_list = item->next_item;
if (last_gui_completion_partial == item)
+2 -2
View File
@@ -381,9 +381,9 @@ gui_filter_free (struct t_gui_filter *filter)
/* remove filter from filters list */
if (filter->prev_filter)
filter->prev_filter->next_filter = filter->next_filter;
(filter->prev_filter)->next_filter = filter->next_filter;
if (filter->next_filter)
filter->next_filter->prev_filter = filter->prev_filter;
(filter->next_filter)->prev_filter = filter->prev_filter;
if (gui_filters == filter)
gui_filters = filter->next_filter;
if (last_gui_filter == filter)
+1 -64
View File
@@ -114,29 +114,10 @@ gui_input_optimize_size (struct t_gui_buffer *buffer)
{
buffer->input_buffer_alloc = optimal_size;
buffer->input_buffer = realloc (buffer->input_buffer, optimal_size);
buffer->input_buffer_color_mask = realloc (buffer->input_buffer_color_mask,
optimal_size);
}
}
}
/*
* gui_input_init_color_mask: initialize color mask for input buffer
*/
void
gui_input_init_color_mask (struct t_gui_buffer *buffer)
{
int i;
if (buffer->input)
{
for (i = 0; i < buffer->input_buffer_size; i++)
buffer->input_buffer_color_mask[i] = ' ';
buffer->input_buffer_color_mask[buffer->input_buffer_size] = '\0';
}
}
/*
* gui_input_move: move data in input buffer
*/
@@ -151,8 +132,6 @@ gui_input_move (struct t_gui_buffer *buffer, char *target, const char *source,
pos_source = source - buffer->input_buffer;
memmove (target, source, size);
memmove (buffer->input_buffer_color_mask + pos_target,
buffer->input_buffer_color_mask + pos_source, size);
}
/*
@@ -166,7 +145,7 @@ int
gui_input_insert_string (struct t_gui_buffer *buffer, const char *string,
int pos)
{
int i, pos_start, size, length;
int pos_start, size, length;
char *ptr_start;
char *buffer_before_insert, *string2;
@@ -187,24 +166,16 @@ gui_input_insert_string (struct t_gui_buffer *buffer, const char *string,
buffer->input_buffer_length += length;
gui_input_optimize_size (buffer);
buffer->input_buffer[buffer->input_buffer_size] = '\0';
buffer->input_buffer_color_mask[buffer->input_buffer_size] = '\0';
/* move end of string to the right */
ptr_start = utf8_add_offset (buffer->input_buffer, pos);
pos_start = ptr_start - buffer->input_buffer;
memmove (ptr_start + size, ptr_start, strlen (ptr_start));
memmove (buffer->input_buffer_color_mask + pos_start + size,
buffer->input_buffer_color_mask + pos_start,
strlen (buffer->input_buffer_color_mask + pos_start));
/* insert new string */
ptr_start = utf8_add_offset (buffer->input_buffer, pos);
pos_start = ptr_start - buffer->input_buffer;
strncpy (ptr_start, string, size);
for (i = 0; i < size; i++)
{
buffer->input_buffer_color_mask[pos_start + i] = ' ';
}
buffer->input_buffer_pos += length;
@@ -360,7 +331,6 @@ gui_input_return ()
else if (gui_current_window->buffer->input_buffer_size > 0)
{
gui_current_window->buffer->input_buffer[gui_current_window->buffer->input_buffer_size] = '\0';
gui_current_window->buffer->input_buffer_color_mask[gui_current_window->buffer->input_buffer_size] = '\0';
command = strdup (gui_current_window->buffer->input_buffer);
if (!command)
return;
@@ -368,7 +338,6 @@ gui_input_return ()
gui_current_window->buffer->input_buffer);
gui_history_global_add (gui_current_window->buffer->input_buffer);
gui_current_window->buffer->input_buffer[0] = '\0';
gui_current_window->buffer->input_buffer_color_mask[0] = '\0';
gui_current_window->buffer->input_buffer_size = 0;
gui_current_window->buffer->input_buffer_length = 0;
gui_current_window->buffer->input_buffer_pos = 0;
@@ -407,15 +376,12 @@ gui_input_complete (struct t_gui_buffer *buffer)
buffer->completion->diff_length;
gui_input_optimize_size (buffer);
buffer->input_buffer[buffer->input_buffer_size] = '\0';
buffer->input_buffer_color_mask[buffer->input_buffer_size] = '\0';
for (i = buffer->input_buffer_size - 1;
i >= buffer->completion->position_replace +
(int)strlen (buffer->completion->word_found); i--)
{
buffer->input_buffer[i] =
buffer->input_buffer[i - buffer->completion->diff_size];
buffer->input_buffer_color_mask[i] =
buffer->input_buffer_color_mask[i - buffer->completion->diff_size];
}
}
else
@@ -426,23 +392,16 @@ gui_input_complete (struct t_gui_buffer *buffer)
{
buffer->input_buffer[i] =
buffer->input_buffer[i - buffer->completion->diff_size];
buffer->input_buffer_color_mask[i] =
buffer->input_buffer_color_mask[i - buffer->completion->diff_size];
}
buffer->input_buffer_size += buffer->completion->diff_size;
buffer->input_buffer_length += buffer->completion->diff_length;
gui_input_optimize_size (buffer);
buffer->input_buffer[buffer->input_buffer_size] = '\0';
buffer->input_buffer_color_mask[buffer->input_buffer_size] = '\0';
}
strncpy (buffer->input_buffer + buffer->completion->position_replace,
buffer->completion->word_found,
strlen (buffer->completion->word_found));
for (i = 0; i < (int)strlen (buffer->completion->word_found); i++)
{
buffer->input_buffer_color_mask[buffer->completion->position_replace + i] = ' ';
}
buffer->input_buffer_pos =
utf8_pos (buffer->input_buffer,
buffer->completion->position_replace) +
@@ -590,7 +549,6 @@ gui_input_delete_previous_char ()
gui_current_window->buffer->input_buffer_length--;
gui_current_window->buffer->input_buffer_pos--;
gui_current_window->buffer->input_buffer[gui_current_window->buffer->input_buffer_size] = '\0';
gui_current_window->buffer->input_buffer_color_mask[gui_current_window->buffer->input_buffer_size] = '\0';
gui_input_optimize_size (gui_current_window->buffer);
gui_completion_stop (gui_current_window->buffer->completion, 1);
gui_buffer_ask_input_refresh (gui_current_window->buffer, 1);
@@ -623,7 +581,6 @@ gui_input_delete_next_char ()
gui_current_window->buffer->input_buffer_size -= char_size;
gui_current_window->buffer->input_buffer_length--;
gui_current_window->buffer->input_buffer[gui_current_window->buffer->input_buffer_size] = '\0';
gui_current_window->buffer->input_buffer_color_mask[gui_current_window->buffer->input_buffer_size] = '\0';
gui_input_optimize_size (gui_current_window->buffer);
gui_completion_stop (gui_current_window->buffer->completion, 1);
gui_buffer_ask_input_refresh (gui_current_window->buffer, 1);
@@ -683,7 +640,6 @@ gui_input_delete_previous_word ()
gui_current_window->buffer->input_buffer_size -= size_deleted;
gui_current_window->buffer->input_buffer_length -= length_deleted;
gui_current_window->buffer->input_buffer[gui_current_window->buffer->input_buffer_size] = '\0';
gui_current_window->buffer->input_buffer_color_mask[gui_current_window->buffer->input_buffer_size] = '\0';
gui_current_window->buffer->input_buffer_pos -= length_deleted;
gui_input_optimize_size (gui_current_window->buffer);
gui_completion_stop (gui_current_window->buffer->completion, 1);
@@ -725,7 +681,6 @@ gui_input_delete_next_word ()
gui_current_window->buffer->input_buffer_size -= size_deleted;
gui_current_window->buffer->input_buffer_length -= length_deleted;
gui_current_window->buffer->input_buffer[gui_current_window->buffer->input_buffer_size] = '\0';
gui_current_window->buffer->input_buffer_color_mask[gui_current_window->buffer->input_buffer_size] = '\0';
gui_input_optimize_size (gui_current_window->buffer);
gui_completion_stop (gui_current_window->buffer->completion, 1);
gui_buffer_ask_input_refresh (gui_current_window->buffer, 1);
@@ -762,7 +717,6 @@ gui_input_delete_beginning_of_line ()
gui_current_window->buffer->input_buffer_size -= size_deleted;
gui_current_window->buffer->input_buffer_length -= length_deleted;
gui_current_window->buffer->input_buffer[gui_current_window->buffer->input_buffer_size] = '\0';
gui_current_window->buffer->input_buffer_color_mask[gui_current_window->buffer->input_buffer_size] = '\0';
gui_current_window->buffer->input_buffer_pos = 0;
gui_input_optimize_size (gui_current_window->buffer);
gui_completion_stop (gui_current_window->buffer->completion, 1);
@@ -795,7 +749,6 @@ gui_input_delete_end_of_line (const char *args)
length_deleted = utf8_strlen (start);
gui_input_clipboard_copy (start, size_deleted);
start[0] = '\0';
gui_current_window->buffer->input_buffer_color_mask[pos_start] = '\0';
gui_current_window->buffer->input_buffer_size = strlen (gui_current_window->buffer->input_buffer);
gui_current_window->buffer->input_buffer_length = utf8_strlen (gui_current_window->buffer->input_buffer);
gui_input_optimize_size (gui_current_window->buffer);
@@ -815,7 +768,6 @@ gui_input_delete_line ()
if (gui_current_window->buffer->input)
{
gui_current_window->buffer->input_buffer[0] = '\0';
gui_current_window->buffer->input_buffer_color_mask[0] = '\0';
gui_current_window->buffer->input_buffer_size = 0;
gui_current_window->buffer->input_buffer_length = 0;
gui_current_window->buffer->input_buffer_pos = 0;
@@ -859,12 +811,6 @@ gui_input_transpose_chars ()
memcpy (prev_char, start, size_start_char);
memcpy (prev_char + size_start_char, saved_char, size_prev_char);
memcpy (saved_char, gui_current_window->buffer->input_buffer_color_mask + pos_prev_char, size_prev_char);
memcpy (gui_current_window->buffer->input_buffer_color_mask + pos_prev_char,
gui_current_window->buffer->input_buffer_color_mask + pos_start, size_start_char);
memcpy (gui_current_window->buffer->input_buffer_color_mask + pos_prev_char + size_start_char,
saved_char, size_prev_char);
gui_current_window->buffer->input_buffer_pos++;
gui_completion_stop (gui_current_window->buffer->completion, 1);
@@ -1072,7 +1018,6 @@ gui_input_history_previous ()
if (gui_current_window->buffer->input_buffer_size > 0)
{
gui_current_window->buffer->input_buffer[gui_current_window->buffer->input_buffer_size] = '\0';
gui_current_window->buffer->input_buffer_color_mask[gui_current_window->buffer->input_buffer_size] = '\0';
gui_history_buffer_add (gui_current_window->buffer, gui_current_window->buffer->input_buffer);
gui_history_global_add (gui_current_window->buffer->input_buffer);
}
@@ -1082,7 +1027,6 @@ gui_input_history_previous ()
if (gui_current_window->buffer->input_buffer_size > 0)
{
gui_current_window->buffer->input_buffer[gui_current_window->buffer->input_buffer_size] = '\0';
gui_current_window->buffer->input_buffer_color_mask[gui_current_window->buffer->input_buffer_size] = '\0';
if (gui_current_window->buffer->ptr_history->prev_history->text)
free(gui_current_window->buffer->ptr_history->prev_history->text);
gui_current_window->buffer->ptr_history->prev_history->text = strdup (gui_current_window->buffer->input_buffer);
@@ -1098,7 +1042,6 @@ gui_input_history_previous ()
gui_current_window->buffer->input_buffer_1st_display = 0;
strcpy (gui_current_window->buffer->input_buffer,
gui_current_window->buffer->ptr_history->text);
gui_input_init_color_mask (gui_current_window->buffer);
gui_buffer_ask_input_refresh (gui_current_window->buffer, 1);
}
gui_input_text_changed_signal ();
@@ -1137,7 +1080,6 @@ gui_input_history_next ()
else
{
gui_current_window->buffer->input_buffer[0] = '\0';
gui_current_window->buffer->input_buffer_color_mask[0] = '\0';
gui_current_window->buffer->input_buffer_size = 0;
gui_current_window->buffer->input_buffer_length = 0;
}
@@ -1149,7 +1091,6 @@ gui_input_history_next ()
{
strcpy (gui_current_window->buffer->input_buffer,
gui_current_window->buffer->ptr_history->text);
gui_input_init_color_mask (gui_current_window->buffer);
}
gui_buffer_ask_input_refresh (gui_current_window->buffer, 1);
}
@@ -1159,11 +1100,9 @@ gui_input_history_next ()
if (gui_current_window->buffer->input_buffer_size > 0)
{
gui_current_window->buffer->input_buffer[gui_current_window->buffer->input_buffer_size] = '\0';
gui_current_window->buffer->input_buffer_color_mask[gui_current_window->buffer->input_buffer_size] = '\0';
gui_history_buffer_add (gui_current_window->buffer, gui_current_window->buffer->input_buffer);
gui_history_global_add (gui_current_window->buffer->input_buffer);
gui_current_window->buffer->input_buffer[0] = '\0';
gui_current_window->buffer->input_buffer_color_mask[0] = '\0';
gui_current_window->buffer->input_buffer_size = 0;
gui_current_window->buffer->input_buffer_length = 0;
gui_current_window->buffer->input_buffer_pos = 0;
@@ -1214,7 +1153,6 @@ gui_input_history_global_previous ()
gui_current_window->buffer->input_buffer_1st_display = 0;
strcpy (gui_current_window->buffer->input_buffer,
history_global_ptr->text);
gui_input_init_color_mask (gui_current_window->buffer);
gui_buffer_ask_input_refresh (gui_current_window->buffer, 1);
gui_input_text_changed_signal ();
}
@@ -1255,7 +1193,6 @@ gui_input_history_global_next ()
{
strcpy (gui_current_window->buffer->input_buffer,
history_global_ptr->text);
gui_input_init_color_mask (gui_current_window->buffer);
}
gui_buffer_ask_input_refresh (gui_current_window->buffer, 1);
gui_input_text_changed_signal ();
-1
View File
@@ -33,7 +33,6 @@ extern void gui_input_prompt_changed_signal ();
extern void gui_input_text_changed_signal ();
extern void gui_input_search_signal ();
extern void gui_input_optimize_size (struct t_gui_buffer *buffer);
extern void gui_input_init_color_mask (struct t_gui_buffer *buffer);
extern void gui_input_move (struct t_gui_buffer *buffer, char *target,
const char *source, int size);
extern int gui_input_insert_string (struct t_gui_buffer *buffer,
+2 -2
View File
@@ -61,9 +61,9 @@ gui_layout_buffer_remove (struct t_gui_layout_buffer *layout_buffer)
/* remove layout from list */
if (layout_buffer->prev_layout)
layout_buffer->prev_layout->next_layout = layout_buffer->next_layout;
(layout_buffer->prev_layout)->next_layout = layout_buffer->next_layout;
if (layout_buffer->next_layout)
layout_buffer->next_layout->prev_layout = layout_buffer->prev_layout;
(layout_buffer->next_layout)->prev_layout = layout_buffer->prev_layout;
if (gui_layout_buffers == layout_buffer)
gui_layout_buffers = layout_buffer->next_layout;
if (last_gui_layout_buffer == layout_buffer)
+22 -12
View File
@@ -276,6 +276,7 @@ gui_nicklist_search_nick (struct t_gui_buffer *buffer,
const char *name)
{
struct t_gui_nick *ptr_nick;
struct t_gui_nick_group *ptr_group;
for (ptr_nick = (from_group) ? from_group->nicks : buffer->nicklist_root->nicks;
ptr_nick; ptr_nick = ptr_nick->next_nick)
@@ -283,6 +284,15 @@ gui_nicklist_search_nick (struct t_gui_buffer *buffer,
if (strcmp (ptr_nick->name, name) == 0)
return ptr_nick;
}
/* search nick in child groups */
for (ptr_group = (from_group) ? from_group->childs : buffer->nicklist_root->childs;
ptr_group; ptr_group = ptr_group->next_group)
{
ptr_nick = gui_nicklist_search_nick (buffer, ptr_group, name);
if (ptr_nick)
return ptr_nick;
}
/* nick not found */
return NULL;
@@ -337,13 +347,13 @@ gui_nicklist_remove_nick (struct t_gui_buffer *buffer,
/* remove nick from list */
if (nick->prev_nick)
nick->prev_nick->next_nick = nick->next_nick;
(nick->prev_nick)->next_nick = nick->next_nick;
if (nick->next_nick)
nick->next_nick->prev_nick = nick->prev_nick;
if (nick->group->nicks == nick)
nick->group->nicks = nick->next_nick;
if (nick->group->last_nick == nick)
nick->group->last_nick = nick->prev_nick;
(nick->next_nick)->prev_nick = nick->prev_nick;
if ((nick->group)->nicks == nick)
(nick->group)->nicks = nick->next_nick;
if ((nick->group)->last_nick == nick)
(nick->group)->last_nick = nick->prev_nick;
/* free data */
if (nick->name)
@@ -391,13 +401,13 @@ gui_nicklist_remove_group (struct t_gui_buffer *buffer,
{
/* remove group from list */
if (group->prev_group)
group->prev_group->next_group = group->next_group;
(group->prev_group)->next_group = group->next_group;
if (group->next_group)
group->next_group->prev_group = group->prev_group;
if (group->parent->childs == group)
group->parent->childs = group->next_group;
if (group->parent->last_child == group)
group->parent->last_child = group->prev_group;
(group->next_group)->prev_group = group->prev_group;
if ((group->parent)->childs == group)
(group->parent)->childs = group->next_group;
if ((group->parent)->last_child == group)
(group->parent)->last_child = group->prev_group;
}
else
{
+2 -2
View File
@@ -387,9 +387,9 @@ gui_window_free (struct t_gui_window *window)
/* remove window from windows list */
if (window->prev_window)
window->prev_window->next_window = window->next_window;
(window->prev_window)->next_window = window->next_window;
if (window->next_window)
window->next_window->prev_window = window->prev_window;
(window->next_window)->prev_window = window->prev_window;
if (gui_windows == window)
gui_windows = window->next_window;
if (last_gui_window == window)
+2 -2
View File
@@ -31,13 +31,13 @@ IF(NOT DISABLE_ALIAS)
ADD_SUBDIRECTORY( alias )
ENDIF(NOT DISABLE_ALIAS)
IF(ENABLE_ASPELL)
IF(NOT DISABLE_ASPELL)
# Check for aspell libraries
FIND_PACKAGE(Aspell)
IF(ASPELL_FOUND)
ADD_SUBDIRECTORY( aspell )
ENDIF(ASPELL_FOUND)
ENDIF(ENABLE_ASPELL)
ENDIF(NOT DISABLE_ASPELL)
IF(NOT DISABLE_CHARSET)
# Check for iconv support.
+4 -1
View File
@@ -14,7 +14,10 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
ADD_LIBRARY(aspell MODULE aspell.c aspell.h)
ADD_LIBRARY(aspell MODULE
aspell.c aspell.h
aspell-config.c aspell-config.h
aspell-speller.c aspell-speller.h)
SET_TARGET_PROPERTIES(aspell PROPERTIES PREFIX "")
IF(ASPELL_FOUND)
+6 -1
View File
@@ -20,6 +20,11 @@ libdir = ${weechat_libdir}/plugins
lib_LTLIBRARIES = aspell.la
aspell_la_SOURCES = aspell.c aspell.h
aspell_la_SOURCES = aspell.c \
aspell.h \
aspell-config.c \
aspell-config.h \
aspell-speller.c \
aspell-speller.h
aspell_la_LDFLAGS = -module
aspell_la_LIBADD = $(ASPELL_LFLAGS)
+338
View File
@@ -0,0 +1,338 @@
/*
* Copyright (c) 2003-2008 by FlashCode <flashcode@flashtux.org>
* See README for License detail, AUTHORS for developers list.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/* aspell-config.c: aspell configuration options */
#include <stdlib.h>
#include <string.h>
#include <limits.h>
#include "../weechat-plugin.h"
#include "aspell.h"
#include "aspell-config.h"
#include "aspell-speller.h"
struct t_config_file *weechat_aspell_config_file = NULL;
struct t_config_section *weechat_aspell_config_section_dict = NULL;
/* aspell config, look section */
struct t_config_option *weechat_aspell_config_look_color;
/* aspell config, check section */
struct t_config_option *weechat_aspell_config_check_commands;
struct t_config_option *weechat_aspell_config_check_default_dict;
struct t_config_option *weechat_aspell_config_check_real_time;
struct t_config_option *weechat_aspell_config_check_word_min_length;
char **weechat_aspell_commands_to_check = NULL;
int weechat_aspell_count_commands_to_check = 0;
int *weechat_aspell_length_commands_to_check = NULL;
/*
* weechat_aspell_config_change_commands: called when list of commands is
* changed
*/
void
weechat_aspell_config_change_commands (void *data,
struct t_config_option *option)
{
char *value;
int i;
/* make C compiler happy */
(void) data;
if (weechat_aspell_commands_to_check)
{
weechat_string_free_exploded (weechat_aspell_commands_to_check);
weechat_aspell_commands_to_check = NULL;
weechat_aspell_count_commands_to_check = 0;
}
if (weechat_aspell_length_commands_to_check)
{
free (weechat_aspell_length_commands_to_check);
weechat_aspell_length_commands_to_check = NULL;
}
value = weechat_config_string (option);
if (value && value[0])
{
weechat_aspell_commands_to_check = weechat_string_explode (value,
",", 0, 0,
&weechat_aspell_count_commands_to_check);
if (weechat_aspell_count_commands_to_check > 0)
{
weechat_aspell_length_commands_to_check = malloc (weechat_aspell_count_commands_to_check *
sizeof (int));
for (i = 0; i < weechat_aspell_count_commands_to_check; i++)
{
weechat_aspell_length_commands_to_check[i] = strlen (weechat_aspell_commands_to_check[i]);
}
}
}
}
/*
* weechat_aspell_config_change_default_dict: called when default dictionary
* is changed
*/
void
weechat_aspell_config_change_default_dict (void *data,
struct t_config_option *option)
{
/* make C compiler happy */
(void) data;
(void) option;
weechat_aspell_create_spellers (weechat_current_buffer);
}
/*
* weechat_aspell_config_create_option: set a dictionary for a buffer
*/
int
weechat_aspell_config_create_option (void *data,
struct t_config_file *config_file,
struct t_config_section *section,
const char *option_name,
const char *value)
{
struct t_config_option *ptr_option;
int rc;
/* make C compiler happy */
(void) data;
rc = WEECHAT_CONFIG_OPTION_SET_ERROR;
if (value && value[0])
weechat_aspell_speller_check_dictionaries (value);
if (option_name)
{
ptr_option = weechat_config_search_option (config_file, section,
option_name);
if (ptr_option)
{
if (value && value[0])
rc = weechat_config_option_set (ptr_option, value, 1);
else
{
weechat_config_option_free (ptr_option);
rc = WEECHAT_CONFIG_OPTION_SET_OK_SAME_VALUE;
}
}
else
{
if (value && value[0])
{
ptr_option = weechat_config_new_option (
config_file, section,
option_name, "string",
_("comma separated list of dictionaries to use on this buffer"),
NULL, 0, 0, value, NULL, NULL, NULL, NULL, NULL, NULL);
rc = (ptr_option) ?
WEECHAT_CONFIG_OPTION_SET_OK_SAME_VALUE : WEECHAT_CONFIG_OPTION_SET_ERROR;
}
else
rc = WEECHAT_CONFIG_OPTION_SET_OK_SAME_VALUE;
}
}
if (rc == WEECHAT_CONFIG_OPTION_SET_ERROR)
{
weechat_printf (NULL,
_("%s%s: error creating aspell dictionary \"%s\" => \"%s\""),
weechat_prefix ("error"), ASPELL_PLUGIN_NAME,
option_name, value);
}
else
weechat_aspell_create_spellers (weechat_current_buffer);
return rc;
}
/*
* weechat_aspell_config_get_dict: get a dictionary list for a buffer
*/
struct t_config_option *
weechat_aspell_config_get_dict (const char *name)
{
return weechat_config_search_option (weechat_aspell_config_file,
weechat_aspell_config_section_dict,
name);
}
/*
* weechat_aspell_config_set_dict: set a dictionary list for a buffer
*/
int
weechat_aspell_config_set_dict (const char *name, const char *value)
{
return weechat_aspell_config_create_option (NULL,
weechat_aspell_config_file,
weechat_aspell_config_section_dict,
name,
value);
}
/*
* weechat_aspell_config_init: init aspell configuration file
* return: 1 if ok, 0 if error
*/
int
weechat_aspell_config_init ()
{
struct t_config_section *ptr_section;
weechat_aspell_config_file = weechat_config_new (ASPELL_CONFIG_NAME,
NULL, NULL);
if (!weechat_aspell_config_file)
return 0;
/* look */
ptr_section = weechat_config_new_section (weechat_aspell_config_file, "look",
0, 0,
NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL);
if (!ptr_section)
{
weechat_config_free (weechat_aspell_config_file);
return 0;
}
weechat_aspell_config_look_color = weechat_config_new_option (
weechat_aspell_config_file, ptr_section,
"color", "color",
N_("color used for mispelled words"),
NULL, 0, 0, "lightred", NULL, NULL, NULL, NULL, NULL, NULL);
/* check */
ptr_section = weechat_config_new_section (weechat_aspell_config_file, "check",
0, 0,
NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL);
if (!ptr_section)
{
weechat_config_free (weechat_aspell_config_file);
return 0;
}
weechat_aspell_config_check_commands = weechat_config_new_option (
weechat_aspell_config_file, ptr_section,
"commands", "string",
N_("comma separated list of commands for which spell checking is "
"enabled (spell checking is disabled for all other commands)"),
NULL, 0, 0,
"ame,amsg,away,command,cycle,kick,kickban,me,msg,notice,part,query,"
"quit,topic",
NULL, NULL, &weechat_aspell_config_change_commands, NULL, NULL, NULL);
weechat_aspell_config_check_default_dict = weechat_config_new_option (
weechat_aspell_config_file, ptr_section,
"default_dict", "string",
N_("default dictionary (or comma separated list of dictionaries) to "
"use when buffer has no dictionary defined (leave blank to disable "
"aspell on buffers for which you didn't explicitely enabled it)"),
NULL, 0, 0, "",
NULL, NULL, &weechat_aspell_config_change_default_dict, NULL, NULL, NULL);
weechat_aspell_config_check_word_min_length = weechat_config_new_option (
weechat_aspell_config_file, ptr_section,
"word_min_length", "integer",
N_("minimum length for a word to be spell checked (use 0 to check all "
"words)"),
NULL, 0, INT_MAX, "2", NULL, NULL, NULL, NULL, NULL, NULL);
weechat_aspell_config_check_real_time = weechat_config_new_option (
weechat_aspell_config_file, ptr_section,
"real_time", "boolean",
N_("real-time spell checking of words (slower, disabled by default: "
"words are checked only if there's delimiter after)"),
NULL, 0, 0, "off", NULL, NULL, NULL, NULL, NULL, NULL);
ptr_section = weechat_config_new_section (weechat_aspell_config_file, "dict",
1, 1,
NULL, NULL,
NULL, NULL,
NULL, NULL,
&weechat_aspell_config_create_option, NULL);
if (!ptr_section)
{
weechat_config_free (weechat_aspell_config_file);
return 0;
}
weechat_aspell_config_section_dict = ptr_section;
return 1;
}
/*
* weechat_aspell_config_read: read aspell configuration file
*/
int
weechat_aspell_config_read ()
{
int rc;
rc = weechat_config_read (weechat_aspell_config_file);
if (rc == WEECHAT_CONFIG_READ_OK)
{
weechat_aspell_config_change_commands (NULL,
weechat_aspell_config_check_commands);
}
return rc;
}
/*
* weechat_aspell_config_write: write aspell configuration file
*/
int
weechat_aspell_config_write ()
{
return weechat_config_write (weechat_aspell_config_file);
}
/*
* aspell_config_free: free aspell configuration
*/
void
weechat_aspell_config_free ()
{
weechat_config_free (weechat_aspell_config_file);
if (weechat_aspell_commands_to_check)
weechat_string_free_exploded (weechat_aspell_commands_to_check);
if (weechat_aspell_length_commands_to_check)
free (weechat_aspell_length_commands_to_check);
}
+43
View File
@@ -0,0 +1,43 @@
/*
* Copyright (c) 2003-2008 by FlashCode <flashcode@flashtux.org>
* See README for License detail, AUTHORS for developers list.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef __WEECHAT_ASPELL_CONFIG_H
#define __WEECHAT_ASPELL_CONFIG_H 1
#define ASPELL_CONFIG_NAME "aspell"
extern struct t_config_option *weechat_aspell_config_look_color;
extern struct t_config_option *weechat_aspell_config_check_default_dict;
extern struct t_config_option *weechat_aspell_config_check_real_time;
extern struct t_config_option *weechat_aspell_config_check_word_min_length;
extern char **weechat_aspell_commands_to_check;
extern int weechat_aspell_count_commands_to_check;
extern int *weechat_aspell_length_commands_to_check;
extern struct t_config_option *weechat_aspell_config_get_dict (const char *name);
extern int weechat_aspell_config_set_dict (const char *name, const char *value);
extern int weechat_aspell_config_init ();
extern int weechat_aspell_config_read ();
extern int weechat_aspell_config_write ();
extern void weechat_aspell_config_free ();
#endif /* aspell-config.h */
+237
View File
@@ -0,0 +1,237 @@
/*
* Copyright (c) 2003-2008 by FlashCode <flashcode@flashtux.org>
* See README for License detail, AUTHORS for developers list.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/* aspell-speller.c: speller management for aspell plugin */
#include <stdlib.h>
#include <string.h>
#include "../weechat-plugin.h"
#include "aspell.h"
#include "aspell-speller.h"
struct t_aspell_speller *weechat_aspell_spellers = NULL;
struct t_aspell_speller *last_weechat_aspell_speller = NULL;
/*
* weechat_aspell_speller_exists: return 1 if an aspell dict exists for a lang,
* 0 otherwise
*/
int
weechat_aspell_speller_exists (const char *lang)
{
struct AspellConfig *config;
AspellDictInfoList *list;
AspellDictInfoEnumeration *el;
const AspellDictInfo *dict;
int rc;
rc = 0;
config = new_aspell_config ();
list = get_aspell_dict_info_list (config);
el = aspell_dict_info_list_elements (list);
while ((dict = aspell_dict_info_enumeration_next (el)))
{
if (strcmp (dict->name, lang) == 0)
{
rc = 1;
break;
}
}
delete_aspell_dict_info_enumeration (el);
delete_aspell_config (config);
return rc;
}
/*
* weechat_aspell_speller_check_dictionaries: check dictionaries (called when
* user creates/changes dictionaries
* for a buffer)
*/
void
weechat_aspell_speller_check_dictionaries (const char *dict_list)
{
char **argv;
int argc, i;
if (dict_list)
{
argv = weechat_string_explode (dict_list, ",", 0, 0, &argc);
if (argv)
{
for (i = 0; i < argc; i++)
{
if (!weechat_aspell_speller_exists (argv[i]))
{
weechat_printf (NULL,
_("%s: warning: dictionary \"%s\" is not "
"available on your system"),
ASPELL_PLUGIN_NAME, argv[i]);
}
}
weechat_string_free_exploded (argv);
}
}
}
/*
* weechat_aspell_speller_search: search a speller
*/
struct t_aspell_speller *
weechat_aspell_speller_search (const char *lang)
{
struct t_aspell_speller *ptr_speller;
for (ptr_speller = weechat_aspell_spellers; ptr_speller;
ptr_speller = ptr_speller->next_speller)
{
if (strcmp (ptr_speller->lang, lang) == 0)
return ptr_speller;
}
/* no speller found */
return NULL;
}
/*
* weechat_aspell_speller_new: create and add a new speller instance
*/
struct t_aspell_speller *
weechat_aspell_speller_new (const char *lang)
{
struct t_aspell_speller *new_speller;
AspellConfig *config;
AspellCanHaveError *ret;
if (!lang)
return NULL;
if (aspell_debug)
{
weechat_printf (NULL,
"%s: creating new speller for lang \"%s\"",
ASPELL_PLUGIN_NAME, lang);
}
/* create a speller instance for the newly created cell */
config = new_aspell_config();
aspell_config_replace (config, "lang", lang);
ret = new_aspell_speller (config);
if (aspell_error (ret) != 0)
{
weechat_printf (NULL,
"%s%s: error: %s",
weechat_prefix ("error"), ASPELL_PLUGIN_NAME,
aspell_error_message (ret));
delete_aspell_config (config);
delete_aspell_can_have_error (ret);
return NULL;
}
/* create and add a new speller cell */
new_speller = malloc (sizeof (*new_speller));
if (!new_speller)
{
weechat_printf (NULL,
_("%s%s: not enough memory to create new speller"),
weechat_prefix ("error"), ASPELL_PLUGIN_NAME);
return NULL;
}
new_speller->speller = to_aspell_speller (ret);
new_speller->lang = strdup (lang);
/* add speller to list */
new_speller->prev_speller = last_weechat_aspell_speller;
new_speller->next_speller = NULL;
if (weechat_aspell_spellers)
last_weechat_aspell_speller->next_speller = new_speller;
else
weechat_aspell_spellers = new_speller;
last_weechat_aspell_speller = new_speller;
/* free config */
delete_aspell_config (config);
return new_speller;
}
/*
* weechat_aspell_speller_free: remove a speller instance
*/
void
weechat_aspell_speller_free (struct t_aspell_speller *speller)
{
if (!speller)
return;
if (aspell_debug)
{
weechat_printf (NULL,
"%s: removing speller for lang \"%s\"",
ASPELL_PLUGIN_NAME, speller->lang);
}
/* free data */
if (speller->speller)
{
aspell_speller_save_all_word_lists (speller->speller);
delete_aspell_speller (speller->speller);
}
if (speller->lang)
free (speller->lang);
/* remove speller from list */
if (speller->prev_speller)
(speller->prev_speller)->next_speller = speller->next_speller;
if (speller->next_speller)
(speller->next_speller)->prev_speller = speller->prev_speller;
if (weechat_aspell_spellers == speller)
weechat_aspell_spellers = speller->next_speller;
if (last_weechat_aspell_speller == speller)
last_weechat_aspell_speller = speller->prev_speller;
free (speller);
}
/*
* weechat_aspell_speller_free_all: free all spellers
*/
void
weechat_aspell_speller_free_all ()
{
while (weechat_aspell_spellers)
{
weechat_aspell_speller_free (weechat_aspell_spellers);
}
}
+41
View File
@@ -0,0 +1,41 @@
/*
* Copyright (c) 2003-2008 by FlashCode <flashcode@flashtux.org>
* See README for License detail, AUTHORS for developers list.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef __WEECHAT_ASPELL_SPELLER_H
#define __WEECHAT_ASPELL_SPELLER_H 1
struct t_aspell_speller
{
AspellSpeller *speller; /* aspell speller */
char *lang; /* language */
struct t_aspell_speller *prev_speller; /* pointer to next speller */
struct t_aspell_speller *next_speller; /* pointer to previous speller */
};
extern struct t_aspell_speller *weechat_aspell_spellers;
extern int weechat_aspell_speller_exists (const char *lang);
extern struct t_aspell_speller *weechat_aspell_speller_search (const char *lang);
extern void weechat_aspell_speller_check_dictionaries (const char *dict_list);
extern struct t_aspell_speller *weechat_aspell_speller_new (const char *lang);
extern void weechat_aspell_speller_free (struct t_aspell_speller *speller);
extern void weechat_aspell_speller_free_all ();
#endif /* aspell-speller.h */
+832 -1256
View File
File diff suppressed because it is too large Load Diff
+10 -162
View File
@@ -16,180 +16,28 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/* weechat-aspell.h: Aspell plugin support for WeeChat */
#ifndef __WEECHAT_ASPELL_H
#define __WEECHAT_ASPELL_H 1
#include <aspell.h>
#define _PLUGIN_OPTION_WORD_SIZE 2
#define _PLUGIN_OPTION_CHECK_SYNC 0
#define _PLUGIN_OPTION_COLOR "red"
#define weechat_plugin weechat_aspell_plugin
#define ASPELL_PLUGIN_NAME "aspell"
typedef struct aspell_speller_t
{
AspellSpeller *speller;
char *lang;
int refs;
struct aspell_speller_t *prev_speller;
struct aspell_speller_t *next_speller;
} aspell_speller_t;
typedef struct aspell_config_t
{
char *server;
char *channel;
aspell_speller_t *speller;
struct aspell_config_t *prev_config;
struct aspell_config_t *next_config;
} aspell_config_t;
typedef struct aspell_options_t
{
int word_size;
int check_sync;
int color;
char *color_name;
} aspell_options_t;
typedef struct iso_langs_t
struct t_aspell_code
{
char *code;
char *name;
} iso_langs_t;
typedef struct iso_countries_t
{
char *code;
char *name;
} iso_countries_t;
typedef struct cmds_keep_t
{
char *cmd;
int len;
} cmds_keep_t;
/* aspell supported langs 2006-05-27 */
iso_langs_t langs_avail[] =
{
{ "af", "Afrikaans"},
{ "am", "Amharic"},
{ "az", "Azerbaijani"},
{ "be", "Belarusian"},
{ "bg", "Bulgarian"},
{ "bn", "Bengali"},
{ "br", "Breton"},
{ "ca", "Catalan"},
{ "cs", "Czech"},
{ "csb", "Kashubian"},
{ "cy", "Welsh"},
{ "da", "Danish"},
{ "de", "German"},
{ "el", "Greek Modern"},
{ "en", "English"},
{ "eo", "Esperanto"},
{ "es", "Spanish"},
{ "et", "Estonian"},
{ "fa", "Persian"},
{ "fi", "Finnish"},
{ "fo", "Faroese"},
{ "fr", "French"},
{ "ga", "Irish"},
{ "gd", "Gaelic"},
{ "gl", "Galician"},
{ "gu", "Gujarati"},
{ "gv", "Manx"},
{ "he", "Hebrew"},
{ "hi", "Hiligaynon"},
{ "hr", "Croatian"},
{ "hsb", "Upper Sorbian"},
{ "hu", "Hungarian"},
{ "ia", "Interlingua"},
{ "id", "Indonesian"},
{ "is", "Icelandic"},
{ "it", "Italian"},
{ "ku", "Kurdish"},
{ "la", "Latin"},
{ "lt", "Lithuanian"},
{ "lv", "Latvian"},
{ "mg", "Malagasy"},
{ "mi", "Maori"},
{ "mk", "Macedonian"},
{ "mn", "Mongolian"},
{ "mr", "Marathi"},
{ "ms", "Malay"},
{ "mt", "Maltese"},
{ "nb", "Norwegian Bokmal"},
{ "nds", "Saxon Low"},
{ "nl", "Flemish"},
{ "nn", "Norwegian Nynorsk"},
{ "no", "Norwegian"},
{ "ny", "Nyanja"},
{ "or", "Oriya"},
{ "pa", "Panjabi"},
{ "pl", "Polish"},
{ "pt", "Portuguese"},
{ "qu", "Quechua"},
{ "ro", "Romanian"},
{ "ru", "Russian"},
{ "rw", "Kinyarwanda"},
{ "sc", "Sardinian"},
{ "sk", "Slovak"},
{ "sl", "Slovenian"},
{ "sr", "Serbian"},
{ "sv", "Swedish"},
{ "sw", "Swahili"},
{ "ta", "Tamil"},
{ "te", "Telugu"},
{ "tet", "Tetum"},
{ "tl", "Tagalog"},
{ "tn", "Tswana"},
{ "tr", "Turkish"},
{ "uk", "Ukrainian"},
{ "uz", "Uzbek"},
{ "vi", "Vietnamese"},
{ "wa", "Walloon"},
{ "yi", "Yiddish"},
{ "zu", "Zulu"},
{ NULL, NULL}
};
iso_countries_t countries_avail[] =
{
{ "AT", "Austria" },
{ "BR", "Brazil" },
{ "CA", "Canada" },
{ "CH", "Switzerland" },
{ "DE", "Germany" },
{ "FR", "France" },
{ "GB", "Great Britain" },
{ "PT", "Portugal" },
{ "SK", "Slovakia" },
{ "US", "United States of America" },
{ NULL, NULL}
};
extern int aspell_debug;
/* internal or irc commands to be use with spellchecking */
cmds_keep_t cmd_tokeep[] =
{
{ "/builtin ", 9 },
{ "/ame " , 5 },
{ "/amsg " , 6 },
{ "/away " , 6 },
{ "/cycle " , 7 },
{ "/kick " , 6 },
{ "/kickban " , 9 },
{ "/me " , 4 },
{ "/notice " , 8 },
{ "/part " , 6 },
{ "/query " , 7 },
{ "/quit " , 6 },
{ "/topic " , 7 },
{ NULL, 0}
};
extern struct t_weechat_plugin *weechat_aspell_plugin;
extern struct t_aspell_code langs_avail[];
extern struct t_aspell_code countries_avail[];
extern void weechat_aspell_create_spellers (struct t_gui_buffer *buffer);
#endif /* aspell.h */
+6 -6
View File
@@ -354,7 +354,7 @@ charset_decode_cb (void *data, const char *modifier, const char *modifier_data,
{
weechat_printf (NULL,
"charset: debug: using 'decode' charset: %s "
"(modifier='%s', modifier_data='%s', string='%s')",
"(modifier=\"%s\", modifier_data=\"%s\", string=\"%s\")",
charset, modifier, modifier_data, string);
}
if (charset && charset[0])
@@ -383,7 +383,7 @@ charset_encode_cb (void *data, const char *modifier, const char *modifier_data,
{
weechat_printf (NULL,
"charset: debug: using 'encode' charset: %s "
"(modifier='%s', modifier_data='%s', string='%s')",
"(modifier=\"%s\", modifier_data=\"%s\", string=\"%s\")",
charset, modifier, modifier_data, string);
}
if (charset && charset[0])
@@ -407,11 +407,11 @@ charset_set (struct t_config_section *section, const char *type,
value) > 0)
{
if (value && value[0])
weechat_printf (NULL, _("Charset: %s, %s => %s"),
type, name, value);
weechat_printf (NULL, "%s: %s, %s => %s",
CHARSET_PLUGIN_NAME, type, name, value);
else
weechat_printf (NULL, _("Charset: %s, %s: removed"),
type, name);
weechat_printf (NULL, _("%s: %s, %s: removed"),
CHARSET_PLUGIN_NAME, type, name);
}
}
+3 -3
View File
@@ -87,7 +87,7 @@ demo_printf_command_cb (void *data, struct t_gui_buffer *buffer, int argc,
if (argc > 1)
weechat_printf (buffer,
"demo_printf: '%s'", argv_eol[1]);
"demo_printf: \"%s\"", argv_eol[1]);
else
{
weechat_printf (buffer,
@@ -121,7 +121,7 @@ demo_buffer_input_data_cb (void *data, struct t_gui_buffer *buffer,
weechat_printf (buffer,
"buffer_input_data_cb: buffer = %x (%s), "
"input_data = '%s'",
"input_data = \"%s\"",
buffer,
weechat_buffer_get_string (buffer, "name"),
input_data);
@@ -372,7 +372,7 @@ demo_signal_cb (void *data, const char *signal, const char *type_data,
{
weechat_printf (NULL,
_("demo_signal: signal: %s, type_data: %s, "
"signal_data: '%s'"),
"signal_data: \"%s\""),
signal, type_data, (char *)signal_data);
}
else if (strcmp (type_data, WEECHAT_HOOK_SIGNAL_INT) == 0)
+1 -1
View File
@@ -2795,7 +2795,7 @@ irc_command_server (void *data, struct t_gui_buffer *buffer, int argc,
{
weechat_printf (NULL, "");
weechat_printf (NULL,
_("Servers with '%s':"),
_("Servers with \"%s\":"),
server_name);
}
one_server_found = 1;
+2 -2
View File
@@ -230,9 +230,9 @@ irc_ignore_free (struct t_irc_ignore *ignore)
/* remove filter from filters list */
if (ignore->prev_ignore)
ignore->prev_ignore->next_ignore = ignore->next_ignore;
(ignore->prev_ignore)->next_ignore = ignore->next_ignore;
if (ignore->next_ignore)
ignore->next_ignore->prev_ignore = ignore->prev_ignore;
(ignore->next_ignore)->prev_ignore = ignore->prev_ignore;
if (irc_ignore_list == ignore)
irc_ignore_list = ignore->next_ignore;
if (last_irc_ignore == ignore)
-2
View File
@@ -23,8 +23,6 @@
#define LOGGER_CONFIG_NAME "logger"
extern struct t_config_file *logger_config_file;
extern struct t_config_option *logger_config_look_backlog;
extern struct t_config_option *logger_config_file_auto_log;
+1 -1
View File
@@ -179,7 +179,7 @@ script_ptr2str (void *pointer)
if (!pointer)
return strdup ("");
snprintf (pointer_str, sizeof (pointer_str) - 1,
snprintf (pointer_str, sizeof (pointer_str),
"0x%x", (unsigned int)pointer);
return strdup (pointer_str);