core: add local variables of buffer in focus hashtable, remove irc_server/irc_channel from focus hashtable for nicklist

v2.8-utf8proc
Sebastien Helleu 2011-08-16 09:41:02 +02:00
parent a234bc90ad
commit 832d30b665
5 changed files with 126 additions and 102 deletions

View File

@ -8274,43 +8274,45 @@ Content of hashtable sent to callback (keys and values are of type "string"):
[width="100%",cols="5m,5,8,3",options="header"]
|========================================
| Key ^(1)^ | Description | Value examples | Value if N/A
| _x | column on screen 2+| "0" ... "n"
| _y | line on screen 2+| "0" ... "n"
| _key | key or mouse event 2+| "button1", "button2-gesture-left", ...
| _window | pointer to window | "0x12345678" | ""
| _window_number | number of window | "1" ... "n" | "*"
| _buffer | pointer to buffer | "0x12345678" | ""
| _buffer_number | number of buffer | "1" ... "n" | "-1"
| _buffer_plugin | plugin name of buffer | "core", "irc", ... | ""
| _buffer_name | name of buffer | "weechat", "freenode.#weechat", ... | ""
| _chat | chat area indicator | "0" or "1" | "0"
| _chat_line_x | column in line ^(2)^ | "0" ... "n" | "-1"
| _chat_line_y | line number ^(2)^ | "0" ... "n" | "-1"
| _chat_line_date | line date | "1313237175" | "0"
| _chat_line_date_printed | line date ^(3)^ | "1313237175" | "0"
| _chat_line_time | time displayed | "14:06:15" | ""
| _chat_line_tags | tags of line | "irc_privmsg,notify_message,nick_FlashCode,log1" | ""
| _chat_line_nick | nick of line | "FlashCode" | ""
| _chat_line_prefix | prefix of line | "@FlashCode" | ""
| _chat_line_message | message of line | "Hello world!" | ""
| _chat_word | word at (x,y) | "Hello" | ""
| _chat_bol | beginning of line ⇒ (x-1,y) | "He" | ""
| _chat_eol | (x,y) ⇒ end of line | "llo world!" | ""
| _bar_name | name of bar | "title", "nicklist", ... | ""
| _bar_filling | filling of bar | "horizontal", "vertical", ... | ""
| _bar_item_name | name of bar item | "buffer_nicklist", "hotlist", ... | ""
| _bar_item_line | line in bar item | "0" ... "n" | "-1"
| _bar_item_col | column in bar item | "0" ... "n" | "-1"
| Key ^(1)^ | Description | Value examples | Value if N/A
| _x | column on screen 2+| "0" ... "n"
| _y | line on screen 2+| "0" ... "n"
| _key | key or mouse event 2+| "button1", "button2-gesture-left", ...
| _window | pointer to window | "0x12345678" | ""
| _window_number | number of window | "1" ... "n" | "*"
| _buffer | pointer to buffer | "0x12345678" | ""
| _buffer_number | number of buffer | "1" ... "n" | "-1"
| _buffer_plugin | plugin name of buffer | "core", "irc", ... | ""
| _buffer_name | name of buffer | "weechat", "freenode.#weechat", ... | ""
| _buffer_localvar_XXX ^(2)^ | local variables of buffer | any value | not set
| _chat | chat area indicator | "0" or "1" | "0"
| _chat_line_x | column in line ^(3)^ | "0" ... "n" | "-1"
| _chat_line_y | line number ^(3)^ | "0" ... "n" | "-1"
| _chat_line_date | line date | "1313237175" | "0"
| _chat_line_date_printed | line date ^(4)^ | "1313237175" | "0"
| _chat_line_time | time displayed | "14:06:15" | ""
| _chat_line_tags | tags of line | "irc_privmsg,notify_message,nick_FlashCode,log1" | ""
| _chat_line_nick | nick of line | "FlashCode" | ""
| _chat_line_prefix | prefix of line | "@FlashCode" | ""
| _chat_line_message | message of line | "Hello world!" | ""
| _chat_word | word at (x,y) | "Hello" | ""
| _chat_bol | beginning of line ⇒ (x-1,y) | "He" | ""
| _chat_eol | (x,y) ⇒ end of line | "llo world!" | ""
| _bar_name | name of bar | "title", "nicklist", ... | ""
| _bar_filling | filling of bar | "horizontal", "vertical", ... | ""
| _bar_item_name | name of bar item | "buffer_nicklist", "hotlist", ... | ""
| _bar_item_line | line in bar item | "0" ... "n" | "-1"
| _bar_item_col | column in bar item | "0" ... "n" | "-1"
|========================================
[NOTE]
^(1)^ There are same keys suffixed with "2" (ie: "_x2", "_y2", "_window2", ...)
with info on second point (useful only for mouse gestures, to know where mouse
button has been released). +
^(2)^ It is set only for buffers with free content. +
^(3)^ It is date when WeeChat adds line in buffer (greater or equal to
"chat_line_date").
^(2)^ `XXX` is name of local variable in buffer. +
^(3)^ It is set only for buffers with free content. +
^(4)^ It is date when WeeChat adds line in buffer (greater or equal to
"_chat_line_date").
Extra info for bar item "buffer_nicklist":
@ -8321,8 +8323,6 @@ Extra info for bar item "buffer_nicklist":
| prefix | core | prefix for nick
| group | core | group name
| irc_host | irc | host for nick (if known)
| irc_server | irc | internal name of server
| irc_channel | irc | channel name
|========================================
[NOTE]

View File

@ -8411,34 +8411,35 @@ Contenu de la hashtable envoyée au "callback" (les clés et valeurs sont de typ
[width="100%",cols="5m,5,8,3",options="header"]
|========================================
| Clé ^(1)^ | Description | Exemples de valeur | Valeur si non applicable
| _x | colonne sur l'écran 2+| "0" ... "n"
| _y | ligne sur l'écran 2+| "0" ... "n"
| _key | touche ou évènement souris 2+| "button1", "button2-gesture-left", ...
| _window | pointeur vers la fenêtre | "0x12345678" | ""
| _window_number | numéro de la fenêtre | "1" ... "n" | "*"
| _buffer | pointeur vers le tampon | "0x12345678" | ""
| _buffer_number | numéro du tampon | "1" ... "n" | "-1"
| _buffer_plugin | nom d'extension du tampon | "core", "irc", ... | ""
| _buffer_name | nom du tampon | "weechat", "freenode.#weechat", ... | ""
| _chat | indicateur zone "chat" | "0" ou "1" | "0"
| _chat_line_x | colonne de la ligne ^(2)^ | "0" ... "n" | "-1"
| _chat_line_y | numéro de ligne ^(2)^ | "0" ... "n" | "-1"
| _chat_line_date | date de la ligne | "1313237175" | "0"
| _chat_line_date_printed | date de la ligne ^(3)^ | "1313237175" | "0"
| _chat_line_time | heure affichée | "14:06:15" | ""
| _chat_line_tags | étiquettes de la ligne | "irc_privmsg,notify_message,nick_FlashCode,log1" | ""
| _chat_line_nick | pseudo de la ligne | "FlashCode" | ""
| _chat_line_prefix | préfixe de la ligne | "@FlashCode" | ""
| _chat_line_message | message de la ligne | "Hello world!" | ""
| _chat_word | mot à la position (x,y) | "Hello" | ""
| _chat_bol | début de ligne ⇒ (x-1,y) | "He" | ""
| _chat_eol | (x,y) ⇒ fin de ligne | "llo world!" | ""
| _bar_name | nom de la barre | "title", "nicklist", ... | ""
| _bar_filling | remplissage de la barre | "horizontal", "vertical", ... | ""
| _bar_item_name | nom de l'objet de barre | "buffer_nicklist", "hotlist", ... | ""
| _bar_item_line | ligne dans l'objet de barre | "0" ... "n" | "-1"
| _bar_item_col | colonne dans l'objet de barre | "0" ... "n" | "-1"
| Clé ^(1)^ | Description | Exemples de valeur | Valeur si non applicable
| _x | colonne sur l'écran 2+| "0" ... "n"
| _y | ligne sur l'écran 2+| "0" ... "n"
| _key | touche ou évènement souris 2+| "button1", "button2-gesture-left", ...
| _window | pointeur vers la fenêtre | "0x12345678" | ""
| _window_number | numéro de la fenêtre | "1" ... "n" | "*"
| _buffer | pointeur vers le tampon | "0x12345678" | ""
| _buffer_number | numéro du tampon | "1" ... "n" | "-1"
| _buffer_plugin | nom d'extension du tampon | "core", "irc", ... | ""
| _buffer_name | nom du tampon | "weechat", "freenode.#weechat", ... | ""
| _buffer_localvar_XXX ^(2)^ | variables locales du tampon | toute chaîne | non défini
| _chat | indicateur zone "chat" | "0" ou "1" | "0"
| _chat_line_x | colonne de la ligne ^(3)^ | "0" ... "n" | "-1"
| _chat_line_y | numéro de ligne ^(3)^ | "0" ... "n" | "-1"
| _chat_line_date | date de la ligne | "1313237175" | "0"
| _chat_line_date_printed | date de la ligne ^(4)^ | "1313237175" | "0"
| _chat_line_time | heure affichée | "14:06:15" | ""
| _chat_line_tags | étiquettes de la ligne | "irc_privmsg,notify_message,nick_FlashCode,log1" | ""
| _chat_line_nick | pseudo de la ligne | "FlashCode" | ""
| _chat_line_prefix | préfixe de la ligne | "@FlashCode" | ""
| _chat_line_message | message de la ligne | "Hello world!" | ""
| _chat_word | mot à la position (x,y) | "Hello" | ""
| _chat_bol | début de ligne ⇒ (x-1,y) | "He" | ""
| _chat_eol | (x,y) ⇒ fin de ligne | "llo world!" | ""
| _bar_name | nom de la barre | "title", "nicklist", ... | ""
| _bar_filling | remplissage de la barre | "horizontal", "vertical", ... | ""
| _bar_item_name | nom de l'objet de barre | "buffer_nicklist", "hotlist", ... | ""
| _bar_item_line | ligne dans l'objet de barre | "0" ... "n" | "-1"
| _bar_item_col | colonne dans l'objet de barre | "0" ... "n" | "-1"
|========================================
[NOTE]
@ -8446,9 +8447,10 @@ Contenu de la hashtable envoyée au "callback" (les clés et valeurs sont de typ
"_window2", ...) avec l'information sur le second point (pratique seulement
pour les gestes de souris, pour savoir où le bouton de la souris a été
relâché). +
^(2)^ Renseigné seulement pour les tampons avec contenu libre. +
^(3)^ Il s'agit de la date lorsque WeeChat ajoute la ligne dans le tampon
(supérieure ou égale à "chat_line_date").
^(2)^ `XXX` est le nom d'une variable locale du tampon. +
^(3)^ Renseigné seulement pour les tampons avec contenu libre. +
^(4)^ Il s'agit de la date lorsque WeeChat ajoute la ligne dans le tampon
(supérieure ou égale à "_chat_line_date").
Informations additionnelles pour l'objet de barre "buffer_nicklist":
@ -8459,8 +8461,6 @@ Informations additionnelles pour l'objet de barre "buffer_nicklist":
| prefix | core | préfixe du pseudonyme
| group | core | nom du groupe
| irc_host | irc | nom d'hôte pour le pseudonyme (si connu)
| irc_server | irc | nom interne du serveur
| irc_channel | irc | nom du canal
|========================================
[NOTE]

View File

@ -8331,43 +8331,45 @@ Content of hashtable sent to callback (keys and values are of type "string"):
[width="100%",cols="5m,5,8,3",options="header"]
|========================================
| Key ^(1)^ | Description | Value examples | Value if N/A
| _x | column on screen 2+| "0" ... "n"
| _y | line on screen 2+| "0" ... "n"
| _key | key or mouse event 2+| "button1", "button2-gesture-left", ...
| _window | pointer to window | "0x12345678" | ""
| _window_number | number of window | "1" ... "n" | "*"
| _buffer | pointer to buffer | "0x12345678" | ""
| _buffer_number | number of buffer | "1" ... "n" | "-1"
| _buffer_plugin | plugin name of buffer | "core", "irc", ... | ""
| _buffer_name | name of buffer | "weechat", "freenode.#weechat", ... | ""
| _chat | chat area indicator | "0" or "1" | "0"
| _chat_line_x | column in line ^(2)^ | "0" ... "n" | "-1"
| _chat_line_y | line number ^(2)^ | "0" ... "n" | "-1"
| _chat_line_date | line date | "1313237175" | "0"
| _chat_line_date_printed | line date ^(3)^ | "1313237175" | "0"
| _chat_line_time | time displayed | "14:06:15" | ""
| _chat_line_tags | tags of line | "irc_privmsg,notify_message,nick_FlashCode,log1" | ""
| _chat_line_nick | nick of line | "FlashCode" | ""
| _chat_line_prefix | prefix of line | "@FlashCode" | ""
| _chat_line_message | message of line | "Hello world!" | ""
| _chat_word | word at (x,y) | "Hello" | ""
| _chat_bol | beginning of line ⇒ (x-1,y) | "He" | ""
| _chat_eol | (x,y) ⇒ end of line | "llo world!" | ""
| _bar_name | name of bar | "title", "nicklist", ... | ""
| _bar_filling | filling of bar | "horizontal", "vertical", ... | ""
| _bar_item_name | name of bar item | "buffer_nicklist", "hotlist", ... | ""
| _bar_item_line | line in bar item | "0" ... "n" | "-1"
| _bar_item_col | column in bar item | "0" ... "n" | "-1"
| Key ^(1)^ | Description | Value examples | Value if N/A
| _x | column on screen 2+| "0" ... "n"
| _y | line on screen 2+| "0" ... "n"
| _key | key or mouse event 2+| "button1", "button2-gesture-left", ...
| _window | pointer to window | "0x12345678" | ""
| _window_number | number of window | "1" ... "n" | "*"
| _buffer | pointer to buffer | "0x12345678" | ""
| _buffer_number | number of buffer | "1" ... "n" | "-1"
| _buffer_plugin | plugin name of buffer | "core", "irc", ... | ""
| _buffer_name | name of buffer | "weechat", "freenode.#weechat", ... | ""
| _buffer_localvar_XXX ^(2)^ | local variables of buffer | any value | not set
| _chat | chat area indicator | "0" or "1" | "0"
| _chat_line_x | column in line ^(3)^ | "0" ... "n" | "-1"
| _chat_line_y | line number ^(3)^ | "0" ... "n" | "-1"
| _chat_line_date | line date | "1313237175" | "0"
| _chat_line_date_printed | line date ^(4)^ | "1313237175" | "0"
| _chat_line_time | time displayed | "14:06:15" | ""
| _chat_line_tags | tags of line | "irc_privmsg,notify_message,nick_FlashCode,log1" | ""
| _chat_line_nick | nick of line | "FlashCode" | ""
| _chat_line_prefix | prefix of line | "@FlashCode" | ""
| _chat_line_message | message of line | "Hello world!" | ""
| _chat_word | word at (x,y) | "Hello" | ""
| _chat_bol | beginning of line ⇒ (x-1,y) | "He" | ""
| _chat_eol | (x,y) ⇒ end of line | "llo world!" | ""
| _bar_name | name of bar | "title", "nicklist", ... | ""
| _bar_filling | filling of bar | "horizontal", "vertical", ... | ""
| _bar_item_name | name of bar item | "buffer_nicklist", "hotlist", ... | ""
| _bar_item_line | line in bar item | "0" ... "n" | "-1"
| _bar_item_col | column in bar item | "0" ... "n" | "-1"
|========================================
[NOTE]
^(1)^ There are same keys suffixed with "2" (ie: "_x2", "_y2", "_window2", ...)
with info on second point (useful only for mouse gestures, to know where mouse
button has been released). +
^(2)^ It is set only for buffers with free content. +
^(3)^ It is date when WeeChat adds line in buffer (greater or equal to
"chat_line_date").
^(2)^ `XXX` is name of local variable in buffer. +
^(3)^ It is set only for buffers with free content. +
^(4)^ It is date when WeeChat adds line in buffer (greater or equal to
"_chat_line_date").
Extra info for bar item "buffer_nicklist":
@ -8378,8 +8380,6 @@ Extra info for bar item "buffer_nicklist":
| prefix | core | prefix for nick
| group | core | group name
| irc_host | irc | host for nick (if known)
| irc_server | irc | internal name of server
| irc_channel | irc | channel name
|========================================
[NOTE]

View File

@ -121,6 +121,30 @@ gui_focus_free_info (struct t_gui_focus_info *focus_info)
free (focus_info);
}
/*
* gui_focus_buffer_localvar_map_cb: add local variables of buffer in hashtable
*/
void
gui_focus_buffer_localvar_map_cb (void *data, struct t_hashtable *hashtable,
const void *key, const void *value)
{
struct t_hashtable *hashtable_focus;
char hash_key[512];
/* make C compiler happy */
(void) hashtable;
hashtable_focus = (struct t_hashtable *)data;
if (hashtable_focus && key && value)
{
snprintf (hash_key, sizeof (hash_key),
"_buffer_localvar_%s", (const char *)key);
hashtable_set (hashtable_focus, hash_key, (const char *)value);
}
}
/*
* gui_focus_to_hashtable: add two focus info into hashtable
*/
@ -156,6 +180,8 @@ gui_focus_to_hashtable (struct t_gui_focus_info *focus_info, const char *key)
FOCUS_INT("_buffer_number", ((focus_info->window)->buffer)->number);
FOCUS_STR("_buffer_plugin", plugin_get_name (((focus_info->window)->buffer)->plugin));
FOCUS_STR("_buffer_name", ((focus_info->window)->buffer)->name);
hashtable_map (focus_info->window->buffer->local_variables,
&gui_focus_buffer_localvar_map_cb, hashtable);
}
else
{

View File

@ -530,11 +530,9 @@ irc_bar_item_focus_buffer_nicklist (void *data,
if (ptr_nick && ptr_nick->host)
{
weechat_hashtable_set (info, "irc_host", ptr_nick->host);
return info;
}
}
weechat_hashtable_set (info, "irc_server", ptr_server->name);
weechat_hashtable_set (info, "irc_channel", ptr_channel->name);
return info;
}
return NULL;