-
Notifications
You must be signed in to change notification settings - Fork 0
/
eiwic.h
237 lines (193 loc) · 4.01 KB
/
eiwic.h
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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
/******************************************************************************
* eiwic - Extensible Ircbot Written In C
* Copyright (C) Hannes Graeuler <lordi@styleliga.org>
*
* eiwic.h: Main header file.
****************************************************************************/
#ifndef _EIWIC_H_INCLUDED
#define _EIWIC_H_INCLUDED
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <setjmp.h>
#include <sys/types.h>
typedef u_char *STRING;
#ifndef NAME
#define NAME "eiwic"
#endif
#ifndef VERSION
#define VERSION "1.1.4"
#endif
#define AUTHOR "Hannes Graeuler <lordi@styleliga.org>"
#define EIWIC_HOMEPAGE "http://lordi.styleliga.org/Eiwic"
#define MSG struct eiwic_ircmsg
#define PLUGIN struct eiwic_plugin
#define TRIGGER struct eiwic_plugin_trigger
#define TIMER struct eiwic_plugin_timer
#define GLOBAL struct eiwic_glob
#define CHANNEL struct eiwic_channel
#define SETTING struct eiwic_setting
#define MODLINK struct eiwic_modlink
#define OUTPUT struct eiwic_output
enum _LOG_VERBOSE_LEVELS {
LOG_ERROR = 0,
LOG_WARNING,
LOG_STATUS,
LOG_DEBUG,
LOG_INIT_DEBUG,
#ifdef VV_DEBUG
LOG_VERBOSE_DEBUG,
#else
LOG_VERBOSE_DEBUG_DONT_USE,
#endif
LOG_MISC,
LOG_PLUGIN_OUTPUT
};
enum _TRIGGER_FLAGS {
TRIG_PUBLIC = 0x02,
TRIG_PRIVATE = 0x04,
TRIG_ADMIN = 0x08
};
enum _SETTING_TYPES {
SET_BOOL = 0,
SET_INT,
SET_FLOAT,
SET_STRING, /* 128 chars max */
SET_LONGSTRING /* unlimited length (be careful) */
};
enum _OUTPUT_TYPES {
OP_EAT = 0,
OP_LOG,
OP_QUERY,
OP_NOTICE,
OP_CHANNEL,
OP_SERVER,
OP_SERVER_INPUT,
OP_FILE,
OP_FORWARD,
OP_DOUBLE
};
enum _OUTPUT_BUFFER_TYPES {
OB_NONE = 0,
OB_LINE,
OB_SERVER
};
#define SEGWARN(module,routine) \
log(LOG_WARNING, "Segmentation fault in module %s.%s()",\
(module)->name, routine);
#define MIN(x1,x2) \
(((x1)<(x2))?(x1):(x2))
GLOBAL;
MSG;
TRIGGER;
OUTPUT;
#include "dlist.h"
#include "users.h"
#include "servers.h"
void irc_parse(struct eiwic_ircmsg *);
void irc_resolve(char *, struct eiwic_ircmsg *);
typedef int (*e_trigger_f)(char *, OUTPUT *, MSG *);
typedef void (*e_timer_f)(void *);
CHANNEL {
u_char name[128];
int joined;
OUTPUT *output;
};
MSG {
u_short cmd_num;
u_char is_server;
u_char cmd[10], to[50], args[512];
u_char nick[30], username[30], host[512];
u_char server[64];
CHANNEL *channel;
USER *user;
};
PLUGIN {
u_char filename[255];
u_char name[20];
char inited;
void *handle;
void *modlink;
OUTPUT *init_out;
int (*ep_init)(GLOBAL *, PLUGIN *, OUTPUT *);
int (*ep_main)(OUTPUT *);
int (*ep_unload)(OUTPUT *);
int (*ep_parse)(MSG *);
int (*ep_trigger)(TRIGGER *, OUTPUT *, MSG *);
int (*ep_help)(OUTPUT *);
};
TRIGGER {
u_char trigger[30];
e_trigger_f func;
u_int flags;
PLUGIN *plugin;
};
TIMER {
u_long time;
e_timer_f func;
void *data;
PLUGIN *plugin;
};
SETTING {
char label[64];
int type;
union {
char *d_string;
float d_float;
long d_int;
} data;
};
OUTPUT {
u_int op_id;
u_int op_type;
u_int op_buffered;
union {
USER *d_user; /* output to a user (query) */
CHANNEL *d_channel; /* output to a channel */
OUTPUT *d_output; /* output forward to another output */
SERVER *d_server; /* output to a server */
struct {
OUTPUT *f1,*f2;
} d_double;
int d_loglevel; /* OP_LOG */
} data;
u_char *op_buffer;
};
GLOBAL {
u_int var_socket;
u_char quit, logged_in;
u_char botnick[30];
u_char vvd_section[40];
u_char *vvd_param;
/*u_char *b_send;*/
u_char mod_need_init;
sigjmp_buf jmp_past;
u_char jump_back;
int time_launched;
int var_bytes;
int var_highest_output;
int var_daemon;
int var_log;
int var_verbose;
int var_noconnect;
u_char var_logfilename[128];
u_char var_testtrigger[300];
FILE *var_logfile;
void *modlink;
OUTPUT *server_output, *log_output, *server_input, *plugin_output;
SERVER *server, *proxy;
DList
plugins,
triggers,
timers,
connections,
channels,
servers,
users,
settings,
outputs;
};
extern GLOBAL *e_global;
extern PLUGIN *plugin;
#endif /* _EIWIC_H_INCLUDED */