summaryrefslogtreecommitdiff
path: root/src/gui/gui-nicklist.h
blob: cf031675b175977db40f9050a80b41a1a2c04d8e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
/*
 * Copyright (c) 2003-2008 by FlashCode <flashcode@flashtux.org>
 * See README for License detail, AUTHORS for developers list.
 *
 * This program 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.
 *
 * This program 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 this program.  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_gui_nick_group
{
    char *name;                        /* group name                        */
    int 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 *childs;     /* childs                          */
    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                         */
    int color;                         /* color for nick in nicklist        */
    char prefix;                       /* prefix for nick (for admins, ..)  */
    int 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,
                                                 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 char *gui_nicklist_get_group_start (const char *name);
extern int gui_nicklist_get_max_length (struct t_gui_buffer *buffer,
                                        struct t_gui_nick_group *group);
extern void gui_nicklist_compute_visible_count (struct t_gui_buffer *buffer,
                                                struct t_gui_nick_group *group);
extern void gui_nicklist_print_log (struct t_gui_nick_group *group, int indent);

/* nicklist functions (GUI dependent) */

extern void gui_nicklist_draw (struct t_gui_buffer *buffer, int erase);

#endif /* gui-nicklist.h */