1
0
mirror of https://github.com/weechat/weechat.git synced 2026-07-02 07:46:38 +02:00
Files
weechat/src/gui/gui-nicklist.h
T
Sébastien Helleu cf6aca1619 core: add pointer in some callbacks (closes #406)
This pointer is the first argument received by callbacks, and the
existing argument "data" is now automatically freed by WeeChat when the
object containing the callback is removed.

With this new pointer, the linked list of callbacks in scripts has been
removed. This will improve speed of scripts (using a lot of hooks),
reduce memory used by scripts and reduce time to unload scripts.

Following functions are affected in the C API:

* exec_on_files
* config_new
* config_new_section
* config_new_option
* hook_command
* hook_command_run
* hook_timer
* hook_fd
* hook_process
* hook_process_hashtable
* hook_connect
* hook_print
* hook_signal
* hook_hsignal
* hook_config
* hook_completion
* hook_modifier
* hook_info
* hook_info_hashtable
* hook_infolist
* hook_hdata
* hook_focus
* unhook_all_plugin
* buffer_new
* bar_item_new
* upgrade_new
* upgrade_read
2016-03-21 18:11:21 +01:00

124 lines
7.0 KiB
C

/*
* Copyright (C) 2003-2016 Sébastien Helleu <flashcode@flashtux.org>
*
* This file is part of WeeChat, the extensible chat client.
*
* WeeChat is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* WeeChat is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with WeeChat. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef WEECHAT_GUI_NICKLIST_H
#define WEECHAT_GUI_NICKLIST_H 1
struct t_gui_buffer;
struct t_infolist;
struct t_gui_nick_group
{
char *name; /* group name */
char *color; /* color for group in nicklist */
int visible; /* 1 if group is displayed */
int level; /* group level (root is 0) */
struct t_gui_nick_group *parent; /* parent */
struct t_gui_nick_group *children; /* children */
struct t_gui_nick_group *last_child; /* last child */
struct t_gui_nick *nicks; /* nicks for group */
struct t_gui_nick *last_nick; /* last nick for group */
struct t_gui_nick_group *prev_group; /* link to previous group */
struct t_gui_nick_group *next_group; /* link to next group */
};
struct t_gui_nick
{
struct t_gui_nick_group *group; /* group which contains nick */
char *name; /* nick name */
char *color; /* color for nick in nicklist */
char *prefix; /* prefix for nick (for admins, ..) */
char *prefix_color; /* color for prefix */
int visible; /* 1 if nick is displayed */
struct t_gui_nick *prev_nick; /* link to previous nick */
struct t_gui_nick *next_nick; /* link to next nick */
};
/* nicklist functions */
extern struct t_gui_nick_group *gui_nicklist_search_group (struct t_gui_buffer *buffer,
struct t_gui_nick_group *from_group,
const char *name);
extern struct t_gui_nick_group *gui_nicklist_add_group (struct t_gui_buffer *buffer,
struct t_gui_nick_group *parent_group,
const char *name,
const char *color,
int visible);
extern struct t_gui_nick *gui_nicklist_search_nick (struct t_gui_buffer *buffer,
struct t_gui_nick_group *from_group,
const char *name);
extern struct t_gui_nick *gui_nicklist_add_nick (struct t_gui_buffer *buffer,
struct t_gui_nick_group *group,
const char *name,
const char *color,
const char *prefix,
const char *prefix_color,
int visible);
extern void gui_nicklist_remove_group (struct t_gui_buffer *buffer,
struct t_gui_nick_group *group);
extern void gui_nicklist_remove_nick (struct t_gui_buffer *buffer,
struct t_gui_nick *nick);
extern void gui_nicklist_remove_all (struct t_gui_buffer *buffer);
extern void gui_nicklist_get_next_item (struct t_gui_buffer *buffer,
struct t_gui_nick_group **group,
struct t_gui_nick **nick);
extern const char *gui_nicklist_get_group_start (const char *name);
extern void gui_nicklist_compute_visible_count (struct t_gui_buffer *buffer,
struct t_gui_nick_group *group);
extern int gui_nicklist_group_get_integer (struct t_gui_buffer *buffer,
struct t_gui_nick_group *group,
const char *property);
extern const char *gui_nicklist_group_get_string (struct t_gui_buffer *buffer,
struct t_gui_nick_group *group,
const char *property);
extern void *gui_nicklist_group_get_pointer (struct t_gui_buffer *buffer,
struct t_gui_nick_group *group,
const char *property);
extern void gui_nicklist_group_set (struct t_gui_buffer *buffer,
struct t_gui_nick_group *group,
const char *property, const char *value);
extern int gui_nicklist_nick_get_integer (struct t_gui_buffer *buffer,
struct t_gui_nick *nick,
const char *property);
extern const char *gui_nicklist_nick_get_string (struct t_gui_buffer *buffer,
struct t_gui_nick *nick,
const char *property);
extern void *gui_nicklist_nick_get_pointer (struct t_gui_buffer *buffer,
struct t_gui_nick *nick,
const char *property);
extern void gui_nicklist_nick_set (struct t_gui_buffer *buffer,
struct t_gui_nick *nick,
const char *property, const char *value);
extern struct t_hdata *gui_nicklist_hdata_nick_group_cb (const void *pointer,
void *data,
const char *hdata_name);
extern struct t_hdata *gui_nicklist_hdata_nick_cb (const void *pointer,
void *data,
const char *hdata_name);
extern int gui_nicklist_add_to_infolist (struct t_infolist *infolist,
struct t_gui_buffer *buffer,
const char *name);
extern void gui_nicklist_print_log (struct t_gui_nick_group *group, int indent);
extern void gui_nicklist_end ();
#endif /* WEECHAT_GUI_NICKLIST_H */