weechat-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Weechat-cvs] weechat/src/plugins/aspell weechat-aspell.c wee...


From: kolter
Subject: [Weechat-cvs] weechat/src/plugins/aspell weechat-aspell.c wee...
Date: Sun, 11 Jun 2006 12:48:06 +0000

CVSROOT:        /sources/weechat
Module name:    weechat
Changes by:     kolter <kolter> 06/06/11 12:48:05

Modified files:
        src/plugins/aspell: weechat-aspell.c weechat-aspell.h 

Log message:
        add some improvements

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/weechat/src/plugins/aspell/weechat-aspell.c?cvsroot=weechat&r1=1.2&r2=1.3
http://cvs.savannah.gnu.org/viewcvs/weechat/src/plugins/aspell/weechat-aspell.h?cvsroot=weechat&r1=1.1&r2=1.2

Patches:
Index: weechat-aspell.c
===================================================================
RCS file: /sources/weechat/weechat/src/plugins/aspell/weechat-aspell.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -b -r1.2 -r1.3
--- weechat-aspell.c    11 Jun 2006 11:20:18 -0000      1.2
+++ weechat-aspell.c    11 Jun 2006 12:48:05 -0000      1.3
@@ -45,7 +45,7 @@
     if (!s)
     {
        plugin->print (plugin, NULL, NULL, 
-                      "[%s] [ERROR] : unable to alloc memory.", plugin_name);
+                      "[%s] [ERROR] : unable to alloc memory.", _PLUGIN_NAME);
        return NULL;
     }
     
@@ -114,7 +114,7 @@
     {
        plugin->print (plugin, NULL, NULL,
                       "[%s] [ERROR] : %s", 
-                      plugin_name, aspell_error_message (ret));
+                      _PLUGIN_NAME, aspell_error_message (ret));
        delete_aspell_config (config);
        delete_aspell_can_have_error (ret);
        return 0;
@@ -190,7 +190,7 @@
     if (!c)
     {
        plugin->print (plugin, NULL, NULL, 
-                      "[%s] [ERROR] : unable to alloc memory.", plugin_name);
+                      "[%s] [ERROR] : unable to alloc memory.", _PLUGIN_NAME);
        return NULL;
     }
 
@@ -408,7 +408,7 @@
     el = aspell_dict_info_list_elements (l);    
     di = NULL;
     
-    plugin->print (plugin, NULL, NULL, "[%s] *** dictionnaries list :", 
plugin_name);
+    plugin->print (plugin, NULL, NULL, "[%s] *** dictionnaries list :", 
_PLUGIN_NAME);
 
     while (( di = aspell_dict_info_enumeration_next (el)))
     {
@@ -440,7 +440,7 @@
                snprintf (buffer, sizeof(buffer), "%-22s %s (%s)", di->name, 
lang, di->jargon);
        }
        
-       plugin->print (plugin, NULL, NULL, "[%s]  - %s", plugin_name, buffer);
+       plugin->print (plugin, NULL, NULL, "[%s]  - %s", _PLUGIN_NAME, buffer);
        
        if (lang)
            free (lang);
@@ -462,31 +462,31 @@
     if (!plugin_config)
        plugin->print (plugin, NULL, NULL, 
                       "[%s] [SHOW] *** No buffers with spellchecking enable",
-                      plugin_name);
+                      _PLUGIN_NAME);
     else
        plugin->print (plugin, NULL, NULL, 
                       "[%s] [SHOW] *** Spellchecking is active on the 
following buffers :",
-                      plugin_name);
+                      _PLUGIN_NAME);
        
     for(p = plugin_config; p; p = p->next_config)
        plugin->print (plugin, NULL, NULL,
                       "[%s] [SHOW]    -> address@hidden with lang '%s'",
-                      plugin_name, p->channel, p->server, p->speller->lang);
+                      _PLUGIN_NAME, p->channel, p->server, p->speller->lang);
 
     plugin->print (plugin, NULL, NULL,
-                  "[%s] [SHOW] *** plugin options :", plugin_name);
+                  "[%s] [SHOW] *** plugin options :", _PLUGIN_NAME);
     plugin->print (plugin, NULL, NULL,
                   "[%s] [SHOW]     -> word-size = %d", 
-                  plugin_name, plugin_options.word_size);
+                  _PLUGIN_NAME, plugin_options.word_size);
     plugin->print (plugin, NULL, NULL,
                   "[%s] [SHOW]     ->     color = %s",
-                  plugin_name, plugin_options.color_name);
+                  _PLUGIN_NAME, plugin_options.color_name);
     plugin->print (plugin, NULL, NULL,
                   plugin_options.check_sync == 1
                   ? "[%s] [SHOW]     -> realtime spellchecking is enable"
                   : "[%s] [SHOW]     -> asynchronous spellchecking is enable"
                   , 
-                  plugin_name);
+                  _PLUGIN_NAME);
 }
 
 /*
@@ -515,11 +515,11 @@
     if (ret)
        plugin->print (plugin, NULL, NULL,
                       "[%s] [ADD-WORD] word '%s' successfully added in your 
personnal dictionnary",
-                      plugin_name, word);
+                      _PLUGIN_NAME, word);
     else
        plugin->print (plugin, NULL, NULL,
                       "[%s] [ADD-WORD] an error occured while adding word '%s' 
in your personnal dict",
-                      plugin_name, word);
+                      _PLUGIN_NAME, word);
     
     if (server)
        free (server);
@@ -540,22 +540,22 @@
     if (!plugin_config)
        plugin->print (plugin, NULL, NULL, 
                       "[%s] [DEBUG] [CONFIG] no config",
-                      plugin_name);
+                      _PLUGIN_NAME);
 
     for(p = plugin_config; p; p = p->next_config)
        plugin->print (plugin, NULL, NULL,
                       "[%s] [DEBUG] [CONFIG] @%p server='%s' channel='%s' 
@speller=%p lang='%s' @p=%p @n=%p",
-                      plugin_name, p, p->server, p->channel, p->speller, 
p->speller->lang, p->prev_config, p->next_config);
+                      _PLUGIN_NAME, p, p->server, p->channel, p->speller, 
p->speller->lang, p->prev_config, p->next_config);
 
     if (!plugin_speller)
        plugin->print (plugin, NULL, NULL, 
                       "[%s] [DEBUG] [SPELLER] no speller",
-                      plugin_name);
+                      _PLUGIN_NAME);
     
     for(s = plugin_speller; s; s = s->next_speller)
        plugin->print (plugin, NULL, NULL,
                       "[%s] [DEBUG] [SPELLER] @%p lang='%s' refs=%d @engine=%p 
@p=%p @n=%p",
-                      plugin_name, s, s->lang, s->refs, s->speller, 
s->prev_speller, s->next_speller);
+                      _PLUGIN_NAME, s, s->lang, s->refs, s->speller, 
s->prev_speller, s->next_speller);
 }
 
 /*
@@ -570,7 +570,7 @@
     {
        plugin->print (plugin, NULL, NULL, 
                       "[%s] [WARN] '%s' dictionary doesn't seems to be 
available on your system", 
-                      plugin_name, lang);
+                      _PLUGIN_NAME, lang);
                return;
     }
     
@@ -587,7 +587,7 @@
     {
        plugin->print (plugin, NULL, NULL, 
                       "[%s] [ERROR] enabling spell checking on address@hidden 
failed", 
-                      plugin_name, channel, server);
+                      _PLUGIN_NAME, channel, server);
        return;
     }
 
@@ -618,7 +618,7 @@
     {
        plugin->print (plugin, NULL, NULL, 
                       "[%s] [WARN] you are not in a channel", 
-                      plugin_name);
+                      _PLUGIN_NAME);
        return;
     }
     
@@ -626,7 +626,7 @@
 
     plugin->print (plugin, NULL, NULL, 
                   "[%s] spell checking '%s' is now active on address@hidden",
-                  plugin_name, lang, channel, server);
+                  _PLUGIN_NAME, lang, channel, server);
     
     if (channel)
        free (channel);
@@ -649,7 +649,7 @@
     {
        plugin->print (plugin, NULL, NULL, 
                       "[%s] [WARN] you are not in a channel", 
-                      plugin_name, NULL, NULL);
+                      _PLUGIN_NAME, NULL, NULL);
        return;
     }
     
@@ -658,7 +658,7 @@
     {
        plugin->print (plugin, NULL, NULL, 
                       "[%s] [WARN] spell checking is not active on 
address@hidden", 
-                      plugin_name, channel, server);
+                      _PLUGIN_NAME, channel, server);
        if (channel)
            free (channel);
        if (server)
@@ -674,7 +674,7 @@
     
     plugin->print (plugin, NULL, NULL, 
                   "[%s] spell checking is now inactive on address@hidden",
-                  plugin_name, channel, server);
+                  _PLUGIN_NAME, channel, server);
     
     if (channel)
        free (channel);
@@ -694,7 +694,7 @@
        plugin_options.word_size = atoi ((value == NULL) ? "" : value);
        plugin->print (plugin, NULL, NULL, 
                       "[%s] [SET] setting %s = %d", 
-                      plugin_name, option, plugin_options.word_size);
+                      _PLUGIN_NAME, option, plugin_options.word_size);
     }
     else if (strcmp (option, "toggle-check-mode") == 0)
     {
@@ -703,7 +703,7 @@
                       plugin_options.check_sync == 1
                       ? "[%s] [SET] spellchecking is now set in realtime mode"
                       : "[%s] [SET] spellchecking is now set in asynchronous 
mode",
-                       plugin_name, option);
+                       _PLUGIN_NAME, option);
     }
     else if (strcmp (option, "color") == 0)
     {
@@ -711,7 +711,7 @@
        if (c == -1)
            plugin->print (plugin, NULL, NULL, 
                           "[%s] [SET] setting %s = %s failed : color '%s' is 
unknown", 
-                          plugin_name, option, 
+                          _PLUGIN_NAME, option, 
                           (value == NULL) ? "" : value,
                           (value == NULL) ? "" : value);
        else
@@ -722,7 +722,7 @@
            plugin_options.color_name = strdup (value);
            plugin->print (plugin, NULL, NULL, 
                           "[%s] [SET] setting %s = %s",
-                          plugin_name, option, plugin_options.color_name);
+                          _PLUGIN_NAME, option, plugin_options.color_name);
        }
     }
     else
@@ -805,7 +805,7 @@
        }
     }
     
-    plugin->print (plugin, NULL, NULL, "[%s] [SAVE] configuration saved", 
plugin_name);
+    plugin->print (plugin, NULL, NULL, "[%s] [SAVE] configuration saved", 
_PLUGIN_NAME);
     return 1;
 }
 
@@ -863,7 +863,7 @@
        plugin->free_exploded_string (plugin, servers_list);
     }
 
-    plugin->print (plugin, NULL, NULL, "[%s] [LOAD] configuration loaded", 
plugin_name);
+    plugin->print (plugin, NULL, NULL, "[%s] [LOAD] configuration loaded", 
_PLUGIN_NAME);
     return 1;
 }
 
@@ -882,7 +882,7 @@
     
     plugin->set_plugin_config (plugin, "color", plugin_options.color_name);
 
-    plugin->print (plugin, NULL, NULL, "[%s] [SAVE] options saved", 
plugin_name);
+    plugin->print (plugin, NULL, NULL, "[%s] [SAVE] options saved", 
_PLUGIN_NAME);
     return 1;
 }
 
@@ -901,18 +901,18 @@
        free (buffer);
     }
     else
-       plugin_options.word_size = _OPTION_WORD_SIZE;
+       plugin_options.word_size = _PLUGIN_OPTION_WORD_SIZE;
     
     buffer = plugin->get_plugin_config (plugin, "check-sync");
     if (buffer)
     {  
        plugin_options.check_sync = atoi (buffer);
        if (plugin_options.check_sync != 0 && plugin_options.check_sync != 1)
-           plugin_options.check_sync = _OPTION_CHECK_SYNC;
+           plugin_options.check_sync = _PLUGIN_OPTION_CHECK_SYNC;
        free (buffer);
     }
     else
-       plugin_options.check_sync = _OPTION_CHECK_SYNC;
+       plugin_options.check_sync = _PLUGIN_OPTION_CHECK_SYNC;
     
     
     buffer = plugin->get_plugin_config (plugin, "color");    
@@ -921,8 +921,8 @@
        n = plugin->get_irc_color (plugin, buffer);
        if (n == -1)
        {
-           plugin_options.color = plugin->get_irc_color (plugin, 
_OPTION_COLOR);
-           plugin_options.color_name = strdup (_OPTION_COLOR);
+           plugin_options.color = plugin->get_irc_color (plugin, 
_PLUGIN_OPTION_COLOR);
+           plugin_options.color_name = strdup (_PLUGIN_OPTION_COLOR);
        }
        else 
        {
@@ -932,11 +932,11 @@
        free (buffer);
     }
     else {
-       plugin_options.color = plugin->get_irc_color (plugin, _OPTION_COLOR);
-       plugin_options.color_name = strdup (_OPTION_COLOR);
+       plugin_options.color = plugin->get_irc_color (plugin, 
_PLUGIN_OPTION_COLOR);
+       plugin_options.color_name = strdup (_PLUGIN_OPTION_COLOR);
     }
     
-    plugin->print (plugin, NULL, NULL, "[%s] [LOAD] options loaded", 
plugin_name);
+    plugin->print (plugin, NULL, NULL, "[%s] [LOAD] options loaded", 
_PLUGIN_NAME);
     return 1;
 }
 
@@ -1118,8 +1118,10 @@
              "           OPTION := { word-size SIZE | toogle-check-mode  | 
color COLOR }\n"
              "           word-size : minimum size for a word to be checked 
(default : %d)\n"         
              "   toggle-check-mode : switch between a realtime or an 
asynchronous checking\n"
-             "               color : color of the mispelled words\n",
-             _OPTION_WORD_SIZE);
+             "               color : color of the mispelled words\n"
+             "\n"
+             " *NB : input line beginning with a '/' is not checked\n",
+             _PLUGIN_OPTION_WORD_SIZE);
     
     plugin->cmd_handler_add (plugin, "aspell",
                              "Aspell Plugin configuration",

Index: weechat-aspell.h
===================================================================
RCS file: /sources/weechat/weechat/src/plugins/aspell/weechat-aspell.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -b -r1.1 -r1.2
--- weechat-aspell.h    11 Jun 2006 02:28:23 -0000      1.1
+++ weechat-aspell.h    11 Jun 2006 12:48:05 -0000      1.2
@@ -1,17 +1,42 @@
+/*
+ * Copyright (c) 2003-2006 by FlashCode <address@hidden>
+ * 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 2 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, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+
+/* weechat-aspell.h: Aspell plugin support for WeeChat */
 
 #ifndef WEECHAT_ASPELL__H
 #define WEECHAT_ASPELL__H 1
 
 #include <aspell.h>
 
-char plugin_name[]        = "Aspell";
-char plugin_version[]     = "0.1";
-char plugin_description[] = "Aspell plugin for WeeChat";
-char plugin_command[]     = "aspell";
-
-#define _OPTION_WORD_SIZE 2
-#define _OPTION_CHECK_SYNC 0
-#define _OPTION_COLOR "red"
+#define _PLUGIN_NAME    "Aspell"
+#define _PLUGIN_VERSION "0.1"
+#define _PLUGIN_DESC    "Aspell plugin for WeeChat"
+#define _PLUGIN_COMMAND "aspell"
+
+char plugin_name[]        = _PLUGIN_NAME;
+char plugin_version[]     = _PLUGIN_VERSION;
+char plugin_description[] = _PLUGIN_DESC;
+char plugin_command[]     = _PLUGIN_COMMAND;
+
+#define _PLUGIN_OPTION_WORD_SIZE 2
+#define _PLUGIN_OPTION_CHECK_SYNC 0
+#define _PLUGIN_OPTION_COLOR "red"
 
 typedef struct speller_t
 {




reply via email to

[Prev in Thread] Current Thread [Next in Thread]