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

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

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


Revision 1.4 - (hide annotations) (download) (as text)
Wed Sep 8 06:30:55 1999 UTC (20 years ago) by poptix
Branch: MAIN
Changes since 1.3: +3 -0 lines
File MIME type: text/x-csrc
: Committing in .
: more of fabian's ereet patch3s ;)
: Modified Files:
: 	Makefile eggdrop.conf.dist help/core.help src/botmsg.c
: 	src/cmds.c src/main.h src/modules.h src/patch.h src/proto.h
: 	src/tclegg.h src/tclhash.c src/userent.c src/users.h
: 	src/mod/filesys.mod/filesys.h

1 segfault 1.1 /* structures and definitions used by users.c & userrec.c */
2     /*
3     * This file is part of the eggdrop source code
4     * copyright (c) 1997 Robey Pointer
5     * and is distributed according to the GNU general public license.
6     * For full details, read the top of 'main.c' or the file called
7     * COPYING that was distributed with this code.
8     */
9    
10     #ifndef _H_USERS
11     #define _H_USERS
12    
13     /* list functions :) , next *must* be the 1st item in the struct */
14     struct list_type {
15     struct list_type *next;
16     char *extra;
17     };
18    
19     #define list_insert(a,b) { b->next = *a; *a = b; }
20     int list_append(struct list_type **, struct list_type *);
21     int list_delete(struct list_type **, struct list_type *);
22     int list_contains(struct list_type *, struct list_type *);
23    
24     /* new userfile format stuff */
25     struct userrec;
26     struct user_entry;
27     struct user_entry_type {
28     struct user_entry_type *next;
29     int (*got_share) (struct userrec *, struct user_entry *, char *, int);
30     int (*dup_user) (struct userrec *, struct userrec *,
31     struct user_entry *);
32     int (*unpack) (struct userrec *, struct user_entry *);
33     int (*pack) (struct userrec *, struct user_entry *);
34     int (*write_userfile) (FILE *, struct userrec *, struct user_entry *);
35     int (*kill) (struct user_entry *);
36     void *(*get) (struct userrec *, struct user_entry *);
37     int (*set) (struct userrec *, struct user_entry *, void *);
38     int (*tcl_get) (Tcl_Interp *, struct userrec *, struct user_entry *,
39     int, char **);
40     int (*tcl_set) (Tcl_Interp *, struct userrec *, struct user_entry *,
41     int, char **);
42     int (*expmem) (struct user_entry *);
43     void (*display) (int idx, struct user_entry *);
44     char *name;
45     };
46    
47     #ifndef MAKING_MODS
48     extern struct user_entry_type USERENTRY_EMAIL, USERENTRY_COMMENT, USERENTRY_LASTON,
49     USERENTRY_XTRA, USERENTRY_INFO, USERENTRY_BOTADDR, USERENTRY_HOSTS,
50     USERENTRY_PASS, USERENTRY_BOTFL, USERENTRY_URL;
51    
52     #endif
53    
54     struct laston_info {
55     time_t laston;
56     char *lastonplace;
57     };
58    
59     struct bot_addr {
60     int telnet_port;
61     int relay_port;
62     char *address;
63     };
64    
65     struct user_entry {
66     struct user_entry *next;
67     struct user_entry_type *type;
68     union {
69     char *string;
70     void *extra;
71     struct list_type *list;
72     unsigned long ulong;
73     } u;
74     char *name;
75     };
76    
77     struct xtra_key {
78     struct xtra_key *next;
79     char *key;
80     char *data;
81     };
82    
83     struct filesys_stats {
84     int uploads;
85     int upload_ks;
86     int dnloads;
87     int dnload_ks;
88     };
89    
90     void *_user_malloc(int, char *, int);
91 poptix 1.3 void *_user_realloc(void *, int, char *, int);
92 segfault 1.1
93     #ifndef MAKING_MODS
94     #define user_malloc(x) _user_malloc(x,__FILE__,__LINE__)
95 poptix 1.3 #define user_realloc(x,y) _user_realloc(x,y,__FILE__,__LINE__)
96 segfault 1.1 #endif
97     int add_entry_type(struct user_entry_type *);
98     int del_entry_type(struct user_entry_type *);
99     struct user_entry_type *find_entry_type(char *);
100     struct user_entry *find_user_entry(struct user_entry_type *, struct userrec *);
101     void *get_user(struct user_entry_type *, struct userrec *);
102     int set_user(struct user_entry_type *, struct userrec *, void *);
103    
104     #define bot_flags(u) ((long)get_user(&USERENTRY_BOTFL,u))
105     #define is_bot(u) (u && (u->flags & USER_BOT))
106     #define is_master(u) (u && (u->flags & USER_MASTER))
107     #define is_owner(u) (u && (u->flags & USER_OWNER))
108    
109     /* fake users used to store ignores and bans */
110     #define IGNORE_NAME "*ignore"
111     #define BAN_NAME "*ban"
112     #define EXEMPT_NAME "*exempt"
113 arthur2 1.2 #define INVITE_NAME "*Invite"
114 segfault 1.1
115     /* channel-specific info */
116     struct chanuserrec {
117     struct chanuserrec *next;
118     char channel[81];
119     time_t laston;
120     unsigned long flags;
121     unsigned long flags_udef;
122     char *info;
123     };
124    
125     /* new-style userlist */
126     struct userrec {
127     struct userrec *next;
128     char handle[HANDLEN + 1];
129     unsigned long flags;
130     unsigned long flags_udef;
131     struct chanuserrec *chanrec;
132     struct user_entry *entries;
133     };
134    
135     /* let's get neat, a struct for each */
136     struct banrec {
137     struct banrec *next;
138     char *banmask;
139     time_t expire;
140     time_t added;
141     time_t lastactive;
142     char *user;
143     char *desc;
144     int flags;
145     };
146     extern struct banrec *global_bans;
147    
148     #define BANREC_STICKY 1
149     #define BANREC_PERM 2
150    
151     struct igrec {
152     struct igrec *next;
153     char *igmask;
154     time_t expire;
155     char *user;
156     time_t added;
157     char *msg;
158     int flags;
159     };
160     extern struct igrec *global_ign;
161    
162     #define IGREC_PERM 2
163 arthur2 1.2
164     struct exemptrec {
165     struct exemptrec * next;
166     char * exemptmask;
167     time_t expire;
168     time_t added;
169     time_t lastactive;
170     char * user;
171     char * desc;
172     int flags;
173     };
174     extern struct exemptrec * global_exempts;
175    
176     #define EXEMPTREC_STICKY 1
177     #define EXEMPTREC_PERM 2
178    
179     struct inviterec {
180     struct inviterec * next;
181     char * invitemask;
182     time_t expire;
183     time_t added;
184     time_t lastactive;
185     char * user;
186     char * desc;
187     int flags;
188     };
189     extern struct inviterec * global_invites;
190    
191     #define INVITEREC_STICKY 1
192     #define INVITEREC_PERM 2
193 segfault 1.1
194     /* flags are in eggdrop.h */
195    
196     struct userrec *adduser();
197     struct userrec *get_user_by_handle(struct userrec *, char *);
198     struct userrec *get_user_by_host(char *);
199     struct userrec *check_chanlist();
200     struct userrec *check_chanlist_hand();
201    
202     /* all the default userentry stuff, for code re-use */
203     int def_unpack(struct userrec *u, struct user_entry *e);
204     int def_pack(struct userrec *u, struct user_entry *e);
205     int def_kill(struct user_entry *e);
206     int def_write_userfile(FILE * f, struct userrec *u, struct user_entry *e);
207     void *def_get(struct userrec *u, struct user_entry *e);
208     int def_set(struct userrec *u, struct user_entry *e, void *buf);
209     int def_gotshare(struct userrec *u, struct user_entry *e,
210     char *data, int idx);
211     int def_tcl_get(Tcl_Interp * interp, struct userrec *u,
212     struct user_entry *e, int argc, char **argv);
213     int def_tcl_set(Tcl_Interp * irp, struct userrec *u,
214     struct user_entry *e, int argc, char **argv);
215     int def_expmem(struct user_entry *e);
216     void def_display(int idx, struct user_entry *e);
217     int def_dupuser(struct userrec *new, struct userrec *old,
218     struct user_entry *e);
219    
220 poptix 1.4 /* key name in the XTRA list for note ignore masks */
221     #define NOTES_IGNKEY "NOTESIGNORE"
222    
223 segfault 1.1 #endif

webmaster@eggheads.org
ViewVC Help
Powered by ViewVC 1.1.23