]> jfr.im git - irc/quakenet/newserv.git/blob - nterface/nterfacer_relay.h
af673dcd45938d91e5c6eeed986b34148fe0a6e0
[irc/quakenet/newserv.git] / nterface / nterfacer_relay.h
1 /*
2 nterfacer relay4
3 Copyright (C) 2004 Chris Porter.
4 */
5
6 #ifndef __nterfacer_relay_H
7 #define __nterfacer_relay_H
8
9 #include <pcre.h>
10
11 #include "../lib/sstring.h"
12 #include "../localuser/localuserchannel.h"
13 #include "nterfacer.h"
14
15 #define MESSAGE_TIMEOUT 10
16
17 #define RELAY_PARSE_ERROR 0x01
18 #define RELAY_NICK_NOT_FOUND 0x02
19 #define RELAY_MEMORY_ERROR 0x03
20 #define RELAY_UNLOADED 0x04
21 #define RELAY_KILLED 0x05
22 #define RELAY_OVER_BUFFER 0x06 /* deprecated, use BF_OVER instead */
23 #define RELAY_NICK_ERROR 0x07
24 #define RELAY_TIMEOUT 0x08
25 #define RELAY_TARGET_LEFT 0x09
26 #define RELAY_O_AUTH_ERROR 0x0A
27 #define RELAY_REGEX_ERROR 0x0B
28 #define RELAY_REGEX_HINT_ERROR 0x0C
29 #define RELAY_NOT_ON_IRC 0x0D
30 #define RELAY_DISCONNECTED 0x0E
31 #define RELAY_SERVER_NOT_FOUND 0x0F
32 #define RELAY_INVALID_COMMAND 0x10
33 #define RELAY_INVALID_CHARS 0x11
34
35 #define MODE_TAG 0x01
36 #define MODE_LINES 0x02
37 #define MODE_IS_O 0x04
38 #define MODE_O_AUTH1 0x08
39 #define MODE_O_AUTH2 0x10
40 #define MODE_STATS 0x20
41
42 #define PCRE_FLAGS PCRE_CASELESS | PCRE_ANCHORED
43
44 #define DEFAULT_NICK_PREFIX "nterfacer"
45
46 #define dispose_rld(a) dispose_rld_dontquit(a, 0)
47
48 typedef struct regex {
49 pcre *phrase;
50 pcre_extra *hint;
51 } regex;
52
53 typedef struct rld {
54 short mode;
55 union {
56 int remaining_lines;
57 regex pcre;
58 } termination;
59 struct rline *rline;
60 nick *nick;
61 nick *dest;
62 struct rld *next;
63 void *schedule;
64 } rld;
65
66 struct rld *list = NULL;
67
68 int relay_handler(struct rline *ri, int argc, char **argv);
69 void relay_messages(nick *target, int messagetype, void **args);
70 void dispose_rld_prev(struct rld *item, struct rld *prev);
71 void dispose_rld_dontquit(struct rld *item, int dontquit);
72 void relay_timeout(void *arg);
73 void relay_quits(int hook, void *args);
74 void relay_disconnect(int hook, void *args);
75 void relay_rehash(int hook, void *args);
76 int load_config(void);
77
78 #endif