make link timeout less aggressive
[fillybot.git] / shared.h
blob36e9094c324fb85ab8e423e6eda1a0cc5cc8166f
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, "unaffiliated/metool") || // Hope
30 !strcmp(host, "who.needs.pants.anyway") || // foxie
31 !strcmp(host, "assassin.for.hire") || // foxie
32 !strcmp(host, "bookworm.extraordinaire") || // foxie
33 !strcmp(host, "sweetie.belle") || // self
34 strcasestr(host, owner); // un1c0rn on other network
37 struct bio {
38 void (*writeline)(struct bio *b, const char *fmt, ...)
39 __attribute__ ((__format__ (__printf__, 2, 3)));
40 int (*fill)(struct bio *b);
41 int (*readline)(struct bio *b, char **line);
42 int (*poll)(struct bio *b, int timeout);
43 SSL *ssl;
44 int fd, maxlen, len, ofs;
45 char *priv;
46 long err;
49 void init_hook(struct bio *b, const char *target, const char *self, unsigned ponify);
51 void privmsg_hook(struct bio *b, const char *prefix, const char *ident, const char *host,
52 const char *const *args, unsigned nargs);
54 void command_hook(struct bio *b, const char *prefix, const char *ident, const char *host,
55 const char *command, const char *const *args, unsigned nargs);