add !XdY alias
[fillybot.git] / shared.h
blob0f809a5a03e6077e4d7dafb3531ad9ed32812c37
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>
12 #include <openssl/ssl.h>
13 #include <openssl/rand.h>
14 #include <openssl/err.h>
16 #include "owner.h"
18 #define ALARM_TIME 240
20 static inline unsigned admin(const char *host)
22 if (!host)
23 return 0;
24 return !strcmp(host, "equestria") || // un1c0rn
25 !strcmp(host, "friendship.sgu.equ") || // robomint
26 !strcmp(host, "genres.i.dont.even") || // z0r8
27 !strcmp(host, "unaffiliated/apologue") || // foxeee
28 !strcmp(host, "lucky.break") || // Hope
29 !strcmp(host, "who.needs.pants.anyway") || // foxie
30 !strcmp(host, "assassin.for.hire") || // foxie
31 !strcmp(host, "sweetie.belle") || // self
32 strcasestr(host, owner); // un1c0rn on other network
35 struct bio {
36 void (*writeline)(struct bio *b, const char *fmt, ...)
37 __attribute__ ((__format__ (__printf__, 2, 3)));
38 int (*fill)(struct bio *b);
39 int (*readline)(struct bio *b, char **line);
40 int (*poll)(struct bio *b, int timeout);
41 SSL *ssl;
42 int fd, maxlen, len, ofs;
43 char *priv;
44 long err;
47 void init_hook(struct bio *b, const char *target, const char *self, unsigned ponify);
49 void privmsg_hook(struct bio *b, const char *prefix, const char *ident, const char *host,
50 const char *const *args, unsigned nargs);
52 void command_hook(struct bio *b, const char *prefix, const char *ident, const char *host,
53 const char *command, const char *const *args, unsigned nargs);