/[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.19 - (hide annotations) (download) (as text)
Tue Feb 25 06:52:19 2003 UTC (16 years, 7 months ago) by stdarg
Branch: MAIN
Changes since 1.18: +3 -11 lines
File MIME type: text/x-csrc
* Well, I think Tcl is finally removed from the core (except for detection/configuration).

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.17 * Copyright (C) 1999, 2000, 2001, 2002, 2003 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 stdarg 1.19 * $Id: users.h,v 1.18 2003/02/15 05:04:58 wcc 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 fabian 1.5 /* List functions :) , next *must* be the 1st item in the struct */
32 segfault 1.1 struct list_type {
33     struct list_type *next;
34     char *extra;
35     };
36    
37 fabian 1.5 #define list_insert(a,b) { \
38     (b)->next = *(a); \
39     *(a) = (b); \
40     }
41 segfault 1.1 int list_append(struct list_type **, struct list_type *);
42     int list_delete(struct list_type **, struct list_type *);
43     int list_contains(struct list_type *, struct list_type *);
44    
45 fabian 1.5
46     /* New userfile format stuff
47     */
48 segfault 1.1 struct userrec;
49     struct user_entry;
50     struct user_entry_type {
51     struct user_entry_type *next;
52     int (*got_share) (struct userrec *, struct user_entry *, char *, int);
53 wcc 1.18 int (*dup_user) (struct userrec *, struct userrec *, struct user_entry *);
54 segfault 1.1 int (*unpack) (struct userrec *, struct user_entry *);
55     int (*pack) (struct userrec *, struct user_entry *);
56     int (*write_userfile) (FILE *, struct userrec *, struct user_entry *);
57     int (*kill) (struct user_entry *);
58     void *(*get) (struct userrec *, struct user_entry *);
59     int (*set) (struct userrec *, struct user_entry *, void *);
60 stdarg 1.19 void *ignore1;
61     void *ignore2;
62 segfault 1.1 void (*display) (int idx, struct user_entry *);
63     char *name;
64     };
65    
66 fabian 1.5
67 segfault 1.1 #ifndef MAKING_MODS
68 fabian 1.6 extern struct user_entry_type USERENTRY_COMMENT, USERENTRY_LASTON,
69     USERENTRY_XTRA, USERENTRY_INFO, USERENTRY_BOTADDR, USERENTRY_HOSTS,
70     USERENTRY_PASS, USERENTRY_BOTFL;
71 fabian 1.5 #endif
72 segfault 1.1
73    
74     struct laston_info {
75     time_t laston;
76     char *lastonplace;
77     };
78    
79     struct bot_addr {
80     int telnet_port;
81     int relay_port;
82     char *address;
83     };
84    
85     struct user_entry {
86     struct user_entry *next;
87     struct user_entry_type *type;
88     union {
89     char *string;
90     void *extra;
91     struct list_type *list;
92     unsigned long ulong;
93     } u;
94     char *name;
95     };
96    
97     struct xtra_key {
98     struct xtra_key *next;
99     char *key;
100     char *data;
101     };
102    
103     struct filesys_stats {
104     int uploads;
105     int upload_ks;
106     int dnloads;
107     int dnload_ks;
108     };
109    
110 ite 1.13 int user_init();
111 segfault 1.1 int add_entry_type(struct user_entry_type *);
112     int del_entry_type(struct user_entry_type *);
113     struct user_entry_type *find_entry_type(char *);
114     struct user_entry *find_user_entry(struct user_entry_type *, struct userrec *);
115     void *get_user(struct user_entry_type *, struct userrec *);
116     int set_user(struct user_entry_type *, struct userrec *, void *);
117 wingman 1.11
118     void addignore(char *, char *, char *, time_t);
119     int delignore(char *);
120     void tell_ignores(int, char *);
121     int match_ignore(char *);
122     void check_expired_ignores();
123     void tell_file_stats(int, char *);
124     void tell_user_ident(int, char *, int);
125     void tell_users_match(int, char *, int, int, int, char *);
126     int readuserfile(char *, struct userrec **);
127     void backup_userfile(void);
128 segfault 1.1
129 fabian 1.5 #define bot_flags(u) ((long)get_user(&USERENTRY_BOTFL, (u)))
130     #define is_bot(u) ((u) && ((u)->flags & USER_BOT))
131     #define is_master(u) ((u) && ((u)->flags & USER_MASTER))
132     #define is_owner(u) ((u) && ((u)->flags & USER_OWNER))
133 segfault 1.1
134 fabian 1.5 /* Fake users used to store ignores and bans
135     */
136 segfault 1.1 #define IGNORE_NAME "*ignore"
137     #define BAN_NAME "*ban"
138     #define EXEMPT_NAME "*exempt"
139     #define INVITE_NAME "*Invite"
140    
141 fabian 1.5 /* Channel-specific info
142     */
143 segfault 1.1 struct chanuserrec {
144     struct chanuserrec *next;
145     char channel[81];
146     time_t laston;
147     unsigned long flags;
148     unsigned long flags_udef;
149     char *info;
150     };
151    
152 fabian 1.5 /* New-style userlist
153     */
154 segfault 1.1 struct userrec {
155     struct userrec *next;
156     char handle[HANDLEN + 1];
157     unsigned long flags;
158     unsigned long flags_udef;
159     struct chanuserrec *chanrec;
160     struct user_entry *entries;
161     };
162 stdarg 1.14
163 segfault 1.1 struct igrec {
164     struct igrec *next;
165     char *igmask;
166     time_t expire;
167     char *user;
168     time_t added;
169     char *msg;
170     int flags;
171     };
172     extern struct igrec *global_ign;
173    
174     #define IGREC_PERM 2
175    
176 fabian 1.5 /*
177     * Note: Flags are in eggdrop.h
178     */
179 segfault 1.1
180     struct userrec *adduser();
181 stdarg 1.14 struct userrec *get_user_by_handle(struct userrec *, const char *);
182     user_t *get_user_authed(char *handle, char *pass);
183 segfault 1.1 struct userrec *get_user_by_host(char *);
184 fabian 1.2 struct userrec *get_user_by_nick(char *);
185 segfault 1.1 struct userrec *check_chanlist();
186     struct userrec *check_chanlist_hand();
187    
188 fabian 1.5 /* All the default userentry stuff, for code re-use
189     */
190 segfault 1.1 int def_unpack(struct userrec *u, struct user_entry *e);
191     int def_pack(struct userrec *u, struct user_entry *e);
192     int def_kill(struct user_entry *e);
193 fabian 1.5 int def_write_userfile(FILE *f, struct userrec *u, struct user_entry *e);
194 segfault 1.1 void *def_get(struct userrec *u, struct user_entry *e);
195     int def_set(struct userrec *u, struct user_entry *e, void *buf);
196     int def_gotshare(struct userrec *u, struct user_entry *e,
197     char *data, int idx);
198     void def_display(int idx, struct user_entry *e);
199     int def_dupuser(struct userrec *new, struct userrec *old,
200     struct user_entry *e);
201    
202 tothwolf 1.12 #endif /* !_EGG_USERS_H */

webmaster@eggheads.org
ViewVC Help
Powered by ViewVC 1.1.23