core: add syntax "@buffer:item" in bar items to force the buffer used when displaying the bar item (task #12717)

v2.8-utf8proc
Sebastien Helleu 2013-08-19 21:22:10 +02:00
parent 9990917cc7
commit eac1ca929b
41 changed files with 1111 additions and 614 deletions

View File

@ -1,7 +1,7 @@
WeeChat ChangeLog
=================
Sébastien Helleu <flashcode@flashtux.org>
v0.4.2-dev, 2013-08-18
v0.4.2-dev, 2013-08-19
This document lists all changes for each version.
@ -14,6 +14,8 @@ http://weechat.org/files/releasenotes/ReleaseNotes-devel.html[release notes]
Version 0.4.2 (under dev!)
--------------------------
* core: add syntax "@buffer:item" in bar items to force the buffer used when
displaying the bar item (task #12717)
* core: add search of regular expression in buffer, don't reset search type on
a new search, select where to search (messages/prefixes), add keys in search
context: alt+"c" (case (in)sensitive search), tab (search in

View File

@ -426,6 +426,7 @@
'items_count' (integer) +
'items_subcount' (pointer) +
'items_array' (pointer) +
'items_buffer' (pointer) +
'items_prefix' (pointer) +
'items_name' (pointer) +
'items_suffix' (pointer) +

View File

@ -734,6 +734,11 @@ angezeigt).
Eine Liste von Bar-Items kann man sich mit dem Befehl `/bar listitems` anzeigen lassen.
// TRANSLATION MISSING
Before or after item name, you can use chars (that are not alphanumeric, "-" or
"_"). They will be displayed before/after item with the delimiters color
defined in bar (option 'color_delim').
Beispiel einer Bar mit den Items, "[time],buffer_number+:+buffer_plugin+.+buffer_name":
........................................
@ -742,6 +747,23 @@ Beispiel einer Bar mit den Items, "[time],buffer_number+:+buffer_plugin+.+buffer
└─────────────────────────────────────────────────────────────────────────────────────────┘
........................................
// TRANSLATION MISSING
A special syntax can be used to force the buffer used when displaying the bar
item: "@buffer:item" (where "buffer" is the full name of buffer and "item" is
the name of a bar item).
// TRANSLATION MISSING
This is useful in root bars, to display item for a specific buffer which is
not displayed in the current window (or even not displayed at all).
// TRANSLATION MISSING
Example: nicklist of bitlbee in a root bar (if the bar is called
'bitlist' and if bitlbee server is called 'bitlbee'):
----------------------------------------
/set weechat.bar.bitlist.items "@irc.bitlbee.&bitlbee:buffer_nicklist"
----------------------------------------
[[bar_filling]]
Darstellung innerhalb einer Bar
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

View File

@ -426,6 +426,7 @@
'items_count' (integer) +
'items_subcount' (pointer) +
'items_array' (pointer) +
'items_buffer' (pointer) +
'items_prefix' (pointer) +
'items_name' (pointer) +
'items_suffix' (pointer) +

View File

@ -11682,6 +11682,8 @@ bar_item = weechat.bar_item_search("myitem")
weechat_bar_item_new
^^^^^^^^^^^^^^^^^^^^
_Updated in version 0.4.2._
Create a new bar item.
Prototype:
@ -11691,7 +11693,9 @@ Prototype:
struct t_gui_bar_item *weechat_bar_item_new (const char *name,
char *(*build_callback)(void *data,
struct t_gui_bar_item *item,
struct t_gui_window *window),
struct t_gui_window *window,
struct t_gui_buffer *buffer,
struct t_hashtable *extra_info),
void *build_callback_data);
----------------------------------------
@ -11702,7 +11706,13 @@ Arguments:
return value:
** 'void *data': pointer
** 'struct t_gui_bar_item *item': item pointer
** 'struct t_gui_window *window': window pointer
** 'struct t_gui_window *window': window pointer (NULL when called for a root
bar)
** 'struct t_gui_buffer *buffer': buffer displayed in window (if window is NULL,
then it is current buffer) or buffer given in bar item with syntax:
"@buffer:item" _(new in version 0.4.2)_
** 'struct t_hashtable *extra_info': always NULL (argument is reserved for a
future version) _(new in version 0.4.2)_
** return value: content of bar item
* 'build_callback_data': pointer given to build callback, when it is called by
WeeChat
@ -11718,7 +11728,9 @@ C example:
char *
my_build_callback (void *data,
struct t_gui_bar_item *item,
struct t_gui_window *window)
struct t_gui_window *window,
struct t_gui_buffer *buffer,
struct t_hashtable *extra_info)
{
return strdup ("my content");
}
@ -11730,16 +11742,28 @@ struct t_gui_bar_item *my_item = weechat_bar_item_new ("myitem",
Script (Python):
[NOTE]
For compatibility with versions ≤ 0.4.1, the default callback has only 3
arguments: 'data', 'item' and 'window' (no 'buffer' and 'extra_info'). +
To use a callback with all arguments, you must add "(extra)" before the name,
see example below.
[source,python]
----------------------------------------
# prototype
bar_item = weechat.bar_item_new(name, build_callback, build_callback_data)
# example
# example (callback without "buffer" and "extra_info")
def my_build_callback(data, item, window):
return "my content"
bar_item = weechat.bar_item_new("myitem", "my_build_callback", "")
# example (callback with all arguments)
def my_build_callback2(data, item, window, buffer, extra_info):
return "my content"
bar_item2 = weechat.bar_item_new("(extra)myitem2", "my_build_callback2", "")
----------------------------------------
weechat_bar_item_update

View File

@ -731,6 +731,10 @@ The option 'items' is a string with a list of bar items, separated by a comma
The list of bar items is displayed with command `/bar listitems`.
Before or after item name, you can use chars (that are not alphanumeric, "-" or
"_"). They will be displayed before/after item with the delimiters color
defined in bar (option 'color_delim').
Example of bar with items "[time],buffer_number+:+buffer_plugin+.+buffer_name":
........................................
@ -739,6 +743,20 @@ Example of bar with items "[time],buffer_number+:+buffer_plugin+.+buffer_name":
└─────────────────────────────────────────────────────────────────────────────────────────┘
........................................
A special syntax can be used to force the buffer used when displaying the bar
item: "@buffer:item" (where "buffer" is the full name of buffer and "item" is
the name of a bar item).
This is useful in root bars, to display item for a specific buffer which is
not displayed in the current window (or even not displayed at all).
Example: nicklist of bitlbee in a root bar (if the bar is called
'bitlist' and if bitlbee server is called 'bitlbee'):
----------------------------------------
/set weechat.bar.bitlist.items "@irc.bitlbee.&bitlbee:buffer_nicklist"
----------------------------------------
[[bar_filling]]
Filling
^^^^^^^

View File

@ -426,6 +426,7 @@
'items_count' (integer) +
'items_subcount' (pointer) +
'items_array' (pointer) +
'items_buffer' (pointer) +
'items_prefix' (pointer) +
'items_name' (pointer) +
'items_suffix' (pointer) +

View File

@ -11878,6 +11878,8 @@ bar_item = weechat.bar_item_search("myitem")
weechat_bar_item_new
^^^^^^^^^^^^^^^^^^^^
_Mis à jour dans la version 0.4.2._
Créé un nouvel objet de barre.
Prototype :
@ -11887,7 +11889,9 @@ Prototype :
struct t_gui_bar_item *weechat_bar_item_new (const char *name,
char *(*build_callback)(void *data,
struct t_gui_bar_item *item,
struct t_gui_window *window),
struct t_gui_window *window,
struct t_gui_buffer *buffer,
struct t_hashtable *extra_info),
void *build_callback_data);
----------------------------------------
@ -11898,7 +11902,13 @@ Paramètres :
et valeur de retour :
** 'void *data' : pointeur
** 'struct t_gui_bar_item *item' : pointeur vers l'objet de barre
** 'struct t_gui_window *window' : pointeur vers la fenêtre
** 'struct t_gui_window *window' : pointeur vers la fenêtre (NULL lors d'un
appel pour une barre "root")
** 'struct t_gui_buffer *buffer' : tampon affiché dans la fenêtre (si la fenêtre
est NULL alors c'est le tampon courant) ou tampon passé dans l'objet de
barre avec la syntaxe : "@buffer:item" _(nouveau dans la version 0.4.2)_
** 'struct t_hashtable *extra_info' : toujours NULL (le paramètre est réservé pour
une version future) _(nouveau dans la version 0.4.2)_
** valeur de retour : contenu de l'objet de barre
* 'build_callback_data' : pointeur donné au "callback" lorsqu'il est appelé par
WeeChat
@ -11914,7 +11924,9 @@ Exemple en C :
char *
my_build_callback (void *data,
struct t_gui_bar_item *item,
struct t_gui_window *window)
struct t_gui_window *window,
struct t_gui_buffer *buffer,
struct t_hashtable *extra_info)
{
return strdup ("mon contenu");
}
@ -11926,16 +11938,29 @@ struct t_gui_bar_item *my_item = weechat_bar_item_new ("myitem",
Script (Python) :
[NOTE]
Pour la compatibilité avec les versions ≤ 0.4.1, le "callback" par défaut a
seulement 3 paramètres : 'data', 'item' et 'window' (pas de 'buffer' et
'extra_info'). +
Pour utiliser le callback avec tous les paramètres, vous devez ajouter "(extra)"
avant le nom, voir l'exemple ci-dessous.
[source,python]
----------------------------------------
# prototype
bar_item = weechat.bar_item_new(name, build_callback, build_callback_data)
# exemple
# exemple (callback sans "buffer" et "extra_info")
def my_build_callback(data, item, window):
return "my content"
return "mon contenu"
bar_item = weechat.bar_item_new("myitem", "my_build_callback", "")
# example (callback avec tous les paramètres)
def my_build_callback2(data, item, window, buffer, extra_info):
return "mon contenu"
bar_item2 = weechat.bar_item_new("(extra)myitem2", "my_build_callback2", "")
----------------------------------------
weechat_bar_item_update

View File

@ -747,6 +747,11 @@ une virgule (espace entre les objets à l'écran) ou un "+" (objets collés).
La liste des objets de barre est affichée avec la commande `/bar listitems`.
Avant ou après l'objet de barre, vous pouvez utiliser des caractères (qui ne
sont pas alphanumériques, "-" ou "_"). Ils seront affichés avant/après l'objet
de barre avec la couleur des délimiteurs définie dans la barre (option
'color_delim').
Exemple de barre avec les objets
"[time],buffer_number+:+buffer_plugin+.+buffer_name" :
@ -756,6 +761,21 @@ Exemple de barre avec les objets
└─────────────────────────────────────────────────────────────────────────────────────────┘
........................................
Une syntaxe spéciale peut être utilisée pour forcer le tampon utilisé lors de
l'affichage de l'objet de barre : "@tampon:objet" (où "tampon" est le nom
complet du tampon et "objet" est le nom d'un objet de barre).
Ceci peut être pratique dans les barres "root", pour afficher un objet de barre
pour un tampon qui n'est pas affiché dans la fenêtre courante (ou même pas
affiché du tout).
Exemple : liste de pseudos de bitlbee dans une barre "root" (si la barre
s'appelle 'bitlist' et si le serveur bitlbee s'appelle 'bitlbee') :
----------------------------------------
/set weechat.bar.bitlist.items "@irc.bitlbee.&bitlbee:buffer_nicklist"
----------------------------------------
[[bar_filling]]
Remplissage
^^^^^^^^^^^

View File

@ -426,6 +426,7 @@
'items_count' (integer) +
'items_subcount' (pointer) +
'items_array' (pointer) +
'items_buffer' (pointer) +
'items_prefix' (pointer) +
'items_name' (pointer) +
'items_suffix' (pointer) +

View File

@ -11854,6 +11854,9 @@ bar_item = weechat.bar_item_search("myitem")
weechat_bar_item_new
^^^^^^^^^^^^^^^^^^^^
// TRANSLATION MISSING
_Updated in version 0.4.2._
Crea un nuovo elemento barra.
Prototipo:
@ -11863,7 +11866,9 @@ Prototipo:
struct t_gui_bar_item *weechat_bar_item_new (const char *name,
char *(*build_callback)(void *data,
struct t_gui_bar_item *item,
struct t_gui_window *window),
struct t_gui_window *window,
struct t_gui_buffer *buffer,
struct t_hashtable *extra_info),
void *build_callback_data);
----------------------------------------
@ -11874,7 +11879,16 @@ Argomenti:
compilato, argomenti e valore restituito:
** 'void *data': puntatore
** 'struct t_gui_bar_item *item': puntatore all'elemento barra
** 'struct t_gui_window *window': puntatore alla finestra
// TRANSLATION MISSING
** 'struct t_gui_window *window': puntatore alla finestra (NULL when called for
a root bar)
// TRANSLATION MISSING
** 'struct t_gui_buffer *buffer': buffer displayed in window (if window is NULL,
then it is current buffer) or buffer given in bar item with syntax:
"@buffer:item" _(novità nella versione 0.4.2)_
// TRANSLATION MISSING
** 'struct t_hashtable *extra_info': always NULL (argument is reserved for a
future version) _(novità nella versione 0.4.2)_
** valore restituito: contenuto dell'elemento barra
* 'build_callback_data': puntatore fornito alla callback quando
chiamata da WeeChat
@ -11890,7 +11904,9 @@ Esempio in C:
char *
my_build_callback (void *data,
struct t_gui_bar_item *item,
struct t_gui_window *window)
struct t_gui_window *window,
struct t_gui_buffer *buffer,
struct t_hashtable *extra_info)
{
return strdup ("my content");
}
@ -11902,16 +11918,30 @@ struct t_gui_bar_item *my_item = weechat_bar_item_new ("myitem",
Script (Python):
// TRANSLATION MISSING
[NOTE]
For compatibility with versions ≤ 0.4.1, the default callback has only 3
arguments: 'data', 'item' and 'window' (no 'buffer' and 'extra_info'). +
To use a callback with all arguments, you must add "(extra)" before the name,
see example below.
// TRANSLATION MISSING
[source,python]
----------------------------------------
# prototipo
bar_item = weechat.bar_item_new(name, build_callback, build_callback_data)
# esempio
# esempio (callback without "buffer" and "extra_info")
def my_build_callback(data, item, window):
return "my content"
bar_item = weechat.bar_item_new("myitem", "my_build_callback", "")
# example (callback with all arguments)
def my_build_callback2(data, item, window, buffer, extra_info):
return "my content"
bar_item2 = weechat.bar_item_new("(extra)myitem2", "my_build_callback2", "")
----------------------------------------
weechat_bar_item_update

View File

@ -753,6 +753,11 @@ The option 'items' is a string with a list of bar items, separated by a comma
The list of bar items is displayed with command `/bar listitems`.
// TRANSLATION MISSING
Before or after item name, you can use chars (that are not alphanumeric, "-" or
"_"). They will be displayed before/after item with the delimiters color
defined in bar (option 'color_delim').
Example of bar with items "[time],buffer_number+:+buffer_plugin+.+buffer_name":
........................................
@ -761,6 +766,23 @@ Example of bar with items "[time],buffer_number+:+buffer_plugin+.+buffer_name":
└─────────────────────────────────────────────────────────────────────────────────────────┘
........................................
// TRANSLATION MISSING
A special syntax can be used to force the buffer used when displaying the bar
item: "@buffer:item" (where "buffer" is the full name of buffer and "item" is
the name of a bar item).
// TRANSLATION MISSING
This is useful in root bars, to display item for a specific buffer which is
not displayed in the current window (or even not displayed at all).
// TRANSLATION MISSING
Example: nicklist of bitlbee in a root bar (if the bar is called
'bitlist' and if bitlbee server is called 'bitlbee'):
----------------------------------------
/set weechat.bar.bitlist.items "@irc.bitlbee.&bitlbee:buffer_nicklist"
----------------------------------------
[[bar_filling]]
Filling
^^^^^^^

View File

@ -426,6 +426,7 @@
'items_count' (integer) +
'items_subcount' (pointer) +
'items_array' (pointer) +
'items_buffer' (pointer) +
'items_prefix' (pointer) +
'items_name' (pointer) +
'items_suffix' (pointer) +

View File

@ -719,6 +719,11 @@ WeeChat を起動したターミナルの例:
バーアイテムのリストは `/bar listitems` コマンドで表示されます。
// TRANSLATION MISSING
Before or after item name, you can use chars (that are not alphanumeric, "-" or
"_"). They will be displayed before/after item with the delimiters color
defined in bar (option 'color_delim').
アイテムを含むバーの例 "[time],buffer_number+:+buffer_plugin+.+buffer_name":
........................................
@ -727,6 +732,23 @@ WeeChat を起動したターミナルの例:
└─────────────────────────────────────────────────────────────────────────────────────────┘
........................................
// TRANSLATION MISSING
A special syntax can be used to force the buffer used when displaying the bar
item: "@buffer:item" (where "buffer" is the full name of buffer and "item" is
the name of a bar item).
// TRANSLATION MISSING
This is useful in root bars, to display item for a specific buffer which is
not displayed in the current window (or even not displayed at all).
// TRANSLATION MISSING
Example: nicklist of bitlbee in a root bar (if the bar is called
'bitlist' and if bitlbee server is called 'bitlbee'):
----------------------------------------
/set weechat.bar.bitlist.items "@irc.bitlbee.&bitlbee:buffer_nicklist"
----------------------------------------
[[bar_filling]]
==== フィリング ====

View File

@ -20,7 +20,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat 0.4.2-dev\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2013-08-17 11:49+0200\n"
"POT-Creation-Date: 2013-08-19 21:15+0200\n"
"PO-Revision-Date: 2013-08-17 10:37+0200\n"
"Last-Translator: Jiri Golembiovsky <golemj@gmail.com>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@ -3840,9 +3840,11 @@ msgstr "výchozí barva pozadí pro pole"
msgid "separator line between bar and other bars/windows"
msgstr "oddělovací řádek mezi polem a ostatními poli/okny"
#, fuzzy
msgid ""
"items of bar, they can be separated by comma (space between items) or \"+"
"\" (glued items)"
"\" (glued items); special syntax \"@buffer:item\" can be used to force "
"buffer used when displaying the bar item"
msgstr ""
"položky pole, můžou být rozděleny čárkou (mezera mezi položkami) nebo \"+"
"\" (slepené položky)"

View File

@ -22,7 +22,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat 0.4.2-dev\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2013-08-18 19:01+0200\n"
"POT-Creation-Date: 2013-08-19 21:15+0200\n"
"PO-Revision-Date: 2013-08-18 19:01+0200\n"
"Last-Translator: Nils Görs <weechatter@arcor.de>\n"
"Language-Team: German <weechatter@arcor.de>\n"
@ -4385,9 +4385,11 @@ msgstr "Standardhintergrundfarbe der Infobar"
msgid "separator line between bar and other bars/windows"
msgstr "Trennzeichen zwischen verschieden Infobars und Fenstern"
#, fuzzy
msgid ""
"items of bar, they can be separated by comma (space between items) or \"+"
"\" (glued items)"
"\" (glued items); special syntax \"@buffer:item\" can be used to force "
"buffer used when displaying the bar item"
msgstr ""
"Items einer Bar können durch entweder durch Kommata (\",\") voneinander "
"getrennt (setzt ein Leerzeichen zwischen die Items), oder durch ein \"+\" "

View File

@ -22,7 +22,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat 0.4.2-dev\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2013-08-17 11:49+0200\n"
"POT-Creation-Date: 2013-08-19 21:15+0200\n"
"PO-Revision-Date: 2013-08-17 10:37+0200\n"
"Last-Translator: Elián Hanisch <lambdae2@gmail.com>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@ -4042,9 +4042,11 @@ msgstr "color de fondo por defecto para la barra"
msgid "separator line between bar and other bars/windows"
msgstr "línea separadora entre la barra y otras barras/ventanas"
#, fuzzy
msgid ""
"items of bar, they can be separated by comma (space between items) or \"+"
"\" (glued items)"
"\" (glued items); special syntax \"@buffer:item\" can be used to force "
"buffer used when displaying the bar item"
msgstr ""
"elementos de la barra, pueden estar separados por coma (espacio entre "
"elementos) o \"+\" (elementos pegados entre sí)"

View File

@ -21,8 +21,8 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat 0.4.2-dev\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2013-08-17 11:49+0200\n"
"PO-Revision-Date: 2013-08-17 11:50+0200\n"
"POT-Creation-Date: 2013-08-19 21:15+0200\n"
"PO-Revision-Date: 2013-08-19 21:19+0200\n"
"Last-Translator: Sebastien Helleu <flashcode@flashtux.org>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
"Language: fr\n"
@ -4275,10 +4275,13 @@ msgstr "ligne de séparation entre la barre et les autres barres/fenêtres"
msgid ""
"items of bar, they can be separated by comma (space between items) or \"+"
"\" (glued items)"
"\" (glued items); special syntax \"@buffer:item\" can be used to force "
"buffer used when displaying the bar item"
msgstr ""
"objets de la barre, ils peuvent être séparés par une virgule (espace entre "
"les objets) ou \"+\" (objets collés)"
"les objets) ou \"+\" (objets collés); la syntaxe spéciale \"@tampon:objet\" "
"peut être utilisée pour forcer le tampon utilisé lors de l'affichage de "
"l'objet de barre"
#, c-format
msgid "Bar \"%s\" updated"

View File

@ -20,7 +20,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat 0.4.2-dev\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2013-08-17 11:49+0200\n"
"POT-Creation-Date: 2013-08-19 21:15+0200\n"
"PO-Revision-Date: 2013-08-17 10:37+0200\n"
"Last-Translator: Andras Voroskoi <voroskoi@frugalware.org>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@ -3474,7 +3474,8 @@ msgstr "a névlista és a beszélgetőablak közti elválasztó"
msgid ""
"items of bar, they can be separated by comma (space between items) or \"+"
"\" (glued items)"
"\" (glued items); special syntax \"@buffer:item\" can be used to force "
"buffer used when displaying the bar item"
msgstr ""
#, fuzzy, c-format

View File

@ -20,7 +20,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat 0.4.2-dev\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2013-08-17 11:49+0200\n"
"POT-Creation-Date: 2013-08-19 21:15+0200\n"
"PO-Revision-Date: 2013-08-17 10:37+0200\n"
"Last-Translator: Esteban I. Ruiz Moreno <exio4.com@gmail.com>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@ -4110,9 +4110,11 @@ msgstr "colore predefinito di sfondo per la barra"
msgid "separator line between bar and other bars/windows"
msgstr "riga di separazione tra la barra e le altre barre/finestre"
#, fuzzy
msgid ""
"items of bar, they can be separated by comma (space between items) or \"+"
"\" (glued items)"
"\" (glued items); special syntax \"@buffer:item\" can be used to force "
"buffer used when displaying the bar item"
msgstr ""
"elementi della barra, possono essere separati da virgola (spazio tra gli "
"elementi) o \"+\" (elementi incollati)"

View File

@ -20,7 +20,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat 0.4.2-dev\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2013-08-17 11:49+0200\n"
"POT-Creation-Date: 2013-08-19 21:15+0200\n"
"PO-Revision-Date: 2013-08-17 10:37+0200\n"
"Last-Translator: AYANOKOUZI, Ryuunosuke <i38w7i3@yahoo.co.jp>\n"
"Language-Team: Japanese <https://github.com/l/WeeChat>\n"
@ -4036,9 +4036,11 @@ msgstr "バーのデフォルト背景色"
msgid "separator line between bar and other bars/windows"
msgstr "バーと他のバー/ウィンドウの間の区切り行"
#, fuzzy
msgid ""
"items of bar, they can be separated by comma (space between items) or \"+"
"\" (glued items)"
"\" (glued items); special syntax \"@buffer:item\" can be used to force "
"buffer used when displaying the bar item"
msgstr ""
"バーのアイテム、コンマ (アイテム間に空白を含める場合) 又は \"+\" (アイテムを"
"連結する場合) 区切り"

View File

@ -21,7 +21,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat 0.4.2-dev\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2013-08-17 11:49+0200\n"
"POT-Creation-Date: 2013-08-19 21:15+0200\n"
"PO-Revision-Date: 2013-08-17 10:37+0200\n"
"Last-Translator: Krzysztof Korościk <soltys@szluug.org>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@ -4119,9 +4119,11 @@ msgstr "domyślny kolor tła paska"
msgid "separator line between bar and other bars/windows"
msgstr "separator pomiędzy paskiem a innymi paskami/oknami"
#, fuzzy
msgid ""
"items of bar, they can be separated by comma (space between items) or \"+"
"\" (glued items)"
"\" (glued items); special syntax \"@buffer:item\" can be used to force "
"buffer used when displaying the bar item"
msgstr ""
"elementy paska, mogą być oddzielone przecinkiem (spacja pomiędzy elementami) "
"lub \"+\" (skleja elementy)"

View File

@ -21,7 +21,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat 0.4.2-dev\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2013-08-17 11:49+0200\n"
"POT-Creation-Date: 2013-08-19 21:15+0200\n"
"PO-Revision-Date: 2013-08-17 10:37+0200\n"
"Last-Translator: Sergio Durigan Junior <sergiosdj@gmail.com>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@ -3932,9 +3932,11 @@ msgstr "cor padrão do fundo para a barra"
msgid "separator line between bar and other bars/windows"
msgstr "linha separadora entre a barra e outras barras/janelas"
#, fuzzy
msgid ""
"items of bar, they can be separated by comma (space between items) or \"+"
"\" (glued items)"
"\" (glued items); special syntax \"@buffer:item\" can be used to force "
"buffer used when displaying the bar item"
msgstr ""
"itens da barra, podem ser separados por vírgula (espaço entre itens) ou \"+"
"\" (itens \"colados\")"

View File

@ -21,7 +21,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat 0.4.2-dev\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2013-08-17 11:49+0200\n"
"POT-Creation-Date: 2013-08-19 21:15+0200\n"
"PO-Revision-Date: 2013-08-17 10:37+0200\n"
"Last-Translator: Aleksey V Zapparov AKA ixti <ixti@member.fsf.org>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@ -3506,7 +3506,8 @@ msgstr "разделитель чата и никлиста"
msgid ""
"items of bar, they can be separated by comma (space between items) or \"+"
"\" (glued items)"
"\" (glued items); special syntax \"@buffer:item\" can be used to force "
"buffer used when displaying the bar item"
msgstr ""
#, fuzzy, c-format

View File

@ -20,7 +20,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat 0.4.2-dev\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2013-08-17 11:49+0200\n"
"POT-Creation-Date: 2013-08-19 21:15+0200\n"
"PO-Revision-Date: 2013-08-17 10:37+0200\n"
"Last-Translator: Hasan Kiran <sunder67@hotmail.com>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@ -3110,7 +3110,8 @@ msgstr ""
msgid ""
"items of bar, they can be separated by comma (space between items) or \"+"
"\" (glued items)"
"\" (glued items); special syntax \"@buffer:item\" can be used to force "
"buffer used when displaying the bar item"
msgstr ""
#, c-format

View File

@ -21,7 +21,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat 0.4.1-dev\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2013-08-17 11:49+0200\n"
"POT-Creation-Date: 2013-08-19 21:15+0200\n"
"PO-Revision-Date: 2013-02-14 18:20+0100\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@ -3114,7 +3114,8 @@ msgstr ""
msgid ""
"items of bar, they can be separated by comma (space between items) or \"+"
"\" (glued items)"
"\" (glued items); special syntax \"@buffer:item\" can be used to force "
"buffer used when displaying the bar item"
msgstr ""
#, c-format

View File

@ -271,21 +271,29 @@ gui_bar_item_used_in_at_least_one_bar (const char *item_name, int partial_name,
}
/*
* Gets prefix, name and suffix for an item.
* Gets buffer, prefix, name and suffix for an item.
*
* For example, item name "[time]", returns:
* prefix: "["
* name : "time"
* suffix: "]"
* Examples:
* - item name "[time]" returns:
* buffer: NULL
* prefix: "["
* name : "time"
* suffix: "]"
* - item name "@irc.bitlbee.&bitlbee:buffer_nicklist" returns:
* buffer: "irc.bitlbee.&bitlbee"
* prefix: NULL
* name : "buffer_nicklist"
* suffix: NULL
*/
void
gui_bar_item_set_prefix_name_suffix (const char *item_name,
char **prefix, char **name, char **suffix)
gui_bar_item_get_vars (const char *item_name,
char **buffer, char **prefix, char **name, char **suffix)
{
const char *ptr, *start, *end;
const char *ptr, *ptr_start, *pos, *start, *end;
int valid_char;
*buffer = NULL;
*prefix = NULL;
*name = NULL;
*suffix = NULL;
@ -297,6 +305,19 @@ gui_bar_item_set_prefix_name_suffix (const char *item_name,
end = NULL;
ptr = item_name;
ptr_start = item_name;
if (ptr[0] == '@')
{
pos = strchr (ptr, ':');
if (pos && (pos > ptr + 1))
{
*buffer = string_strndup (ptr + 1, pos - ptr - 1);
ptr = pos + 1;
ptr_start = pos + 1;
}
}
while (ptr[0])
{
valid_char = (((ptr[0] >= 'a') && (ptr[0] <= 'z'))
@ -312,11 +333,11 @@ gui_bar_item_set_prefix_name_suffix (const char *item_name,
}
if (start)
{
if (start > item_name)
*prefix = string_strndup (item_name, start - item_name);
if (start > ptr_start)
*prefix = string_strndup (ptr_start, start - ptr_start);
}
else
*prefix = strdup (item_name);
*prefix = strdup (ptr_start);
if (start)
{
*name = (end) ?
@ -344,26 +365,32 @@ gui_bar_item_get_value (struct t_gui_bar *bar, struct t_gui_window *window,
char *item_value, delimiter_color[32], bar_color[32];
char *result, str_attr[8];
int length;
struct t_gui_buffer *buffer;
struct t_gui_bar_item *ptr_item;
struct t_weechat_plugin *ptr_plugin;
if (!bar->items_array[item][subitem])
return NULL;
buffer = (window) ?
window->buffer : ((gui_current_window) ? gui_current_window->buffer : NULL);
item_value = NULL;
if (bar->items_name[item][subitem])
{
ptr_plugin = NULL;
if (window && window->buffer)
ptr_plugin = window->buffer->plugin;
else if (gui_current_window && gui_current_window->buffer)
ptr_plugin = gui_current_window->buffer->plugin;
ptr_item = gui_bar_item_search_with_plugin (ptr_plugin, 0,
if (bar->items_buffer[item][subitem])
{
buffer = gui_buffer_search_by_full_name (bar->items_buffer[item][subitem]);
if (!buffer)
return NULL;
}
ptr_item = gui_bar_item_search_with_plugin ((buffer) ? buffer->plugin : NULL,
0,
bar->items_name[item][subitem]);
if (ptr_item && ptr_item->build_callback)
{
item_value = (ptr_item->build_callback) (ptr_item->build_callback_data,
ptr_item, window);
ptr_item, window, buffer,
NULL);
}
if (item_value && !item_value[0])
{
@ -490,7 +517,9 @@ struct t_gui_bar_item *
gui_bar_item_new (struct t_weechat_plugin *plugin, const char *name,
char *(*build_callback)(void *data,
struct t_gui_bar_item *item,
struct t_gui_window *window),
struct t_gui_window *window,
struct t_gui_buffer *buffer,
struct t_hashtable *extra_info),
void *build_callback_data)
{
struct t_gui_bar_item *new_bar_item;
@ -642,14 +671,18 @@ gui_bar_item_free_all_plugin (struct t_weechat_plugin *plugin)
char *
gui_bar_item_default_input_paste (void *data, struct t_gui_bar_item *item,
struct t_gui_window *window)
struct t_gui_window *window,
struct t_gui_buffer *buffer,
struct t_hashtable *extra_info)
{
char buf[1024];
char str_paste[1024];
int lines;
/* make C compiler happy */
(void) data;
(void) item;
(void) buffer;
(void) extra_info;
if (window && (window != gui_current_window))
return NULL;
@ -658,13 +691,13 @@ gui_bar_item_default_input_paste (void *data, struct t_gui_bar_item *item,
return NULL;
lines = gui_key_get_paste_lines ();
snprintf (buf, sizeof (buf),
snprintf (str_paste, sizeof (str_paste),
NG_("%sPaste %d line ? [ctrl-Y] Yes [ctrl-N] No",
"%sPaste %d lines ? [ctrl-Y] Yes [ctrl-N] No",
lines),
gui_color_get_custom (gui_color_get_name (CONFIG_COLOR(config_color_input_actions))),
lines);
return strdup (buf);
return strdup (str_paste);
}
/*
@ -673,23 +706,24 @@ gui_bar_item_default_input_paste (void *data, struct t_gui_bar_item *item,
char *
gui_bar_item_default_input_prompt (void *data, struct t_gui_bar_item *item,
struct t_gui_window *window)
struct t_gui_window *window,
struct t_gui_buffer *buffer,
struct t_hashtable *extra_info)
{
const char *nick;
/* make C compiler happy */
(void) data;
(void) item;
(void) window;
(void) extra_info;
if (!window)
window = gui_current_window;
nick = (const char *)hashtable_get (window->buffer->local_variables,
"nick");
if (!nick)
if (!buffer)
return NULL;
return strdup (nick);
nick = (const char *)hashtable_get (buffer->local_variables, "nick");
return (nick) ? strdup (nick) : NULL;
}
/*
@ -698,33 +732,37 @@ gui_bar_item_default_input_prompt (void *data, struct t_gui_bar_item *item,
char *
gui_bar_item_default_input_search (void *data, struct t_gui_bar_item *item,
struct t_gui_window *window)
struct t_gui_window *window,
struct t_gui_buffer *buffer,
struct t_hashtable *extra_info)
{
char str_search[1024];
/* make C compiler happy */
(void) data;
(void) item;
(void) window;
(void) extra_info;
if (!window)
window = gui_current_window;
if (!buffer)
return NULL;
if (window->buffer->text_search == GUI_TEXT_SEARCH_DISABLED)
if (buffer->text_search == GUI_TEXT_SEARCH_DISABLED)
return NULL;
snprintf (str_search, sizeof (str_search), "%s%s (%s %s,%s%s%s)",
(window->buffer->text_search_found
|| !window->buffer->input_buffer
|| !window->buffer->input_buffer[0]) ?
(buffer->text_search_found
|| !buffer->input_buffer
|| !buffer->input_buffer[0]) ?
GUI_COLOR_CUSTOM_BAR_FG :
gui_color_get_custom (gui_color_get_name (CONFIG_COLOR(config_color_input_text_not_found))),
_("Search"),
(window->buffer->text_search_exact) ? "==" : "~",
(window->buffer->text_search_regex) ? "regex" : "str",
(window->buffer->text_search_where & GUI_TEXT_SEARCH_IN_PREFIX) ? "pre" : "",
((window->buffer->text_search_where & GUI_TEXT_SEARCH_IN_PREFIX)
&& (window->buffer->text_search_where & GUI_TEXT_SEARCH_IN_MESSAGE)) ? "|" : "",
(window->buffer->text_search_where & GUI_TEXT_SEARCH_IN_MESSAGE) ? "msg" : "");
(buffer->text_search_exact) ? "==" : "~",
(buffer->text_search_regex) ? "regex" : "str",
(buffer->text_search_where & GUI_TEXT_SEARCH_IN_PREFIX) ? "pre" : "",
((buffer->text_search_where & GUI_TEXT_SEARCH_IN_PREFIX)
&& (buffer->text_search_where & GUI_TEXT_SEARCH_IN_MESSAGE)) ? "|" : "",
(buffer->text_search_where & GUI_TEXT_SEARCH_IN_MESSAGE) ? "msg" : "");
return strdup (str_search);
}
@ -735,7 +773,9 @@ gui_bar_item_default_input_search (void *data, struct t_gui_bar_item *item,
char *
gui_bar_item_default_input_text (void *data, struct t_gui_bar_item *item,
struct t_gui_window *window)
struct t_gui_window *window,
struct t_gui_buffer *buffer,
struct t_hashtable *extra_info)
{
char *ptr_input, *ptr_input2, str_buffer[128], str_start_input[16];
char str_cursor[16], *buf;
@ -745,9 +785,11 @@ gui_bar_item_default_input_text (void *data, struct t_gui_bar_item *item,
/* make C compiler happy */
(void) data;
(void) item;
(void) window;
(void) extra_info;
if (!window)
window = gui_current_window;
if (!buffer)
return NULL;
snprintf (str_cursor, sizeof (str_cursor), "%c%c%c",
GUI_COLOR_COLOR_CHAR,
@ -762,7 +804,7 @@ gui_bar_item_default_input_text (void *data, struct t_gui_bar_item *item,
/* for modifiers */
snprintf (str_buffer, sizeof (str_buffer),
"0x%lx", (long unsigned int)(window->buffer));
"0x%lx", (long unsigned int)buffer);
/* execute modifier with basic string (without cursor tag) */
ptr_input = NULL;
@ -771,20 +813,20 @@ gui_bar_item_default_input_text (void *data, struct t_gui_bar_item *item,
ptr_input = hook_modifier_exec (NULL,
"input_text_display",
str_buffer,
(window->buffer->input_buffer) ?
window->buffer->input_buffer : "");
(buffer->input_buffer) ?
buffer->input_buffer : "");
}
if (!ptr_input)
{
ptr_input = (window->buffer->input_buffer) ?
strdup (window->buffer->input_buffer) : NULL;
ptr_input = (buffer->input_buffer) ?
strdup (buffer->input_buffer) : NULL;
}
/* insert "move cursor" id in string */
if (ptr_input)
{
pos_cursor = gui_chat_string_add_offset (ptr_input,
window->buffer->input_buffer_pos);
buffer->input_buffer_pos);
length = strlen (ptr_input) + length_cursor + 1;
buf = malloc (length);
if (buf)
@ -858,7 +900,9 @@ gui_bar_item_default_input_text (void *data, struct t_gui_bar_item *item,
char *
gui_bar_item_default_time (void *data, struct t_gui_bar_item *item,
struct t_gui_window *window)
struct t_gui_window *window,
struct t_gui_buffer *buffer,
struct t_hashtable *extra_info)
{
time_t date;
struct tm *local_time;
@ -868,6 +912,8 @@ gui_bar_item_default_time (void *data, struct t_gui_bar_item *item,
(void) data;
(void) item;
(void) window;
(void) buffer;
(void) extra_info;
date = time (NULL);
local_time = localtime (&date);
@ -889,7 +935,9 @@ gui_bar_item_default_time (void *data, struct t_gui_bar_item *item,
char *
gui_bar_item_default_buffer_count (void *data, struct t_gui_bar_item *item,
struct t_gui_window *window)
struct t_gui_window *window,
struct t_gui_buffer *buffer,
struct t_hashtable *extra_info)
{
char buf[32];
@ -897,6 +945,8 @@ gui_bar_item_default_buffer_count (void *data, struct t_gui_bar_item *item,
(void) data;
(void) item;
(void) window;
(void) buffer;
(void) extra_info;
snprintf (buf, sizeof (buf), "%d",
(last_gui_buffer) ? last_gui_buffer->number : 0);
@ -910,18 +960,23 @@ gui_bar_item_default_buffer_count (void *data, struct t_gui_bar_item *item,
char *
gui_bar_item_default_buffer_plugin (void *data, struct t_gui_bar_item *item,
struct t_gui_window *window)
struct t_gui_window *window,
struct t_gui_buffer *buffer,
struct t_hashtable *extra_info)
{
const char *plugin_name;
/* make C compiler happy */
(void) data;
(void) item;
(void) window;
(void) extra_info;
if (!window)
window = gui_current_window;
if (!buffer)
return NULL;
plugin_name = gui_buffer_get_plugin_name (buffer);
plugin_name = gui_buffer_get_plugin_name (window->buffer);
return (plugin_name) ? strdup (plugin_name) : strdup ("");
}
@ -931,22 +986,26 @@ gui_bar_item_default_buffer_plugin (void *data, struct t_gui_bar_item *item,
char *
gui_bar_item_default_buffer_number (void *data, struct t_gui_bar_item *item,
struct t_gui_window *window)
struct t_gui_window *window,
struct t_gui_buffer *buffer,
struct t_hashtable *extra_info)
{
char buf[64];
char str_number[64];
/* make C compiler happy */
(void) data;
(void) item;
(void) window;
(void) extra_info;
if (!window)
window = gui_current_window;
if (!buffer)
return NULL;
snprintf (buf, sizeof (buf), "%s%d",
snprintf (str_number, sizeof (str_number), "%s%d",
gui_color_get_custom (gui_color_get_name (CONFIG_COLOR(config_color_status_number))),
window->buffer->number);
buffer->number);
return strdup (buf);
return strdup (str_number);
}
/*
@ -955,22 +1014,26 @@ gui_bar_item_default_buffer_number (void *data, struct t_gui_bar_item *item,
char *
gui_bar_item_default_buffer_name (void *data, struct t_gui_bar_item *item,
struct t_gui_window *window)
struct t_gui_window *window,
struct t_gui_buffer *buffer,
struct t_hashtable *extra_info)
{
char buf[256];
char str_name[256];
/* make C compiler happy */
(void) data;
(void) item;
(void) window;
(void) extra_info;
if (!window)
window = gui_current_window;
if (!buffer)
return NULL;
snprintf (buf, sizeof (buf), "%s%s",
snprintf (str_name, sizeof (str_name), "%s%s",
gui_color_get_custom (gui_color_get_name (CONFIG_COLOR(config_color_status_name))),
window->buffer->name);
buffer->name);
return strdup (buf);
return strdup (str_name);
}
/*
@ -982,12 +1045,16 @@ gui_bar_item_default_buffer_name (void *data, struct t_gui_bar_item *item,
char *
gui_bar_item_default_buffer_modes (void *data, struct t_gui_bar_item *item,
struct t_gui_window *window)
struct t_gui_window *window,
struct t_gui_buffer *buffer,
struct t_hashtable *extra_info)
{
/* make C compiler happy */
(void) data;
(void) item;
(void) window;
(void) buffer;
(void) extra_info;
return NULL;
}
@ -998,26 +1065,30 @@ gui_bar_item_default_buffer_modes (void *data, struct t_gui_bar_item *item,
char *
gui_bar_item_default_buffer_filter (void *data, struct t_gui_bar_item *item,
struct t_gui_window *window)
struct t_gui_window *window,
struct t_gui_buffer *buffer,
struct t_hashtable *extra_info)
{
char buf[512];
char str_filter[512];
/* make C compiler happy */
(void) data;
(void) item;
(void) window;
(void) extra_info;
if (!window)
window = gui_current_window;
if (!gui_filters_enabled || !gui_filters || !window->buffer->lines->lines_hidden)
if (!buffer)
return NULL;
snprintf (buf, sizeof (buf),
if (!gui_filters_enabled || !gui_filters || !buffer->lines->lines_hidden)
return NULL;
snprintf (str_filter, sizeof (str_filter),
"%s%s",
gui_color_get_custom (gui_color_get_name (CONFIG_COLOR(config_color_status_filter))),
CONFIG_STRING(config_look_item_buffer_filter));
return strdup (buf);
return strdup (str_filter);
}
/*
@ -1027,24 +1098,25 @@ gui_bar_item_default_buffer_filter (void *data, struct t_gui_bar_item *item,
char *
gui_bar_item_default_buffer_nicklist_count (void *data,
struct t_gui_bar_item *item,
struct t_gui_window *window)
struct t_gui_window *window,
struct t_gui_buffer *buffer,
struct t_hashtable *extra_info)
{
char buf[32];
char str_count[64];
/* make C compiler happy */
(void) data;
(void) item;
(void) window;
(void) extra_info;
if (!window)
window = gui_current_window;
if (!window->buffer->nicklist)
if (!buffer || !buffer->nicklist)
return NULL;
snprintf (buf, sizeof (buf), "%d",
window->buffer->nicklist_visible_count);
snprintf (str_count, sizeof (str_count), "%d",
buffer->nicklist_visible_count);
return strdup (buf);
return strdup (str_count);
}
/*
@ -1053,13 +1125,17 @@ gui_bar_item_default_buffer_nicklist_count (void *data,
char *
gui_bar_item_default_scroll (void *data, struct t_gui_bar_item *item,
struct t_gui_window *window)
struct t_gui_window *window,
struct t_gui_buffer *buffer,
struct t_hashtable *extra_info)
{
char buf[64];
char str_scroll[512];
/* make C compiler happy */
(void) data;
(void) item;
(void) buffer;
(void) extra_info;
if (!window)
window = gui_current_window;
@ -1067,11 +1143,11 @@ gui_bar_item_default_scroll (void *data, struct t_gui_bar_item *item,
if (!window->scroll->scrolling)
return NULL;
snprintf (buf, sizeof (buf), _("%s-MORE(%d)-"),
snprintf (str_scroll, sizeof (str_scroll), _("%s-MORE(%d)-"),
gui_color_get_custom (gui_color_get_name (CONFIG_COLOR(config_color_status_more))),
window->scroll->lines_after);
return strdup (buf);
return strdup (str_scroll);
}
/*
@ -1080,9 +1156,11 @@ gui_bar_item_default_scroll (void *data, struct t_gui_bar_item *item,
char *
gui_bar_item_default_hotlist (void *data, struct t_gui_bar_item *item,
struct t_gui_window *window)
struct t_gui_window *window,
struct t_gui_buffer *buffer,
struct t_hashtable *extra_info)
{
char buf[4096], format[32], *buffer_without_name_displayed;
char str_hotlist[4096], format[32], *buffer_without_name_displayed;
const char *hotlist_suffix;
struct t_gui_hotlist *ptr_hotlist;
int numbers_count, names_count, display_name, count_max;
@ -1092,13 +1170,15 @@ gui_bar_item_default_hotlist (void *data, struct t_gui_bar_item *item,
(void) data;
(void) item;
(void) window;
(void) buffer;
(void) extra_info;
if (!gui_hotlist)
return NULL;
buf[0] = '\0';
str_hotlist[0] = '\0';
strcat (buf, CONFIG_STRING(config_look_hotlist_prefix));
strcat (str_hotlist, CONFIG_STRING(config_look_hotlist_prefix));
buffer_without_name_displayed = NULL;
if (CONFIG_BOOLEAN(config_look_hotlist_unique_numbers) && last_gui_buffer)
@ -1145,23 +1225,28 @@ gui_bar_item_default_hotlist (void *data, struct t_gui_bar_item *item,
&& (CONFIG_STRING(config_look_hotlist_buffer_separator))
&& (CONFIG_STRING(config_look_hotlist_buffer_separator)[0]))
{
strcat (buf, GUI_COLOR_CUSTOM_BAR_DELIM);
strcat (buf, CONFIG_STRING(config_look_hotlist_buffer_separator));
strcat (str_hotlist, GUI_COLOR_CUSTOM_BAR_DELIM);
strcat (str_hotlist,
CONFIG_STRING(config_look_hotlist_buffer_separator));
}
switch (ptr_hotlist->priority)
{
case GUI_HOTLIST_LOW:
strcat (buf, gui_color_get_custom (gui_color_get_name (CONFIG_COLOR(config_color_status_data_other))));
strcat (str_hotlist,
gui_color_get_custom (gui_color_get_name (CONFIG_COLOR(config_color_status_data_other))));
break;
case GUI_HOTLIST_MESSAGE:
strcat (buf, gui_color_get_custom (gui_color_get_name (CONFIG_COLOR(config_color_status_data_msg))));
strcat (str_hotlist,
gui_color_get_custom (gui_color_get_name (CONFIG_COLOR(config_color_status_data_msg))));
break;
case GUI_HOTLIST_PRIVATE:
strcat (buf, gui_color_get_custom (gui_color_get_name (CONFIG_COLOR(config_color_status_data_private))));
strcat (str_hotlist,
gui_color_get_custom (gui_color_get_name (CONFIG_COLOR(config_color_status_data_private))));
break;
case GUI_HOTLIST_HIGHLIGHT:
strcat (buf, gui_color_get_custom (gui_color_get_name (CONFIG_COLOR(config_color_status_data_highlight))));
strcat (str_hotlist,
gui_color_get_custom (gui_color_get_name (CONFIG_COLOR(config_color_status_data_highlight))));
break;
case GUI_HOTLIST_NUM_PRIORITIES:
/*
@ -1170,23 +1255,24 @@ gui_bar_item_default_hotlist (void *data, struct t_gui_bar_item *item,
*/
break;
}
sprintf (buf + strlen (buf), "%d", ptr_hotlist->buffer->number);
sprintf (str_hotlist + strlen (str_hotlist),
"%d", ptr_hotlist->buffer->number);
numbers_count++;
if (display_name)
{
names_count++;
strcat (buf, GUI_COLOR_CUSTOM_BAR_DELIM);
strcat (buf, ":");
strcat (buf, GUI_COLOR_CUSTOM_BAR_FG);
strcat (str_hotlist, GUI_COLOR_CUSTOM_BAR_DELIM);
strcat (str_hotlist, ":");
strcat (str_hotlist, GUI_COLOR_CUSTOM_BAR_FG);
if (CONFIG_INTEGER(config_look_hotlist_names_length) == 0)
snprintf (format, sizeof (format) - 1, "%%s");
else
snprintf (format, sizeof (format) - 1,
"%%.%ds",
CONFIG_INTEGER(config_look_hotlist_names_length));
sprintf (buf + strlen (buf), format,
sprintf (str_hotlist + strlen (str_hotlist), format,
(CONFIG_BOOLEAN(config_look_hotlist_short_names)) ?
gui_buffer_get_short_name (ptr_hotlist->buffer) : ptr_hotlist->buffer->name);
}
@ -1240,21 +1326,21 @@ gui_bar_item_default_hotlist (void *data, struct t_gui_bar_item *item,
continue;
if (private && (priority == GUI_HOTLIST_MESSAGE))
continue;
strcat (buf, GUI_COLOR_CUSTOM_BAR_DELIM);
strcat (buf, (priority == (int)ptr_hotlist->priority) ? "(" : ",");
strcat (str_hotlist, GUI_COLOR_CUSTOM_BAR_DELIM);
strcat (str_hotlist, (priority == (int)ptr_hotlist->priority) ? "(" : ",");
switch (priority)
{
case GUI_HOTLIST_LOW:
strcat (buf, gui_color_get_custom (gui_color_get_name (CONFIG_COLOR(config_color_status_count_other))));
strcat (str_hotlist, gui_color_get_custom (gui_color_get_name (CONFIG_COLOR(config_color_status_count_other))));
break;
case GUI_HOTLIST_MESSAGE:
strcat (buf, gui_color_get_custom (gui_color_get_name (CONFIG_COLOR(config_color_status_count_msg))));
strcat (str_hotlist, gui_color_get_custom (gui_color_get_name (CONFIG_COLOR(config_color_status_count_msg))));
break;
case GUI_HOTLIST_PRIVATE:
strcat (buf, gui_color_get_custom (gui_color_get_name (CONFIG_COLOR(config_color_status_count_private))));
strcat (str_hotlist, gui_color_get_custom (gui_color_get_name (CONFIG_COLOR(config_color_status_count_private))));
break;
case GUI_HOTLIST_HIGHLIGHT:
strcat (buf, gui_color_get_custom (gui_color_get_name (CONFIG_COLOR(config_color_status_count_highlight))));
strcat (str_hotlist, gui_color_get_custom (gui_color_get_name (CONFIG_COLOR(config_color_status_count_highlight))));
break;
case GUI_HOTLIST_NUM_PRIORITIES:
/*
@ -1263,15 +1349,15 @@ gui_bar_item_default_hotlist (void *data, struct t_gui_bar_item *item,
*/
break;
}
sprintf (buf + strlen (buf),
sprintf (str_hotlist + strlen (str_hotlist),
"%d", ptr_hotlist->count[priority]);
}
strcat (buf, GUI_COLOR_CUSTOM_BAR_DELIM);
strcat (buf, ")");
strcat (str_hotlist, GUI_COLOR_CUSTOM_BAR_DELIM);
strcat (str_hotlist, ")");
}
}
if (strlen (buf) > sizeof (buf) - 256)
if (strlen (str_hotlist) > sizeof (str_hotlist) - 256)
break;
}
}
@ -1281,13 +1367,13 @@ gui_bar_item_default_hotlist (void *data, struct t_gui_bar_item *item,
hotlist_suffix = CONFIG_STRING(config_look_hotlist_suffix);
if (hotlist_suffix[0]
&& (strlen (buf) + strlen (CONFIG_STRING(config_look_hotlist_suffix)) + 16 < sizeof (buf)))
&& (strlen (str_hotlist) + strlen (CONFIG_STRING(config_look_hotlist_suffix)) + 16 < sizeof (str_hotlist)))
{
strcat (buf, GUI_COLOR_CUSTOM_BAR_FG);
strcat (buf, hotlist_suffix);
strcat (str_hotlist, GUI_COLOR_CUSTOM_BAR_FG);
strcat (str_hotlist, hotlist_suffix);
}
return strdup (buf);
return strdup (str_hotlist);
}
/*
@ -1296,25 +1382,28 @@ gui_bar_item_default_hotlist (void *data, struct t_gui_bar_item *item,
char *
gui_bar_item_default_completion (void *data, struct t_gui_bar_item *item,
struct t_gui_window *window)
struct t_gui_window *window,
struct t_gui_buffer *buffer,
struct t_hashtable *extra_info)
{
int length;
char *buf, number_str[16];
char *buf, str_number[64];
struct t_gui_completion_partial *ptr_item;
/* make C compiler happy */
(void) data;
(void) item;
(void) window;
(void) extra_info;
if (!window)
window = gui_current_window;
if (!window->buffer->completion
|| !window->buffer->completion->partial_completion_list)
if (!buffer || !buffer->completion
|| !buffer->completion->partial_completion_list)
{
return NULL;
}
length = 1;
for (ptr_item = window->buffer->completion->partial_completion_list;
for (ptr_item = buffer->completion->partial_completion_list;
ptr_item; ptr_item = ptr_item->next_item)
{
length += strlen (ptr_item->word) + 32;
@ -1324,7 +1413,7 @@ gui_bar_item_default_completion (void *data, struct t_gui_bar_item *item,
if (buf)
{
buf[0] = '\0';
for (ptr_item = window->buffer->completion->partial_completion_list;
for (ptr_item = buffer->completion->partial_completion_list;
ptr_item; ptr_item = ptr_item->next_item)
{
strcat (buf, GUI_COLOR_CUSTOM_BAR_FG);
@ -1333,9 +1422,9 @@ gui_bar_item_default_completion (void *data, struct t_gui_bar_item *item,
{
strcat (buf, GUI_COLOR_CUSTOM_BAR_DELIM);
strcat (buf, "(");
snprintf (number_str, sizeof (number_str),
snprintf (str_number, sizeof (str_number),
"%d", ptr_item->count);
strcat (buf, number_str);
strcat (buf, str_number);
strcat (buf, ")");
}
if (ptr_item->next_item)
@ -1352,17 +1441,20 @@ gui_bar_item_default_completion (void *data, struct t_gui_bar_item *item,
char *
gui_bar_item_default_buffer_title (void *data, struct t_gui_bar_item *item,
struct t_gui_window *window)
struct t_gui_window *window,
struct t_gui_buffer *buffer,
struct t_hashtable *extra_info)
{
/* make C compiler happy */
(void) data;
(void) item;
(void) window;
(void) extra_info;
if (!window)
window = gui_current_window;
if (!buffer)
return NULL;
return (window->buffer->title) ?
strdup (window->buffer->title) : NULL;
return (buffer->title) ? strdup (buffer->title) : NULL;
}
/*
@ -1371,30 +1463,34 @@ gui_bar_item_default_buffer_title (void *data, struct t_gui_bar_item *item,
char *
gui_bar_item_default_buffer_nicklist (void *data, struct t_gui_bar_item *item,
struct t_gui_window *window)
struct t_gui_window *window,
struct t_gui_buffer *buffer,
struct t_hashtable *extra_info)
{
struct t_gui_nick_group *ptr_group;
struct t_gui_nick *ptr_nick;
struct t_config_option *ptr_option;
int i, length;
char *buf;
char *str_nicklist;
/* make C compiler happy */
(void) data;
(void) item;
(void) window;
(void) extra_info;
if (!window)
window = gui_current_window;
if (!buffer)
return NULL;
length = 1;
ptr_group = NULL;
ptr_nick = NULL;
gui_nicklist_get_next_item (window->buffer, &ptr_group, &ptr_nick);
gui_nicklist_get_next_item (buffer, &ptr_group, &ptr_nick);
while (ptr_group || ptr_nick)
{
if ((ptr_nick && ptr_nick->visible)
|| (ptr_group && !ptr_nick
&& window->buffer->nicklist_display_groups
&& buffer->nicklist_display_groups
&& ptr_group->visible))
{
if (ptr_nick)
@ -1408,33 +1504,33 @@ gui_bar_item_default_buffer_nicklist (void *data, struct t_gui_bar_item *item,
+ strlen (gui_nicklist_get_group_start (ptr_group->name))
+ 1;
}
gui_nicklist_get_next_item (window->buffer, &ptr_group, &ptr_nick);
gui_nicklist_get_next_item (buffer, &ptr_group, &ptr_nick);
}
buf = malloc (length);
if (buf)
str_nicklist = malloc (length);
if (str_nicklist)
{
buf[0] = '\0';
str_nicklist[0] = '\0';
ptr_group = NULL;
ptr_nick = NULL;
gui_nicklist_get_next_item (window->buffer, &ptr_group, &ptr_nick);
gui_nicklist_get_next_item (buffer, &ptr_group, &ptr_nick);
while (ptr_group || ptr_nick)
{
if ((ptr_nick && ptr_nick->visible)
|| (ptr_group && !ptr_nick
&& window->buffer->nicklist_display_groups
&& buffer->nicklist_display_groups
&& ptr_group->visible))
{
if (buf[0])
strcat (buf, "\n");
if (str_nicklist[0])
strcat (str_nicklist, "\n");
if (ptr_nick)
{
if (window->buffer->nicklist_display_groups)
if (buffer->nicklist_display_groups)
{
for (i = 0; i < ptr_nick->group->level; i++)
{
strcat (buf, " ");
strcat (str_nicklist, " ");
}
}
if (ptr_nick->prefix_color)
@ -1445,15 +1541,15 @@ gui_bar_item_default_buffer_nicklist (void *data, struct t_gui_bar_item *item,
NULL, NULL, &ptr_option,
NULL);
if (ptr_option)
strcat (buf, gui_color_get_custom (gui_color_get_name (CONFIG_COLOR(ptr_option))));
strcat (str_nicklist, gui_color_get_custom (gui_color_get_name (CONFIG_COLOR(ptr_option))));
}
else
{
strcat (buf, gui_color_get_custom (ptr_nick->prefix_color));
strcat (str_nicklist, gui_color_get_custom (ptr_nick->prefix_color));
}
}
if (ptr_nick->prefix)
strcat (buf, ptr_nick->prefix);
strcat (str_nicklist, ptr_nick->prefix);
if (ptr_nick->color)
{
if (strchr (ptr_nick->color, '.'))
@ -1462,20 +1558,20 @@ gui_bar_item_default_buffer_nicklist (void *data, struct t_gui_bar_item *item,
NULL, NULL, &ptr_option,
NULL);
if (ptr_option)
strcat (buf, gui_color_get_custom (gui_color_get_name (CONFIG_COLOR(ptr_option))));
strcat (str_nicklist, gui_color_get_custom (gui_color_get_name (CONFIG_COLOR(ptr_option))));
}
else
{
strcat (buf, gui_color_get_custom (ptr_nick->color));
strcat (str_nicklist, gui_color_get_custom (ptr_nick->color));
}
}
strcat (buf, ptr_nick->name);
strcat (str_nicklist, ptr_nick->name);
}
else
{
for (i = 0; i < ptr_group->level - 1; i++)
{
strcat (buf, " ");
strcat (str_nicklist, " ");
}
if (ptr_group->color)
{
@ -1485,21 +1581,21 @@ gui_bar_item_default_buffer_nicklist (void *data, struct t_gui_bar_item *item,
NULL, NULL, &ptr_option,
NULL);
if (ptr_option)
strcat (buf, gui_color_get_custom (gui_color_get_name (CONFIG_COLOR(ptr_option))));
strcat (str_nicklist, gui_color_get_custom (gui_color_get_name (CONFIG_COLOR(ptr_option))));
}
else
{
strcat (buf, gui_color_get_custom (ptr_group->color));
strcat (str_nicklist, gui_color_get_custom (ptr_group->color));
}
}
strcat (buf, gui_nicklist_get_group_start (ptr_group->name));
strcat (str_nicklist, gui_nicklist_get_group_start (ptr_group->name));
}
}
gui_nicklist_get_next_item (window->buffer, &ptr_group, &ptr_nick);
gui_nicklist_get_next_item (buffer, &ptr_group, &ptr_nick);
}
}
return buf;
return str_nicklist;
}
/*
@ -1508,20 +1604,24 @@ gui_bar_item_default_buffer_nicklist (void *data, struct t_gui_bar_item *item,
char *
gui_bar_item_default_window_number (void *data, struct t_gui_bar_item *item,
struct t_gui_window *window)
struct t_gui_window *window,
struct t_gui_buffer *buffer,
struct t_hashtable *extra_info)
{
char buf[64];
char str_number[64];
/* make C compiler happy */
(void) data;
(void) item;
(void) buffer;
(void) extra_info;
if (!window)
window = gui_current_window;
snprintf (buf, sizeof (buf), "%d", window->number);
snprintf (str_number, sizeof (str_number), "%d", window->number);
return strdup (buf);
return strdup (str_number);
}
/*

View File

@ -52,7 +52,9 @@ struct t_gui_bar_item
char *name; /* bar item name */
char *(*build_callback)(void *data,
struct t_gui_bar_item *item,
struct t_gui_window *window);
struct t_gui_window *window,
struct t_gui_buffer *buffer,
struct t_hashtable *extra_info);
/* callback called for building item */
void *build_callback_data; /* data for callback */
struct t_gui_bar_item *prev_item; /* link to previous bar item */
@ -82,9 +84,9 @@ extern int gui_bar_item_used_in_bar (struct t_gui_bar *bar,
extern int gui_bar_item_used_in_at_least_one_bar (const char *item_name,
int partial_name,
int ignore_hidden_bars);
extern void gui_bar_item_set_prefix_name_suffix (const char *item_name,
char **prefix, char **name,
char **suffix);
extern void gui_bar_item_get_vars (const char *item_name,
char **buffer, char **prefix, char **name,
char **suffix);
extern char *gui_bar_item_get_value (struct t_gui_bar *bar,
struct t_gui_window *window,
int item, int subitem);
@ -93,7 +95,9 @@ extern struct t_gui_bar_item *gui_bar_item_new (struct t_weechat_plugin *plugin,
const char *name,
char *(*build_callback)(void *data,
struct t_gui_bar_item *item,
struct t_gui_window *window),
struct t_gui_window *window,
struct t_gui_buffer *buffer,
struct t_hashtable *extra_info),
void *build_callback_data);
extern void gui_bar_item_update (const char *name);
extern void gui_bar_item_free (struct t_gui_bar_item *item);

View File

@ -709,6 +709,8 @@ gui_bar_free_items_arrays (struct t_gui_bar *bar)
string_free_split (bar->items_array[i]);
for (j = 0; j < bar->items_subcount[i]; j++)
{
if (bar->items_buffer[i][j])
free (bar->items_buffer[i][j]);
if (bar->items_prefix[i][j])
free (bar->items_prefix[i][j]);
if (bar->items_name[i][j])
@ -716,6 +718,8 @@ gui_bar_free_items_arrays (struct t_gui_bar *bar)
if (bar->items_suffix[i][j])
free (bar->items_suffix[i][j]);
}
if (bar->items_buffer[i])
free (bar->items_buffer[i]);
if (bar->items_prefix[i])
free (bar->items_prefix[i]);
if (bar->items_name[i])
@ -728,6 +732,11 @@ gui_bar_free_items_arrays (struct t_gui_bar *bar)
free (bar->items_array);
bar->items_array = NULL;
}
if (bar->items_buffer)
{
free (bar->items_buffer);
bar->items_buffer = NULL;
}
if (bar->items_prefix)
{
free (bar->items_prefix);
@ -771,6 +780,7 @@ gui_bar_set_items_array (struct t_gui_bar *bar, const char *items)
bar->items_count = count;
bar->items_subcount = malloc (count * sizeof (*bar->items_subcount));
bar->items_array = malloc (count * sizeof (*bar->items_array));
bar->items_buffer = malloc (count * sizeof (*bar->items_buffer));
bar->items_prefix = malloc (count * sizeof (*bar->items_prefix));
bar->items_name = malloc (count * sizeof (*bar->items_name));
bar->items_suffix = malloc (count * sizeof (*bar->items_suffix));
@ -780,6 +790,8 @@ gui_bar_set_items_array (struct t_gui_bar *bar, const char *items)
&(bar->items_subcount[i]));
if (bar->items_subcount[i] > 0)
{
bar->items_buffer[i] = malloc (bar->items_subcount[i] *
sizeof (*(bar->items_buffer[i])));
bar->items_prefix[i] = malloc (bar->items_subcount[i] *
sizeof (*(bar->items_prefix[i])));
bar->items_name[i] = malloc (bar->items_subcount[i] *
@ -788,10 +800,11 @@ gui_bar_set_items_array (struct t_gui_bar *bar, const char *items)
sizeof (*(bar->items_suffix[i])));
for (j = 0; j < bar->items_subcount[i]; j++)
{
gui_bar_item_set_prefix_name_suffix (bar->items_array[i][j],
&bar->items_prefix[i][j],
&bar->items_name[i][j],
&bar->items_suffix[i][j]);
gui_bar_item_get_vars (bar->items_array[i][j],
&bar->items_buffer[i][j],
&bar->items_prefix[i][j],
&bar->items_name[i][j],
&bar->items_suffix[i][j]);
}
}
}
@ -1494,7 +1507,9 @@ gui_bar_create_option (const char *bar_name, int index_option, const char *value
weechat_config_file, weechat_config_section_bar,
option_name, "string",
N_("items of bar, they can be separated by comma (space "
"between items) or \"+\" (glued items)"),
"between items) or \"+\" (glued items); special syntax "
"\"@buffer:item\" can be used to force buffer used when "
"displaying the bar item"),
NULL, 0, 0, gui_bar_default_items (bar_name), value, 0,
NULL, NULL, &gui_bar_config_change_items, NULL, NULL, NULL);
break;
@ -1592,6 +1607,7 @@ gui_bar_alloc (const char *name)
}
new_bar->items_count = 0;
new_bar->items_array = NULL;
new_bar->items_buffer = NULL;
new_bar->items_prefix = NULL;
new_bar->items_name = NULL;
new_bar->items_suffix = NULL;
@ -1651,6 +1667,7 @@ gui_bar_new_with_options (const char *name,
new_bar->items_count = 0;
new_bar->items_subcount = NULL;
new_bar->items_array = NULL;
new_bar->items_buffer = NULL;
new_bar->items_prefix = NULL;
new_bar->items_name = NULL;
new_bar->items_suffix = NULL;
@ -2298,6 +2315,7 @@ gui_bar_hdata_bar_cb (void *data, const char *hdata_name)
HDATA_VAR(struct t_gui_bar, items_count, INTEGER, 0, NULL, NULL);
HDATA_VAR(struct t_gui_bar, items_subcount, POINTER, 0, NULL, NULL);
HDATA_VAR(struct t_gui_bar, items_array, POINTER, 0, NULL, NULL);
HDATA_VAR(struct t_gui_bar, items_buffer, POINTER, 0, NULL, NULL);
HDATA_VAR(struct t_gui_bar, items_prefix, POINTER, 0, NULL, NULL);
HDATA_VAR(struct t_gui_bar, items_name, POINTER, 0, NULL, NULL);
HDATA_VAR(struct t_gui_bar, items_suffix, POINTER, 0, NULL, NULL);
@ -2375,6 +2393,11 @@ gui_bar_add_to_infolist (struct t_infolist *infolist,
if (!infolist_new_var_string (ptr_item, option_name,
bar->items_array[i][j]))
return 0;
snprintf (option_name, sizeof (option_name),
"items_buffer_%05d_%05d", i + 1, j + 1);
if (!infolist_new_var_string (ptr_item, option_name,
bar->items_buffer[i][j]))
return 0;
snprintf (option_name, sizeof (option_name),
"items_prefix_%05d_%05d", i + 1, j + 1);
if (!infolist_new_var_string (ptr_item, option_name,
@ -2444,9 +2467,10 @@ gui_bar_print_log ()
for (j = 0; j < ptr_bar->items_subcount[i]; j++)
{
log_printf (" items_array[%03d][%03d]: '%s' "
"(prefix: '%s', name: '%s', suffix: '%s')",
"(buffer: '%s', prefix: '%s', name: '%s', suffix: '%s')",
i, j,
ptr_bar->items_array[i][j],
ptr_bar->items_buffer[i][j],
ptr_bar->items_prefix[i][j],
ptr_bar->items_name[i][j],
ptr_bar->items_suffix[i][j]);

View File

@ -87,6 +87,7 @@ struct t_gui_bar
int items_count; /* number of bar items */
int *items_subcount; /* number of sub items */
char ***items_array; /* bar items (after split) */
char ***items_buffer; /* buffer name for each (sub)item */
char ***items_prefix; /* prefix for each (sub)item */
char ***items_name; /* name for each (sub)item */
char ***items_suffix; /* suffix for each (sub)item */

View File

@ -36,27 +36,24 @@
char *
weechat_aspell_bar_item_dict (void *data, struct t_gui_bar_item *item,
struct t_gui_window *window)
struct t_gui_window *window,
struct t_gui_buffer *buffer,
struct t_hashtable *extra_info)
{
struct t_gui_buffer *buffer;
const char *dict_list;
/* make C compiler happy */
(void) data;
(void) item;
(void) window;
(void) extra_info;
if (!window)
window = weechat_current_window ();
if (!buffer)
return NULL;
buffer = weechat_window_get_pointer (window, "buffer");
if (buffer)
{
dict_list = weechat_aspell_get_dict (buffer);
if (dict_list)
return strdup (dict_list);
}
dict_list = weechat_aspell_get_dict (buffer);
return NULL;
return (dict_list) ? strdup (dict_list) : NULL;
}
/*
@ -65,9 +62,10 @@ weechat_aspell_bar_item_dict (void *data, struct t_gui_bar_item *item,
char *
weechat_aspell_bar_item_suggest (void *data, struct t_gui_bar_item *item,
struct t_gui_window *window)
struct t_gui_window *window,
struct t_gui_buffer *buffer,
struct t_hashtable *extra_info)
{
struct t_gui_buffer *buffer;
const char *ptr_suggestions, *pos;
char **suggestions, *suggestions2;
int i, num_suggestions, length;
@ -75,60 +73,56 @@ weechat_aspell_bar_item_suggest (void *data, struct t_gui_bar_item *item,
/* make C compiler happy */
(void) data;
(void) item;
(void) window;
(void) extra_info;
if (!aspell_enabled)
return NULL;
if (!window)
window = weechat_current_window ();
if (!buffer)
return NULL;
buffer = weechat_window_get_pointer (window, "buffer");
if (buffer)
ptr_suggestions = weechat_buffer_get_string (buffer,
"localvar_aspell_suggest");
if (!ptr_suggestions)
return NULL;
pos = strchr (ptr_suggestions, ':');
if (pos)
pos++;
else
pos = ptr_suggestions;
suggestions = weechat_string_split (pos, "/", 0, 0, &num_suggestions);
if (suggestions)
{
ptr_suggestions = weechat_buffer_get_string (buffer,
"localvar_aspell_suggest");
if (ptr_suggestions)
length = 64 + 1;
for (i = 0; i < num_suggestions; i++)
{
pos = strchr (ptr_suggestions, ':');
if (pos)
pos++;
else
pos = ptr_suggestions;
suggestions = weechat_string_split (pos, "/", 0, 0, &num_suggestions);
if (suggestions)
length += strlen (suggestions[i]) + 64;
}
suggestions2 = malloc (length);
if (suggestions2)
{
suggestions2[0] = '\0';
strcat (suggestions2,
weechat_color (weechat_config_string (weechat_aspell_config_color_suggestions)));
for (i = 0; i < num_suggestions; i++)
{
length = 64 + 1;
for (i = 0; i < num_suggestions; i++)
if (i > 0)
{
length += strlen (suggestions[i]) + 64;
}
suggestions2 = malloc (length);
if (suggestions2)
{
suggestions2[0] = '\0';
strcat (suggestions2, weechat_color ("bar_delim"));
strcat (suggestions2, "/");
strcat (suggestions2,
weechat_color (weechat_config_string (weechat_aspell_config_color_suggestions)));
for (i = 0; i < num_suggestions; i++)
{
if (i > 0)
{
strcat (suggestions2, weechat_color ("bar_delim"));
strcat (suggestions2, "/");
strcat (suggestions2,
weechat_color (weechat_config_string (weechat_aspell_config_color_suggestions)));
}
strcat (suggestions2, suggestions[i]);
}
weechat_string_free_split (suggestions);
return suggestions2;
}
weechat_string_free_split (suggestions);
strcat (suggestions2, suggestions[i]);
}
return strdup (pos);
weechat_string_free_split (suggestions);
return suggestions2;
}
weechat_string_free_split (suggestions);
}
return NULL;
return strdup (pos);
}
/*

View File

@ -3639,29 +3639,56 @@ weechat_guile_api_bar_item_search (SCM name)
char *
weechat_guile_api_bar_item_build_cb (void *data, struct t_gui_bar_item *item,
struct t_gui_window *window)
struct t_gui_window *window,
struct t_gui_buffer *buffer,
struct t_hashtable *extra_info)
{
struct t_plugin_script_cb *script_callback;
void *func_argv[3];
void *func_argv[5];
char empty_arg[1] = { '\0' }, *ret;
script_callback = (struct t_plugin_script_cb *)data;
if (script_callback && script_callback->function && script_callback->function[0])
{
func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
func_argv[1] = API_PTR2STR(item);
func_argv[2] = API_PTR2STR(window);
if (strncmp (script_callback->function, "(extra)", 7) == 0)
{
/* new callback: data, item, window, buffer, extra_info */
func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
func_argv[1] = API_PTR2STR(item);
func_argv[2] = API_PTR2STR(window);
func_argv[3] = API_PTR2STR(buffer);
func_argv[4] = extra_info;
ret = (char *)weechat_guile_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_STRING,
script_callback->function,
"sss", func_argv);
ret = (char *)weechat_guile_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_STRING,
script_callback->function + 7,
"ssssh", func_argv);
if (func_argv[1])
free (func_argv[1]);
if (func_argv[2])
free (func_argv[2]);
if (func_argv[1])
free (func_argv[1]);
if (func_argv[2])
free (func_argv[2]);
if (func_argv[3])
free (func_argv[3]);
}
else
{
/* old callback: data, item, window */
func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
func_argv[1] = API_PTR2STR(item);
func_argv[2] = API_PTR2STR(window);
ret = (char *)weechat_guile_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_STRING,
script_callback->function,
"sss", func_argv);
if (func_argv[1])
free (func_argv[1]);
if (func_argv[2])
free (func_argv[2]);
}
return ret;
}

View File

@ -39,9 +39,9 @@
char *
irc_bar_item_away (void *data, struct t_gui_bar_item *item,
struct t_gui_window *window)
struct t_gui_window *window, struct t_gui_buffer *buffer,
struct t_hashtable *extra_info)
{
struct t_gui_buffer *buffer;
struct t_irc_server *server;
char *buf, *message;
int length;
@ -49,41 +49,38 @@ irc_bar_item_away (void *data, struct t_gui_bar_item *item,
/* make C compiler happy */
(void) data;
(void) item;
(void) window;
(void) extra_info;
if (!buffer)
return NULL;
buf = NULL;
if (!window)
window = weechat_current_window ();
irc_buffer_get_server_and_channel (buffer, &server, NULL);
buffer = weechat_window_get_pointer (window, "buffer");
if (buffer)
if (server && server->is_away)
{
irc_buffer_get_server_and_channel (buffer, &server, NULL);
if (server && server->is_away)
if (weechat_config_boolean (irc_config_look_item_away_message)
&& server->away_message && server->away_message[0])
{
if (weechat_config_boolean (irc_config_look_item_away_message)
&& server->away_message && server->away_message[0])
message = strdup (server->away_message);
}
else
{
message = strdup (_("away"));
}
if (message)
{
length = strlen (message) + 64 + 1;
buf = malloc (length);
if (buf)
{
message = strdup (server->away_message);
}
else
{
message = strdup (_("away"));
}
if (message)
{
length = strlen (message) + 64 + 1;
buf = malloc (length);
if (buf)
{
snprintf (buf, length, "%s%s",
IRC_COLOR_ITEM_AWAY,
message);
}
free (message);
snprintf (buf, length, "%s%s",
IRC_COLOR_ITEM_AWAY,
message);
}
free (message);
}
}
@ -96,35 +93,31 @@ irc_bar_item_away (void *data, struct t_gui_bar_item *item,
char *
irc_bar_item_buffer_title (void *data, struct t_gui_bar_item *item,
struct t_gui_window *window)
struct t_gui_window *window,
struct t_gui_buffer *buffer,
struct t_hashtable *extra_info)
{
struct t_gui_buffer *buffer;
const char *title;
char *title_color;
/* make C compiler happy */
(void) data;
(void) item;
(void) window;
(void) extra_info;
if (!window)
window = weechat_current_window ();
if (!buffer)
return NULL;
buffer = weechat_window_get_pointer (window, "buffer");
title = weechat_buffer_get_string (buffer, "title");
if (!title)
return NULL;
if (buffer)
{
title = weechat_buffer_get_string (buffer, "title");
if (!title)
return NULL;
title_color = irc_color_decode (title,
(weechat_config_boolean (irc_config_look_topic_strip_colors)) ?
0 : 1);
title_color = irc_color_decode (title,
(weechat_config_boolean (irc_config_look_topic_strip_colors)) ?
0 : 1);
return (title_color) ? title_color : strdup (title);
}
return NULL;
return (title_color) ? title_color : strdup (title);
}
/*
@ -133,10 +126,11 @@ irc_bar_item_buffer_title (void *data, struct t_gui_bar_item *item,
char *
irc_bar_item_buffer_plugin (void *data, struct t_gui_bar_item *item,
struct t_gui_window *window)
struct t_gui_window *window,
struct t_gui_buffer *buffer,
struct t_hashtable *extra_info)
{
char buf[512];
struct t_gui_buffer *buffer;
struct t_weechat_plugin *ptr_plugin;
const char *name;
struct t_irc_server *server;
@ -145,41 +139,36 @@ irc_bar_item_buffer_plugin (void *data, struct t_gui_bar_item *item,
/* make C compiler happy */
(void) data;
(void) item;
(void) window;
(void) extra_info;
if (!window)
window = weechat_current_window ();
if (!buffer)
return NULL;
buffer = weechat_window_get_pointer (window, "buffer");
if (buffer)
ptr_plugin = weechat_buffer_get_pointer (buffer, "plugin");
name = weechat_plugin_get_name (ptr_plugin);
if (ptr_plugin == weechat_irc_plugin)
{
ptr_plugin = weechat_buffer_get_pointer (buffer, "plugin");
name = weechat_plugin_get_name (ptr_plugin);
if (ptr_plugin == weechat_irc_plugin)
irc_buffer_get_server_and_channel (buffer, &server, &channel);
if (server && channel
&& (weechat_config_integer (irc_config_look_item_display_server) == IRC_CONFIG_LOOK_ITEM_DISPLAY_SERVER_PLUGIN))
{
irc_buffer_get_server_and_channel (buffer, &server, &channel);
if (server && channel
&& (weechat_config_integer (irc_config_look_item_display_server) == IRC_CONFIG_LOOK_ITEM_DISPLAY_SERVER_PLUGIN))
{
snprintf (buf, sizeof (buf), "%s%s/%s%s",
name,
IRC_COLOR_BAR_DELIM,
IRC_COLOR_BAR_FG,
server->name);
}
else
{
snprintf (buf, sizeof (buf), "%s", name);
}
snprintf (buf, sizeof (buf), "%s%s/%s%s",
name,
IRC_COLOR_BAR_DELIM,
IRC_COLOR_BAR_FG,
server->name);
}
else
{
snprintf (buf, sizeof (buf), "%s", name);
}
return strdup (buf);
}
return NULL;
else
{
snprintf (buf, sizeof (buf), "%s", name);
}
return strdup (buf);
}
/*
@ -188,79 +177,76 @@ irc_bar_item_buffer_plugin (void *data, struct t_gui_bar_item *item,
char *
irc_bar_item_buffer_name (void *data, struct t_gui_bar_item *item,
struct t_gui_window *window)
struct t_gui_window *window,
struct t_gui_buffer *buffer,
struct t_hashtable *extra_info)
{
char buf[512], buf_name[256], modes[128];
const char *name;
int part_from_channel, display_server;
struct t_gui_buffer *buffer;
struct t_irc_server *server;
struct t_irc_channel *channel;
/* make C compiler happy */
(void) data;
(void) item;
(void) window;
(void) extra_info;
if (!window)
window = weechat_current_window ();
if (!buffer)
return NULL;
buf_name[0] = '\0';
modes[0] = '\0';
display_server = (weechat_config_integer (irc_config_look_item_display_server) == IRC_CONFIG_LOOK_ITEM_DISPLAY_SERVER_NAME);
buffer = weechat_window_get_pointer (window, "buffer");
if (buffer)
irc_buffer_get_server_and_channel (buffer, &server, &channel);
if (server || channel)
{
irc_buffer_get_server_and_channel (buffer, &server, &channel);
if (server || channel)
if (server && !channel)
{
if (server && !channel)
{
snprintf (buf_name, sizeof (buf_name), "%s%s[%s%s%s]",
_("server"),
IRC_COLOR_BAR_DELIM,
(server && server->ssl_connected) ? IRC_COLOR_STATUS_NAME_SSL : IRC_COLOR_STATUS_NAME,
server->name,
IRC_COLOR_BAR_DELIM);
}
else
{
if (channel)
{
part_from_channel = ((channel->type == IRC_CHANNEL_TYPE_CHANNEL)
&& !channel->nicks);
snprintf (buf_name, sizeof (buf_name),
"%s%s%s%s%s%s%s%s%s%s",
(part_from_channel) ? IRC_COLOR_BAR_DELIM : "",
(part_from_channel) ? "(" : "",
(server && server->ssl_connected) ? IRC_COLOR_STATUS_NAME_SSL : IRC_COLOR_STATUS_NAME,
(server && display_server) ? server->name : "",
(server && display_server) ? IRC_COLOR_BAR_DELIM : "",
(server && display_server) ? "/" : "",
(server && server->ssl_connected) ? IRC_COLOR_STATUS_NAME_SSL : IRC_COLOR_STATUS_NAME,
channel->name,
(part_from_channel) ? IRC_COLOR_BAR_DELIM : "",
(part_from_channel) ? ")" : "");
}
}
snprintf (buf_name, sizeof (buf_name), "%s%s[%s%s%s]",
_("server"),
IRC_COLOR_BAR_DELIM,
(server && server->ssl_connected) ? IRC_COLOR_STATUS_NAME_SSL : IRC_COLOR_STATUS_NAME,
server->name,
IRC_COLOR_BAR_DELIM);
}
else
{
name = weechat_buffer_get_string (buffer, "name");
if (name)
snprintf (buf_name, sizeof (buf_name), "%s", name);
if (channel)
{
part_from_channel = ((channel->type == IRC_CHANNEL_TYPE_CHANNEL)
&& !channel->nicks);
snprintf (buf_name, sizeof (buf_name),
"%s%s%s%s%s%s%s%s%s%s",
(part_from_channel) ? IRC_COLOR_BAR_DELIM : "",
(part_from_channel) ? "(" : "",
(server && server->ssl_connected) ? IRC_COLOR_STATUS_NAME_SSL : IRC_COLOR_STATUS_NAME,
(server && display_server) ? server->name : "",
(server && display_server) ? IRC_COLOR_BAR_DELIM : "",
(server && display_server) ? "/" : "",
(server && server->ssl_connected) ? IRC_COLOR_STATUS_NAME_SSL : IRC_COLOR_STATUS_NAME,
channel->name,
(part_from_channel) ? IRC_COLOR_BAR_DELIM : "",
(part_from_channel) ? ")" : "");
}
}
snprintf (buf, sizeof (buf), "%s%s%s",
(server && server->ssl_connected) ? IRC_COLOR_STATUS_NAME_SSL : IRC_COLOR_STATUS_NAME,
buf_name,
modes);
return strdup (buf);
}
else
{
name = weechat_buffer_get_string (buffer, "name");
if (name)
snprintf (buf_name, sizeof (buf_name), "%s", name);
}
return NULL;
snprintf (buf, sizeof (buf), "%s%s%s",
(server && server->ssl_connected) ? IRC_COLOR_STATUS_NAME_SSL : IRC_COLOR_STATUS_NAME,
buf_name,
modes);
return strdup (buf);
}
/*
@ -269,28 +255,27 @@ irc_bar_item_buffer_name (void *data, struct t_gui_bar_item *item,
char *
irc_bar_item_buffer_modes (void *data, struct t_gui_bar_item *item,
struct t_gui_window *window)
struct t_gui_window *window,
struct t_gui_buffer *buffer,
struct t_hashtable *extra_info)
{
char modes[128], *modes_without_args;
const char *pos_space, *pos_key;
int part_from_channel;
struct t_gui_buffer *buffer;
struct t_irc_server *server;
struct t_irc_channel *channel;
/* make C compiler happy */
(void) data;
(void) item;
(void) window;
(void) extra_info;
if (!window)
window = weechat_current_window ();
modes[0] = '\0';
buffer = weechat_window_get_pointer (window, "buffer");
if (!buffer)
return NULL;
modes[0] = '\0';
irc_buffer_get_server_and_channel (buffer, &server, &channel);
if (!channel)
return NULL;
@ -334,79 +319,75 @@ irc_bar_item_buffer_modes (void *data, struct t_gui_bar_item *item,
char *
irc_bar_item_channel (void *data, struct t_gui_bar_item *item,
struct t_gui_window *window)
struct t_gui_window *window, struct t_gui_buffer *buffer,
struct t_hashtable *extra_info)
{
char buf[512], buf_name[256], modes[128];
const char *name;
int part_from_channel, display_server;
struct t_gui_buffer *buffer;
struct t_irc_server *server;
struct t_irc_channel *channel;
/* make C compiler happy */
(void) data;
(void) item;
(void) window;
(void) extra_info;
if (!window)
window = weechat_current_window ();
if (!buffer)
return NULL;
buf_name[0] = '\0';
modes[0] = '\0';
display_server = (weechat_config_integer (irc_config_look_item_display_server) == IRC_CONFIG_LOOK_ITEM_DISPLAY_SERVER_NAME);
buffer = weechat_window_get_pointer (window, "buffer");
if (buffer)
irc_buffer_get_server_and_channel (buffer, &server, &channel);
if (server || channel)
{
irc_buffer_get_server_and_channel (buffer, &server, &channel);
if (server || channel)
if (server && !channel)
{
if (server && !channel)
{
snprintf (buf_name, sizeof (buf_name), "%s%s[%s%s%s]",
_("server"),
IRC_COLOR_BAR_DELIM,
IRC_COLOR_STATUS_NAME,
server->name,
IRC_COLOR_BAR_DELIM);
}
else
{
if (channel)
{
part_from_channel = ((channel->type == IRC_CHANNEL_TYPE_CHANNEL)
&& !channel->nicks);
snprintf (buf_name, sizeof (buf_name),
"%s%s%s%s%s%s%s%s%s%s",
(part_from_channel) ? IRC_COLOR_BAR_DELIM : "",
(part_from_channel) ? "(" : "",
IRC_COLOR_STATUS_NAME,
(server && display_server) ? server->name : "",
(server && display_server) ? IRC_COLOR_BAR_DELIM : "",
(server && display_server) ? "/" : "",
IRC_COLOR_STATUS_NAME,
channel->name,
(part_from_channel) ? IRC_COLOR_BAR_DELIM : "",
(part_from_channel) ? ")" : "");
}
}
snprintf (buf_name, sizeof (buf_name), "%s%s[%s%s%s]",
_("server"),
IRC_COLOR_BAR_DELIM,
IRC_COLOR_STATUS_NAME,
server->name,
IRC_COLOR_BAR_DELIM);
}
else
{
name = weechat_buffer_get_string (buffer, "name");
if (name)
snprintf (buf_name, sizeof (buf_name), "%s", name);
if (channel)
{
part_from_channel = ((channel->type == IRC_CHANNEL_TYPE_CHANNEL)
&& !channel->nicks);
snprintf (buf_name, sizeof (buf_name),
"%s%s%s%s%s%s%s%s%s%s",
(part_from_channel) ? IRC_COLOR_BAR_DELIM : "",
(part_from_channel) ? "(" : "",
IRC_COLOR_STATUS_NAME,
(server && display_server) ? server->name : "",
(server && display_server) ? IRC_COLOR_BAR_DELIM : "",
(server && display_server) ? "/" : "",
IRC_COLOR_STATUS_NAME,
channel->name,
(part_from_channel) ? IRC_COLOR_BAR_DELIM : "",
(part_from_channel) ? ")" : "");
}
}
snprintf (buf, sizeof (buf), "%s%s%s",
IRC_COLOR_STATUS_NAME,
buf_name,
modes);
return strdup (buf);
}
else
{
name = weechat_buffer_get_string (buffer, "name");
if (name)
snprintf (buf_name, sizeof (buf_name), "%s", name);
}
return NULL;
snprintf (buf, sizeof (buf), "%s%s%s",
IRC_COLOR_STATUS_NAME,
buf_name,
modes);
return strdup (buf);
}
/*
@ -415,37 +396,34 @@ irc_bar_item_channel (void *data, struct t_gui_bar_item *item,
char *
irc_bar_item_lag (void *data, struct t_gui_bar_item *item,
struct t_gui_window *window)
struct t_gui_window *window, struct t_gui_buffer *buffer,
struct t_hashtable *extra_info)
{
char buf[128];
struct t_gui_buffer *buffer;
struct t_irc_server *server;
/* make C compiler happy */
(void) data;
(void) item;
(void) window;
(void) extra_info;
if (!window)
window = weechat_current_window ();
if (!buffer)
return NULL;
buffer = weechat_window_get_pointer (window, "buffer");
irc_buffer_get_server_and_channel (buffer, &server, NULL);
if (buffer)
if (server
&& (server->lag >= weechat_config_integer (irc_config_network_lag_min_show)))
{
irc_buffer_get_server_and_channel (buffer, &server, NULL);
if (server
&& (server->lag >= weechat_config_integer (irc_config_network_lag_min_show)))
{
snprintf (buf, sizeof (buf),
((server->lag_check_time.tv_sec == 0) || (server->lag < 1000)) ?
"%s: %s%.3f" : "%s: %s%.0f",
_("Lag"),
(server->lag_check_time.tv_sec == 0) ?
IRC_COLOR_ITEM_LAG_FINISHED : IRC_COLOR_ITEM_LAG_COUNTING,
((float)(server->lag)) / 1000);
return strdup (buf);
}
snprintf (buf, sizeof (buf),
((server->lag_check_time.tv_sec == 0) || (server->lag < 1000)) ?
"%s: %s%.3f" : "%s: %s%.0f",
_("Lag"),
(server->lag_check_time.tv_sec == 0) ?
IRC_COLOR_ITEM_LAG_FINISHED : IRC_COLOR_ITEM_LAG_COUNTING,
((float)(server->lag)) / 1000);
return strdup (buf);
}
return NULL;
@ -457,9 +435,10 @@ irc_bar_item_lag (void *data, struct t_gui_bar_item *item,
char *
irc_bar_item_input_prompt (void *data, struct t_gui_bar_item *item,
struct t_gui_window *window)
struct t_gui_window *window,
struct t_gui_buffer *buffer,
struct t_hashtable *extra_info)
{
struct t_gui_buffer *buffer;
struct t_irc_server *server;
struct t_irc_channel *channel;
struct t_irc_nick *ptr_nick;
@ -469,68 +448,63 @@ irc_bar_item_input_prompt (void *data, struct t_gui_bar_item *item,
/* make C compiler happy */
(void) data;
(void) item;
(void) window;
(void) extra_info;
if (!window)
window = weechat_current_window ();
if (!buffer)
return NULL;
buffer = weechat_window_get_pointer (window, "buffer");
irc_buffer_get_server_and_channel (buffer, &server, &channel);
if (!server || !server->nick)
return NULL;
if (buffer)
/* build prefix */
str_prefix[0] = '\0';
if (weechat_config_boolean (irc_config_look_item_nick_prefix)
&& channel
&& (channel->type == IRC_CHANNEL_TYPE_CHANNEL))
{
irc_buffer_get_server_and_channel (buffer, &server, &channel);
if (!server || !server->nick)
return NULL;
/* build prefix */
str_prefix[0] = '\0';
if (weechat_config_boolean (irc_config_look_item_nick_prefix)
&& channel
&& (channel->type == IRC_CHANNEL_TYPE_CHANNEL))
ptr_nick = irc_nick_search (server, channel, server->nick);
if (ptr_nick)
{
ptr_nick = irc_nick_search (server, channel, server->nick);
if (ptr_nick)
if (ptr_nick->prefix[0] != ' ')
{
if (ptr_nick->prefix[0] != ' ')
{
snprintf (str_prefix, sizeof (str_prefix), "%s%s",
weechat_color (irc_nick_get_prefix_color_name (server, ptr_nick->prefix[0])),
ptr_nick->prefix);
}
snprintf (str_prefix, sizeof (str_prefix), "%s%s",
weechat_color (irc_nick_get_prefix_color_name (server, ptr_nick->prefix[0])),
ptr_nick->prefix);
}
}
/* build bar item */
length = 64 + strlen (server->nick) + 64 +
((server->nick_modes) ? strlen (server->nick_modes) : 0) + 64 + 1;
buf = malloc (length);
if (buf)
{
if (weechat_config_boolean (irc_config_look_item_nick_modes)
&& server->nick_modes && server->nick_modes[0])
{
snprintf (buf, length, "%s%s%s%s(%s%s%s)",
str_prefix,
IRC_COLOR_INPUT_NICK,
server->nick,
IRC_COLOR_BAR_DELIM,
IRC_COLOR_BAR_FG,
server->nick_modes,
IRC_COLOR_BAR_DELIM);
}
else
{
snprintf (buf, length, "%s%s%s",
str_prefix,
IRC_COLOR_INPUT_NICK,
server->nick);
}
}
return buf;
}
return NULL;
/* build bar item */
length = 64 + strlen (server->nick) + 64 +
((server->nick_modes) ? strlen (server->nick_modes) : 0) + 64 + 1;
buf = malloc (length);
if (buf)
{
if (weechat_config_boolean (irc_config_look_item_nick_modes)
&& server->nick_modes && server->nick_modes[0])
{
snprintf (buf, length, "%s%s%s%s(%s%s%s)",
str_prefix,
IRC_COLOR_INPUT_NICK,
server->nick,
IRC_COLOR_BAR_DELIM,
IRC_COLOR_BAR_FG,
server->nick_modes,
IRC_COLOR_BAR_DELIM);
}
else
{
snprintf (buf, length, "%s%s%s",
str_prefix,
IRC_COLOR_INPUT_NICK,
server->nick);
}
}
return buf;
}
/*

View File

@ -3997,29 +3997,56 @@ weechat_lua_api_bar_item_search (lua_State *L)
char *
weechat_lua_api_bar_item_build_cb (void *data, struct t_gui_bar_item *item,
struct t_gui_window *window)
struct t_gui_window *window,
struct t_gui_buffer *buffer,
struct t_hashtable *extra_info)
{
struct t_plugin_script_cb *script_callback;
void *func_argv[3];
void *func_argv[5];
char empty_arg[1] = { '\0' }, *ret;
script_callback = (struct t_plugin_script_cb *)data;
if (script_callback && script_callback->function && script_callback->function[0])
{
func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
func_argv[1] = API_PTR2STR(item);
func_argv[2] = API_PTR2STR(window);
if (strncmp (script_callback->function, "(extra)", 7) == 0)
{
/* new callback: data, item, window, buffer, extra_info */
func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
func_argv[1] = API_PTR2STR(item);
func_argv[2] = API_PTR2STR(window);
func_argv[3] = API_PTR2STR(buffer);
func_argv[4] = extra_info;
ret = (char *)weechat_lua_exec (script_callback->script, NULL,
WEECHAT_SCRIPT_EXEC_STRING,
script_callback->function,
"sss", func_argv);
ret = (char *)weechat_lua_exec (script_callback->script, NULL,
WEECHAT_SCRIPT_EXEC_STRING,
script_callback->function + 7,
"ssssh", func_argv);
if (func_argv[1])
free (func_argv[1]);
if (func_argv[2])
free (func_argv[2]);
if (func_argv[1])
free (func_argv[1]);
if (func_argv[2])
free (func_argv[2]);
if (func_argv[3])
free (func_argv[3]);
}
else
{
/* old callback: data, item, window */
func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
func_argv[1] = API_PTR2STR(item);
func_argv[2] = API_PTR2STR(window);
ret = (char *)weechat_lua_exec (script_callback->script, NULL,
WEECHAT_SCRIPT_EXEC_STRING,
script_callback->function,
"sss", func_argv);
if (func_argv[1])
free (func_argv[1]);
if (func_argv[2])
free (func_argv[2]);
}
return ret;
}

View File

@ -3783,29 +3783,56 @@ XS (XS_weechat_api_bar_item_search)
char *
weechat_perl_api_bar_item_build_cb (void *data, struct t_gui_bar_item *item,
struct t_gui_window *window)
struct t_gui_window *window,
struct t_gui_buffer *buffer,
struct t_hashtable *extra_info)
{
struct t_plugin_script_cb *script_callback;
void *func_argv[3];
void *func_argv[5];
char empty_arg[1] = { '\0' }, *ret;
script_callback = (struct t_plugin_script_cb *)data;
if (script_callback && script_callback->function && script_callback->function[0])
{
func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
func_argv[1] = API_PTR2STR(item);
func_argv[2] = API_PTR2STR(window);
if (strncmp (script_callback->function, "(extra)", 7) == 0)
{
/* new callback: data, item, window, buffer, extra_info */
func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
func_argv[1] = API_PTR2STR(item);
func_argv[2] = API_PTR2STR(window);
func_argv[3] = API_PTR2STR(buffer);
func_argv[4] = extra_info;
ret = (char *)weechat_perl_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_STRING,
script_callback->function,
"sss", func_argv);
ret = (char *)weechat_perl_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_STRING,
script_callback->function + 7,
"ssssh", func_argv);
if (func_argv[1])
free (func_argv[1]);
if (func_argv[2])
free (func_argv[2]);
if (func_argv[1])
free (func_argv[1]);
if (func_argv[2])
free (func_argv[2]);
if (func_argv[3])
free (func_argv[3]);
}
else
{
/* old callback: data, item, window */
func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
func_argv[1] = API_PTR2STR(item);
func_argv[2] = API_PTR2STR(window);
ret = (char *)weechat_perl_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_STRING,
script_callback->function,
"sss", func_argv);
if (func_argv[1])
free (func_argv[1]);
if (func_argv[2])
free (func_argv[2]);
}
return ret;
}

View File

@ -1258,20 +1258,39 @@ plugin_script_api_bar_item_new (struct t_weechat_plugin *weechat_plugin,
const char *name,
char *(*build_callback)(void *data,
struct t_gui_bar_item *item,
struct t_gui_window *window),
struct t_gui_window *window,
struct t_gui_buffer *buffer,
struct t_hashtable *extra_info),
const char *function,
const char *data)
{
struct t_plugin_script_cb *script_cb;
struct t_gui_bar_item *new_item;
char str_function[1024];
int new_callback;
script_cb = plugin_script_callback_add (script, function, data);
new_callback = 0;
if (strncmp (name, "(extra)", 7) == 0)
{
name += 7;
new_callback = 1;
}
str_function[0] = '\0';
if (function && function[0])
{
snprintf (str_function, sizeof (str_function),
"%s%s",
(new_callback) ? "(extra)" : "",
function);
}
script_cb = plugin_script_callback_add (script, str_function, data);
if (!script_cb)
return NULL;
new_item = weechat_bar_item_new (name,
(function && function[0]) ? build_callback : NULL,
(function && function[0]) ? script_cb : NULL);
(str_function[0]) ? build_callback : NULL,
(str_function[0]) ? script_cb : NULL);
if (new_item)
script_cb->bar_item = new_item;
else

View File

@ -322,7 +322,9 @@ extern struct t_gui_bar_item *plugin_script_api_bar_item_new (struct t_weechat_p
const char *name,
char *(*build_callback)(void *data,
struct t_gui_bar_item *item,
struct t_gui_window *window),
struct t_gui_window *window,
struct t_gui_buffer *buffer,
struct t_hashtable *extra_info),
const char *function,
const char *data);
extern void plugin_script_api_bar_item_remove (struct t_weechat_plugin *weechat_plugin,

View File

@ -3935,29 +3935,60 @@ weechat_python_api_bar_item_search (PyObject *self, PyObject *args)
char *
weechat_python_api_bar_item_build_cb (void *data, struct t_gui_bar_item *item,
struct t_gui_window *window)
struct t_gui_window *window,
struct t_gui_buffer *buffer,
struct t_hashtable *extra_info)
{
struct t_plugin_script_cb *script_callback;
void *func_argv[3];
void *func_argv[5];
char empty_arg[1] = { '\0' }, *ret;
script_callback = (struct t_plugin_script_cb *)data;
if (script_callback && script_callback->function && script_callback->function[0])
{
func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
func_argv[1] = API_PTR2STR(item);
func_argv[2] = API_PTR2STR(window);
if (strncmp (script_callback->function, "(extra)", 7) == 0)
{
/* new callback: data, item, window, buffer, extra_info */
func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
func_argv[1] = API_PTR2STR(item);
func_argv[2] = API_PTR2STR(window);
func_argv[3] = API_PTR2STR(buffer);
func_argv[4] = weechat_python_hashtable_to_dict (extra_info);
ret = (char *)weechat_python_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_STRING,
script_callback->function,
"sss", func_argv);
ret = (char *)weechat_python_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_STRING,
script_callback->function + 7,
"ssssO", func_argv);
if (func_argv[1])
free (func_argv[1]);
if (func_argv[2])
free (func_argv[2]);
if (func_argv[1])
free (func_argv[1]);
if (func_argv[2])
free (func_argv[2]);
if (func_argv[3])
free (func_argv[3]);
if (func_argv[4])
{
Py_XDECREF((PyObject *)func_argv[4]);
}
}
else
{
/* old callback: data, item, window */
func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
func_argv[1] = API_PTR2STR(item);
func_argv[2] = API_PTR2STR(window);
ret = (char *)weechat_python_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_STRING,
script_callback->function,
"sss", func_argv);
if (func_argv[1])
free (func_argv[1]);
if (func_argv[2])
free (func_argv[2]);
}
return ret;
}

View File

@ -4590,29 +4590,56 @@ weechat_ruby_api_bar_item_search (VALUE class, VALUE name)
char *
weechat_ruby_api_bar_item_build_cb (void *data, struct t_gui_bar_item *item,
struct t_gui_window *window)
struct t_gui_window *window,
struct t_gui_buffer *buffer,
struct t_hashtable *extra_info)
{
struct t_plugin_script_cb *script_callback;
void *func_argv[3];
void *func_argv[5];
char empty_arg[1] = { '\0' }, *ret;
script_callback = (struct t_plugin_script_cb *)data;
if (script_callback && script_callback->function && script_callback->function[0])
{
func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
func_argv[1] = API_PTR2STR(item);
func_argv[2] = API_PTR2STR(window);
if (strncmp (script_callback->function, "(extra)", 7) == 0)
{
/* new callback: data, item, window, buffer, extra_info */
func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
func_argv[1] = API_PTR2STR(item);
func_argv[2] = API_PTR2STR(window);
func_argv[3] = API_PTR2STR(buffer);
func_argv[4] = extra_info;
ret = (char *)weechat_ruby_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_STRING,
script_callback->function,
"sss", func_argv);
ret = (char *)weechat_ruby_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_STRING,
script_callback->function + 7,
"ssssh", func_argv);
if (func_argv[1])
free (func_argv[1]);
if (func_argv[2])
free (func_argv[2]);
if (func_argv[1])
free (func_argv[1]);
if (func_argv[2])
free (func_argv[2]);
if (func_argv[3])
free (func_argv[3]);
}
else
{
/* old callback: data, item, window */
func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
func_argv[1] = API_PTR2STR(item);
func_argv[2] = API_PTR2STR(window);
ret = (char *)weechat_ruby_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_STRING,
script_callback->function,
"sss", func_argv);
if (func_argv[1])
free (func_argv[1]);
if (func_argv[2])
free (func_argv[2]);
}
return ret;
}

View File

@ -4401,29 +4401,56 @@ weechat_tcl_api_bar_item_search (ClientData clientData, Tcl_Interp *interp,
char *
weechat_tcl_api_bar_item_build_cb (void *data, struct t_gui_bar_item *item,
struct t_gui_window *window)
struct t_gui_window *window,
struct t_gui_buffer *buffer,
struct t_hashtable *extra_info)
{
struct t_plugin_script_cb *script_callback;
void *func_argv[3];
void *func_argv[5];
char empty_arg[1] = { '\0' }, *ret;
script_callback = (struct t_plugin_script_cb *)data;
if (script_callback && script_callback->function && script_callback->function[0])
{
func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
func_argv[1] = API_PTR2STR(item);
func_argv[2] = API_PTR2STR(window);
if (strncmp (script_callback->function, "(extra)", 7) == 0)
{
/* new callback: data, item, window, buffer, extra_info */
func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
func_argv[1] = API_PTR2STR(item);
func_argv[2] = API_PTR2STR(window);
func_argv[3] = API_PTR2STR(buffer);
func_argv[4] = extra_info;
ret = (char *)weechat_tcl_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_STRING,
script_callback->function,
"sss", func_argv);
ret = (char *)weechat_tcl_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_STRING,
script_callback->function + 7,
"ssssh", func_argv);
if (func_argv[1])
free (func_argv[1]);
if (func_argv[2])
free (func_argv[2]);
if (func_argv[1])
free (func_argv[1]);
if (func_argv[2])
free (func_argv[2]);
if (func_argv[3])
free (func_argv[3]);
}
else
{
/* old callback: data, item, window */
func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
func_argv[1] = API_PTR2STR(item);
func_argv[2] = API_PTR2STR(window);
ret = (char *)weechat_tcl_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_STRING,
script_callback->function,
"sss", func_argv);
if (func_argv[1])
free (func_argv[1]);
if (func_argv[2])
free (func_argv[2]);
}
return ret;
}

View File

@ -52,7 +52,7 @@ struct timeval;
* please change the date with current one; for a second change at same
* date, increment the 01, otherwise please keep 01.
*/
#define WEECHAT_PLUGIN_API_VERSION "20130810-01"
#define WEECHAT_PLUGIN_API_VERSION "20130819-01"
/* macros for defining plugin infos */
#define WEECHAT_PLUGIN_NAME(__name) \
@ -768,7 +768,9 @@ struct t_weechat_plugin
const char *name,
char *(*build_callback)(void *data,
struct t_gui_bar_item *item,
struct t_gui_window *window),
struct t_gui_window *window,
struct t_gui_buffer *buffer,
struct t_hashtable *extra_info),
void *build_callback_data);
void (*bar_item_update) (const char *name);
void (*bar_item_remove) (struct t_gui_bar_item *item);