/[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.5 - (hide annotations) (download) (as text)
Sun Jan 30 19:26:21 2000 UTC (19 years, 8 months ago) by fabian
Branch: MAIN
CVS Tags: eggdrop105020, eggdrop10503, eggdrop10403
Changes since 1.4: +35 -22 lines
File MIME type: text/x-csrc
cleanup3 patch

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

webmaster@eggheads.org
ViewVC Help
Powered by ViewVC 1.1.23