/[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.12 - (hide annotations) (download) (as text)
Sun May 5 16:40:39 2002 UTC (17 years, 5 months ago) by tothwolf
Branch: MAIN
Changes since 1.11: +6 -4 lines
File MIME type: text/x-csrc
Grafted GPL header onto newer files.
Storing rcsid in binary files now.

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     * $Id$
26     */
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     int add_entry_type(struct user_entry_type *);
116     int del_entry_type(struct user_entry_type *);
117     struct user_entry_type *find_entry_type(char *);
118     struct user_entry *find_user_entry(struct user_entry_type *, struct userrec *);
119     void *get_user(struct user_entry_type *, struct userrec *);
120     int set_user(struct user_entry_type *, struct userrec *, void *);
121 wingman 1.11
122     void addignore(char *, char *, char *, time_t);
123     int delignore(char *);
124     void tell_ignores(int, char *);
125     int match_ignore(char *);
126     void check_expired_ignores();
127     void autolink_cycle(char *);
128     void tell_file_stats(int, char *);
129     void tell_user_ident(int, char *, int);
130     void tell_users_match(int, char *, int, int, int, char *);
131     int readuserfile(char *, struct userrec **);
132     void backup_userfile(void);
133 segfault 1.1
134 fabian 1.5 #define bot_flags(u) ((long)get_user(&USERENTRY_BOTFL, (u)))
135     #define is_bot(u) ((u) && ((u)->flags & USER_BOT))
136     #define is_master(u) ((u) && ((u)->flags & USER_MASTER))
137     #define is_owner(u) ((u) && ((u)->flags & USER_OWNER))
138 segfault 1.1
139 fabian 1.5 /* Fake users used to store ignores and bans
140     */
141 segfault 1.1 #define IGNORE_NAME "*ignore"
142     #define BAN_NAME "*ban"
143     #define EXEMPT_NAME "*exempt"
144     #define INVITE_NAME "*Invite"
145    
146 fabian 1.5 /* Channel-specific info
147     */
148 segfault 1.1 struct chanuserrec {
149     struct chanuserrec *next;
150     char channel[81];
151     time_t laston;
152     unsigned long flags;
153     unsigned long flags_udef;
154     char *info;
155     };
156    
157 fabian 1.5 /* New-style userlist
158     */
159 segfault 1.1 struct userrec {
160     struct userrec *next;
161     char handle[HANDLEN + 1];
162     unsigned long flags;
163     unsigned long flags_udef;
164     struct chanuserrec *chanrec;
165     struct user_entry *entries;
166     };
167    
168     struct igrec {
169     struct igrec *next;
170     char *igmask;
171     time_t expire;
172     char *user;
173     time_t added;
174     char *msg;
175     int flags;
176     };
177     extern struct igrec *global_ign;
178    
179     #define IGREC_PERM 2
180    
181 fabian 1.5 /*
182     * Note: Flags are in eggdrop.h
183     */
184 segfault 1.1
185     struct userrec *adduser();
186     struct userrec *get_user_by_handle(struct userrec *, char *);
187     struct userrec *get_user_by_host(char *);
188 fabian 1.2 struct userrec *get_user_by_nick(char *);
189 segfault 1.1 struct userrec *check_chanlist();
190     struct userrec *check_chanlist_hand();
191    
192 fabian 1.5 /* All the default userentry stuff, for code re-use
193     */
194 segfault 1.1 int def_unpack(struct userrec *u, struct user_entry *e);
195     int def_pack(struct userrec *u, struct user_entry *e);
196     int def_kill(struct user_entry *e);
197 fabian 1.5 int def_write_userfile(FILE *f, struct userrec *u, struct user_entry *e);
198 segfault 1.1 void *def_get(struct userrec *u, struct user_entry *e);
199     int def_set(struct userrec *u, struct user_entry *e, void *buf);
200     int def_gotshare(struct userrec *u, struct user_entry *e,
201     char *data, int idx);
202 fabian 1.5 int def_tcl_get(Tcl_Interp *interp, struct userrec *u,
203 segfault 1.1 struct user_entry *e, int argc, char **argv);
204 fabian 1.5 int def_tcl_set(Tcl_Interp *irp, struct userrec *u,
205 segfault 1.1 struct user_entry *e, int argc, char **argv);
206     void def_display(int idx, struct user_entry *e);
207     int def_dupuser(struct userrec *new, struct userrec *old,
208     struct user_entry *e);
209    
210 tothwolf 1.12 #endif /* !_EGG_USERS_H */

webmaster@eggheads.org
ViewVC Help
Powered by ViewVC 1.1.23