summaryrefslogtreecommitdiff
path: root/src/plugins/relay/irc/relay-irc.h
blob: 90bc5a92d839cacc17cc0fa5896d5797d484d04b (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
/*
 * Copyright (C) 2003-2018 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_RELAY_IRC_H
#define WEECHAT_PLUGIN_RELAY_IRC_H

struct t_relay_client;

#define RELAY_IRC_DATA(client, var)                              \
    (((struct t_relay_irc_data *)client->protocol_data)->var)

struct t_relay_irc_data
{
    char *address;                     /* client address (used when sending */
                                       /* data to client)                   */
    int password_ok;                   /* password received and OK?         */
    char *nick;                        /* nick for client                   */
    int user_received;                 /* command "USER" received           */
    int cap_ls_received;               /* 1 if CAP LS was received          */
    int cap_end_received;              /* 1 if CAP END was received         */
    int connected;                     /* 1 if client is connected as IRC   */
                                       /* client                            */
    int server_capabilities;           /* server capabilities enabled (one  */
                                       /* bit per capability)               */
    struct t_hook *hook_signal_irc_in2;     /* signal "irc_in2"             */
    struct t_hook *hook_signal_irc_outtags; /* signal "irc_outtags"         */
    struct t_hook *hook_signal_irc_disc;    /* signal "irc_disconnected"    */
    struct t_hook *hook_hsignal_irc_redir;  /* hsignal "irc_redirection_..."*/
};

enum t_relay_irc_command
{
    RELAY_IRC_CMD_JOIN = 0,
    RELAY_IRC_CMD_PART,
    RELAY_IRC_CMD_QUIT,
    RELAY_IRC_CMD_NICK,
    RELAY_IRC_CMD_PRIVMSG,
    /* number of relay irc commands */
    RELAY_IRC_NUM_CMD,
};

enum t_relay_irc_server_capab
{
    RELAY_IRC_CAPAB_SERVER_TIME = 0,
    /* number of server capabilities */
    RELAY_IRC_NUM_CAPAB,
};

extern int relay_irc_search_backlog_commands_tags (const char *tag);
extern void relay_irc_recv (struct t_relay_client *client,
                            const char *data);
extern void relay_irc_close_connection (struct t_relay_client *client);
extern void relay_irc_alloc (struct t_relay_client *client);
extern void relay_irc_alloc_with_infolist (struct t_relay_client *client,
                                           struct t_infolist *infolist);
extern void relay_irc_free (struct t_relay_client *client);
extern int relay_irc_add_to_infolist (struct t_infolist_item *item,
                                      struct t_relay_client *client);
extern void relay_irc_print_log (struct t_relay_client *client);

#endif /* WEECHAT_PLUGIN_RELAY_IRC_H */