add ident to admin checking, and add hope
[fillybot.git] / shared.h
blob932abc9b9c69bb9ec681bf40a3c0e46b79381a9d
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 *ident, 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, "The.Gambler") || // Hope
29 !strcmp(host, "HaveConviction-WillTravel") || // Hope
30 !strcmp(host, "unaffiliated/metool") || // Hope
31 !strcmp(host, "Metool.user.gamesurge") || // Hope
32 (!strcmp(ident, "sid18823") && strstr(host, "gateway/web/irccloud.com/")) || // Hope
33 !strcmp(host, "who.needs.pants.anyway") || // foxie
34 !strcmp(host, "assassin.for.hire") || // foxie
35 !strcmp(host, "bookworm.extraordinaire") || // foxie
36 !strcmp(host, "the_Library") || // Foxie canternet
37 !strcmp(host, "sweetie.belle") || // self
38 strcasestr(host, owner); // un1c0rn on other network
41 struct bio {
42 void (*writeline)(struct bio *b, const char *fmt, ...)
43 __attribute__ ((__format__ (__printf__, 2, 3)));
44 int (*fill)(struct bio *b);
45 int (*readline)(struct bio *b, char **line);
46 int (*poll)(struct bio *b, int timeout);
47 SSL *ssl;
48 int fd, maxlen, len, ofs;
49 char *priv;
50 long err;
53 void init_hook(struct bio *b, const char *target, const char *self, unsigned ponify);
55 void privmsg_hook(struct bio *b, const char *prefix, const char *ident, const char *host,
56 const char *const *args, unsigned nargs);
58 void command_hook(struct bio *b, const char *prefix, const char *ident, const char *host,
59 const char *command, const char *const *args, unsigned nargs);