| 1 |
/** |
| 2 |
* services.h: Data structures related to services psuedo-clients. |
| 3 |
* |
| 4 |
* Copyright © 2007 Pippijn van Steenhoven / The Ermyth Team |
| 5 |
* Rights to this code are as documented in COPYING. |
| 6 |
* |
| 7 |
* |
| 8 |
* Portions of this file were derived from sources bearing the following license: |
| 9 |
* Copyright © 2005 William Pitcock, et al. |
| 10 |
* Rights to this code are as documented in doc/pod/license.pod. |
| 11 |
* |
| 12 |
* $Id: services.h,v 1.6 2007-09-16 18:54:42 pippijn Exp $ |
| 13 |
*/ |
| 14 |
|
| 15 |
#ifndef SERVICES_H |
| 16 |
#define SERVICES_H |
| 17 |
|
| 18 |
#include <map> |
| 19 |
#include <stdexcept> |
| 20 |
#include <util/predicates.h> |
| 21 |
|
| 22 |
// service base class |
| 23 |
struct svs_t |
| 24 |
{ |
| 25 |
char *nick; /* the IRC client's nickname */ |
| 26 |
char *user; /* the IRC client's username */ |
| 27 |
char *host; /* the IRC client's hostname */ |
| 28 |
char *real; /* the IRC client's realname */ |
| 29 |
char *disp; /* the IRC client's dispname */ |
| 30 |
|
| 31 |
service_t *me; /* our service struct */ |
| 32 |
|
| 33 |
void cleanup () |
| 34 |
{ |
| 35 |
sfree (nick); |
| 36 |
sfree (user); |
| 37 |
sfree (host); |
| 38 |
sfree (real); |
| 39 |
} |
| 40 |
}; |
| 41 |
|
| 42 |
/* core services */ |
| 43 |
struct chansvs_t : svs_t |
| 44 |
{ |
| 45 |
bool fantasy; /* enable fantasy commands */ |
| 46 |
|
| 47 |
unsigned int ca_vop; /* xop access levels */ |
| 48 |
unsigned int ca_hop; |
| 49 |
unsigned int ca_aop; |
| 50 |
unsigned int ca_sop; |
| 51 |
|
| 52 |
char *trigger; /* trigger, e.g. !, ` or . */ |
| 53 |
|
| 54 |
bool changets; /* use TS to better deop people */ |
| 55 |
|
| 56 |
time_t expiry; /* expiry time */ |
| 57 |
|
| 58 |
unsigned maxchanacs; /* max entries in chanacs list */ |
| 59 |
unsigned maxfounders; /* max founders per channel */ |
| 60 |
}; |
| 61 |
|
| 62 |
struct globsvs_t : svs_t |
| 63 |
{ |
| 64 |
}; |
| 65 |
|
| 66 |
struct opersvs_t : svs_t |
| 67 |
{ |
| 68 |
}; |
| 69 |
|
| 70 |
struct memosvs_t : svs_t |
| 71 |
{ |
| 72 |
}; |
| 73 |
|
| 74 |
struct gamesvs_t : svs_t |
| 75 |
{ |
| 76 |
}; |
| 77 |
|
| 78 |
|
| 79 |
/* authentication services */ |
| 80 |
struct nicksvs_t : svs_t |
| 81 |
{ |
| 82 |
bool spam; |
| 83 |
bool no_nick_ownership; |
| 84 |
|
| 85 |
time_t expiry; /* expiry time */ |
| 86 |
}; |
| 87 |
|
| 88 |
struct saslsvs_t : svs_t |
| 89 |
{ |
| 90 |
}; |
| 91 |
|
| 92 |
/* help us keep consistent messages */ |
| 93 |
#define STR_INSUFFICIENT_PARAMS _("Insufficient parameters for \2%s\2.") |
| 94 |
#define STR_INVALID_PARAMS _("Invalid parameters for \2%s\2.") |
| 95 |
|
| 96 |
/* global.C */ |
| 97 |
E chansvs_t chansvs; |
| 98 |
E globsvs_t globsvs; |
| 99 |
E opersvs_t opersvs; |
| 100 |
E memosvs_t memosvs; |
| 101 |
E gamesvs_t gamesvs; |
| 102 |
E nicksvs_t nicksvs; |
| 103 |
E saslsvs_t saslsvs; |
| 104 |
|
| 105 |
/* services.c */ |
| 106 |
typedef std::pair<char const * const, service_t *> service_pair; |
| 107 |
typedef std::map<char const * const, service_t *, str_lt> service_map; |
| 108 |
E service_map services; |
| 109 |
|
| 110 |
E unsigned authservice_loaded; |
| 111 |
E int use_myuser_access; |
| 112 |
E int use_svsignore; |
| 113 |
|
| 114 |
E int ban (user_t *source, channel_t *chan, user_t *target); |
| 115 |
E int remove_banlike (user_t *source, channel_t *chan, int type, user_t *target); |
| 116 |
E int remove_ban_exceptions (user_t *source, channel_t *chan, user_t *target); |
| 117 |
E void join (char const * const chan, char const * const nick); |
| 118 |
E void joinall (char *name); |
| 119 |
E void part (char *chan, char *nick); |
| 120 |
E void partall (char *name); |
| 121 |
E void verbose (mychan_t *mychan, char const * const fmt, ...); |
| 122 |
E void snoop (char const * const fmt, ...); |
| 123 |
E void notice (char const * const from, char const * const to, char const * const message, ...); |
| 124 |
E void notice (char const * const from, char const * const to, char const * const message, va_list va); |
| 125 |
E void command_fail (sourceinfo_t *si, fault::code code, char const * const fmt, ...); |
| 126 |
E void command_success_nodata (sourceinfo_t *si, char const * const fmt, ...); |
| 127 |
E void command_success_string (sourceinfo_t *si, char const * const result, char const * const fmt, ...); |
| 128 |
E void command_success_table (sourceinfo_t *si, table_t * table); |
| 129 |
E char const *get_source_name (sourceinfo_t *si); |
| 130 |
E char const *get_source_mask (sourceinfo_t *si); |
| 131 |
E char const *get_oper_name (sourceinfo_t *si); |
| 132 |
E void wallops (char const * const msg, ...); |
| 133 |
E void verbose_wallops (char const * const msg, ...); |
| 134 |
|
| 135 |
/* ptasks.c */ |
| 136 |
E void handle_topic (channel_t *c, char const * const setter, time_t ts, char const * const topic); |
| 137 |
E int floodcheck (user_t *u, user_t *t); |
| 138 |
|
| 139 |
/* ctcp-common.c */ |
| 140 |
E void common_ctcp_init (void); |
| 141 |
E unsigned int handle_ctcp_common (sourceinfo_t *si, char *, char *); |
| 142 |
|
| 143 |
#endif |