summaryrefslogtreecommitdiff
path: root/src/plugins/rmodifier/rmodifier.h
blob: 4233fd8adb919307846250af784cad634801f552 (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
/*
 * Copyright (C) 2010-2014 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_RMODIFIER_H
#define __WEECHAT_RMODIFIER_H 1

#include <regex.h>

#define weechat_plugin weechat_rmodifier_plugin
#define RMODIFIER_PLUGIN_NAME "rmodifier"

struct t_rmodifier
{
    char *name;                         /* name of rmodifier                */
    char *modifiers;                    /* modifiers                        */
    struct t_hook **hooks;              /* hooks for modifiers              */
    int hooks_count;                    /* number of hooks                  */
    char *str_regex;                    /* string with regex                */
    regex_t *regex;                     /* regex                            */
    char *groups;                       /* actions on groups in regex       */
                                        /* (keep, delete, hide)             */
    struct t_rmodifier *prev_rmodifier; /* link to previous rmodifier       */
    struct t_rmodifier *next_rmodifier; /* link to next rmodifier           */
};

extern struct t_rmodifier *rmodifier_list;
extern int rmodifier_count;

extern struct t_weechat_plugin *weechat_rmodifier_plugin;

extern int rmodifier_valid (struct t_rmodifier *rmodifier);
extern struct t_rmodifier *rmodifier_search (const char *name);
struct t_rmodifier *rmodifier_new (const char *name,
                                   const char *modifiers,
                                   const char *str_regex,
                                   const char *groups);
extern struct t_rmodifier *rmodifier_new_with_string (const char *name,
                                                      const char *value);
extern void rmodifier_create_default ();
extern int rmodifier_add_missing ();
extern void rmodifier_free (struct t_rmodifier *rmodifier);
extern void rmodifier_free_all ();
extern int rmodifier_add_to_infolist (struct t_infolist *infolist,
                                      struct t_rmodifier *rmodifier);
extern void rmodifier_print_log ();

#endif /* __WEECHAT_RMODIFIER_H */