/[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.18 - (hide annotations) (download) (as text)
Sat Feb 15 05:04:58 2003 UTC (16 years, 8 months ago) by wcc
Branch: MAIN
Changes since 1.17: +2 -3 lines
File MIME type: text/x-csrc
* Removed share.mod (will be part of the new botnet module).
* More transfer removal.
* More botnet removal.
* Regenerated gettext stuff.
* More doc stuff.
* Removed eggdrop.conf (replaced by config.tcl for 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.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 wcc 1.18 * $Id: users.h,v 1.17 2003/01/02 21:33:17 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 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 wcc 1.18 int (*dup_user) (struct userrec *, struct userrec *, struct user_entry *);
56 segfault 1.1 int (*unpack) (struct userrec *, struct user_entry *);
57     int (*pack) (struct userrec *, struct user_entry *);
58     int (*write_userfile) (FILE *, struct userrec *, struct user_entry *);
59     int (*kill) (struct user_entry *);
60     void *(*get) (struct userrec *, struct user_entry *);
61     int (*set) (struct userrec *, struct user_entry *, void *);
62     int (*tcl_get) (Tcl_Interp *, struct userrec *, struct user_entry *,
63     int, char **);
64     int (*tcl_set) (Tcl_Interp *, struct userrec *, struct user_entry *,
65     int, char **);
66     void (*display) (int idx, struct user_entry *);
67     char *name;
68     };
69    
70 fabian 1.5
71 segfault 1.1 #ifndef MAKING_MODS
72 fabian 1.6 extern struct user_entry_type USERENTRY_COMMENT, USERENTRY_LASTON,
73     USERENTRY_XTRA, USERENTRY_INFO, USERENTRY_BOTADDR, USERENTRY_HOSTS,
74     USERENTRY_PASS, USERENTRY_BOTFL;
75 fabian 1.5 #endif
76 segfault 1.1
77    
78     struct laston_info {
79     time_t laston;
80     char *lastonplace;
81     };
82    
83     struct bot_addr {
84     int telnet_port;
85     int relay_port;
86     char *address;
87     };
88    
89     struct user_entry {
90     struct user_entry *next;
91     struct user_entry_type *type;
92     union {
93     char *string;
94     void *extra;
95     struct list_type *list;
96     unsigned long ulong;
97     } u;
98     char *name;
99     };
100    
101     struct xtra_key {
102     struct xtra_key *next;
103     char *key;
104     char *data;
105     };
106    
107     struct filesys_stats {
108     int uploads;
109     int upload_ks;
110     int dnloads;
111     int dnload_ks;
112     };
113    
114 ite 1.13 int user_init();
115 segfault 1.1 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 tell_file_stats(int, char *);
128     void tell_user_ident(int, char *, int);
129     void tell_users_match(int, char *, int, int, int, char *);
130     int readuserfile(char *, struct userrec **);
131     void backup_userfile(void);
132 segfault 1.1
133 fabian 1.5 #define bot_flags(u) ((long)get_user(&USERENTRY_BOTFL, (u)))
134     #define is_bot(u) ((u) && ((u)->flags & USER_BOT))
135     #define is_master(u) ((u) && ((u)->flags & USER_MASTER))
136     #define is_owner(u) ((u) && ((u)->flags & USER_OWNER))
137 segfault 1.1
138 fabian 1.5 /* Fake users used to store ignores and bans
139     */
140 segfault 1.1 #define IGNORE_NAME "*ignore"
141     #define BAN_NAME "*ban"
142     #define EXEMPT_NAME "*exempt"
143     #define INVITE_NAME "*Invite"
144    
145 fabian 1.5 /* Channel-specific info
146     */
147 segfault 1.1 struct chanuserrec {
148     struct chanuserrec *next;
149     char channel[81];
150     time_t laston;
151     unsigned long flags;
152     unsigned long flags_udef;
153     char *info;
154     };
155    
156 fabian 1.5 /* New-style userlist
157     */
158 segfault 1.1 struct userrec {
159     struct userrec *next;
160     char handle[HANDLEN + 1];
161     unsigned long flags;
162     unsigned long flags_udef;
163     struct chanuserrec *chanrec;
164     struct user_entry *entries;
165     };
166 stdarg 1.14
167 segfault 1.1 struct igrec {
168     struct igrec *next;
169     char *igmask;
170     time_t expire;
171     char *user;
172     time_t added;
173     char *msg;
174     int flags;
175     };
176     extern struct igrec *global_ign;
177    
178     #define IGREC_PERM 2
179    
180 fabian 1.5 /*
181     * Note: Flags are in eggdrop.h
182     */
183 segfault 1.1
184     struct userrec *adduser();
185 stdarg 1.14 struct userrec *get_user_by_handle(struct userrec *, const char *);
186     user_t *get_user_authed(char *handle, char *pass);
187 segfault 1.1 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