summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog4
-rw-r--r--doc/en/autogen/user/weechat_options.txt5
-rw-r--r--doc/en/weechat_plugin_api.en.txt93
-rw-r--r--doc/fr/autogen/user/weechat_options.txt5
-rw-r--r--doc/fr/weechat_plugin_api.fr.txt366
-rw-r--r--doc/it/autogen/user/weechat_options.txt5
-rw-r--r--po/cs.po8
-rw-r--r--po/de.po8
-rw-r--r--po/es.po8
-rw-r--r--po/fr.po13
-rw-r--r--po/hu.po8
-rw-r--r--po/it.po8
-rw-r--r--po/pl.po8
-rw-r--r--po/ru.po8
-rw-r--r--po/weechat.pot8
-rw-r--r--src/core/wee-command.c4
-rw-r--r--src/core/wee-config.c8
-rw-r--r--src/core/wee-config.h1
-rw-r--r--src/core/wee-hook.c8
-rw-r--r--src/core/wee-input.c63
-rw-r--r--src/core/wee-input.h8
-rw-r--r--src/core/wee-string.c77
-rw-r--r--src/core/wee-string.h2
-rw-r--r--src/gui/gui-completion.c26
-rw-r--r--src/plugins/alias/alias.c27
-rw-r--r--src/plugins/aspell/weechat-aspell.c11
-rw-r--r--src/plugins/irc/irc-command.c4
-rw-r--r--src/plugins/irc/irc-input.c9
-rw-r--r--src/plugins/plugin.c2
-rw-r--r--src/plugins/scripts/lua/weechat-lua-api.c77
-rw-r--r--src/plugins/scripts/perl/weechat-perl-api.c62
-rw-r--r--src/plugins/scripts/python/weechat-python-api.c69
-rw-r--r--src/plugins/scripts/ruby/weechat-ruby-api.c77
-rw-r--r--src/plugins/scripts/tcl/weechat-tcl-api.c72
-rw-r--r--src/plugins/weechat-plugin.h8
35 files changed, 935 insertions, 235 deletions
diff --git a/ChangeLog b/ChangeLog
index b94aaa8de..632c2f999 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,7 +1,7 @@
WeeChat ChangeLog
=================
FlashCode <flashcode@flashtux.org>
-v0.3.2-dev, 2010-02-27
+v0.3.2-dev, 2010-03-02
Version 0.3.2 (under dev!)
@@ -17,6 +17,8 @@ Version 0.3.2 (under dev!)
* core: add new option weechat.look.time_format to customize default format
for date/time displayed (localized date by default), add function
weechat_util_get_time_string in plugin API (patch #6914)
+* core: add new option weechat.look.command_chars, add functions
+ string_is_command_char and string_input_for_buffer in plugin and script API
* core: use arguments for infolist "nicklist" to return only one nick or group
* gui: fix bug with global history, reset pointer to last entry after each user
input (bug #28754)
diff --git a/doc/en/autogen/user/weechat_options.txt b/doc/en/autogen/user/weechat_options.txt
index 26862f1b6..71d1066bf 100644
--- a/doc/en/autogen/user/weechat_options.txt
+++ b/doc/en/autogen/user/weechat_options.txt
@@ -378,6 +378,11 @@
** type: boolean
** values: on, off (default value: off)
+* *weechat.look.command_chars*
+** description: chars used to determine if input string is a command or not: input must start with one of these chars; the slash ("/") is always considered as command prefix (example: ".$")
+** type: string
+** values: any string (default value: "")
+
* *weechat.look.day_change*
** description: display special message when day changes
** type: boolean
diff --git a/doc/en/weechat_plugin_api.en.txt b/doc/en/weechat_plugin_api.en.txt
index 2b38da06c..6d728032c 100644
--- a/doc/en/weechat_plugin_api.en.txt
+++ b/doc/en/weechat_plugin_api.en.txt
@@ -868,7 +868,7 @@ Return value:
* array of strings, NULL if problem (must be freed by calling
<<_weechat_string_free_split>> after use)
-Examples:
+C examples:
[source,C]
----------------------------------------
@@ -1035,7 +1035,7 @@ Return value:
* formatted string (must be freed by calling "free" after use)
-Examples:
+C examples:
[source,C]
----------------------------------------
@@ -1082,7 +1082,7 @@ Return value:
* string without color (must be freed by calling "free" after use)
-Examples:
+C examples:
[source,C]
----------------------------------------
@@ -1127,7 +1127,7 @@ Arguments:
* 'to': pointer to string to store result (must be long enough, result is
longer than initial string)
-Example:
+C example:
[source,C]
----------------------------------------
@@ -1158,7 +1158,7 @@ Return value:
* length of string stored in *to (does not count final '\0')
-Example:
+C example:
[source,C]
----------------------------------------
@@ -1168,6 +1168,89 @@ length = weechat_string_decode_base64 (string, result);
/* length == 8, result == "abcdefgh" */
----------------------------------------
+weechat_string_is_command_char
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+Check if first char of string is a command char (default command char is '/').
+
+Prototype:
+
+[source,C]
+----------------------------------------
+int weechat_string_is_command_char (const char *string);
+----------------------------------------
+
+Arguments:
+
+* 'string': string
+
+Return value:
+
+* 1 if first char of string is a command char, otherwise 0
+
+C examples:
+
+[source,C]
+----------------------------------------
+int command_char1 = weechat_string_is_command_char ("/test"); /* == 1 */
+int command_char2 = weechat_string_is_command_char ("test"); /* == 0 */
+----------------------------------------
+
+Script (Python):
+
+[source,python]
+----------------------------------------
+# prototype
+weechat.string_is_command_char(string)
+
+# examples
+command_char1 = weechat.string_is_command_char("/test") # == 1
+command_char2 = weechat.string_is_command_char("test") # == 0
+----------------------------------------
+
+weechat_string_input_for_buffer
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+Return pointer to input text for buffer (pointer inside "string" argument), or
+NULL if it's a command.
+
+Prototype:
+
+[source,C]
+----------------------------------------
+const char *weechat_string_input_for_buffer (const char *string);
+----------------------------------------
+
+Arguments:
+
+* 'string': string
+
+Return value:
+
+* pointer into "string", or NULL
+
+C examples:
+
+[source,C]
+----------------------------------------
+const char *str1 = weechat_string_input_for_buffer ("test"); /* "test" */
+const char *str2 = weechat_string_input_for_buffer ("/test"); /* NULL */
+const char *str3 = weechat_string_input_for_buffer ("//test"); /* "/test" */
+----------------------------------------
+
+Script (Python):
+
+[source,python]
+----------------------------------------
+# prototype
+str = weechat.string_input_for_buffer(string)
+
+# examples
+str1 = weechat.string_input_for_buffer("test") # "test"
+str2 = weechat.string_input_for_buffer("/test") # ""
+str3 = weechat.string_input_for_buffer("//test") # "/test"
+----------------------------------------
+
[[utf-8]]
UTF-8
~~~~~
diff --git a/doc/fr/autogen/user/weechat_options.txt b/doc/fr/autogen/user/weechat_options.txt
index 7fbc920f7..b03d40eaa 100644
--- a/doc/fr/autogen/user/weechat_options.txt
+++ b/doc/fr/autogen/user/weechat_options.txt
@@ -378,6 +378,11 @@
** type: booléen
** valeurs: on, off (valeur par défaut: off)
+* *weechat.look.command_chars*
+** description: caractères utilisés pour déterminer si la chaîne entrée est une commande ou non: l'entrée doit démarrer avec un de ces caractères; le slash ("/") est toujours considéré comme un préfixe de commande (exemple : ".$")
+** type: chaîne
+** valeurs: toute chaîne (valeur par défaut: "")
+
* *weechat.look.day_change*
** description: affiche un message quand le jour change
** type: booléen
diff --git a/doc/fr/weechat_plugin_api.fr.txt b/doc/fr/weechat_plugin_api.fr.txt
index 0bc237ad5..40ed05680 100644
--- a/doc/fr/weechat_plugin_api.fr.txt
+++ b/doc/fr/weechat_plugin_api.fr.txt
@@ -262,7 +262,7 @@ Exemple en C :
const char *name = weechat_plugin_get_name (plugin);
----------------------------------------
-Script (Python):
+Script (Python) :
[source,python]
----------------------------------------
@@ -307,7 +307,7 @@ Exemple en C :
weechat_charset_set (plugin, "iso-8859-1");
----------------------------------------
-Script (Python):
+Script (Python) :
[source,python]
----------------------------------------
@@ -348,7 +348,7 @@ char *str = weechat_iconv_to_internal (plugin, "iso-8859-1", "chaîne iso : é
free (str);
----------------------------------------
-Script (Python):
+Script (Python) :
[source,python]
----------------------------------------
@@ -389,7 +389,7 @@ char *str = weechat_iconv_from_internal ("iso-8859-1", "chaîne utf-8 : é à");
free (str);
----------------------------------------
-Script (Python):
+Script (Python) :
[source,python]
----------------------------------------
@@ -427,7 +427,7 @@ Exemple en C :
char *str = weechat_gettext ("hello");
----------------------------------------
-Script (Python):
+Script (Python) :
[source,python]
----------------------------------------
@@ -470,7 +470,7 @@ Exemple en C :
char *str = weechat_ngettext ("file", "files", num_files);
----------------------------------------
-Script (Python):
+Script (Python) :
[source,python]
----------------------------------------
@@ -880,7 +880,7 @@ Valeur de retour :
* tableau de chaînes, NULL en cas de problème (doit être libéré par un appel à
<<_weechat_string_free_split>> après utilisation)
-Exemples :
+Exemples en C :
[source,C]
----------------------------------------
@@ -1048,7 +1048,7 @@ Valeur de retour :
* chaîne formatée (doit être libérée par un appel à "free" après utilisation)
-Exemples :
+Exemples en C :
[source,C]
----------------------------------------
@@ -1096,7 +1096,7 @@ Valeur de retour :
* chaîne sans couleur (doit être libérée par un appel à "free" après
utilisation)
-Exemples :
+Exemples en C :
[source,C]
----------------------------------------
@@ -1111,7 +1111,7 @@ char *str = weechat_string_remove_color (ma_chaine2, "?");
free (str);
----------------------------------------
-Script (Python):
+Script (Python) :
[source,python]
----------------------------------------
@@ -1141,7 +1141,7 @@ Paramètres :
* 'to': pointeur vers la chaîne pour stocker le résultat (doit être suffisamment
long, le résultat est plus long que la chaîne initiale)
-Exemple :
+Exemple en C :
[source,C]
----------------------------------------
@@ -1172,7 +1172,7 @@ Valeur de retour :
* longueur de la chaîne stockée dans *to (ne compte pas le '\0' final)
-Example:
+Exemple en C :
[source,C]
----------------------------------------
@@ -1182,6 +1182,90 @@ length = weechat_string_decode_base64 (string, result);
/* length == 8, result == "abcdefgh" */
----------------------------------------
+weechat_string_is_command_char
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+Vérifie si le premier caractère de la chaîne est un caractère de commande (le
+caractère par défaut de commande est '/').
+
+Prototype :
+
+[source,C]
+----------------------------------------
+int weechat_string_is_command_char (const char *string);
+----------------------------------------
+
+Paramètres :
+
+* 'string': chaîne
+
+Valeur de retour :
+
+* 1 si le premier caractère de la chaîne est un caractère de commande, sinon 0
+
+Exemples en C :
+
+[source,C]
+----------------------------------------
+int command_char1 = weechat_string_is_command_char ("/test"); /* == 1 */
+int command_char2 = weechat_string_is_command_char ("test"); /* == 0 */
+----------------------------------------
+
+Script (Python) :
+
+[source,python]
+----------------------------------------
+# prototype
+weechat.string_is_command_char(string)
+
+# exemples
+command_char1 = weechat.string_is_command_char("/test") # == 1
+command_char2 = weechat.string_is_command_char("test") # == 0
+----------------------------------------
+
+weechat_string_input_for_buffer
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+Retourne un pointeur vers le texte envoyé vers le tampon (pointeur à
+l'intérieur du paramètre "string"), ou NULL si c'est une commande.
+
+Prototype :
+
+[source,C]
+----------------------------------------
+const char *weechat_string_input_for_buffer (const char *string);
+----------------------------------------
+
+Paramètres :
+
+* 'string': chaîne
+
+Valeur de retour :
+
+* pointeur vers "string", ou NULL
+
+Exemples en C :
+
+[source,C]
+----------------------------------------
+const char *str1 = weechat_string_input_for_buffer ("test"); /* "test" */
+const char *str2 = weechat_string_input_for_buffer ("/test"); /* NULL */
+const char *str3 = weechat_string_input_for_buffer ("//test"); /* "/test" */
+----------------------------------------
+
+Script (Python) :
+
+[source,python]
+----------------------------------------
+# prototype
+str = weechat.string_input_for_buffer(string)
+
+# exemples
+str1 = weechat.string_input_for_buffer("test") # "test"
+str2 = weechat.string_input_for_buffer("/test") # ""
+str3 = weechat.string_input_for_buffer("//test") # "/test"
+----------------------------------------
+
[[utf-8]]
UTF-8
~~~~~
@@ -1662,7 +1746,7 @@ if (!weechat_mkdir_home ("temp", 0755))
}
----------------------------------------
-Script (Python):
+Script (Python) :
[source,python]
----------------------------------------
@@ -1704,7 +1788,7 @@ if (!weechat_mkdir ("/tmp/mydir", 0755))
}
----------------------------------------
-Script (Python):
+Script (Python) :
[source,python]
----------------------------------------
@@ -1746,7 +1830,7 @@ if (!weechat_mkdir_parents ("/tmp/my/dir", 0755))
}
----------------------------------------
-Script (Python):
+Script (Python) :
[source,python]
----------------------------------------
@@ -1940,7 +2024,7 @@ Exemple en C :
struct t_weelist *list = weechat_list_new ();
----------------------------------------
-Script (Python):
+Script (Python) :
[source,python]
----------------------------------------
@@ -1988,7 +2072,7 @@ struct t_weelist_item *my_item =
weechat_list_add (list, "ma donnée", WEECHAT_LIST_POS_SORT, NULL);
----------------------------------------
-Script (Python):
+Script (Python) :
[source,python]
----------------------------------------
@@ -2028,7 +2112,7 @@ Exemple en C :
struct t_weelist_item *item = weechat_list_search (list, "ma donnée");
----------------------------------------
-Script (Python):
+Script (Python) :
[source,python]
----------------------------------------
@@ -2068,7 +2152,7 @@ Exemple en C :
struct t_weelist_item *item = weechat_list_casesearch (list, "ma donnée");
----------------------------------------
-Script (Python):
+Script (Python) :
[source,python]
----------------------------------------
@@ -2108,7 +2192,7 @@ Exemple en C :
struct t_weelist_item *item = weechat_list_get (list, 0); /* premier élément */
----------------------------------------
-Script (Python):
+Script (Python) :
[source,python]
----------------------------------------
@@ -2143,7 +2227,7 @@ Exemple en C :
weechat_list_set (item, "nouvelle donnée");
----------------------------------------
-Script (Python):
+Script (Python) :
[source,python]
----------------------------------------
@@ -2182,7 +2266,7 @@ Exemple en C :
struct t_weelist_item *next_item = weechat_list_next (item);
----------------------------------------
-Script (Python):
+Script (Python) :
[source,python]
----------------------------------------
@@ -2221,7 +2305,7 @@ Exemple en C :
struct t_weelist_item *prev_item = weechat_list_prev (item);
----------------------------------------
-Script (Python):
+Script (Python) :
[source,python]
----------------------------------------
@@ -2259,7 +2343,7 @@ Exemple en C :
weechat_printf (NULL, "valeur de l'item : %s", weechat_list_string (item));
----------------------------------------
-Script (Python):
+Script (Python) :
[source,python]
----------------------------------------
@@ -2297,7 +2381,7 @@ Exemple en C :
weechat_printf (NULL, "taille de la liste : %d", weechat_list_size (list));
----------------------------------------
-Script (Python):
+Script (Python) :
[source,python]
----------------------------------------
@@ -2333,7 +2417,7 @@ Exemple en C :
weechat_list_remove (list, item);
----------------------------------------
-Script (Python):
+Script (Python) :
[source,python]
----------------------------------------
@@ -2367,7 +2451,7 @@ Exemple en C :
weechat_list_remove_all (list);
----------------------------------------
-Script (Python):
+Script (Python) :
[source,python]
----------------------------------------
@@ -2401,7 +2485,7 @@ Exemple en C :
weechat_list_free (list);
----------------------------------------
-Script (Python):
+Script (Python) :
[source,python]
----------------------------------------
@@ -2471,7 +2555,7 @@ struct t_config_file *config_file = weechat_config_new ("test",
NULL);
----------------------------------------
-Script (Python):
+Script (Python) :
[source,python]
----------------------------------------
@@ -2663,7 +2747,7 @@ struct t_config_section *new_section2 =
&my_section_delete_option_cb, NULL);
----------------------------------------
-Script (Python):
+Script (Python) :
[source,python]
----------------------------------------
@@ -2735,7 +2819,7 @@ struct t_config_section *section = weechat_config_search_section (config_file,
"section");
----------------------------------------
-Script (Python):
+Script (Python) :
[source,python]
----------------------------------------
@@ -2894,7 +2978,7 @@ struct t_config_option *option5 =
NULL, NULL); /* callback de suppression de l'option */
----------------------------------------
-Script (Python):
+Script (Python) :
[source,python]
----------------------------------------
@@ -2988,7 +3072,7 @@ struct t_config_option *option =
weechat_config_search_option (config_file, section, "option");
----------------------------------------
-Script (Python):
+Script (Python) :
[source,python]
----------------------------------------
@@ -3082,7 +3166,7 @@ else
}
----------------------------------------
-Script (Python):
+Script (Python) :
[source,python]
----------------------------------------
@@ -3138,7 +3222,7 @@ switch (weechat_config_option_reset (option, 1))
}
----------------------------------------
-Script (Python):
+Script (Python) :
[source,python]
----------------------------------------
@@ -3199,7 +3283,7 @@ switch (weechat_config_option_set (option, "nouvelle_valeur", 1))
}
----------------------------------------
-Script (Python):
+Script (Python) :
[source,python]
----------------------------------------
@@ -3263,7 +3347,7 @@ switch (weechat_config_option_set_null (option, 1))
}
----------------------------------------
-Script (Python):
+Script (Python) :
[source,python]
----------------------------------------
@@ -3326,7 +3410,7 @@ switch (weechat_config_option_unset (option))
}
----------------------------------------
-Script (Python):
+Script (Python) :
[source,python]
----------------------------------------
@@ -3370,7 +3454,7 @@ Exemple en C :
weechat_config_option_rename (option, "nouveau_nom");
----------------------------------------
-Script (Python):
+Script (Python) :
[source,python]
----------------------------------------
@@ -3460,7 +3544,7 @@ else
}
----------------------------------------
-Script (Python):
+Script (Python) :
[source,python]
----------------------------------------
@@ -3507,7 +3591,7 @@ else
}
----------------------------------------
-Script (Python):
+Script (Python) :
[source,python]
----------------------------------------
@@ -3553,7 +3637,7 @@ else
}
----------------------------------------
-Script (Python):
+Script (Python) :
[source,python]
----------------------------------------
@@ -3599,7 +3683,7 @@ else
}
----------------------------------------
-Script (Python):
+Script (Python) :
[source,python]
----------------------------------------
@@ -3638,7 +3722,7 @@ Exemple en C :
int value = weechat_config_integer (option);
----------------------------------------
-Script (Python):
+Script (Python) :
[source,python]
----------------------------------------
@@ -3677,7 +3761,7 @@ Exemple en C :
int value = weechat_config_integer_default (option);
----------------------------------------
-Script (Python):
+Script (Python) :
[source,python]
----------------------------------------
@@ -3716,7 +3800,7 @@ Exemple en C :
const char *value = weechat_config_string (option);
----------------------------------------
-Script (Python):
+Script (Python) :
[source,python]
----------------------------------------
@@ -3754,7 +3838,7 @@ Exemple en C :
const char *value = weechat_config_string_default (option);
----------------------------------------
-Script (Python):
+Script (Python) :
[source,python]
----------------------------------------
@@ -3792,7 +3876,7 @@ Exemple en C :
const char *color = weechat_config_color (option);
----------------------------------------
-Script (Python):
+Script (Python) :
[source,python]
----------------------------------------
@@ -3831,7 +3915,7 @@ Exemple en C :
const char *color = weechat_config_color_default (option);
----------------------------------------
-Script (Python):
+Script (Python) :
[source,python]
----------------------------------------
@@ -3878,7 +3962,7 @@ my_section_write_cb (void *data, struct t_config_file *config_file,
}
----------------------------------------
-Script (Python):
+Script (Python) :
[source,python]
----------------------------------------
@@ -3932,7 +4016,7 @@ my_section_write_cb (void *data, struct t_config_file *config_file,
}
----------------------------------------
-Script (Python):
+Script (Python) :
[source,python]
----------------------------------------
@@ -3986,7 +4070,7 @@ switch (weechat_config_write (config_file))
}
----------------------------------------
-Script (Python):
+Script (Python) :
[source,python]
----------------------------------------
@@ -4043,7 +4127,7 @@ switch (weechat_config_read (config_file))
}
----------------------------------------
-Script (Python):
+Script (Python) :
[source,python]
----------------------------------------
@@ -4100,7 +4184,7 @@ switch (weechat_config_reload (config_file))
}
----------------------------------------
-Script (Python):
+Script (Python) :
[source,python]
----------------------------------------
@@ -4140,7 +4224,7 @@ Exemple en C :
weechat_config_option_free (option);
----------------------------------------
-Script (Python):
+Script (Python) :
[source,python]
----------------------------------------
@@ -4174,7 +4258,7 @@ Exemple en C :
weechat_config_section_free_options (section);
----------------------------------------
-Script (Python):
+Script (Python) :
[source,python]
----------------------------------------
@@ -4240,7 +4324,7 @@ Exemple en C :
weechat_config_free (config_file);
----------------------------------------
-Script (Python):
+Script (Python) :
[source,python]
----------------------------------------
@@ -4278,7 +4362,7 @@ Exemple en C :
struct t_config_option *option = weechat_config_get ("weechat.look.item_time_format");
----------------------------------------
-Script (Python):
+Script (Python) :
[source,python]
----------------------------------------
@@ -4320,7 +4404,7 @@ Exemple en C :
char *value = weechat_config_get_plugin ("option");
----------------------------------------
-Script (Python):
+Script (Python) :
[source,python]
----------------------------------------
@@ -4367,7 +4451,7 @@ else
}
----------------------------------------
-Script (Python):
+Script (Python) :
[source,python]
----------------------------------------
@@ -4430,7 +4514,7 @@ switch (weechat_config_set_plugin ("option", "valeur_test"))
}
----------------------------------------
-Script (Python):
+Script (Python) :
[source,python]
----------------------------------------
@@ -4496,7 +4580,7 @@ switch (weechat_config_unset_plugin ("option"))
}
----------------------------------------
-Script (Python):
+Script (Python) :
[source,python]
----------------------------------------
@@ -4562,7 +4646,7 @@ Exemple en C :
weechat_printf (NULL, "%sCeci est une erreur...", weechat_prefix ("error"));
----------------------------------------
-Script (Python):
+Script (Python) :
[source,python]
----------------------------------------
@@ -4619,7 +4703,7 @@ weechat_printf (NULL, "Couleur : %sbleu %scouleur par défaut %sjaune sur rouge"
weechat_color ("yellow,red"));
----------------------------------------
-Script (Python):
+Script (Python) :
[source,python]
----------------------------------------
@@ -4657,7 +4741,7 @@ weechat_printf (NULL, "Bonjour sur le tampon WeeChat");
weechat_printf (buffer, "Bonjour sur ce tampon");
----------------------------------------
-Script (Python):
+Script (Python) :
[source,python]
----------------------------------------
@@ -4757,7 +4841,7 @@ weechat_printf_date_tags (NULL, time (NULL) - 120, "notify_message",
"Message il y a 2 minutes avec une étiquette 'notify_message'");
----------------------------------------
-Script (Python):
+Script (Python) :
[source,python]
----------------------------------------
@@ -4800,7 +4884,7 @@ Exemple en C :
weechat_printf_y (buffer, 2, "Mon message sur la 3ème ligne");
----------------------------------------
-Script (Python):
+Script (Python) :
[source,python]
----------------------------------------
@@ -4837,7 +4921,7 @@ Exemple en C :
weechat_log_printf ("Mon message dans le fichier log");
----------------------------------------
-Script (Python):
+Script (Python) :
[source,python]
----------------------------------------
@@ -4961,7 +5045,7 @@ argv_eol contiendront les valeurs suivantes :
** 'argv_eol[1]' == "def ghi"
** 'argv_eol[2]' == "ghi"
-Script (Python):
+Script (Python) :
[source,python]
----------------------------------------
@@ -5040,7 +5124,7 @@ struct t_hook *my_command_run_hook =
&my_command_run_cb, NULL);
----------------------------------------
-Script (Python):
+Script (Python) :
[source,python]
----------------------------------------
@@ -5108,7 +5192,7 @@ struct t_hook *my_timer_hook =
weechat_hook_timer (20 * 1000, 0, 0, &my_timer_cb, NULL);
----------------------------------------
-Script (Python):
+Script (Python) :
[source,python]
----------------------------------------
@@ -5176,7 +5260,7 @@ int sock = socket (AF_INET, SOCK_STREAM, 0);
struct t_hook *my_fd_hook = weechat_hook_fd (sock, 1, 0, 0, &my_fd_cb, NULL);
----------------------------------------
-Script (Python):
+Script (Python) :
[source,python]
----------------------------------------
@@ -5271,7 +5355,7 @@ struct t_hook *my_process_hook = weechat_hook_process ("ls", 5000,
&my_process_cb, NULL);
----------------------------------------
-Script (Python):
+Script (Python) :
[source,python]
----------------------------------------
@@ -5405,7 +5489,7 @@ struct t_hook *my_connect_hook = weechat_hook_connect (NULL,
&my_connect_cb, NULL);
----------------------------------------
-Script (Python):
+Script (Python) :
[source,python]
----------------------------------------
@@ -5510,7 +5594,7 @@ struct t_hook *my_print_hook =
weechat_hook_print (NULL, NULL, NULL, 1, &my_print_cb, NULL);
----------------------------------------
-Script (Python):
+Script (Python) :
[source,python]
----------------------------------------
@@ -5764,7 +5848,7 @@ struct t_hook *my_signal_hook = weechat_hook_signal ("quit",
&my_signal_cb, NULL);
----------------------------------------
-Script (Python):
+Script (Python) :
[source,python]
----------------------------------------
@@ -5807,7 +5891,7 @@ Exemple en C :
weechat_hook_signal_send ("mon_signal", WEECHAT_HOOK_SIGNAL_STRING, ma_chaine);
----------------------------------------
-Script (Python):
+Script (Python) :
[source,python]
----------------------------------------
@@ -5866,7 +5950,7 @@ struct t_hook *my_config_hook = weechat_hook_config ("weechat.look.item_time_for
&my_config_cb, NULL);
----------------------------------------
-Script (Python):
+Script (Python) :
[source,python]
----------------------------------------
@@ -5946,7 +6030,7 @@ struct t_hook *my_completion_hook = weechat_hook_completion ("extension_item",
&my_completion_cb, NULL);
----------------------------------------
-Script (Python):
+Script (Python) :
[source,python]
----------------------------------------
@@ -5990,7 +6074,7 @@ Paramètres :
Exemple en C : voir <<_weechat_hook_completion>>.
-Script (Python):
+Script (Python) :
[source,python]
----------------------------------------
@@ -6133,7 +6217,7 @@ struct t_hook *my_modifier_hook = weechat_hook_modifier ("weechat_print",
&my_modifier_cb, NULL);
----------------------------------------
-Script (Python):
+Script (Python) :
[source,python]
----------------------------------------
@@ -6180,7 +6264,7 @@ char *new_string = weechat_hook_modifier_exec ("mon_modifier",
mes_donnees, ma_chaine);
----------------------------------------
-Script (Python):
+Script (Python) :
[source,python]
----------------------------------------
@@ -6244,7 +6328,7 @@ struct t_hook *my_info_hook = weechat_hook_info ("mon_info",
&my_info_cb, NULL);
----------------------------------------
-Script (Python):
+Script (Python) :
[source,python]
----------------------------------------
@@ -6324,7 +6408,7 @@ struct t_hook *my_infolist = weechat_hook_infolist ("mon_infolist",
&my_infolist_cb, NULL);
----------------------------------------
-Script (Python):
+Script (Python) :
[source,python]
----------------------------------------
@@ -6368,7 +6452,7 @@ struct t_hook *my_hook = weechat_hook_command ( /* ... */ );
weechat_unhook (my_hook);
----------------------------------------
-Script (Python):
+Script (Python) :
[source,python]
----------------------------------------
@@ -6398,7 +6482,7 @@ Exemple en C :
weechat_unhook_all ();
----------------------------------------
-Script (Python):
+Script (Python) :
[source,python]
----------------------------------------
@@ -6478,7 +6562,7 @@ struct t_gui_buffer *my_buffer = weechat_buffer_new ("mon_buffer",
&my_close_cb, NULL);
----------------------------------------
-Script (Python):
+Script (Python) :
[source,python]
----------------------------------------
@@ -6522,7 +6606,7 @@ Exemple en C :
weechat_printf (weechat_current_buffer (), "Texte sur le tampon courant");
----------------------------------------
-Script (Python):
+Script (Python) :
[source,python]
----------------------------------------
@@ -6564,7 +6648,7 @@ struct t_gui_buffer *my_buffer = weechat_buffer_search ("mon_extension",
"mon_tampon");
----------------------------------------
-Script (Python):
+Script (Python) :
[source,python]
----------------------------------------
@@ -6599,7 +6683,7 @@ Exemple en C :
struct t_gui_buffer *weechat_buffer = weechat_buffer_search_main ();
----------------------------------------
-Script (Python):
+Script (Python) :
[source,python]
----------------------------------------
@@ -6638,7 +6722,7 @@ if (my_buffer)
}
----------------------------------------
-Script (Python):
+Script (Python) :
[source,python]
----------------------------------------
@@ -6678,7 +6762,7 @@ struct t_gui_buffer *my_buffer = weechat_buffer_new ("mon_tampon",
weechat_buffer_close (my_buffer);
----------------------------------------
-Script (Python):
+Script (Python) :
[source,python]
----------------------------------------
@@ -6720,7 +6804,7 @@ weechat_buffer_merge (weechat_current_buffer (),
weechat_buffer_search_main ());
----------------------------------------
-Script (Python):
+Script (Python) :
[source,python]
----------------------------------------
@@ -6758,7 +6842,7 @@ Exemple en C :
weechat_buffer_unmerge (weechat_current_buffer (), 1);
----------------------------------------
-Script (Python):
+Script (Python) :
[source,python]
----------------------------------------
@@ -6832,7 +6916,7 @@ weechat_printf (NULL, "mon numéro de tampon est : %d",
weechat_buffer_get_integer (mon_tampon, "number"));
----------------------------------------
-Script (Python):
+Script (Python) :
[source,python]
----------------------------------------
@@ -6885,7 +6969,7 @@ weechat_printf (NULL, "nom / nom court du tampon sont : %s / %s",
weechat_buffer_get_string (my_buffer, "short_name"));
----------------------------------------
-Script (Python):
+Script (Python) :
[source,python]
----------------------------------------
@@ -6930,7 +7014,7 @@ weechat_printf (NULL, "pointeur vers l'extension de mon tampon : %lx",
weechat_buffer_get_pointer (mon_tampon, "plugin"));
----------------------------------------
-Script (Python):
+Script (Python) :
[source,python]
----------------------------------------
@@ -7071,7 +7155,7 @@ weechat_buffer_set (mon_tampon, "localvar_set_toto", "abc");
weechat_buffer_set (mon_tampon, "localvar_del_toto", NULL);
----------------------------------------
-Script (Python):
+Script (Python) :
[source,python]
----------------------------------------
@@ -7169,7 +7253,7 @@ char *str = weechat_buffer_string_replace_local_var (mon_tampon,
/* str contient "test avec abc" */
----------------------------------------
-Script (Python):
+Script (Python) :
[source,python]
----------------------------------------
@@ -7211,7 +7295,7 @@ Exemple en C :
struct t_gui_window *current_window = weechat_current_window ();
----------------------------------------
-Script (Python):
+Script (Python) :
[source,python]
----------------------------------------
@@ -7277,7 +7361,7 @@ weechat_printf (NULL, "la fenêtre courante est en position (x,y) : (%d,%d)",
weechat_window_get_integer (weechat_current_window (), "win_y"));
----------------------------------------
-Script (Python):
+Script (Python) :
[source,python]
----------------------------------------
@@ -7349,7 +7433,7 @@ weechat_printf (NULL,
weechat_window_get_pointer (weechat_current_window (), "buffer"));
----------------------------------------
-Script (Python):
+Script (Python) :
[source,python]
----------------------------------------
@@ -7384,7 +7468,7 @@ Exemple en C :
weechat_window_set_title ("nouveau titre ici");
----------------------------------------
-Script (Python):
+Script (Python) :
[source,python]
----------------------------------------
@@ -7457,7 +7541,7 @@ struct t_gui_nick_group *my_group =
1);
----------------------------------------
-Script (Python):
+Script (Python) :
[source,python]
----------------------------------------
@@ -7502,7 +7586,7 @@ struct t_gui_nick_group *ptr_group = weechat_nicklist_search_group (my_buffer,
NULL, "groupe_test");
----------------------------------------
-Script (Python):
+Script (Python) :
[source,python]
----------------------------------------
@@ -7571,7 +7655,7 @@ struct t_gui_nick *my_nick =
1);
----------------------------------------
-Script (Python):
+Script (Python) :
[source,python]
----------------------------------------
@@ -7619,7 +7703,7 @@ struct t_gui_nick *ptr_nick = weechat_nicklist_search_nick (my_buffer,
NULL, "test_nick");
----------------------------------------
-Script (Python):
+Script (Python) :
[source,python]
----------------------------------------
@@ -7656,7 +7740,7 @@ Exemple en C :
weechat_nicklist_remove_group (my_buffer, my_group);
----------------------------------------
-Script (Python):
+Script (Python) :
[source,python]
----------------------------------------
@@ -7692,7 +7776,7 @@ Exemple en C :
weechat_nicklist_remove_nick (my_buffer, my_nick);
----------------------------------------
-Script (Python):
+Script (Python) :
[source,python]
----------------------------------------
@@ -7726,7 +7810,7 @@ Exemple en C :
weechat_nicklist_remove_all (my_buffer);
----------------------------------------
-Script (Python):
+Script (Python) :
[source,python]
----------------------------------------
@@ -7770,7 +7854,7 @@ Exemple en C :
struct t_gui_bar_item *bar_item = weechat_bar_item_search ("myitem");
----------------------------------------
-Script (Python):
+Script (Python) :
[source,python]
----------------------------------------
@@ -7826,7 +7910,7 @@ struct t_gui_bar_item *my_item = weechat_bar_item_new ("myitem",
NULL);
----------------------------------------
-Script (Python):
+Script (Python) :
[source,python]
----------------------------------------
@@ -7864,7 +7948,7 @@ Exemple en C :
weechat_bar_item_update ("myobjet");
----------------------------------------
-Script (Python):
+Script (Python) :
[source,python]
----------------------------------------
@@ -7898,7 +7982,7 @@ Exemple en C :
weechat_bar_item_remove (&my_item);
----------------------------------------
-Script (Python):
+Script (Python) :
[source,python]
----------------------------------------
@@ -7936,7 +8020,7 @@ Exemple en C :
struct t_gui_bar *bar = weechat_bar_search ("my_barre");
----------------------------------------
-Script (Python):
+Script (Python) :
[source,python]
----------------------------------------
@@ -8044,7 +8128,7 @@ struct t_gui_bar *my_bar = weechat_bar_new ("mybar",
"time,buffer_number+buffer_name");
----------------------------------------
-Script (Python):
+Script (Python) :
[source,python]
----------------------------------------
@@ -8090,7 +8174,7 @@ Exemple en C :
weechat_bar_set (my_bar, "position", "bottom");
----------------------------------------
-Script (Python):
+Script (Python) :
[source,python]
----------------------------------------
@@ -8124,7 +8208,7 @@ Exemple en C :
weechat_bar_update ("mybar");
----------------------------------------
-Script (Python):
+Script (Python) :
[source,python]
----------------------------------------
@@ -8158,7 +8242,7 @@ Exemple en C :
weechat_bar_remove (my_bar);
----------------------------------------
-Script (Python):
+Script (Python) :
[source,python]
----------------------------------------
@@ -8202,7 +8286,7 @@ weechat_command (weechat_buffer_search ("irc", "freenode.#weechat"),
"/whois FlashCode");
----------------------------------------
-Script (Python):
+Script (Python) :
[source,python]
----------------------------------------
@@ -8349,7 +8433,7 @@ weechat_printf (NULL, "Le répertoire de WeeChat est : %s",
weechat_info_get ("weechat_dir", NULL));
----------------------------------------
-Script (Python):
+Script (Python) :
[source,python]
----------------------------------------
@@ -8405,7 +8489,7 @@ Exemple en C :
struct t_infolist *infolist = weechat_infolist_new ();
----------------------------------------
-Script (Python):
+Script (Python) :
[source,python]
----------------------------------------
@@ -8443,7 +8527,7 @@ Exemple en C :
struct t_infolist_item *item = weechat_infolist_new_item (infolist);
----------------------------------------
-Script (Python):
+Script (Python) :
[source,python]
----------------------------------------
@@ -8487,7 +8571,7 @@ struct t_infolist_var *var = weechat_infolist_new_var_integer (item,
123);
----------------------------------------
-Script (Python):
+Script (Python) :
[source,python]
----------------------------------------
@@ -8531,7 +8615,7 @@ struct t_infolist_var *var = weechat_infolist_new_var_string (item,
"valeur");
----------------------------------------
-Script (Python):
+Script (Python) :
[source,python]
----------------------------------------
@@ -8575,7 +8659,7 @@ struct t_infolist_var *var = weechat_infolist_new_var_pointer (item,
&pointer);
----------------------------------------
-Script (Python):
+Script (Python) :
[source,python]
----------------------------------------
@@ -8657,7 +8741,7 @@ struct t_infolist_var *var = weechat_infolist_new_var_time (item,
time (NULL));
----------------------------------------
-Script (Python):
+Script (Python) :
[source,python]
----------------------------------------
@@ -8702,7 +8786,7 @@ Exemple en C :
struct t_infolist *infolist = weechat_infolist_get ("irc_server", NULL, NULL);
----------------------------------------
-Script (Python):
+Script (Python) :
[source,python]
----------------------------------------
@@ -8750,7 +8834,7 @@ else
}
----------------------------------------
-Script (Python):
+Script (Python) :
[source,python]
----------------------------------------
@@ -8802,7 +8886,7 @@ else
}
----------------------------------------
-Script (Python):
+Script (Python) :
[source,python]
----------------------------------------
@@ -8840,7 +8924,7 @@ Exemple en C :
weechat_infolist_reset_item_cursor (infolist);
----------------------------------------
-Script (Python):
+Script (Python) :
[source,python]
----------------------------------------
@@ -8883,7 +8967,7 @@ const char *fields = weechat_infolist_fields (infolist);
"i:mon_entier,s:ma_chaine,p:mon_pointeur,b:mon_buffer,t:ma_date" */
----------------------------------------
-Script (Python):
+Script (Python) :
[source,python]
----------------------------------------
@@ -8926,7 +9010,7 @@ weechat_printf (NULL, "entier = %d",
weechat_infolist_integer (infolist, "mon_entier"));
----------------------------------------
-Script (Python):
+Script (Python) :
[source,python]
----------------------------------------
@@ -8967,7 +9051,7 @@ weechat_printf (NULL, "chaîne = %s",
weechat_infolist_string (infolist, "ma_chaine"));
----------------------------------------
-Script (Python):
+Script (Python) :
[source,python]
----------------------------------------
@@ -9008,7 +9092,7 @@ weechat_printf (NULL, "pointeur = 0x%lx",
weechat_infolist_pointer (infolist, "mon_pointeur"));
----------------------------------------
-Script (Python):
+Script (Python) :
[source,python]
----------------------------------------
@@ -9084,7 +9168,7 @@ weechat_printf (NULL, "date/heure = %ld",
weechat_infolist_time (infolist, "mon_time"));
----------------------------------------
-Script (Python):
+Script (Python) :
[source,python]
----------------------------------------
@@ -9118,7 +9202,7 @@ Exemple en C :
weechat_infolist_free (infolist);
----------------------------------------
-Script (Python):
+Script (Python) :
[source,python]
----------------------------------------
@@ -9166,7 +9250,7 @@ Exemple en C :
struct t_upgrade_file *upgrade_file = weechat_upgrade_new ("mon_fichier", 1);
----------------------------------------
-Script (Python):
+Script (Python) :
[source,python]
----------------------------------------
@@ -9215,7 +9299,7 @@ else
}
----------------------------------------
-Script (Python):
+Script (Python) :
[source,python]
----------------------------------------
@@ -9271,7 +9355,7 @@ my_upgrade_read_cb (struct t_upgrade_file *upgrade_file,
weechat_upgrade_read (upgrade_file, &my_upgrade_read_cb, NULL);
----------------------------------------
-Script (Python):
+Script (Python) :
[source,python]
----------------------------------------
@@ -9309,7 +9393,7 @@ Exemple en C :
weechat_upgrade_close (upgrade_file);
----------------------------------------
-Script (Python):
+Script (Python) :
[source,python]
----------------------------------------
diff --git a/doc/it/autogen/user/weechat_options.txt b/doc/it/autogen/user/weechat_options.txt
index 5996a6413..7ef548f22 100644
--- a/doc/it/autogen/user/weechat_options.txt
+++ b/doc/it/autogen/user/weechat_options.txt
@@ -378,6 +378,11 @@
** tipo: bool
** valori: on, off (valore predefinito: off)
+* *weechat.look.command_chars*
+** descrizione: chars used to determine if input string is a command or not: input must start with one of these chars; the slash ("/") is always considered as command prefix (example: ".$")
+** tipo: stringa
+** valori: qualsiasi stringa (valore predefinito: "")
+
* *weechat.look.day_change*
** descrizione: mostra un messaggio speciale al cambio di data
** tipo: bool
diff --git a/po/cs.po b/po/cs.po
index 67a5a31eb..0b0db5377 100644
--- a/po/cs.po
+++ b/po/cs.po
@@ -6,7 +6,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat 0.3.2-dev\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
-"POT-Creation-Date: 2010-02-26 11:22+0100\n"
+"POT-Creation-Date: 2010-03-02 16:35+0100\n"
"PO-Revision-Date: 2010-02-23 10:43+0100\n"
"Last-Translator: Jiri Golembiovsky <golemj@gmail.com>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@@ -1536,6 +1536,12 @@ msgstr ""
"byste toto nastavení zapnout, pro zobrazení skutečně bílé barvy místo "
"výchozí barvy popředí terminálu)"
+msgid ""
+"chars used to determine if input string is a command or not: input must "
+"start with one of these chars; the slash (\"/\") is always considered as "
+"command prefix (example: \".$\")"
+msgstr ""
+
msgid "display special message when day changes"
msgstr "zobrazit speiální zprávy při změně dne"
diff --git a/po/de.po b/po/de.po
index 49a07bd43..9f7423f7a 100644
--- a/po/de.po
+++ b/po/de.po
@@ -10,7 +10,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat 0.3.2-dev\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
-"POT-Creation-Date: 2010-02-26 11:22+0100\n"
+"POT-Creation-Date: 2010-03-02 16:35+0100\n"
"PO-Revision-Date: 2010-02-23 10:43+0100\n"
"Last-Translator: Nils G <weechatter@arcor.de>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@@ -1622,6 +1622,12 @@ msgstr ""
"Option zu aktivieren, andernfalls wird die voreingestellte Vordergrundfarbe "
"des Terminals genutzt)"
+msgid ""
+"chars used to determine if input string is a command or not: input must "
+"start with one of these chars; the slash (\"/\") is always considered as "
+"command prefix (example: \".$\")"
+msgstr ""
+
msgid "display special message when day changes"
msgstr "Spezielle Nachricht anzeigen, wenn ein neuer Tag beginnt"
diff --git a/po/es.po b/po/es.po
index bf6ffc691..fc3831cba 100644
--- a/po/es.po
+++ b/po/es.po
@@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat 0.3.2-dev\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
-"POT-Creation-Date: 2010-02-26 11:22+0100\n"
+"POT-Creation-Date: 2010-03-02 16:35+0100\n"
"PO-Revision-Date: 2010-02-23 10:43+0100\n"
"Last-Translator: Elián Hanisch <lambdae2@gmail.com>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@@ -1556,6 +1556,12 @@ msgstr ""
"activar esta opción para ver el blanco verdadero en vez del color de primer "
"plano del terminal por defecto)"
+msgid ""
+"chars used to determine if input string is a command or not: input must "
+"start with one of these chars; the slash (\"/\") is always considered as "
+"command prefix (example: \".$\")"
+msgstr ""
+
msgid "display special message when day changes"
msgstr "mostrar un mensaje especial cuando el día cambia"
diff --git a/po/fr.po b/po/fr.po
index 36a3a436b..722a11890 100644
--- a/po/fr.po
+++ b/po/fr.po
@@ -6,8 +6,8 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat 0.3.2-dev\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
-"POT-Creation-Date: 2010-02-26 11:22+0100\n"
-"PO-Revision-Date: 2010-02-26 11:27+0100\n"
+"POT-Creation-Date: 2010-03-02 16:35+0100\n"
+"PO-Revision-Date: 2010-02-28 21:07+0100\n"
"Last-Translator: FlashCode <flashcode@flashtux.org>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
"MIME-Version: 1.0\n"
@@ -1579,6 +1579,15 @@ msgstr ""
"devriez activer cette option pour voir du vrai blanc au lieu de la couleur "
"d'avant plan par défaut du terminal)"
+msgid ""
+"chars used to determine if input string is a command or not: input must "
+"start with one of these chars; the slash (\"/\") is always considered as "
+"command prefix (example: \".$\")"
+msgstr ""
+"caractères utilisés pour déterminer si la chaîne entrée est une commande ou "
+"non: l'entrée doit démarrer avec un de ces caractères; le slash (\"/\") est "
+"toujours considéré comme un préfixe de commande (exemple : \".$\")"
+
msgid "display special message when day changes"
msgstr "affiche un message quand le jour change"
diff --git a/po/hu.po b/po/hu.po
index 77fde668a..3ce2c7bec 100644
--- a/po/hu.po
+++ b/po/hu.po
@@ -12,7 +12,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat 0.3.2-dev\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
-"POT-Creation-Date: 2010-02-26 11:22+0100\n"
+"POT-Creation-Date: 2010-03-02 16:35+0100\n"
"PO-Revision-Date: 2010-02-23 10:43+0100\n"
"Last-Translator: Andras Voroskoi <voroskoi@frugalware.org>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@@ -1416,6 +1416,12 @@ msgstr ""
"hátteret, akkor bekapcsolhatja, hogy valódi fehéret kapjon a terminálban "
"használt betűszín helyett)"
+msgid ""
+"chars used to determine if input string is a command or not: input must "
+"start with one of these chars; the slash (\"/\") is always considered as "
+"command prefix (example: \".$\")"
+msgstr ""
+
msgid "display special message when day changes"
msgstr "speciális üzenet az aktuális nap megváltozásakor"
diff --git a/po/it.po b/po/it.po
index f836b8077..8f0cfe9b5 100644
--- a/po/it.po
+++ b/po/it.po
@@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: Weechat 0.3.2-dev\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
-"POT-Creation-Date: 2010-02-26 11:22+0100\n"
+"POT-Creation-Date: 2010-03-02 16:35+0100\n"
"PO-Revision-Date: 2010-02-23 10:43+0100\n"
"Last-Translator: Marco Paolone <marcopaolone@gmail.com>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@@ -1555,6 +1555,12 @@ msgstr ""
"per visualizzare il bianco reale invece del colore di primo piano "
"predefinito del terminale)"
+msgid ""
+"chars used to determine if input string is a command or not: input must "
+"start with one of these chars; the slash (\"/\") is always considered as "
+"command prefix (example: \".$\")"
+msgstr ""
+
msgid "display special message when day changes"
msgstr "mostra un messaggio speciale al cambio di data"
diff --git a/po/pl.po b/po/pl.po
index 70d701b16..fd96a2b32 100644
--- a/po/pl.po
+++ b/po/pl.po
@@ -9,7 +9,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat 0.3.0-dev\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
-"POT-Creation-Date: 2010-02-26 11:22+0100\n"
+"POT-Creation-Date: 2010-03-02 16:35+0100\n"
"PO-Revision-Date: 2010-02-23 10:43+0100\n"
"Last-Translator: Krzysztof Koroscik <soltys@szluug.org>\n"
"Language-Team: Polish\n"
@@ -1582,6 +1582,12 @@ msgstr ""
"włączyć tą opcje, aby zobaczyć prawdziwy biały zamiast domyślnego koloru "
"czcionki w terminalu)"
+msgid ""
+"chars used to determine if input string is a command or not: input must "
+"start with one of these chars; the slash (\"/\") is always considered as "
+"command prefix (example: \".$\")"
+msgstr ""
+
msgid "display special message when day changes"
msgstr "wyświetlaj specjalną wiadomość, kiedy zmienia się dzień"
diff --git a/po/ru.po b/po/ru.po
index 0b0ff9061..843d647a9 100644
--- a/po/ru.po
+++ b/po/ru.po
@@ -6,7 +6,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat 0.3.2-dev\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
-"POT-Creation-Date: 2010-02-26 11:22+0100\n"
+"POT-Creation-Date: 2010-03-02 16:35+0100\n"
"PO-Revision-Date: 2010-02-23 10:43+0100\n"
"Last-Translator: Pavel Shevchuk <stlwrt@gmail.com>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@@ -1420,6 +1420,12 @@ msgstr ""
"белым фоном вам следует включить этот параметр чтобы видеть настоящий белый "
"цвет вместо цвета терминала по умолчанию)"
+msgid ""
+"chars used to determine if input string is a command or not: input must "
+"start with one of these chars; the slash (\"/\") is always considered as "
+"command prefix (example: \".$\")"
+msgstr ""
+
msgid "display special message when day changes"
msgstr "отображать специальное сообщение при смене дня"
diff --git a/po/weechat.pot b/po/weechat.pot
index 606f8d457..fd124dfc9 100644
--- a/po/weechat.pot
+++ b/po/weechat.pot
@@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
-"POT-Creation-Date: 2010-02-26 11:22+0100\n"
+"POT-Creation-Date: 2010-03-02 16:35+0100\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@@ -1216,6 +1216,12 @@ msgid ""
"option to see real white instead of default term foreground color)"
msgstr ""
+msgid ""
+"chars used to determine if input string is a command or not: input must "
+"start with one of these chars; the slash (\"/\") is always considered as "
+"command prefix (example: \".$\")"
+msgstr ""
+
msgid "display special message when day changes"
msgstr ""
diff --git a/src/core/wee-command.c b/src/core/wee-command.c
index 23c800012..a4b28b31d 100644
--- a/src/core/wee-command.c
+++ b/src/core/wee-command.c
@@ -932,7 +932,7 @@ command_command (void *data, struct t_gui_buffer *buffer,
return WEECHAT_RC_ERROR;
}
}
- if (argv_eol[2][0] == '/')
+ if (string_is_command_char (argv_eol[2]))
{
input_exec_command (buffer, 0, ptr_plugin, argv_eol[2]);
}
@@ -2291,7 +2291,7 @@ command_mute (void *data, struct t_gui_buffer *buffer,
gui_chat_mute = mute_mode;
gui_chat_mute_buffer = mute_buffer;
- if (ptr_command[0] == '/')
+ if (string_is_command_char (ptr_command))
{
input_exec_command (buffer, 1, NULL, ptr_command);
}
diff --git a/src/core/wee-config.c b/src/core/wee-config.c
index fa8f4a5b7..3a96c5f23 100644
--- a/src/core/wee-config.c
+++ b/src/core/wee-config.c
@@ -74,6 +74,7 @@ struct t_config_option *config_look_buffer_notify_default;
struct t_config_option *config_look_buffer_time_format;
struct t_config_option *config_look_color_nicks_number;
struct t_config_option *config_look_color_real_white;
+struct t_config_option *config_look_command_chars;
struct t_config_option *config_look_day_change;
struct t_config_option *config_look_day_change_time_format;
struct t_config_option *config_look_highlight;
@@ -1234,6 +1235,13 @@ config_weechat_init_options ()
"see real white instead of default term foreground "
"color)"),
NULL, 0, 0, "off", NULL, 0, NULL, NULL, &config_change_color, NULL, NULL, NULL);
+ config_look_command_chars = config_file_new_option (
+ weechat_config_file, ptr_section,
+ "command_chars", "string",
+ N_("chars used to determine if input string is a command or not: "
+ "input must start with one of these chars; the slash (\"/\") is "
+ "always considered as command prefix (example: \".$\")"),
+ NULL, 0, 0, "", NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL);
config_look_day_change = config_file_new_option (
weechat_config_file, ptr_section,
"day_change", "boolean",
diff --git a/src/core/wee-config.h b/src/core/wee-config.h
index b9337f051..0c3e4fb5a 100644
--- a/src/core/wee-config.h
+++ b/src/core/wee-config.h
@@ -87,6 +87,7 @@ extern struct t_config_option *config_startup_weechat_slogan;
extern struct t_config_option *config_look_buffer_notify_default;
extern struct t_config_option *config_look_buffer_time_format;
+extern struct t_config_option *config_look_command_chars;
extern struct t_config_option *config_look_color_nicks_number;
extern struct t_config_option *config_look_color_real_white;
extern struct t_config_option *config_look_day_change;
diff --git a/src/core/wee-hook.c b/src/core/wee-hook.c
index fc298e226..8286e72b1 100644
--- a/src/core/wee-hook.c
+++ b/src/core/wee-hook.c
@@ -572,7 +572,7 @@ hook_command_exec (struct t_gui_buffer *buffer, int any_plugin,
{
struct t_hook *ptr_hook, *next_hook;
struct t_hook *hook_for_plugin, *hook_for_other_plugin;
- char **argv, **argv_eol;
+ char **argv, **argv_eol, *ptr_command_name;
int argc, rc, number_for_other_plugin;
if (!buffer || !string || !string[0])
@@ -592,6 +592,8 @@ hook_command_exec (struct t_gui_buffer *buffer, int any_plugin,
}
argv_eol = string_split (string, " ", 1, 0, NULL);
+ ptr_command_name = utf8_next_char (argv[0]);
+
hook_exec_start ();
hook_for_plugin = NULL;
@@ -603,8 +605,8 @@ hook_command_exec (struct t_gui_buffer *buffer, int any_plugin,
next_hook = ptr_hook->next_hook;
if (!ptr_hook->deleted
- && ((argv[0][0] == '/') && (string_strcasecmp (argv[0] + 1,
- HOOK_COMMAND(ptr_hook, command)) == 0)))
+ && (string_strcasecmp (ptr_command_name,
+ HOOK_COMMAND(ptr_hook, command)) == 0))
{
if (ptr_hook->plugin == plugin)
{
diff --git a/src/core/wee-input.c b/src/core/wee-input.c
index 2622192c0..c47ce6b7f 100644
--- a/src/core/wee-input.c
+++ b/src/core/wee-input.c
@@ -31,31 +31,12 @@
#include "wee-config.h"
#include "wee-hook.h"
#include "wee-string.h"
+#include "wee-utf8.h"
#include "../gui/gui-buffer.h"
#include "../gui/gui-chat.h"
#include "../plugins/plugin.h"
-
-/*
- * input_is_command: return 1 if line is a command, 0 otherwise
- */
-
-int
-input_is_command (const char *line)
-{
- char *pos_slash, *pos_space;
-
- if (strncmp (line, "/*", 2) == 0)
- return 0;
-
- pos_slash = strchr (line + 1, '/');
- pos_space = strchr (line + 1, ' ');
-
- return (line[0] == '/')
- && (!pos_slash || (pos_space && pos_slash > pos_space));
-}
-
/*
* input_exec_data: send data to buffer input callbackr
*/
@@ -78,11 +59,9 @@ input_exec_data (struct t_gui_buffer *buffer, const char *data)
/*
* input_exec_command: execute a command (WeeChat internal or a plugin command)
- * returns: 1 if command was executed succesfully
- * 0 if error (command not executed)
*/
-int
+void
input_exec_command (struct t_gui_buffer *buffer,
int any_plugin,
struct t_weechat_plugin *plugin,
@@ -91,12 +70,12 @@ input_exec_command (struct t_gui_buffer *buffer,
int rc;
char *command, *pos, *ptr_args;
- if ((!string) || (!string[0]) || (string[0] != '/'))
- return 0;
+ if ((!string) || (!string[0]))
+ return;
command = strdup (string);
if (!command)
- return 0;
+ return ;
/* look for end of command */
ptr_args = NULL;
@@ -166,7 +145,6 @@ input_exec_command (struct t_gui_buffer *buffer,
break;
}
free (command);
- return 0;
}
/*
@@ -176,8 +154,9 @@ input_exec_command (struct t_gui_buffer *buffer,
void
input_data (struct t_gui_buffer *buffer, const char *data)
{
- char *pos;
- const char *ptr_data;
+ char *pos, *buf;
+ const char *ptr_data, *ptr_data_for_buffer;
+ int length, char_size;
if (!buffer || !data || !data[0] || (data[0] == '\r') || (data[0] == '\n'))
return;
@@ -190,14 +169,32 @@ input_data (struct t_gui_buffer *buffer, const char *data)
if (pos)
pos[0] = '\0';
- if (input_is_command (ptr_data))
+ ptr_data_for_buffer = string_input_for_buffer (ptr_data);
+ if (ptr_data_for_buffer)
{
- /* WeeChat or plugin command */
- (void) input_exec_command (buffer, 1, buffer->plugin, ptr_data);
+ /* input string is NOT a command, send it to buffer input
+ callback */
+ if (string_is_command_char (ptr_data_for_buffer))
+ {
+ char_size = utf8_char_size (ptr_data_for_buffer);
+ length = strlen (ptr_data_for_buffer) + char_size + 1;
+ buf = malloc (length);
+ if (buf)
+ {
+ memcpy (buf, ptr_data_for_buffer, char_size);
+ snprintf (buf + char_size, length - char_size,
+ "%s", ptr_data_for_buffer);
+ input_exec_data (buffer, buf);
+ free (buf);
+ }
+ }
+ else
+ input_exec_data (buffer, ptr_data_for_buffer);
}
else
{
- input_exec_data (buffer, ptr_data);
+ /* input string is a command */
+ input_exec_command (buffer, 1, buffer->plugin, ptr_data);
}
if (pos)
diff --git a/src/core/wee-input.h b/src/core/wee-input.h
index b16af25d0..a4000eadb 100644
--- a/src/core/wee-input.h
+++ b/src/core/wee-input.h
@@ -23,10 +23,10 @@
struct t_gui_buffer;
struct t_weechat_plugin;
-extern int input_exec_command (struct t_gui_buffer *buffer,
- int any_plugin,
- struct t_weechat_plugin *plugin,
- const char *string);
+extern void input_exec_command (struct t_gui_buffer *buffer,
+ int any_plugin,
+ struct t_weechat_plugin *plugin,
+ const char *string);
extern void input_data (struct t_gui_buffer *buffer, const char *data);
#endif /* wee-input.h */
diff --git a/src/core/wee-string.c b/src/core/wee-string.c
index 94c626f9d..a0ee93505 100644
--- a/src/core/wee-string.c
+++ b/src/core/wee-string.c
@@ -50,6 +50,7 @@
#include "weechat.h"
#include "wee-string.h"
+#include "wee-config.h"
#include "wee-utf8.h"
#include "../gui/gui-color.h"
@@ -1410,3 +1411,79 @@ string_decode_base64 (const char *from, char *to)
return to_length;
}
+
+/*
+ * string_is_command_char: return 1 if first char of string is a command char,
+ * otherwise 0
+ */
+
+int
+string_is_command_char (const char *string)
+{
+ const char *ptr_command_chars;
+
+ if (!string)
+ return 0;
+
+ if (string[0] == '/')
+ return 1;
+
+ ptr_command_chars = CONFIG_STRING(config_look_command_chars);
+ if (!ptr_command_chars || !ptr_command_chars[0])
+ return 0;
+
+ while (ptr_command_chars && ptr_command_chars[0])
+ {
+ if (utf8_charcmp (ptr_command_chars, string) == 0)
+ return 1;
+ ptr_command_chars = utf8_next_char (ptr_command_chars);
+ }
+
+ return 0;
+}
+
+/*
+ * string_input_for_buffer: return pointer to input text for buffer (pointer
+ * inside "string" argument)
+ * or return NULL if it's a command
+ * (by default, a command starts with a single '/')
+ */
+
+const char *
+string_input_for_buffer (const char *string)
+{
+ char *pos_slash, *pos_space, *next_char;
+
+ /* special case for C comments pasted in input line */
+ if (strncmp (string, "/*", 2) == 0)
+ return string;
+
+ /* special case if string starts with '/': to allow to paste a path line
+ "/path/to/file.txt", we check if next '/' is after a space or not */
+ if (string[0] == '/')
+ {
+ pos_slash = strchr (string + 1, '/');
+ pos_space = strchr (string + 1, ' ');
+
+ /* if there's no other '/' of if '/' is after first space,
+ then it is a command, and return NULL */
+ if (!pos_slash || (pos_space && pos_slash > pos_space))
+ return NULL;
+
+ return (string[1] == '/') ? string + 1 : string;
+ }
+
+ /* if string does not start with a command char, then it's not command */
+ if (!string_is_command_char (string))
+ return string;
+
+ /* check if first char is doubled: if yes, then it's not a command */
+ next_char = utf8_next_char (string);
+ if (!next_char || !next_char[0])
+ return string;
+ if (utf8_charcmp (string, next_char) == 0)
+ return next_char;
+
+ /* string is a command */
+ return NULL;
+}
diff --git a/src/core/wee-string.h b/src/core/wee-string.h
index 2666b79c2..477d86e4c 100644
--- a/src/core/wee-string.h
+++ b/src/core/wee-string.h
@@ -58,5 +58,7 @@ extern void string_iconv_fprintf (FILE *file, const char *data, ...);
extern char *string_format_size (unsigned long size);
extern void string_encode_base64 (const char *from, int length, char *to);
extern int string_decode_base64 (const char *from, char *to);
+extern int string_is_command_char (const char *string);
+extern const char *string_input_for_buffer (const char *string);
#endif /* wee-string.h */
diff --git a/src/gui/gui-completion.c b/src/gui/gui-completion.c
index 698bddabb..f509c5481 100644
--- a/src/gui/gui-completion.c
+++ b/src/gui/gui-completion.c
@@ -1546,11 +1546,12 @@ gui_completion_find_context (struct t_gui_completion *completion,
const char *data, int size, int pos)
{
int i, command, command_arg, pos_start, pos_end;
+ char *prev_char;
/* look for context */
gui_completion_free_data (completion);
gui_completion_buffer_init (completion, completion->buffer);
- command = (data[0] == '/') ? 1 : 0;
+ command = (string_input_for_buffer (data)) ? 0 : 1;
command_arg = 0;
i = 0;
while (i < pos)
@@ -1623,8 +1624,8 @@ gui_completion_find_context (struct t_gui_completion *completion,
if (completion->context == GUI_COMPLETION_COMMAND)
{
pos_start++;
- if (data[pos_start] == '/')
- pos_start++;
+ if (string_is_command_char (data + pos_start))
+ pos_start += utf8_char_size (data + pos_start);
}
completion->base_word_pos = pos_start;
@@ -1648,22 +1649,25 @@ gui_completion_find_context (struct t_gui_completion *completion,
if (completion->context == GUI_COMPLETION_COMMAND_ARG)
{
pos_start = 0;
- while ((pos_start < size) && (data[pos_start] != '/'))
+ while ((pos_start < size) && !string_is_command_char (data + pos_start))
{
- pos_start++;
+ pos_start += utf8_char_size (data + pos_start);
}
- if (data[pos_start] == '/')
+ if (string_is_command_char (data + pos_start))
{
- pos_start++;
- if (data[pos_start] == '/')
- pos_start++;
+ pos_start += utf8_char_size (data + pos_start);
+ if (string_is_command_char (data + pos_start))
+ pos_start += utf8_char_size (data + pos_start);
pos_end = pos_start;
while ((pos_end < size) && (data[pos_end] != ' '))
{
- pos_end++;
+ pos_end += utf8_char_size (data + pos_end);
}
if (data[pos_end] == ' ')
- pos_end--;
+ {
+ prev_char = utf8_prev_char (data, data + pos_end);
+ pos_end -= utf8_char_size (prev_char);
+ }
completion->base_command = malloc (pos_end - pos_start + 2);
for (i = pos_start; i <= pos_end; i++)
diff --git a/src/plugins/alias/alias.c b/src/plugins/alias/alias.c
index 7821b7c8f..d93a51b66 100644
--- a/src/plugins/alias/alias.c
+++ b/src/plugins/alias/alias.c
@@ -371,10 +371,10 @@ alias_cb (void *data, struct t_gui_buffer *buffer, int argc, char **argv,
alias_command = malloc (1 + length1 + 1 + length2 + 1);
if (alias_command)
{
- if (*ptr_cmd[0] != '/')
+ if (!weechat_string_is_command_char (*ptr_cmd))
strcpy (alias_command, "/");
else
- strcpy (alias_command, "");
+ alias_command[0] = '\0';
strcat (alias_command, *ptr_cmd);
strcat (alias_command, " ");
@@ -387,7 +387,7 @@ alias_cb (void *data, struct t_gui_buffer *buffer, int argc, char **argv,
}
else
{
- if (*ptr_cmd[0] == '/')
+ if (weechat_string_is_command_char (*ptr_cmd))
{
alias_run_command (&buffer,
(args_replaced) ? args_replaced : *ptr_cmd);
@@ -497,9 +497,9 @@ alias_new (const char *name, const char *command)
if (!name || !name[0] || !command || !command[0])
return NULL;
- while (name[0] == '/')
+ while (weechat_string_is_command_char (name))
{
- name++;
+ name = weechat_utf8_next_char (name);
}
ptr_alias = alias_search (name);
@@ -514,7 +514,8 @@ alias_new (const char *name, const char *command)
if (str_completion)
{
snprintf (str_completion, length, "%%%%%s",
- (command[0] == '/') ? command + 1 : command);
+ (weechat_string_is_command_char (command)) ?
+ weechat_utf8_next_char (command) : command);
}
new_hook = weechat_hook_command (name, command, NULL, NULL,
(str_completion) ? str_completion : NULL,
@@ -587,8 +588,8 @@ alias_get_final_command (struct t_alias *alias)
return NULL;
}
- ptr_alias = alias_search ((alias->command[0] == '/') ?
- alias->command + 1 : alias->command);
+ ptr_alias = alias_search ((weechat_string_is_command_char (alias->command)) ?
+ weechat_utf8_next_char (alias->command) : alias->command);
if (ptr_alias)
{
alias->running = 1;
@@ -596,8 +597,8 @@ alias_get_final_command (struct t_alias *alias)
alias->running = 0;
return result;
}
- return (alias->command[0] == '/') ?
- alias->command + 1 : alias->command;
+ return (weechat_string_is_command_char (alias->command)) ?
+ weechat_utf8_next_char (alias->command) : alias->command;
}
/*
@@ -812,7 +813,8 @@ alias_command_cb (void *data, struct t_gui_buffer *buffer, int argc,
if (argc > 1)
{
- alias_name = (argv[1][0] == '/') ? argv[1] + 1 : argv[1];
+ alias_name = (weechat_string_is_command_char (argv[1])) ?
+ weechat_utf8_next_char (argv[1]) : argv[1];
if (argc > 2)
{
/* Define new alias */
@@ -920,7 +922,8 @@ unalias_command_cb (void *data, struct t_gui_buffer *buffer, int argc,
{
for (i = 1; i < argc; i++)
{
- alias_name = (argv[i][0] == '/') ? argv[i] + 1 : argv[i];
+ alias_name = (weechat_string_is_command_char (argv[i])) ?
+ weechat_utf8_next_char (argv[i]) : argv[i];
ptr_alias = alias_search (alias_name);
if (!ptr_alias)
{
diff --git a/src/plugins/aspell/weechat-aspell.c b/src/plugins/aspell/weechat-aspell.c
index 9ff334cde..dcb8f0547 100644
--- a/src/plugins/aspell/weechat-aspell.c
+++ b/src/plugins/aspell/weechat-aspell.c
@@ -733,10 +733,10 @@ weechat_aspell_modifier_cb (void *data, const char *modifier,
index_result = 0;
/* check if string is a command */
- if ((ptr_string[0] == '/') && ptr_string[1] && (ptr_string[1] != '/')
- && (ptr_string[1] != ' '))
+ if (!weechat_string_input_for_buffer (ptr_string))
{
- ptr_string++;
+ char_size = weechat_utf8_char_size (ptr_string);
+ ptr_string += char_size;
pos_space = ptr_string;
while (pos_space && pos_space[0] && (pos_space[0] != ' '))
{
@@ -756,10 +756,11 @@ weechat_aspell_modifier_cb (void *data, const char *modifier,
free (result);
return NULL;
}
- result[index_result++] = '/';
+ memcpy (result + index_result, aspell_last_modifier_string, char_size);
+ index_result += char_size;
strcpy (result + index_result, ptr_string);
index_result += strlen (ptr_string);
-
+
pos_space[0] = ' ';
ptr_string = pos_space;
}
diff --git a/src/plugins/irc/irc-command.c b/src/plugins/irc/irc-command.c
index 5f907ced2..9500f7beb 100644
--- a/src/plugins/irc/irc-command.c
+++ b/src/plugins/irc/irc-command.c
@@ -121,7 +121,7 @@ irc_command_exec_all_channels (struct t_irc_server *server,
if (!command || !command[0])
return;
- if (command[0] != '/')
+ if (!weechat_string_is_command_char (command))
{
length = 1 + strlen (command) + 1;
str_command = malloc (length);
@@ -240,7 +240,7 @@ irc_command_exec_all_servers (const char *exclude_servers, const char *command)
if (!command || !command[0])
return;
- if (command[0] != '/')
+ if (!weechat_string_is_command_char (command))
{
length = 1 + strlen (command) + 1;
str_command = malloc (length);
diff --git a/src/plugins/irc/irc-input.c b/src/plugins/irc/irc-input.c
index ba3ce319e..caa1767dd 100644
--- a/src/plugins/irc/irc-input.c
+++ b/src/plugins/irc/irc-input.c
@@ -162,18 +162,19 @@ irc_input_data_cb (void *data, struct t_gui_buffer *buffer,
/* if send unknown commands is enabled and that input data is a command,
then send this command to IRC server */
if (weechat_config_boolean (irc_config_network_send_unknown_commands)
- && (input_data[0] == '/') && (input_data[1] != '/'))
+ && !weechat_string_input_for_buffer (input_data))
{
if (ptr_server)
irc_server_sendf (ptr_server, IRC_SERVER_OUTQUEUE_PRIO_HIGH,
- input_data + 1);
+ weechat_utf8_next_char (input_data));
return WEECHAT_RC_OK;
}
if (ptr_channel)
{
- ptr_data = ((input_data[0] == '/') && (input_data[1] == '/')) ?
- input_data + 1 : input_data;
+ ptr_data = weechat_string_input_for_buffer (input_data);
+ if (!ptr_data)
+ ptr_data = input_data;
data_with_colors = irc_color_encode (ptr_data,
weechat_config_boolean (irc_config_network_colors_send));
diff --git a/src/plugins/plugin.c b/src/plugins/plugin.c
index 38e72c022..91c12e8e3 100644
--- a/src/plugins/plugin.c
+++ b/src/plugins/plugin.c
@@ -386,6 +386,8 @@ plugin_load (const char *filename)
new_plugin->string_remove_color = &gui_color_decode;
new_plugin->string_encode_base64 = &string_encode_base64;
new_plugin->string_decode_base64 = &string_decode_base64;
+ new_plugin->string_is_command_char = &string_is_command_char;
+ new_plugin->string_input_for_buffer = &string_input_for_buffer;
new_plugin->utf8_has_8bits = &utf8_has_8bits;
new_plugin->utf8_is_valid = &utf8_is_valid;
diff --git a/src/plugins/scripts/lua/weechat-lua-api.c b/src/plugins/scripts/lua/weechat-lua-api.c
index 7554070b8..aa52fb6c0 100644
--- a/src/plugins/scripts/lua/weechat-lua-api.c
+++ b/src/plugins/scripts/lua/weechat-lua-api.c
@@ -403,6 +403,81 @@ weechat_lua_api_string_remove_color (lua_State *L)
}
/*
+ * weechat_lua_api_string_is_command_char: check if first char of string is a
+ * command char
+ */
+
+static int
+weechat_lua_api_string_is_command_char (lua_State *L)
+{
+ const char *string;
+ int n, value;
+
+ /* make C compiler happy */
+ (void) L;
+
+ if (!lua_current_script)
+ {
+ WEECHAT_SCRIPT_MSG_NOT_INIT(LUA_CURRENT_SCRIPT_NAME, "string_is_command_char");
+ LUA_RETURN_INT(0);
+ }
+
+ string = NULL;
+
+ n = lua_gettop (lua_current_interpreter);
+
+ if (n < 1)
+ {
+ WEECHAT_SCRIPT_MSG_WRONG_ARGS(LUA_CURRENT_SCRIPT_NAME, "string_is_command_char");
+ LUA_RETURN_INT(0);
+ }
+
+ string = lua_tostring (lua_current_interpreter, -1);
+
+ value = weechat_string_is_command_char (string);
+
+ LUA_RETURN_INT(value);
+}
+
+/*
+ * weechat_lua_api_string_input_for_buffer: return string with input text
+ * for buffer or empty string if
+ * it's a command
+ */
+
+static int
+weechat_lua_api_string_input_for_buffer (lua_State *L)
+{
+ const char *string, *result;
+ int n;
+
+ /* make C compiler happy */
+ (void) L;
+
+ if (!lua_current_script)
+ {
+ WEECHAT_SCRIPT_MSG_NOT_INIT(LUA_CURRENT_SCRIPT_NAME, "string_input_for_buffer");
+ LUA_RETURN_EMPTY;
+ }
+
+ string = NULL;
+
+ n = lua_gettop (lua_current_interpreter);
+
+ if (n < 1)
+ {
+ WEECHAT_SCRIPT_MSG_WRONG_ARGS(LUA_CURRENT_SCRIPT_NAME, "string_input_for_buffer");
+ LUA_RETURN_EMPTY;
+ }
+
+ string = lua_tostring (lua_current_interpreter, -1);
+
+ result = weechat_string_input_for_buffer (string);
+
+ LUA_RETURN_STRING(result);
+}
+
+/*
* weechat_lua_api_mkdir_home: create a directory in WeeChat home
*/
@@ -7232,6 +7307,8 @@ const struct luaL_reg weechat_lua_api_funcs[] = {
{ "gettext", &weechat_lua_api_gettext },
{ "ngettext", &weechat_lua_api_ngettext },
{ "string_remove_color", &weechat_lua_api_string_remove_color },
+ { "string_is_command_char", &weechat_lua_api_string_is_command_char },
+ { "string_input_for_buffer", &weechat_lua_api_string_input_for_buffer },
{ "mkdir_home", &weechat_lua_api_mkdir_home },
{ "mkdir", &weechat_lua_api_mkdir },
{ "mkdir_parents", &weechat_lua_api_mkdir_parents },
diff --git a/src/plugins/scripts/perl/weechat-perl-api.c b/src/plugins/scripts/perl/weechat-perl-api.c
index 660af505f..08b84d8e7 100644
--- a/src/plugins/scripts/perl/weechat-perl-api.c
+++ b/src/plugins/scripts/perl/weechat-perl-api.c
@@ -346,6 +346,66 @@ XS (XS_weechat_api_string_remove_color)
}
/*
+ * weechat::string_is_command_char: check if first char of string is a command
+ * char
+ */
+
+XS (XS_weechat_api_string_is_command_char)
+{
+ int value;
+ dXSARGS;
+
+ /* make C compiler happy */
+ (void) cv;
+
+ if (!perl_current_script)
+ {
+ WEECHAT_SCRIPT_MSG_NOT_INIT(PERL_CURRENT_SCRIPT_NAME, "string_is_command_char");
+ PERL_RETURN_INT(0);
+ }
+
+ if (items < 1)
+ {
+ WEECHAT_SCRIPT_MSG_WRONG_ARGS(PERL_CURRENT_SCRIPT_NAME, "string_is_command_char");
+ PERL_RETURN_INT(0);
+ }
+
+ value = weechat_string_is_command_char (SvPV (ST (0), PL_na)); /* string */
+
+ PERL_RETURN_INT(value);
+}
+
+/*
+ * weechat::string_input_for_buffer: return string with input text for buffer
+ * or empty string if it's a command
+ */
+
+XS (XS_weechat_api_string_input_for_buffer)
+{
+ const char *result;
+ dXSARGS;
+
+ /* make C compiler happy */
+ (void) cv;
+
+ if (!perl_current_script)
+ {
+ WEECHAT_SCRIPT_MSG_NOT_INIT(PERL_CURRENT_SCRIPT_NAME, "string_input_for_buffer");
+ PERL_RETURN_EMPTY;
+ }
+
+ if (items < 1)
+ {
+ WEECHAT_SCRIPT_MSG_WRONG_ARGS(PERL_CURRENT_SCRIPT_NAME, "string_input_for_buffer");
+ PERL_RETURN_EMPTY;
+ }
+
+ result = weechat_string_input_for_buffer (SvPV (ST (0), PL_na)); /* string */
+
+ PERL_RETURN_STRING(result);
+}
+
+/*
* weechat::mkdir_home: create a directory in WeeChat home
*/
@@ -5790,6 +5850,8 @@ weechat_perl_api_init (pTHX)
newXS ("weechat::gettext", XS_weechat_api_gettext, "weechat");
newXS ("weechat::ngettext", XS_weechat_api_ngettext, "weechat");
newXS ("weechat::string_remove_color", XS_weechat_api_string_remove_color, "weechat");
+ newXS ("weechat::string_is_command_char", XS_weechat_api_string_is_command_char, "weechat");
+ newXS ("weechat::string_input_for_buffer", XS_weechat_api_string_input_for_buffer, "weechat");
newXS ("weechat::mkdir_home", XS_weechat_api_mkdir_home, "weechat");
newXS ("weechat::mkdir", XS_weechat_api_mkdir, "weechat");
newXS ("weechat::mkdir_parents", XS_weechat_api_mkdir_parents, "weechat");
diff --git a/src/plugins/scripts/python/weechat-python-api.c b/src/plugins/scripts/python/weechat-python-api.c
index 5ab77a57a..f4205b59e 100644
--- a/src/plugins/scripts/python/weechat-python-api.c
+++ b/src/plugins/scripts/python/weechat-python-api.c
@@ -351,6 +351,73 @@ weechat_python_api_string_remove_color (PyObject *self, PyObject *args)
}
/*
+ * weechat_python_api_string_is_command_char: check if first char of string is
+ * a command char
+ */
+
+static PyObject *
+weechat_python_api_string_is_command_char (PyObject *self, PyObject *args)
+{
+ char *string;
+ int value;
+
+ /* make C compiler happy */
+ (void) self;
+
+ if (!python_current_script)
+ {
+ WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "string_is_command_char");
+ PYTHON_RETURN_INT(0);
+ }
+
+ string = NULL;
+
+ if (!PyArg_ParseTuple (args, "s", &string))
+ {
+ WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "string_is_command_char");
+ PYTHON_RETURN_INT(0);
+ }
+
+ value = weechat_string_is_command_char (string);
+
+ PYTHON_RETURN_INT(value);
+}
+
+/*
+ * weechat_python_api_string_input_for_buffer: return string with input text
+ * for buffer or empty string if
+ * it's a command
+ */
+
+static PyObject *
+weechat_python_api_string_input_for_buffer (PyObject *self, PyObject *args)
+{
+ char *string;
+ const char *result;
+
+ /* make C compiler happy */
+ (void) self;
+
+ if (!python_current_script)
+ {
+ WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "string_input_for_buffer");
+ PYTHON_RETURN_EMPTY;
+ }
+
+ string = NULL;
+
+ if (!PyArg_ParseTuple (args, "s", &string))
+ {
+ WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "string_input_for_buffer");
+ PYTHON_RETURN_EMPTY;
+ }
+
+ result = weechat_string_input_for_buffer (string);
+
+ PYTHON_RETURN_STRING(result);
+}
+
+/*
* weechat_python_api_mkdir_home: create a directory in WeeChat home
*/
@@ -6081,6 +6148,8 @@ PyMethodDef weechat_python_funcs[] =
{ "gettext", &weechat_python_api_gettext, METH_VARARGS, "" },
{ "ngettext", &weechat_python_api_ngettext, METH_VARARGS, "" },
{ "string_remove_color", &weechat_python_api_string_remove_color, METH_VARARGS, "" },
+ { "string_is_command_char", &weechat_python_api_string_is_command_char, METH_VARARGS, "" },
+ { "string_input_for_buffer", &weechat_python_api_string_input_for_buffer, METH_VARARGS, "" },
{ "mkdir_home", &weechat_python_api_mkdir_home, METH_VARARGS, "" },
{ "mkdir", &weechat_python_api_mkdir, METH_VARARGS, "" },
{ "mkdir_parents", &weechat_python_api_mkdir_parents, METH_VARARGS, "" },
diff --git a/src/plugins/scripts/ruby/weechat-ruby-api.c b/src/plugins/scripts/ruby/weechat-ruby-api.c
index a5af066cd..af98c38d5 100644
--- a/src/plugins/scripts/ruby/weechat-ruby-api.c
+++ b/src/plugins/scripts/ruby/weechat-ruby-api.c
@@ -408,6 +408,81 @@ weechat_ruby_api_string_remove_color (VALUE class, VALUE string,
}
/*
+ * weechat_ruby_api_string_is_command_char: check if first char of string is a
+ * command char
+ */
+
+static VALUE
+weechat_ruby_api_string_is_command_char (VALUE class, VALUE string)
+{
+ char *c_string;
+ int value;
+
+ /* make C compiler happy */
+ (void) class;
+
+ if (!ruby_current_script)
+ {
+ WEECHAT_SCRIPT_MSG_NOT_INIT(RUBY_CURRENT_SCRIPT_NAME, "string_is_command_char");
+ RUBY_RETURN_INT(0);
+ }
+
+ c_string = NULL;
+
+ if (NIL_P (string))
+ {
+ WEECHAT_SCRIPT_MSG_WRONG_ARGS(RUBY_CURRENT_SCRIPT_NAME, "string_is_command_char");
+ RUBY_RETURN_INT(0);
+ }
+
+ Check_Type (string, T_STRING);
+
+ c_string = STR2CSTR (string);
+
+ value = weechat_string_is_command_char (c_string);
+
+ RUBY_RETURN_INT(value);
+}
+
+/*
+ * weechat_ruby_api_string_input_for_buffer: return string with input text
+ * for buffer or empty string if
+ * it's a command
+ */
+
+static VALUE
+weechat_ruby_api_string_input_for_buffer (VALUE class, VALUE string)
+{
+ char *c_string;
+ const char *result;
+
+ /* make C compiler happy */
+ (void) class;
+
+ if (!ruby_current_script)
+ {
+ WEECHAT_SCRIPT_MSG_NOT_INIT(RUBY_CURRENT_SCRIPT_NAME, "string_input_for_buffer");
+ RUBY_RETURN_EMPTY;
+ }
+
+ c_string = NULL;
+
+ if (NIL_P (string))
+ {
+ WEECHAT_SCRIPT_MSG_WRONG_ARGS(RUBY_CURRENT_SCRIPT_NAME, "string_input_for_buffer");
+ RUBY_RETURN_EMPTY;
+ }
+
+ Check_Type (string, T_STRING);
+
+ c_string = STR2CSTR (string);
+
+ result = weechat_string_input_for_buffer (c_string);
+
+ RUBY_RETURN_STRING(result);
+}
+
+/*
* weechat_ruby_api_mkdir_home: create a directory in WeeChat home
*/
@@ -7023,6 +7098,8 @@ weechat_ruby_api_init (VALUE ruby_mWeechat)
rb_define_module_function (ruby_mWeechat, "gettext", &weechat_ruby_api_gettext, 1);
rb_define_module_function (ruby_mWeechat, "ngettext", &weechat_ruby_api_ngettext, 3);
rb_define_module_function (ruby_mWeechat, "string_remove_color", &weechat_ruby_api_string_remove_color, 2);
+ rb_define_module_function (ruby_mWeechat, "string_is_command_char", &weechat_ruby_api_string_is_command_char, 1);
+ rb_define_module_function (ruby_mWeechat, "string_input_for_buffer", &weechat_ruby_api_string_input_for_buffer, 1);
rb_define_module_function (ruby_mWeechat, "mkdir_home", &weechat_ruby_api_mkdir_home, 2);
rb_define_module_function (ruby_mWeechat, "mkdir", &weechat_ruby_api_mkdir, 2);
rb_define_module_function (ruby_mWeechat, "mkdir_parents", &weechat_ruby_api_mkdir_parents, 2);
diff --git a/src/plugins/scripts/tcl/weechat-tcl-api.c b/src/plugins/scripts/tcl/weechat-tcl-api.c
index 65fcb1bd4..84f75aa7d 100644
--- a/src/plugins/scripts/tcl/weechat-tcl-api.c
+++ b/src/plugins/scripts/tcl/weechat-tcl-api.c
@@ -446,7 +446,7 @@ weechat_tcl_api_string_remove_color (ClientData clientData, Tcl_Interp *interp,
{
Tcl_Obj* objp;
char *result, *replacement, *string;
- int i;
+ int i;
/* make C compiler happy */
(void) clientData;
@@ -472,6 +472,72 @@ weechat_tcl_api_string_remove_color (ClientData clientData, Tcl_Interp *interp,
}
/*
+ * weechat_tcl_api_string_is_command_char: check if first char of string is a
+ * command char
+ */
+
+static int
+weechat_tcl_api_string_is_command_char (ClientData clientData, Tcl_Interp *interp,
+ int objc, Tcl_Obj *CONST objv[])
+{
+ Tcl_Obj* objp;
+ int result, i;
+
+ /* make C compiler happy */
+ (void) clientData;
+
+ if (!tcl_current_script)
+ {
+ WEECHAT_SCRIPT_MSG_NOT_INIT(TCL_CURRENT_SCRIPT_NAME, "string_is_command_char");
+ TCL_RETURN_INT(0);
+ }
+
+ if (objc < 2)
+ {
+ WEECHAT_SCRIPT_MSG_WRONG_ARGS(TCL_CURRENT_SCRIPT_NAME, "string_is_command_char");
+ TCL_RETURN_INT(0);
+ }
+
+ result = weechat_string_is_command_char (Tcl_GetStringFromObj (objv[1], &i)); /* string */
+
+ TCL_RETURN_INT(result);
+}
+
+/*
+ * weechat_tcl_api_string_input_for_buffer: return string with input text
+ * for buffer or empty string if
+ * it's a command
+ */
+
+static int
+weechat_tcl_api_string_input_for_buffer (ClientData clientData, Tcl_Interp *interp,
+ int objc, Tcl_Obj *CONST objv[])
+{
+ Tcl_Obj* objp;
+ const char *result;
+ int i;
+
+ /* make C compiler happy */
+ (void) clientData;
+
+ if (!tcl_current_script)
+ {
+ WEECHAT_SCRIPT_MSG_NOT_INIT(TCL_CURRENT_SCRIPT_NAME, "string_input_for_buffer");
+ TCL_RETURN_EMPTY;
+ }
+
+ if (objc < 2)
+ {
+ WEECHAT_SCRIPT_MSG_WRONG_ARGS(TCL_CURRENT_SCRIPT_NAME, "string_input_for_buffer");
+ TCL_RETURN_EMPTY;
+ }
+
+ result = weechat_string_input_for_buffer (Tcl_GetStringFromObj (objv[1], &i));
+
+ TCL_RETURN_STRING(result);
+}
+
+/*
* weechat_tcl_api_mkdir_home: create a directory in WeeChat home
*/
@@ -6552,6 +6618,10 @@ void weechat_tcl_api_init (Tcl_Interp *interp)
weechat_tcl_api_ngettext, (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL);
Tcl_CreateObjCommand (interp, "weechat::string_remove_color",
weechat_tcl_api_string_remove_color, (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL);
+ Tcl_CreateObjCommand (interp, "weechat::string_is_command_char",
+ weechat_tcl_api_string_is_command_char, (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL);
+ Tcl_CreateObjCommand (interp, "weechat::string_input_for_buffer",
+ weechat_tcl_api_string_input_for_buffer, (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL);
Tcl_CreateObjCommand (interp, "weechat::mkdir_home",
weechat_tcl_api_mkdir_home, (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL);
Tcl_CreateObjCommand (interp, "weechat::mkdir",
diff --git a/src/plugins/weechat-plugin.h b/src/plugins/weechat-plugin.h
index f364ecc26..3e68a6dff 100644
--- a/src/plugins/weechat-plugin.h
+++ b/src/plugins/weechat-plugin.h
@@ -34,7 +34,7 @@ struct t_weelist;
struct timeval;
/* API version (used to check that plugin has same API and can be loaded) */
-#define WEECHAT_PLUGIN_API_VERSION "20100216-01"
+#define WEECHAT_PLUGIN_API_VERSION "20100302-01"
/* macros for defining plugin infos */
#define WEECHAT_PLUGIN_NAME(__name) \
@@ -172,6 +172,8 @@ struct t_weechat_plugin
char *(*string_remove_color) (const char *string, const char *replacement);
void (*string_encode_base64) (const char *from, int length, char *to);
int (*string_decode_base64) (const char *from, char *to);
+ int (*string_is_command_char) (const char *string);
+ const char *(*string_input_for_buffer) (const char *string);
/* UTF-8 strings */
int (*utf8_has_8bits) (const char *string);
@@ -723,6 +725,10 @@ extern int weechat_plugin_end (struct t_weechat_plugin *plugin);
weechat_plugin->string_encode_base64(__from, __length, __to)
#define weechat_string_decode_base64(__from, __to) \
weechat_plugin->string_decode_base64(__from, __to)
+#define weechat_string_is_command_char(__string) \
+ weechat_plugin->string_is_command_char(__string)
+#define weechat_string_input_for_buffer(__string) \
+ weechat_plugin->string_input_for_buffer(__string)
/* UTF-8 strings */
#define weechat_utf8_has_8bits(__string) \