-
Notifications
You must be signed in to change notification settings - Fork 7
/
gseen.h
157 lines (140 loc) · 3.94 KB
/
gseen.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
/*
* Copyright (C) 2000,2001 Florian Sander
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
/* #define USE_MEMDEBUG 1 */
#define SEEN_JOIN 1
#define SEEN_PART 2
#define SEEN_SIGN 3
#define SEEN_NICK 4
#define SEEN_NCKF 5
#define SEEN_KICK 6
#define SEEN_SPLT 7
#define SEEN_REJN 8
#define SEEN_CHPT 9
#define SEEN_CHJN 10
typedef struct gseen_data {
int type;
char *nick;
char *host;
char *chan;
char *msg;
time_t when;
int spent;
} seendat;
typedef struct gseen_result {
struct gseen_result *next;
seendat *seen;
} gseenres;
typedef struct gseen_requests {
struct gseen_requests *next;
char *who;
char *host;
char *chan;
time_t when;
} seenreq_by;
typedef struct gseen_request {
struct gseen_request *next;
char *nick;
struct gseen_requests *by;
} seenreq;
typedef struct gseen_ignorewords {
struct gseen_ignorewords *next;
char *word;
} ignoredword;
#ifdef MAKING_GSEEN
static int gseen_expmem();
static void free_gseen();
static int get_spent(char *, char *);
static void write_seens();
static void read_seens();
static char *do_seen(char *, char *, char *, char *, int);
static void add_seenresult(seendat *);
static int expmem_seenresults();
static void free_seenresults();
static void sortresults();
static char *do_seennick(seendat *);
static int onchan(char *, char *);
static char *handonchan(char *, char *);
static struct chanset_t *onanychan(char *);
static struct chanset_t *handonanychan(char *);
static char *do_seenstats();
static void add_seenreq(char *, char *, char *, char *, time_t);
static int expmem_seenreq();
static void free_seenreq();
static void sortrequests(seenreq *);
static void report_seenreq(char *, char *);
static int count_seenreq(seenreq_by *b);
static int expmem_ignoredwords();
static void free_ignoredwords();
static void add_ignoredword(char *word);
static int word_is_ignored(char *word);
static void purge_seens();
static int seenflood();
static int secretchan(char *);
static int nopub(char *);
static int quietseen(char *);
static int quietaiseens(char *);
static int nolog(char *);
static void start_seentime_calc();
static void end_seentime_calc();
#endif
#ifdef MAKING_GSEEN
// tree stuff
static void maskstricthost(const char *, char *);
#endif
// interface for webseen
#define WS_OK 0
#define WS_NORESULT 1
#define WS_NOPARAM 2
#define WS_NOWILDCARDS 3
#define WS_TOOLONGNICK 4
#define WS_TOOMANYMATCHES 5
#define WS_TOOLONGHOST 6
#ifndef MAKING_GSEEN
#define findseens ((gseenres *(*)(char *, int *, int))gseen_funcs[4])
#define free_seenresults ((void (*)())gseen_funcs[5])
#define gseen_duration ((char *(*)(int))gseen_funcs[6])
#define numresults (*(int *)(gseen_funcs[12]))
#define fuzzy_search (*(int *)(gseen_funcs[13]))
#define numseens (*(int *)(gseen_funcs[15]))
#define glob_total_queries (*(int *)(gseen_funcs[16]))
#define glob_total_searchtime (*(double *)(gseen_funcs[17]))
#define gseen_numversion (*(int *)(gseen_funcs[19]))
#else
static gseenres *findseens(char *, int *, int);
static char *gseen_duration(int);
#endif
#ifdef MAKING_GSEEN
#ifdef malloc
#undef malloc
#endif
#ifdef free
#undef free
#endif
#ifdef realloc
#undef realloc
#endif
#ifdef USE_MEMDEBUG
#define my_malloc nmalloc
#define my_free nfree
#define my_realloc nrealloc
#else
#define my_malloc malloc
#define my_free free
#define my_realloc realloc
#endif
#endif