mirror of
https://github.com/weechat/weechat.git
synced 2026-07-05 09:13:14 +02:00
core: add local variables of buffer in focus hashtable, remove irc_server/irc_channel from focus hashtable for nicklist
This commit is contained in:
@@ -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
|
||||
{
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user