Add new option weechat.look.highlight_regex and function string_has_highlight_regex in plugin API (task #10321)
parent
8b9abab711
commit
e92079cfe9
|
@ -1,12 +1,14 @@
|
|||
WeeChat ChangeLog
|
||||
=================
|
||||
Sébastien Helleu <flashcode@flashtux.org>
|
||||
v0.3.4-dev, 2010-11-18
|
||||
v0.3.4-dev, 2010-11-25
|
||||
|
||||
|
||||
Version 0.3.4 (under dev!)
|
||||
--------------------------
|
||||
|
||||
* core: add new option weechat.look.highlight_regex and function
|
||||
string_has_highlight_regex in plugin API (task #10321)
|
||||
* core: fix infinite loop on gnutls handshake when connecting with SSL to server
|
||||
on wrong port or server with SSL problems (bug #27487)
|
||||
* core: fix data sent to callback of hook_process (some data was sometimes
|
||||
|
|
|
@ -388,6 +388,11 @@
|
|||
** Typ: Zeichenkette
|
||||
** Werte: beliebige Zeichenkette (Standardwert: `""`)
|
||||
|
||||
* *weechat.look.highlight_regex*
|
||||
** Beschreibung: `regular expression used to check if a message has highlight or not, at least one match in string must be surrounded by word chars (alphanumeric, "-", "_" or "|"), regular expression is case sensitive, example: "FlashCode|flashy"`
|
||||
** Typ: Zeichenkette
|
||||
** Werte: beliebige Zeichenkette (Standardwert: `""`)
|
||||
|
||||
* *weechat.look.hline_char*
|
||||
** Beschreibung: `Das angegebene Zeichen wird genutzt um damit die horizontalen Linien zu zeichnen. Hinweis: Ein leerer Wert bewirkt das ncurses eine durchgezogene Linie zeichnet. Dies kann aber bei einigen Terminals, in URL Sektionen, zu Fehlern führen.`
|
||||
** Typ: Zeichenkette
|
||||
|
|
|
@ -388,6 +388,11 @@
|
|||
** type: string
|
||||
** values: any string (default value: `""`)
|
||||
|
||||
* *weechat.look.highlight_regex*
|
||||
** description: `regular expression used to check if a message has highlight or not, at least one match in string must be surrounded by word chars (alphanumeric, "-", "_" or "|"), regular expression is case sensitive, example: "FlashCode|flashy"`
|
||||
** type: string
|
||||
** values: any string (default value: `""`)
|
||||
|
||||
* *weechat.look.hline_char*
|
||||
** description: `char used to draw horizontal lines, note that empty value will draw a real line with ncurses, but may cause bugs with URL selection under some terminals`
|
||||
** type: string
|
||||
|
|
|
@ -933,6 +933,49 @@ highlight = weechat.string_has_highlight(string, highlight_words)
|
|||
highlight = weechat.string_has_highlight("my test string", "test,word2") # 1
|
||||
----------------------------------------
|
||||
|
||||
weechat_string_has_highlight_regex
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
_New in version 0.3.4._
|
||||
|
||||
Check if a string has one or more highlights, using a regular expression.
|
||||
For at least one match of regular expression on string, it must be surrounded
|
||||
by word chars (alphanumeric character, "-", "_" or "|").
|
||||
|
||||
Prototype:
|
||||
|
||||
[source,C]
|
||||
----------------------------------------
|
||||
int weechat_string_has_highlight_regex (const char *string, const char *regex);
|
||||
----------------------------------------
|
||||
|
||||
Arguments:
|
||||
|
||||
* 'string': string
|
||||
* 'regex': regular expression
|
||||
|
||||
Return value:
|
||||
|
||||
* 1 if string has one or more highlights, otherwise 0
|
||||
|
||||
C example:
|
||||
|
||||
[source,C]
|
||||
----------------------------------------
|
||||
int hl = weechat_string_has_highlight_regex ("my test string", "test|word2"); /* == 1 */
|
||||
----------------------------------------
|
||||
|
||||
Script (Python):
|
||||
|
||||
[source,python]
|
||||
----------------------------------------
|
||||
# prototype
|
||||
highlight = weechat.string_has_highlight_regex(string, regex)
|
||||
|
||||
# example
|
||||
highlight = weechat.string_has_highlight_regex("my test string", "test|word2") # 1
|
||||
----------------------------------------
|
||||
|
||||
weechat_string_mask_to_regex
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
|
|
|
@ -388,6 +388,11 @@
|
|||
** type: chaîne
|
||||
** valeurs: toute chaîne (valeur par défaut: `""`)
|
||||
|
||||
* *weechat.look.highlight_regex*
|
||||
** description: `expression régulière utilisée pour vérifier si un message a un "highlight" ou non, au moins une correspondante dans la chaîne doit être entourée de caractères de mot (alpha-numérique, "-", "_" ou "|"), l'expression régulière est sensible à la casse, exemple: "FlashCode|flashy"`
|
||||
** type: chaîne
|
||||
** valeurs: toute chaîne (valeur par défaut: `""`)
|
||||
|
||||
* *weechat.look.hline_char*
|
||||
** description: `caractère utilisé pour tracer les lignes horizontales, notez qu'une valeur vide tracera une vraie ligne avec ncurses, mais peut causer des problèmes d'affichage avec la sélection d'URL sous certains terminaux`
|
||||
** type: chaîne
|
||||
|
|
|
@ -943,6 +943,50 @@ highlight = weechat.string_has_highlight(string, highlight_words)
|
|||
highlight = weechat.string_has_highlight("my test string", "test,word2") # 1
|
||||
----------------------------------------
|
||||
|
||||
weechat_string_has_highlight_regex
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
_Nouveau dans la version 0.3.4._
|
||||
|
||||
Vérifie si une chaîne a un ou plusieurs "highlights", en utilisant une
|
||||
expression régulière.
|
||||
Pour au moins une correspondance dans la chaîne, elle doit être entourée de
|
||||
caractères de mot (caractère alpha-numérique, "-", "_" ou "|").
|
||||
|
||||
Prototype :
|
||||
|
||||
[source,C]
|
||||
----------------------------------------
|
||||
int weechat_string_has_highlight_regex (const char *string, const char *regex);
|
||||
----------------------------------------
|
||||
|
||||
Paramètres :
|
||||
|
||||
* 'string' : chaîne
|
||||
* 'regex' : expression régulière
|
||||
|
||||
Valeur de retour :
|
||||
|
||||
* 1 si la chaîne a un ou plusieurs "highlights", sinon 0
|
||||
|
||||
Exemple en C :
|
||||
|
||||
[source,C]
|
||||
----------------------------------------
|
||||
int hl = weechat_string_has_highlight_regex ("my test string", "test|word2"); /* == 1 */
|
||||
----------------------------------------
|
||||
|
||||
Script (Python) :
|
||||
|
||||
[source,python]
|
||||
----------------------------------------
|
||||
# prototype
|
||||
highlight = weechat.string_has_highlight_regex(string, regex)
|
||||
|
||||
# exemple
|
||||
highlight = weechat.string_has_highlight_regex("my test string", "test|word2") # 1
|
||||
----------------------------------------
|
||||
|
||||
weechat_string_mask_to_regex
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
|
|
|
@ -388,6 +388,11 @@
|
|||
** tipo: stringa
|
||||
** valori: qualsiasi stringa (valore predefinito: `""`)
|
||||
|
||||
* *weechat.look.highlight_regex*
|
||||
** descrizione: `regular expression used to check if a message has highlight or not, at least one match in string must be surrounded by word chars (alphanumeric, "-", "_" or "|"), regular expression is case sensitive, example: "FlashCode|flashy"`
|
||||
** tipo: stringa
|
||||
** valori: qualsiasi stringa (valore predefinito: `""`)
|
||||
|
||||
* *weechat.look.hline_char*
|
||||
** descrizione: `carattere utilizzato per disegnare le righe orizzontali; notare che un valore vuoto disegnerà una vera riga con ncurses, ma può causare errori con la selezione dell'URL in alcuni terminali`
|
||||
** tipo: stringa
|
||||
|
|
|
@ -954,6 +954,50 @@ highlight = weechat.string_has_highlight(string, highlight_words)
|
|||
highlight = weechat.string_has_highlight("my test string", "test,word2") # 1
|
||||
----------------------------------------
|
||||
|
||||
// TRANSLATION MISSING
|
||||
weechat_string_has_highlight_regex
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
_New in version 0.3.4._
|
||||
|
||||
Check if a string has one or more highlights, using a regular expression.
|
||||
For at least one match of regular expression on string, it must be surrounded
|
||||
by word chars (alphanumeric character, "-", "_" or "|").
|
||||
|
||||
Prototype:
|
||||
|
||||
[source,C]
|
||||
----------------------------------------
|
||||
int weechat_string_has_highlight_regex (const char *string, const char *regex);
|
||||
----------------------------------------
|
||||
|
||||
Arguments:
|
||||
|
||||
* 'string': string
|
||||
* 'regex': regular expression
|
||||
|
||||
Return value:
|
||||
|
||||
* 1 if string has one or more highlights, otherwise 0
|
||||
|
||||
C example:
|
||||
|
||||
[source,C]
|
||||
----------------------------------------
|
||||
int hl = weechat_string_has_highlight_regex ("my test string", "test|word2"); /* == 1 */
|
||||
----------------------------------------
|
||||
|
||||
Script (Python):
|
||||
|
||||
[source,python]
|
||||
----------------------------------------
|
||||
# prototype
|
||||
highlight = weechat.string_has_highlight_regex(string, regex)
|
||||
|
||||
# example
|
||||
highlight = weechat.string_has_highlight_regex("my test string", "test|word2") # 1
|
||||
----------------------------------------
|
||||
|
||||
weechat_string_mask_to_regex
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
|
|
9
po/cs.po
9
po/cs.po
|
@ -20,7 +20,7 @@ msgid ""
|
|||
msgstr ""
|
||||
"Project-Id-Version: WeeChat 0.3.4-dev\n"
|
||||
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
|
||||
"POT-Creation-Date: 2010-11-18 18:24+0100\n"
|
||||
"POT-Creation-Date: 2010-11-25 14:41+0100\n"
|
||||
"PO-Revision-Date: 2010-11-06 11:55+0100\n"
|
||||
"Last-Translator: Jiri Golembiovsky <golemj@gmail.com>\n"
|
||||
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
|
||||
|
@ -1842,6 +1842,13 @@ msgstr ""
|
|||
"čárkou oddělený seznam slov pro zvýraznění (neporovnává se velikost písmen, "
|
||||
"slova mohou začínat nebo končit \"*\" pro částečnou schodu)"
|
||||
|
||||
msgid ""
|
||||
"regular expression used to check if a message has highlight or not, at least "
|
||||
"one match in string must be surrounded by word chars (alphanumeric, \"-\", "
|
||||
"\"_\" or \"|\"), regular expression is case sensitive, example: \"FlashCode|"
|
||||
"flashy\""
|
||||
msgstr ""
|
||||
|
||||
msgid ""
|
||||
"char used to draw horizontal lines, note that empty value will draw a real "
|
||||
"line with ncurses, but may cause bugs with URL selection under some terminals"
|
||||
|
|
9
po/de.po
9
po/de.po
|
@ -22,7 +22,7 @@ msgid ""
|
|||
msgstr ""
|
||||
"Project-Id-Version: WeeChat 0.3.3-dev\n"
|
||||
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
|
||||
"POT-Creation-Date: 2010-11-19 22:56+0100\n"
|
||||
"POT-Creation-Date: 2010-11-25 14:41+0100\n"
|
||||
"PO-Revision-Date: 2010-11-20 00:05+0100\n"
|
||||
"Last-Translator: Nils G.\n"
|
||||
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
|
||||
|
@ -1915,6 +1915,13 @@ msgstr ""
|
|||
"Kleinschreibung wird nicht beachtet, die Wörter können mit \"*\" als Joker "
|
||||
"beginnen oder enden)"
|
||||
|
||||
msgid ""
|
||||
"regular expression used to check if a message has highlight or not, at least "
|
||||
"one match in string must be surrounded by word chars (alphanumeric, \"-\", "
|
||||
"\"_\" or \"|\"), regular expression is case sensitive, example: \"FlashCode|"
|
||||
"flashy\""
|
||||
msgstr ""
|
||||
|
||||
msgid ""
|
||||
"char used to draw horizontal lines, note that empty value will draw a real "
|
||||
"line with ncurses, but may cause bugs with URL selection under some terminals"
|
||||
|
|
9
po/es.po
9
po/es.po
|
@ -21,7 +21,7 @@ msgid ""
|
|||
msgstr ""
|
||||
"Project-Id-Version: WeeChat 0.3.4-dev\n"
|
||||
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
|
||||
"POT-Creation-Date: 2010-11-18 18:24+0100\n"
|
||||
"POT-Creation-Date: 2010-11-25 14:41+0100\n"
|
||||
"PO-Revision-Date: 2010-11-06 11:56+0100\n"
|
||||
"Last-Translator: Elián Hanisch <lambdae2@gmail.com>\n"
|
||||
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
|
||||
|
@ -1858,6 +1858,13 @@ msgstr ""
|
|||
"mayúsculas, las palabras pueden empezar o terminar con \"*\" para una "
|
||||
"concordancia parcial)"
|
||||
|
||||
msgid ""
|
||||
"regular expression used to check if a message has highlight or not, at least "
|
||||
"one match in string must be surrounded by word chars (alphanumeric, \"-\", "
|
||||
"\"_\" or \"|\"), regular expression is case sensitive, example: \"FlashCode|"
|
||||
"flashy\""
|
||||
msgstr ""
|
||||
|
||||
msgid ""
|
||||
"char used to draw horizontal lines, note that empty value will draw a real "
|
||||
"line with ncurses, but may cause bugs with URL selection under some terminals"
|
||||
|
|
15
po/fr.po
15
po/fr.po
|
@ -21,8 +21,8 @@ msgid ""
|
|||
msgstr ""
|
||||
"Project-Id-Version: WeeChat 0.3.4-dev\n"
|
||||
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
|
||||
"POT-Creation-Date: 2010-11-18 18:24+0100\n"
|
||||
"PO-Revision-Date: 2010-11-18 18:25+0100\n"
|
||||
"POT-Creation-Date: 2010-11-25 14:41+0100\n"
|
||||
"PO-Revision-Date: 2010-11-25 11:02+0100\n"
|
||||
"Last-Translator: Sebastien Helleu <flashcode@flashtux.org>\n"
|
||||
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
|
||||
"Language: French\n"
|
||||
|
@ -1876,6 +1876,17 @@ msgstr ""
|
|||
"comparaison ne tient pas compte de la casse, les mots peuvent commencer ou "
|
||||
"se terminer par \"*\" pour une comparaison partielle)"
|
||||
|
||||
msgid ""
|
||||
"regular expression used to check if a message has highlight or not, at least "
|
||||
"one match in string must be surrounded by word chars (alphanumeric, \"-\", "
|
||||
"\"_\" or \"|\"), regular expression is case sensitive, example: \"FlashCode|"
|
||||
"flashy\""
|
||||
msgstr ""
|
||||
"expression régulière utilisée pour vérifier si un message a un \"highlight\" "
|
||||
"ou non, au moins une correspondante dans la chaîne doit être entourée de "
|
||||
"caractères de mot (alpha-numérique, \"-\", \"_\" ou \"|\"), l'expression "
|
||||
"régulière est sensible à la casse, exemple: \"FlashCode|flashy\""
|
||||
|
||||
msgid ""
|
||||
"char used to draw horizontal lines, note that empty value will draw a real "
|
||||
"line with ncurses, but may cause bugs with URL selection under some terminals"
|
||||
|
|
9
po/hu.po
9
po/hu.po
|
@ -20,7 +20,7 @@ msgid ""
|
|||
msgstr ""
|
||||
"Project-Id-Version: WeeChat 0.3.4-dev\n"
|
||||
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
|
||||
"POT-Creation-Date: 2010-11-18 18:24+0100\n"
|
||||
"POT-Creation-Date: 2010-11-25 14:41+0100\n"
|
||||
"PO-Revision-Date: 2010-11-05 17:17+0100\n"
|
||||
"Last-Translator: Andras Voroskoi <voroskoi@frugalware.org>\n"
|
||||
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
|
||||
|
@ -1656,6 +1656,13 @@ msgstr ""
|
|||
"kiemelendő szavak vesszővel elválasztott listája (kis/nagybetűtől független "
|
||||
"összehasonlítás, a szavak végére/elejére \"*\"-ot illesztve részleges keresés"
|
||||
|
||||
msgid ""
|
||||
"regular expression used to check if a message has highlight or not, at least "
|
||||
"one match in string must be surrounded by word chars (alphanumeric, \"-\", "
|
||||
"\"_\" or \"|\"), regular expression is case sensitive, example: \"FlashCode|"
|
||||
"flashy\""
|
||||
msgstr ""
|
||||
|
||||
msgid ""
|
||||
"char used to draw horizontal lines, note that empty value will draw a real "
|
||||
"line with ncurses, but may cause bugs with URL selection under some terminals"
|
||||
|
|
9
po/it.po
9
po/it.po
|
@ -20,7 +20,7 @@ msgid ""
|
|||
msgstr ""
|
||||
"Project-Id-Version: WeeChat 0.3.4-dev\n"
|
||||
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
|
||||
"POT-Creation-Date: 2010-11-18 18:24+0100\n"
|
||||
"POT-Creation-Date: 2010-11-25 14:41+0100\n"
|
||||
"PO-Revision-Date: 2010-11-06 11:56+0100\n"
|
||||
"Last-Translator: Marco Paolone <marcopaolone@gmail.com>\n"
|
||||
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
|
||||
|
@ -1867,6 +1867,13 @@ msgstr ""
|
|||
"le parole potrebbero cominciare o terminare con \"*\" per un riscontro "
|
||||
"parziale)"
|
||||
|
||||
msgid ""
|
||||
"regular expression used to check if a message has highlight or not, at least "
|
||||
"one match in string must be surrounded by word chars (alphanumeric, \"-\", "
|
||||
"\"_\" or \"|\"), regular expression is case sensitive, example: \"FlashCode|"
|
||||
"flashy\""
|
||||
msgstr ""
|
||||
|
||||
msgid ""
|
||||
"char used to draw horizontal lines, note that empty value will draw a real "
|
||||
"line with ncurses, but may cause bugs with URL selection under some terminals"
|
||||
|
|
9
po/pl.po
9
po/pl.po
|
@ -21,7 +21,7 @@ msgid ""
|
|||
msgstr ""
|
||||
"Project-Id-Version: WeeChat 0.3.4-dev\n"
|
||||
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
|
||||
"POT-Creation-Date: 2010-11-18 18:24+0100\n"
|
||||
"POT-Creation-Date: 2010-11-25 14:41+0100\n"
|
||||
"PO-Revision-Date: 2010-11-06 11:56+0100\n"
|
||||
"Last-Translator: Krzysztof Koroscik <soltys@szluug.org>\n"
|
||||
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
|
||||
|
@ -1867,6 +1867,13 @@ msgstr ""
|
|||
"wielkość znaków, słowa mogą się zaczynać lub kończyć \"*\" dla częściowego "
|
||||
"dopasowania)"
|
||||
|
||||
msgid ""
|
||||
"regular expression used to check if a message has highlight or not, at least "
|
||||
"one match in string must be surrounded by word chars (alphanumeric, \"-\", "
|
||||
"\"_\" or \"|\"), regular expression is case sensitive, example: \"FlashCode|"
|
||||
"flashy\""
|
||||
msgstr ""
|
||||
|
||||
msgid ""
|
||||
"char used to draw horizontal lines, note that empty value will draw a real "
|
||||
"line with ncurses, but may cause bugs with URL selection under some terminals"
|
||||
|
|
|
@ -20,7 +20,7 @@ msgid ""
|
|||
msgstr ""
|
||||
"Project-Id-Version: WeeChat 0.3.4-dev\n"
|
||||
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
|
||||
"POT-Creation-Date: 2010-11-18 18:24+0100\n"
|
||||
"POT-Creation-Date: 2010-11-25 14:41+0100\n"
|
||||
"PO-Revision-Date: 2010-11-13 09:26+0100\n"
|
||||
"Last-Translator: Ivan Sichmann Freitas <ivansichfreitas@gmail.com>\n"
|
||||
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
|
||||
|
@ -1477,6 +1477,13 @@ msgid ""
|
|||
"words may begin or end with \"*\" for partial match)"
|
||||
msgstr ""
|
||||
|
||||
msgid ""
|
||||
"regular expression used to check if a message has highlight or not, at least "
|
||||
"one match in string must be surrounded by word chars (alphanumeric, \"-\", "
|
||||
"\"_\" or \"|\"), regular expression is case sensitive, example: \"FlashCode|"
|
||||
"flashy\""
|
||||
msgstr ""
|
||||
|
||||
msgid ""
|
||||
"char used to draw horizontal lines, note that empty value will draw a real "
|
||||
"line with ncurses, but may cause bugs with URL selection under some terminals"
|
||||
|
|
9
po/ru.po
9
po/ru.po
|
@ -20,7 +20,7 @@ msgid ""
|
|||
msgstr ""
|
||||
"Project-Id-Version: WeeChat 0.3.4-dev\n"
|
||||
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
|
||||
"POT-Creation-Date: 2010-11-18 18:24+0100\n"
|
||||
"POT-Creation-Date: 2010-11-25 14:41+0100\n"
|
||||
"PO-Revision-Date: 2010-11-05 17:17+0100\n"
|
||||
"Last-Translator: Pavel Shevchuk <stlwrt@gmail.com>\n"
|
||||
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
|
||||
|
@ -1665,6 +1665,13 @@ msgstr ""
|
|||
"разделённый запятыми список подсвечиваемых слов (регистр учитывается, слова "
|
||||
"могут начинаться или кончаться \"*\" для неполного соответствия)"
|
||||
|
||||
msgid ""
|
||||
"regular expression used to check if a message has highlight or not, at least "
|
||||
"one match in string must be surrounded by word chars (alphanumeric, \"-\", "
|
||||
"\"_\" or \"|\"), regular expression is case sensitive, example: \"FlashCode|"
|
||||
"flashy\""
|
||||
msgstr ""
|
||||
|
||||
msgid ""
|
||||
"char used to draw horizontal lines, note that empty value will draw a real "
|
||||
"line with ncurses, but may cause bugs with URL selection under some terminals"
|
||||
|
|
|
@ -7,7 +7,7 @@ msgid ""
|
|||
msgstr ""
|
||||
"Project-Id-Version: PACKAGE VERSION\n"
|
||||
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
|
||||
"POT-Creation-Date: 2010-11-18 18:24+0100\n"
|
||||
"POT-Creation-Date: 2010-11-25 14:41+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"
|
||||
|
@ -1417,6 +1417,13 @@ msgid ""
|
|||
"words may begin or end with \"*\" for partial match)"
|
||||
msgstr ""
|
||||
|
||||
msgid ""
|
||||
"regular expression used to check if a message has highlight or not, at least "
|
||||
"one match in string must be surrounded by word chars (alphanumeric, \"-\", "
|
||||
"\"_\" or \"|\"), regular expression is case sensitive, example: \"FlashCode|"
|
||||
"flashy\""
|
||||
msgstr ""
|
||||
|
||||
msgid ""
|
||||
"char used to draw horizontal lines, note that empty value will draw a real "
|
||||
"line with ncurses, but may cause bugs with URL selection under some terminals"
|
||||
|
|
|
@ -62,6 +62,9 @@ CHECK_FUNCTION_EXISTS(strpbrk HAVE_STRPBRK)
|
|||
CHECK_FUNCTION_EXISTS(strrchr HAVE_STRRCHR)
|
||||
CHECK_FUNCTION_EXISTS(strstr HAVE_STRSTR)
|
||||
|
||||
CHECK_INCLUDE_FILES("regex.h" HAVE_REGEX_H)
|
||||
CHECK_FUNCTION_EXISTS(regexec HAVE_REGEXEC)
|
||||
|
||||
|
||||
#needs to be splitted in subdirectories
|
||||
# FIXME: weechat_gui_common MUST be the first lib in the list
|
||||
|
|
|
@ -35,6 +35,7 @@
|
|||
#include <time.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <regex.h>
|
||||
|
||||
#include "weechat.h"
|
||||
#include "wee-config.h"
|
||||
|
@ -83,6 +84,7 @@ struct t_config_option *config_look_confirm_quit;
|
|||
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;
|
||||
struct t_config_option *config_look_highlight_regex;
|
||||
struct t_config_option *config_look_hline_char;
|
||||
struct t_config_option *config_look_hotlist_names_count;
|
||||
struct t_config_option *config_look_hotlist_names_length;
|
||||
|
@ -200,6 +202,7 @@ struct t_config_option *config_plugin_save_config_on_unload;
|
|||
|
||||
struct t_hook *config_day_change_timer = NULL;
|
||||
int config_day_change_old_day = -1;
|
||||
regex_t *config_highlight_regex = NULL;
|
||||
|
||||
|
||||
/*
|
||||
|
@ -283,6 +286,41 @@ config_change_buffer_time_format (void *data, struct t_config_option *option)
|
|||
gui_window_ask_refresh (1);
|
||||
}
|
||||
|
||||
/*
|
||||
* config_change_highlight_regex: called when highlight_regex changes
|
||||
*/
|
||||
|
||||
void
|
||||
config_change_highlight_regex (void *data, struct t_config_option *option)
|
||||
{
|
||||
/* make C compiler happy */
|
||||
(void) data;
|
||||
(void) option;
|
||||
|
||||
if (config_highlight_regex)
|
||||
{
|
||||
regfree (config_highlight_regex);
|
||||
free (config_highlight_regex);
|
||||
config_highlight_regex = NULL;
|
||||
}
|
||||
|
||||
if (CONFIG_STRING(config_look_highlight_regex)
|
||||
&& CONFIG_STRING(config_look_highlight_regex)[0])
|
||||
{
|
||||
config_highlight_regex = malloc (sizeof (*config_highlight_regex));
|
||||
if (config_highlight_regex)
|
||||
{
|
||||
if (regcomp (config_highlight_regex,
|
||||
CONFIG_STRING(config_look_highlight_regex),
|
||||
REG_EXTENDED) != 0)
|
||||
{
|
||||
free (config_highlight_regex);
|
||||
config_highlight_regex = NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* config_change_hotlist: called when hotlist changes
|
||||
*/
|
||||
|
@ -1334,6 +1372,14 @@ config_weechat_init_options ()
|
|||
N_("comma separated list of words to highlight (case insensitive "
|
||||
"comparison, words may begin or end with \"*\" for partial match)"),
|
||||
NULL, 0, 0, "", NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL);
|
||||
config_look_highlight_regex = config_file_new_option (
|
||||
weechat_config_file, ptr_section,
|
||||
"highlight_regex", "string",
|
||||
N_("regular expression used to check if a message has highlight or not, "
|
||||
"at least one match in string must be surrounded by word chars "
|
||||
"(alphanumeric, \"-\", \"_\" or \"|\"), regular expression is case "
|
||||
"sensitive, example: \"FlashCode|flashy\""),
|
||||
NULL, 0, 0, "", NULL, 0, NULL, NULL, &config_change_highlight_regex, NULL, NULL, NULL);
|
||||
config_look_hline_char = config_file_new_option (
|
||||
weechat_config_file, ptr_section,
|
||||
"hline_char", "string",
|
||||
|
@ -2196,6 +2242,7 @@ config_weechat_init ()
|
|||
0,
|
||||
&config_day_change_timer_cb,
|
||||
NULL);
|
||||
config_change_highlight_regex (NULL, NULL);
|
||||
}
|
||||
|
||||
return rc;
|
||||
|
|
|
@ -21,10 +21,11 @@
|
|||
#ifndef __WEECHAT_CONFIG_H
|
||||
#define __WEECHAT_CONFIG_H 1
|
||||
|
||||
struct t_gui_buffer;
|
||||
|
||||
#include <regex.h>
|
||||
#include "wee-config-file.h"
|
||||
|
||||
struct t_gui_buffer;
|
||||
|
||||
#define WEECHAT_CONFIG_NAME "weechat"
|
||||
|
||||
enum t_config_look_nicklist
|
||||
|
@ -112,6 +113,7 @@ extern struct t_config_option *config_look_color_real_white;
|
|||
extern struct t_config_option *config_look_day_change;
|
||||
extern struct t_config_option *config_look_day_change_time_format;
|
||||
extern struct t_config_option *config_look_highlight;
|
||||
extern struct t_config_option *config_look_highlight_regex;
|
||||
extern struct t_config_option *config_look_hline_char;
|
||||
extern struct t_config_option *config_look_hotlist_names_count;
|
||||
extern struct t_config_option *config_look_hotlist_names_length;
|
||||
|
@ -215,6 +217,8 @@ extern struct t_config_option *config_plugin_extension;
|
|||
extern struct t_config_option *config_plugin_path;
|
||||
extern struct t_config_option *config_plugin_save_config_on_unload;
|
||||
|
||||
extern regex_t *config_highlight_regex;
|
||||
|
||||
|
||||
extern struct t_config_option *config_weechat_debug_get (const char *plugin_name);
|
||||
extern int config_weechat_debug_set (const char *plugin_name,
|
||||
|
|
|
@ -31,6 +31,7 @@
|
|||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
#include <wctype.h>
|
||||
#include <regex.h>
|
||||
|
||||
#if defined(__OpenBSD__)
|
||||
#include <utf8/wchar.h>
|
||||
|
@ -708,6 +709,76 @@ string_has_highlight (const char *string, const char *highlight_words)
|
|||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* string_has_highlight_regex_compiled: return 1 if string contains a highlight
|
||||
* using a regular expression (any match
|
||||
* in string must be surrounded by word
|
||||
* chars)
|
||||
*/
|
||||
|
||||
int
|
||||
string_has_highlight_regex_compiled (const char *string, regex_t *regex)
|
||||
{
|
||||
int rc, startswith, endswith;
|
||||
regmatch_t regex_match;
|
||||
const char *match_pre;
|
||||
|
||||
if (!string || !regex)
|
||||
return 0;
|
||||
|
||||
while (string && string[0])
|
||||
{
|
||||
rc = regexec (regex, string, 1, ®ex_match, 0);
|
||||
if ((rc != 0) || (regex_match.rm_so < 0) || (regex_match.rm_eo < 0))
|
||||
break;
|
||||
|
||||
startswith = (regex_match.rm_so == 0);
|
||||
if (!startswith)
|
||||
{
|
||||
match_pre = utf8_prev_char (string, string + regex_match.rm_so);
|
||||
startswith = !string_is_word_char (match_pre);
|
||||
}
|
||||
endswith = 0;
|
||||
if (startswith)
|
||||
{
|
||||
endswith = ((regex_match.rm_eo == (int)strlen (string))
|
||||
|| !string_is_word_char (string + regex_match.rm_eo));
|
||||
}
|
||||
if (startswith && endswith)
|
||||
return 1;
|
||||
|
||||
string += regex_match.rm_eo;
|
||||
}
|
||||
|
||||
/* no highlight found */
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* string_has_highlight_regex: return 1 if string contains a highlight
|
||||
* using a regular expression (any match in string
|
||||
* must be surrounded by word chars)
|
||||
*/
|
||||
|
||||
int
|
||||
string_has_highlight_regex (const char *string, const char *regex)
|
||||
{
|
||||
regex_t reg;
|
||||
int rc;
|
||||
|
||||
if (!string || !regex)
|
||||
return 0;
|
||||
|
||||
if (regcomp (®, regex, REG_EXTENDED) != 0)
|
||||
return 0;
|
||||
|
||||
rc = string_has_highlight_regex_compiled (string, ®);
|
||||
|
||||
regfree (®);
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
/*
|
||||
* string_mask_to_regex: convert a mask (string with only "*" as wildcard) to a
|
||||
* regex, paying attention to special chars in a regex
|
||||
|
|
|
@ -20,6 +20,8 @@
|
|||
#ifndef __WEECHAT_STRING_H
|
||||
#define __WEECHAT_STRING_H 1
|
||||
|
||||
#include <regex.h>
|
||||
|
||||
extern char *string_strndup (const char *string, int length);
|
||||
extern void string_tolower (char *string);
|
||||
extern void string_toupper (char *string);
|
||||
|
@ -42,6 +44,9 @@ extern char *string_strip (const char *string, int left, int right,
|
|||
extern char *string_convert_hex_chars (const char *string);
|
||||
extern int string_has_highlight (const char *string,
|
||||
const char *highlight_words);
|
||||
extern int string_has_highlight_regex_compiled (const char *string,
|
||||
regex_t *regex);
|
||||
extern int string_has_highlight_regex (const char *string, const char *regex);
|
||||
extern char *string_mask_to_regex (const char *mask);
|
||||
extern char **string_split (const char *string, const char *separators,
|
||||
int keep_eol, int num_items_max, int *num_items);
|
||||
|
|
|
@ -474,6 +474,12 @@ gui_line_has_highlight (struct t_gui_line *line)
|
|||
free (highlight_words);
|
||||
}
|
||||
|
||||
if (!rc && config_highlight_regex)
|
||||
{
|
||||
rc = string_has_highlight_regex_compiled (msg_no_color,
|
||||
config_highlight_regex);
|
||||
}
|
||||
|
||||
free (msg_no_color);
|
||||
|
||||
return rc;
|
||||
|
|
|
@ -45,9 +45,6 @@ irc-server.c irc-server.h
|
|||
irc-upgrade.c irc-upgrade.h)
|
||||
SET_TARGET_PROPERTIES(irc PROPERTIES PREFIX "")
|
||||
|
||||
CHECK_INCLUDE_FILES("regex.h" HAVE_REGEX_H)
|
||||
CHECK_FUNCTION_EXISTS(regexec HAVE_REGEXEC)
|
||||
|
||||
SET (LINK_LIBS)
|
||||
|
||||
IF(GNUTLS_FOUND)
|
||||
|
|
|
@ -465,6 +465,7 @@ plugin_load (const char *filename)
|
|||
new_plugin->string_remove_quotes = &string_remove_quotes;
|
||||
new_plugin->string_strip = &string_strip;
|
||||
new_plugin->string_has_highlight = &string_has_highlight;
|
||||
new_plugin->string_has_highlight_regex = &string_has_highlight_regex;
|
||||
new_plugin->string_mask_to_regex = &string_mask_to_regex;
|
||||
new_plugin->string_split = &string_split;
|
||||
new_plugin->string_free_split = &string_free_split;
|
||||
|
|
|
@ -422,6 +422,45 @@ weechat_lua_api_string_has_highlight (lua_State *L)
|
|||
LUA_RETURN_INT(value);
|
||||
}
|
||||
|
||||
/*
|
||||
* weechat_lua_api_string_has_highlight_regex: return 1 if string contains a
|
||||
* highlight (using regular
|
||||
* expression)
|
||||
* return 0 if no highlight is
|
||||
* found in string
|
||||
*/
|
||||
|
||||
static int
|
||||
weechat_lua_api_string_has_highlight_regex (lua_State *L)
|
||||
{
|
||||
const char *string, *regex;
|
||||
int n, value;
|
||||
|
||||
/* make C compiler happy */
|
||||
(void) L;
|
||||
|
||||
if (!lua_current_script || !lua_current_script->name)
|
||||
{
|
||||
WEECHAT_SCRIPT_MSG_NOT_INIT(LUA_CURRENT_SCRIPT_NAME, "string_has_highlight_regex");
|
||||
LUA_RETURN_INT(0);
|
||||
}
|
||||
|
||||
n = lua_gettop (lua_current_interpreter);
|
||||
|
||||
if (n < 2)
|
||||
{
|
||||
WEECHAT_SCRIPT_MSG_WRONG_ARGS(LUA_CURRENT_SCRIPT_NAME, "string_has_highlight_regex");
|
||||
LUA_RETURN_INT(0);
|
||||
}
|
||||
|
||||
string = lua_tostring (lua_current_interpreter, -2);
|
||||
regex = lua_tostring (lua_current_interpreter, -1);
|
||||
|
||||
value = weechat_string_has_highlight_regex (string, regex);
|
||||
|
||||
LUA_RETURN_INT(value);
|
||||
}
|
||||
|
||||
/*
|
||||
* weechat_lua_api_string_mask_to_regex: convert a mask (string with only
|
||||
* "*" as wildcard) to a regex, paying
|
||||
|
@ -7562,6 +7601,7 @@ const struct luaL_reg weechat_lua_api_funcs[] = {
|
|||
{ "ngettext", &weechat_lua_api_ngettext },
|
||||
{ "string_match", &weechat_lua_api_string_match },
|
||||
{ "string_has_highlight", &weechat_lua_api_string_has_highlight },
|
||||
{ "string_has_highlight_regex", &weechat_lua_api_string_has_highlight_regex },
|
||||
{ "string_mask_to_regex", &weechat_lua_api_string_mask_to_regex },
|
||||
{ "string_remove_color", &weechat_lua_api_string_remove_color },
|
||||
{ "string_is_command_char", &weechat_lua_api_string_is_command_char },
|
||||
|
|
|
@ -387,6 +387,39 @@ XS (XS_weechat_api_string_has_highlight)
|
|||
PERL_RETURN_INT(value);
|
||||
}
|
||||
|
||||
/*
|
||||
* weechat::string_has_highlight_regex: return 1 if string contains a highlight
|
||||
* (using regular expression)
|
||||
* return 0 if no highlight is found in
|
||||
* string
|
||||
*/
|
||||
|
||||
XS (XS_weechat_api_string_has_highlight_regex)
|
||||
{
|
||||
int value;
|
||||
dXSARGS;
|
||||
|
||||
/* make C compiler happy */
|
||||
(void) cv;
|
||||
|
||||
if (!perl_current_script || !perl_current_script->name)
|
||||
{
|
||||
WEECHAT_SCRIPT_MSG_NOT_INIT(PERL_CURRENT_SCRIPT_NAME, "string_has_highlight_regex");
|
||||
PERL_RETURN_INT(0);
|
||||
}
|
||||
|
||||
if (items < 2)
|
||||
{
|
||||
WEECHAT_SCRIPT_MSG_WRONG_ARGS(PERL_CURRENT_SCRIPT_NAME, "string_has_highlight_regex");
|
||||
PERL_RETURN_INT(0);
|
||||
}
|
||||
|
||||
value = weechat_string_has_highlight_regex (SvPV (ST (0), PL_na), /* string */
|
||||
SvPV (ST (1), PL_na)); /* regex */
|
||||
|
||||
PERL_RETURN_INT(value);
|
||||
}
|
||||
|
||||
/*
|
||||
* weechat::string_mask_to_regex: convert a mask (string with only "*" as
|
||||
* wildcard) to a regex, paying attention to
|
||||
|
@ -6509,6 +6542,7 @@ weechat_perl_api_init (pTHX)
|
|||
newXS ("weechat::ngettext", XS_weechat_api_ngettext, "weechat");
|
||||
newXS ("weechat::string_match", XS_weechat_api_string_match, "weechat");
|
||||
newXS ("weechat::string_has_highlight", XS_weechat_api_string_has_highlight, "weechat");
|
||||
newXS ("weechat::string_has_highlight_regex", XS_weechat_api_string_has_highlight_regex, "weechat");
|
||||
newXS ("weechat::string_mask_to_regex", XS_weechat_api_string_mask_to_regex, "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");
|
||||
|
|
|
@ -395,6 +395,43 @@ weechat_python_api_string_has_highlight (PyObject *self, PyObject *args)
|
|||
PYTHON_RETURN_INT(value);
|
||||
}
|
||||
|
||||
/*
|
||||
* weechat_python_api_string_has_highlight_regex: return 1 if string contains a
|
||||
* highlight (using regular
|
||||
* expression)
|
||||
* return 0 if no highlight is
|
||||
* found in string
|
||||
*/
|
||||
|
||||
static PyObject *
|
||||
weechat_python_api_string_has_highlight_regex (PyObject *self, PyObject *args)
|
||||
{
|
||||
char *string, *regex;
|
||||
int value;
|
||||
|
||||
/* make C compiler happy */
|
||||
(void) self;
|
||||
|
||||
if (!python_current_script || !python_current_script->name)
|
||||
{
|
||||
WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "string_has_highlight_regex");
|
||||
PYTHON_RETURN_INT(0);
|
||||
}
|
||||
|
||||
string = NULL;
|
||||
regex = NULL;
|
||||
|
||||
if (!PyArg_ParseTuple (args, "ss", &string, ®ex))
|
||||
{
|
||||
WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "string_has_highlight_regex");
|
||||
PYTHON_RETURN_INT(0);
|
||||
}
|
||||
|
||||
value = weechat_string_has_highlight_regex (string, regex);
|
||||
|
||||
PYTHON_RETURN_INT(value);
|
||||
}
|
||||
|
||||
/*
|
||||
* weechat_python_api_string_mask_to_regex: convert a mask (string with only
|
||||
* "*" as wildcard) to a regex, paying
|
||||
|
@ -6838,6 +6875,7 @@ PyMethodDef weechat_python_funcs[] =
|
|||
{ "ngettext", &weechat_python_api_ngettext, METH_VARARGS, "" },
|
||||
{ "string_match", &weechat_python_api_string_match, METH_VARARGS, "" },
|
||||
{ "string_has_highlight", &weechat_python_api_string_has_highlight, METH_VARARGS, "" },
|
||||
{ "string_has_highlight_regex", &weechat_python_api_string_has_highlight_regex, METH_VARARGS, "" },
|
||||
{ "string_mask_to_regex", &weechat_python_api_string_mask_to_regex, 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, "" },
|
||||
|
|
|
@ -430,6 +430,47 @@ weechat_ruby_api_string_has_highlight (VALUE class, VALUE string,
|
|||
RUBY_RETURN_INT(value);
|
||||
}
|
||||
|
||||
/*
|
||||
* weechat_ruby_api_string_has_highlight_regex: return 1 if string contains a
|
||||
* highlight (using regular
|
||||
* expression)
|
||||
* return 0 if no highlight is
|
||||
* found in string
|
||||
*/
|
||||
|
||||
static VALUE
|
||||
weechat_ruby_api_string_has_highlight_regex (VALUE class, VALUE string,
|
||||
VALUE regex)
|
||||
{
|
||||
char *c_string, *c_regex;
|
||||
int value;
|
||||
|
||||
/* make C compiler happy */
|
||||
(void) class;
|
||||
|
||||
if (!ruby_current_script || !ruby_current_script->name)
|
||||
{
|
||||
WEECHAT_SCRIPT_MSG_NOT_INIT(RUBY_CURRENT_SCRIPT_NAME, "string_has_highlight_regex");
|
||||
RUBY_RETURN_INT(0);
|
||||
}
|
||||
|
||||
if (NIL_P (string) || NIL_P (regex))
|
||||
{
|
||||
WEECHAT_SCRIPT_MSG_WRONG_ARGS(RUBY_CURRENT_SCRIPT_NAME, "string_has_highlight_regex");
|
||||
RUBY_RETURN_INT(0);
|
||||
}
|
||||
|
||||
Check_Type (string, T_STRING);
|
||||
Check_Type (regex, T_STRING);
|
||||
|
||||
c_string = StringValuePtr (string);
|
||||
c_regex = StringValuePtr (regex);
|
||||
|
||||
value = weechat_string_has_highlight_regex (c_string, c_regex);
|
||||
|
||||
RUBY_RETURN_INT(value);
|
||||
}
|
||||
|
||||
/*
|
||||
* weechat_ruby_api_string_mask_to_regex: convert a mask (string with only
|
||||
* "*" as wildcard) to a regex, paying
|
||||
|
@ -7494,6 +7535,7 @@ weechat_ruby_api_init (VALUE ruby_mWeechat)
|
|||
rb_define_module_function (ruby_mWeechat, "ngettext", &weechat_ruby_api_ngettext, 3);
|
||||
rb_define_module_function (ruby_mWeechat, "string_match", &weechat_ruby_api_string_match, 3);
|
||||
rb_define_module_function (ruby_mWeechat, "string_has_highlight", &weechat_ruby_api_string_has_highlight, 2);
|
||||
rb_define_module_function (ruby_mWeechat, "string_has_highlight_regex", &weechat_ruby_api_string_has_highlight_regex, 2);
|
||||
rb_define_module_function (ruby_mWeechat, "string_mask_to_regex", &weechat_ruby_api_string_mask_to_regex, 1);
|
||||
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);
|
||||
|
|
|
@ -530,6 +530,46 @@ weechat_tcl_api_string_has_highlight (ClientData clientData,
|
|||
TCL_RETURN_INT(result);
|
||||
}
|
||||
|
||||
/*
|
||||
* weechat_tcl_api_string_has_highlight_regex: return 1 if string contains a
|
||||
* highlight (using a regular
|
||||
* expression)
|
||||
* return 0 if no highlight is
|
||||
* found in string
|
||||
*/
|
||||
|
||||
static int
|
||||
weechat_tcl_api_string_has_highlight_regex (ClientData clientData,
|
||||
Tcl_Interp *interp,
|
||||
int objc, Tcl_Obj *CONST objv[])
|
||||
{
|
||||
Tcl_Obj* objp;
|
||||
char *string, *regex;
|
||||
int result, i;
|
||||
|
||||
/* make C compiler happy */
|
||||
(void) clientData;
|
||||
|
||||
if (!tcl_current_script || !tcl_current_script->name)
|
||||
{
|
||||
WEECHAT_SCRIPT_MSG_NOT_INIT(TCL_CURRENT_SCRIPT_NAME, "string_has_highlight_regex");
|
||||
TCL_RETURN_INT(0);
|
||||
}
|
||||
|
||||
if (objc < 3)
|
||||
{
|
||||
WEECHAT_SCRIPT_MSG_WRONG_ARGS(TCL_CURRENT_SCRIPT_NAME, "string_has_highlight_regex");
|
||||
TCL_RETURN_INT(0);
|
||||
}
|
||||
|
||||
string = Tcl_GetStringFromObj (objv[1], &i);
|
||||
regex = Tcl_GetStringFromObj (objv[2], &i);
|
||||
|
||||
result = weechat_string_has_highlight_regex (string, regex);
|
||||
|
||||
TCL_RETURN_INT(result);
|
||||
}
|
||||
|
||||
/*
|
||||
* weechat_tcl_api_string_mask_to_regex: convert a mask (string with only
|
||||
* "*" as wildcard) to a regex, paying
|
||||
|
@ -7343,6 +7383,8 @@ void weechat_tcl_api_init (Tcl_Interp *interp)
|
|||
weechat_tcl_api_string_match, (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL);
|
||||
Tcl_CreateObjCommand (interp, "weechat::string_has_highlight",
|
||||
weechat_tcl_api_string_has_highlight, (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL);
|
||||
Tcl_CreateObjCommand (interp, "weechat::string_has_highlight_regex",
|
||||
weechat_tcl_api_string_has_highlight_regex, (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL);
|
||||
Tcl_CreateObjCommand (interp, "weechat::string_mask_to_regex",
|
||||
weechat_tcl_api_string_mask_to_regex, (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL);
|
||||
Tcl_CreateObjCommand (interp, "weechat::string_remove_color",
|
||||
|
|
|
@ -45,7 +45,7 @@ struct timeval;
|
|||
*/
|
||||
|
||||
/* API version (used to check that plugin has same API and can be loaded) */
|
||||
#define WEECHAT_PLUGIN_API_VERSION "20101110-01"
|
||||
#define WEECHAT_PLUGIN_API_VERSION "20101125-01"
|
||||
|
||||
/* macros for defining plugin infos */
|
||||
#define WEECHAT_PLUGIN_NAME(__name) \
|
||||
|
@ -180,6 +180,7 @@ struct t_weechat_plugin
|
|||
const char *chars);
|
||||
int (*string_has_highlight) (const char *string,
|
||||
const char *highlight_words);
|
||||
int (*string_has_highlight_regex) (const char *string, const char *regex);
|
||||
char *(*string_mask_to_regex) (const char *mask);
|
||||
char **(*string_split) (const char *string, const char *separators,
|
||||
int keep_eol, int num_items_max, int *num_items);
|
||||
|
@ -800,6 +801,8 @@ extern int weechat_plugin_end (struct t_weechat_plugin *plugin);
|
|||
weechat_plugin->string_strip(__string, __left, __right, __chars)
|
||||
#define weechat_string_has_highlight(__string, __highlight_words) \
|
||||
weechat_plugin->string_has_highlight(__string, __highlight_words)
|
||||
#define weechat_string_has_highlight_regex(__string, __regex) \
|
||||
weechat_plugin->string_has_highlight_regex(__string, __regex)
|
||||
#define weechat_string_mask_to_regex(__mask) \
|
||||
weechat_plugin->string_mask_to_regex(__mask)
|
||||
#define weechat_string_split(__string, __separator, __eol, __max, \
|
||||
|
|
Loading…
Reference in New Issue