/[cvs]/eggdrop1.9/src/users.h
ViewVC logotype

Annotation of /eggdrop1.9/src/users.h

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.13 - (hide annotations) (download) (as text)
Sun May 12 15:35:44 2002 UTC (17 years, 5 months ago) by ite
Branch: MAIN
Changes since 1.12: +2 -1 lines
File MIME type: text/x-csrc
* Now always preforking
* More minor configure macros cleanup
* Let's try to detect JS_NewObject() instead of JS_Now() for javascript library detection.
* Js headers to be corectly detected when --with-jsinc isn't passed to ./configure

1 guppy 1.8 /*
2 tothwolf 1.12 * users.h --
3 guppy 1.8 *
4 tothwolf 1.12 * structures and definitions used by users.c and userrec.c
5 fabian 1.3 */
6 guppy 1.8 /*
7     * Copyright (C) 1997 Robey Pointer
8 wcc 1.10 * Copyright (C) 1999, 2000, 2001, 2002 Eggheads Development Team
9 guppy 1.8 *
10 fabian 1.3 * This program is free software; you can redistribute it and/or
11     * modify it under the terms of the GNU General Public License
12     * as published by the Free Software Foundation; either version 2
13     * of the License, or (at your option) any later version.
14 guppy 1.8 *
15 fabian 1.3 * This program is distributed in the hope that it will be useful,
16     * but WITHOUT ANY WARRANTY; without even the implied warranty of
17     * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18     * GNU General Public License for more details.
19 guppy 1.8 *
20 fabian 1.3 * You should have received a copy of the GNU General Public License
21     * along with this program; if not, write to the Free Software
22     * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
23 segfault 1.1 */
24 tothwolf 1.12 /*
25 ite 1.13 * $Id: users.h,v 1.12 2002/05/05 16:40:39 tothwolf Exp $
26 tothwolf 1.12 */
27 segfault 1.1
28 fabian 1.3 #ifndef _EGG_USERS_H
29     #define _EGG_USERS_H
30 segfault 1.1
31 wingman 1.11 #include "tclegg.h" /* Tcl_Interp */
32    
33 fabian 1.5 /* List functions :) , next *must* be the 1st item in the struct */
34 segfault 1.1 struct list_type {
35     struct list_type *next;
36     char *extra;
37     };
38    
39 fabian 1.5 #define list_insert(a,b) { \
40     (b)->next = *(a); \
41     *(a) = (b); \
42     }
43 segfault 1.1 int list_append(struct list_type **, struct list_type *);
44     int list_delete(struct list_type **, struct list_type *);
45     int list_contains(struct list_type *, struct list_type *);
46    
47 fabian 1.5
48     /* New userfile format stuff
49     */
50 segfault 1.1 struct userrec;
51     struct user_entry;
52     struct user_entry_type {
53     struct user_entry_type *next;
54     int (*got_share) (struct userrec *, struct user_entry *, char *, int);
55     int (*dup_user) (struct userrec *, struct userrec *,
56     struct user_entry *);
57     int (*unpack) (struct userrec *, struct user_entry *);
58     int (*pack) (struct userrec *, struct user_entry *);
59     int (*write_userfile) (FILE *, struct userrec *, struct user_entry *);
60     int (*kill) (struct user_entry *);
61     void *(*get) (struct userrec *, struct user_entry *);
62     int (*set) (struct userrec *, struct user_entry *, void *);
63     int (*tcl_get) (Tcl_Interp *, struct userrec *, struct user_entry *,
64     int, char **);
65     int (*tcl_set) (Tcl_Interp *, struct userrec *, struct user_entry *,
66     int, char **);
67     void (*display) (int idx, struct user_entry *);
68     char *name;
69     };
70    
71 fabian 1.5
72 segfault 1.1 #ifndef MAKING_MODS
73 fabian 1.6 extern struct user_entry_type USERENTRY_COMMENT, USERENTRY_LASTON,
74     USERENTRY_XTRA, USERENTRY_INFO, USERENTRY_BOTADDR, USERENTRY_HOSTS,
75     USERENTRY_PASS, USERENTRY_BOTFL;
76 fabian 1.5 #endif
77 segfault 1.1
78    
79     struct laston_info {
80     time_t laston;
81     char *lastonplace;
82     };
83    
84     struct bot_addr {
85     int telnet_port;
86     int relay_port;
87     char *address;
88     };
89    
90     struct user_entry {
91     struct user_entry *next;
92     struct user_entry_type *type;
93     union {
94     char *string;
95     void *extra;
96     struct list_type *list;
97     unsigned long ulong;
98     } u;
99     char *name;
100     };
101    
102     struct xtra_key {
103     struct xtra_key *next;
104     char *key;
105     char *data;
106     };
107    
108     struct filesys_stats {
109     int uploads;
110     int upload_ks;
111     int dnloads;
112     int dnload_ks;
113     };
114    
115 ite 1.13 int user_init();
116 segfault 1.1 int add_entry_type(struct user_entry_type *);
117     int del_entry_type(struct user_entry_type *);
118     struct user_entry_type *find_entry_type(char *);
119     struct user_entry *find_user_entry(struct user_entry_type *, struct userrec *);
120     void *get_user(struct user_entry_type *, struct userrec *);
121     int set_user(struct user_entry_type *, struct userrec *, void *);
122 wingman 1.11
123     void addignore(char *, char *, char *, time_t);
124     int delignore(char *);
125     void tell_ignores(int, char *);
126     int match_ignore(char *);
127     void check_expired_ignores();
128     void autolink_cycle(char *);
129     void tell_file_stats(int, char *);
130     void tell_user_ident(int, char *, int);
131     void tell_users_match(int, char *, int, int, int, char *);
132     int readuserfile(char *, struct userrec **);
133     void backup_userfile(void);
134 segfault 1.1
135 fabian 1.5 #define bot_flags(u) ((long)get_user(&USERENTRY_BOTFL, (u)))
136     #define is_bot(u) ((u) && ((u)->flags & USER_BOT))
137     #define is_master(u) ((u) && ((u)->flags & USER_MASTER))
138     #define is_owner(u) ((u) && ((u)->flags & USER_OWNER))
139 segfault 1.1
140 fabian 1.5 /* Fake users used to store ignores and bans
141     */
142 segfault 1.1 #define IGNORE_NAME "*ignore"
143     #define BAN_NAME "*ban"
144     #define EXEMPT_NAME "*exempt"
145     #define INVITE_NAME "*Invite"
146    
147 fabian 1.5 /* Channel-specific info
148     */
149 segfault 1.1 struct chanuserrec {
150     struct chanuserrec *next;
151     char channel[81];
152     time_t laston;
153     unsigned long flags;
154     unsigned long flags_udef;
155     char *info;
156     };
157    
158 fabian 1.5 /* New-style userlist
159     */
160 segfault 1.1 struct userrec {
161     struct userrec *next;
162     char handle[HANDLEN + 1];
163     unsigned long flags;
164     unsigned long flags_udef;
165     struct chanuserrec *chanrec;
166     struct user_entry *entries;
167     };
168    
169     struct igrec {
170     struct igrec *next;
171     char *igmask;
172     time_t expire;
173     char *user;
174     time_t added;
175     char *msg;
176     int flags;
177     };
178     extern struct igrec *global_ign;
179    
180     #define IGREC_PERM 2
181    
182 fabian 1.5 /*
183     * Note: Flags are in eggdrop.h
184     */
185 segfault 1.1
186     struct userrec *adduser();
187     struct userrec *get_user_by_handle(struct userrec *, char *);
188     struct userrec *get_user_by_host(char *);
189 fabian 1.2 struct userrec *get_user_by_nick(char *);
190 segfault 1.1 struct userrec *check_chanlist();
191     struct userrec *check_chanlist_hand();
192    
193 fabian 1.5 /* All the default userentry stuff, for code re-use
194     */
195 segfault 1.1 int def_unpack(struct userrec *u, struct user_entry *e);
196     int def_pack(struct userrec *u, struct user_entry *e);
197     int def_kill(struct user_entry *e);
198 fabian 1.5 int def_write_userfile(FILE *f, struct userrec *u, struct user_entry *e);
199 segfault 1.1 void *def_get(struct userrec *u, struct user_entry *e);
200     int def_set(struct userrec *u, struct user_entry *e, void *buf);
201     int def_gotshare(struct userrec *u, struct user_entry *e,
202     char *data, int idx);
203 fabian 1.5 int def_tcl_get(Tcl_Interp *interp, struct userrec *u,
204 segfault 1.1 struct user_entry *e, int argc, char **argv);
205 fabian 1.5 int def_tcl_set(Tcl_Interp *irp, struct userrec *u,
206 segfault 1.1 struct user_entry *e, int argc, char **argv);
207     void def_display(int idx, struct user_entry *e);
208     int def_dupuser(struct userrec *new, struct userrec *old,
209     struct user_entry *e);
210    
211 tothwolf 1.12 #endif /* !_EGG_USERS_H */

webmaster@eggheads.org
ViewVC Help
Powered by ViewVC 1.1.23