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

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

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


Revision 1.10 - (show annotations) (download) (as text)
Sat Jan 8 21:23:15 2000 UTC (19 years, 7 months ago) by per
Branch: MAIN
CVS Tags: eggdrop104030RC2, eggdrop10403RC1, eggdrop10402RC1, eggdrop10404, eggdrop10403, eggdrop10402, HEAD
Changes since 1.9: +2 -2 lines
File MIME type: text/x-csrc
copyright

1 /*
2 * users.h
3 * structures and definitions used by users.c and userrec.c
4 *
5 * $Id: users.h,v 1.9 1999/12/22 20:30:03 guppy Exp $
6 */
7 /*
8 * Copyright (C) 1997 Robey Pointer
9 * Copyright (C) 1999, 2000 Eggheads
10 *
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 */
25
26 #ifndef _EGG_USERS_H
27 #define _EGG_USERS_H
28
29 /* list functions :) , next *must* be the 1st item in the struct */
30 struct list_type {
31 struct list_type *next;
32 char *extra;
33 };
34
35 #define list_insert(a,b) { b->next = *a; *a = b; }
36 int list_append(struct list_type **, struct list_type *);
37 int list_delete(struct list_type **, struct list_type *);
38 int list_contains(struct list_type *, struct list_type *);
39
40 /* new userfile format stuff */
41 struct userrec;
42 struct user_entry;
43 struct user_entry_type {
44 struct user_entry_type *next;
45 int (*got_share) (struct userrec *, struct user_entry *, char *, int);
46 int (*dup_user) (struct userrec *, struct userrec *,
47 struct user_entry *);
48 int (*unpack) (struct userrec *, struct user_entry *);
49 int (*pack) (struct userrec *, struct user_entry *);
50 int (*write_userfile) (FILE *, struct userrec *, struct user_entry *);
51 int (*kill) (struct user_entry *);
52 void *(*get) (struct userrec *, struct user_entry *);
53 int (*set) (struct userrec *, struct user_entry *, void *);
54 int (*tcl_get) (Tcl_Interp *, struct userrec *, struct user_entry *,
55 int, char **);
56 int (*tcl_set) (Tcl_Interp *, struct userrec *, struct user_entry *,
57 int, char **);
58 int (*expmem) (struct user_entry *);
59 void (*display) (int idx, struct user_entry *);
60 char *name;
61 };
62
63 #ifndef MAKING_MODS
64 extern struct user_entry_type USERENTRY_EMAIL, USERENTRY_COMMENT, USERENTRY_LASTON,
65 USERENTRY_XTRA, USERENTRY_INFO, USERENTRY_BOTADDR, USERENTRY_HOSTS,
66 USERENTRY_PASS, USERENTRY_BOTFL, USERENTRY_URL;
67
68 #endif
69
70 struct laston_info {
71 time_t laston;
72 char *lastonplace;
73 };
74
75 struct bot_addr {
76 int telnet_port;
77 int relay_port;
78 char *address;
79 };
80
81 struct user_entry {
82 struct user_entry *next;
83 struct user_entry_type *type;
84 union {
85 char *string;
86 void *extra;
87 struct list_type *list;
88 unsigned long ulong;
89 } u;
90 char *name;
91 };
92
93 struct xtra_key {
94 struct xtra_key *next;
95 char *key;
96 char *data;
97 };
98
99 struct filesys_stats {
100 int uploads;
101 int upload_ks;
102 int dnloads;
103 int dnload_ks;
104 };
105
106 void *_user_malloc(int, char *, int);
107 void *_user_realloc(void *, int, char *, int);
108
109 #ifndef MAKING_MODS
110 #define user_malloc(x) _user_malloc(x,__FILE__,__LINE__)
111 #define user_realloc(x,y) _user_realloc(x,y,__FILE__,__LINE__)
112 #endif
113 int add_entry_type(struct user_entry_type *);
114 int del_entry_type(struct user_entry_type *);
115 struct user_entry_type *find_entry_type(char *);
116 struct user_entry *find_user_entry(struct user_entry_type *, struct userrec *);
117 void *get_user(struct user_entry_type *, struct userrec *);
118 int set_user(struct user_entry_type *, struct userrec *, void *);
119
120 #define bot_flags(u) ((long)get_user(&USERENTRY_BOTFL,u))
121 #define is_bot(u) (u && (u->flags & USER_BOT))
122 #define is_master(u) (u && (u->flags & USER_MASTER))
123 #define is_owner(u) (u && (u->flags & USER_OWNER))
124
125 /* fake users used to store ignores and bans */
126 #define IGNORE_NAME "*ignore"
127 #define BAN_NAME "*ban"
128 #define EXEMPT_NAME "*exempt"
129 #define INVITE_NAME "*Invite"
130
131 /* channel-specific info */
132 struct chanuserrec {
133 struct chanuserrec *next;
134 char channel[81];
135 time_t laston;
136 unsigned long flags;
137 unsigned long flags_udef;
138 char *info;
139 };
140
141 /* new-style userlist */
142 struct userrec {
143 struct userrec *next;
144 char handle[HANDLEN + 1];
145 unsigned long flags;
146 unsigned long flags_udef;
147 struct chanuserrec *chanrec;
148 struct user_entry *entries;
149 };
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
164 /* flags are in eggdrop.h */
165
166 struct userrec *adduser();
167 struct userrec *get_user_by_handle(struct userrec *, char *);
168 struct userrec *get_user_by_host(char *);
169 struct userrec *get_user_by_nick(char *);
170 struct userrec *check_chanlist();
171 struct userrec *check_chanlist_hand();
172
173 /* all the default userentry stuff, for code re-use */
174 int def_unpack(struct userrec *u, struct user_entry *e);
175 int def_pack(struct userrec *u, struct user_entry *e);
176 int def_kill(struct user_entry *e);
177 int def_write_userfile(FILE * f, struct userrec *u, struct user_entry *e);
178 void *def_get(struct userrec *u, struct user_entry *e);
179 int def_set(struct userrec *u, struct user_entry *e, void *buf);
180 int def_gotshare(struct userrec *u, struct user_entry *e,
181 char *data, int idx);
182 int def_tcl_get(Tcl_Interp * interp, struct userrec *u,
183 struct user_entry *e, int argc, char **argv);
184 int def_tcl_set(Tcl_Interp * irp, struct userrec *u,
185 struct user_entry *e, int argc, char **argv);
186 int def_expmem(struct user_entry *e);
187 void def_display(int idx, struct user_entry *e);
188 int def_dupuser(struct userrec *new, struct userrec *old,
189 struct user_entry *e);
190
191 #endif /* _EGG_USERS_H */

webmaster@eggheads.org
ViewVC Help
Powered by ViewVC 1.1.23