summaryrefslogtreecommitdiff
path: root/src/plugins/irc/irc-join.h
blob: 6fd238a3ecb4d4e214e7f405e422cab42096df4b (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
/*
 * Copyright (C) 2022-2023 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 <https://www.gnu.org/licenses/>.
 */

#ifndef WEECHAT_PLUGIN_IRC_JOIN_H
#define WEECHAT_PLUGIN_IRC_JOIN_H

enum t_irc_join_sort
{
    IRC_JOIN_SORT_DISABLED = 0,        /* no sort                           */
    IRC_JOIN_SORT_ALPHA,               /* alphabetic sort                   */
    IRC_JOIN_SORT_BUFFER,              /* sort by buffer number, then alpha */
    /* number of sort methods */
    IRC_JOIN_NUM_SORT,
};

struct t_irc_server;

struct t_irc_join_channel
{
    char *name;                        /* channel name                      */
    char *key;                         /* channel key                       */
};

extern struct t_arraylist *irc_join_split (struct t_irc_server *server,
                                           const char *join,
                                           enum t_irc_join_sort sort);
extern char *irc_join_build_string (struct t_arraylist *arraylist);
extern int irc_join_has_channel (struct t_irc_server *server,
                                 const char *join, const char *channel_name);
extern char *irc_join_add_channel (struct t_irc_server *server,
                                   const char *join, const char *channel_name,
                                   const char *key);
extern char *irc_join_add_channels (struct t_irc_server *server,
                                    const char *join, const char *join2);
extern void irc_join_add_channel_to_autojoin (struct t_irc_server *server,
                                              const char *channel_name,
                                              const char *key);
extern void irc_join_add_channels_to_autojoin (struct t_irc_server *server,
                                               const char *join);
extern char *irc_join_remove_channel (struct t_irc_server *server,
                                      const char *join,
                                      const char *channel_name);
extern void irc_join_remove_channel_from_autojoin (struct t_irc_server *server,
                                                   const char *channel_name);
extern char *irc_join_rename_channel (struct t_irc_server *server,
                                      const char *join,
                                      const char *channel_name,
                                      const char *new_channel_name);
extern void irc_join_rename_channel_in_autojoin (struct t_irc_server *server,
                                                 const char *channel_name,
                                                 const char *new_channel_name);
extern void irc_join_save_channels_to_autojoin (struct t_irc_server *server);
extern char *irc_join_sort_channels (struct t_irc_server *server,
                                     const char *join,
                                     enum t_irc_join_sort sort);
extern void irc_join_sort_autojoin (struct t_irc_server *server,
                                    enum t_irc_join_sort sort);

#endif /* WEECHAT_PLUGIN_IRC_JOIN_H */