add more derps
[fillybot.git] / shared.h
blob079151314e8a06c7a89e41f23538b296475c969e
1 #define _GNU_SOURCE
2 #include <features.h>
3 #include <fcntl.h>
4 #include <stdio.h>
5 #include <assert.h>
6 #include <stdlib.h>
7 #include <unistd.h>
8 #include <string.h>
9 #include <errno.h>
10 #include <poll.h>
11 #include <stdarg.h>
13 #include "owner.h"
15 static inline unsigned admin(const char *host)
17 if (!host)
18 return 0;
19 return !strcmp(host, "equestria") || !strcmp(host, "roboponies.equ") || !strcmp(host, "genres.i.dont.even") || strcasestr(host, owner);
22 struct bio {
23 void (*writeline)(struct bio *b, const char *fmt, ...)
24 __attribute__ ((__format__ (__printf__, 2, 3)));
25 int (*fill)(struct bio *b);
26 int (*readline)(struct bio *b, char **line);
27 int (*poll)(struct bio *b, int timeout);
28 void *ssl;
29 int fd, maxlen, len, ofs;
30 char *priv;
31 long err;
34 void init_hook(struct bio *b, const char *target, const char *self, unsigned ponify);
36 void privmsg_hook(struct bio *b, const char *prefix, const char *ident, const char *host,
37 const char *const *args, unsigned nargs);
39 void command_hook(struct bio *b, const char *prefix, const char *ident, const char *host,
40 const char *command, const char *const *args, unsigned nargs);