mirror of
https://github.com/weechat/weechat.git
synced 2026-07-05 01:03:14 +02:00
api: allow search by buffer id in function buffer_search (issue #2081)
This commit is contained in:
@@ -2924,6 +2924,7 @@ gui_buffer_search_by_full_name (const char *full_name)
|
||||
* Searches for a buffer by plugin and name, full name or id.
|
||||
*
|
||||
* If plugin is "==", the name is used to search by full name.
|
||||
* If plugin is "==id", the name is used to search by id (which must be numeric).
|
||||
*/
|
||||
|
||||
struct t_gui_buffer *
|
||||
@@ -2931,6 +2932,8 @@ gui_buffer_search (const char *plugin, const char *name)
|
||||
{
|
||||
struct t_gui_buffer *ptr_buffer;
|
||||
int plugin_match, plugin_case_sensitive, name_case_sensitive;
|
||||
long long id;
|
||||
char *error;
|
||||
|
||||
if (!name || !name[0])
|
||||
return gui_current_window->buffer;
|
||||
@@ -2938,6 +2941,13 @@ gui_buffer_search (const char *plugin, const char *name)
|
||||
if (plugin && (strcmp (plugin, "==") == 0))
|
||||
return gui_buffer_search_by_full_name (name);
|
||||
|
||||
if (plugin && (strcmp (plugin, "==id") == 0))
|
||||
{
|
||||
error = NULL;
|
||||
id = strtoll (name, &error, 10);
|
||||
return (error && !error[0]) ? gui_buffer_search_by_id (id) : NULL;
|
||||
}
|
||||
|
||||
plugin_case_sensitive = 1;
|
||||
name_case_sensitive = 1;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user