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

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

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


Revision 1.1.1.1 - (hide annotations) (download) (as text) (vendor branch)
Wed Jun 23 19:51:33 1999 UTC (20 years, 5 months ago) by segfault
Branch: eggdev
CVS Tags: start
Changes since 1.1: +0 -0 lines
File MIME type: text/x-csrc
Eggdrop 1.3.28 CVS Code

1 segfault 1.1 /* structures and definitions used by users.c & userrec.c */
2     /*
3     * This file is part of the eggdrop source code
4     * copyright (c) 1997 Robey Pointer
5     * and is distributed according to the GNU general public license.
6     * For full details, read the top of 'main.c' or the file called
7     * COPYING that was distributed with this code.
8     */
9    
10     #ifndef _H_USERS
11     #define _H_USERS
12    
13     /* list functions :) , next *must* be the 1st item in the struct */
14     struct list_type {
15     struct list_type *next;
16     char *extra;
17     };
18    
19     #define list_insert(a,b) { b->next = *a; *a = b; }
20     int list_append(struct list_type **, struct list_type *);
21     int list_delete(struct list_type **, struct list_type *);
22     int list_contains(struct list_type *, struct list_type *);
23    
24     /* new userfile format stuff */
25     struct userrec;
26     struct user_entry;
27     struct user_entry_type {
28     struct user_entry_type *next;
29     int (*got_share) (struct userrec *, struct user_entry *, char *, int);
30     int (*dup_user) (struct userrec *, struct userrec *,
31     struct user_entry *);
32     int (*unpack) (struct userrec *, struct user_entry *);
33     int (*pack) (struct userrec *, struct user_entry *);
34     int (*write_userfile) (FILE *, struct userrec *, struct user_entry *);
35     int (*kill) (struct user_entry *);
36     void *(*get) (struct userrec *, struct user_entry *);
37     int (*set) (struct userrec *, struct user_entry *, void *);
38     int (*tcl_get) (Tcl_Interp *, struct userrec *, struct user_entry *,
39     int, char **);
40     int (*tcl_set) (Tcl_Interp *, struct userrec *, struct user_entry *,
41     int, char **);
42     int (*expmem) (struct user_entry *);
43     void (*display) (int idx, struct user_entry *);
44     char *name;
45     };
46    
47     #ifndef MAKING_MODS
48     extern struct user_entry_type USERENTRY_EMAIL, USERENTRY_COMMENT, USERENTRY_LASTON,
49     USERENTRY_XTRA, USERENTRY_INFO, USERENTRY_BOTADDR, USERENTRY_HOSTS,
50     USERENTRY_PASS, USERENTRY_BOTFL, USERENTRY_URL;
51    
52     #endif
53    
54     struct laston_info {
55     time_t laston;
56     char *lastonplace;
57     };
58    
59     struct bot_addr {
60     int telnet_port;
61     int relay_port;
62     char *address;
63     };
64    
65     struct user_entry {
66     struct user_entry *next;
67     struct user_entry_type *type;
68     union {
69     char *string;
70     void *extra;
71     struct list_type *list;
72     unsigned long ulong;
73     } u;
74     char *name;
75     };
76    
77     struct xtra_key {
78     struct xtra_key *next;
79     char *key;
80     char *data;
81     };
82    
83     struct filesys_stats {
84     int uploads;
85     int upload_ks;
86     int dnloads;
87     int dnload_ks;
88     };
89    
90     void *_user_malloc(int, char *, int);
91    
92     #ifndef MAKING_MODS
93     #define user_malloc(x) _user_malloc(x,__FILE__,__LINE__)
94     #endif
95     int add_entry_type(struct user_entry_type *);
96     int del_entry_type(struct user_entry_type *);
97     struct user_entry_type *find_entry_type(char *);
98     struct user_entry *find_user_entry(struct user_entry_type *, struct userrec *);
99     void *get_user(struct user_entry_type *, struct userrec *);
100     int set_user(struct user_entry_type *, struct userrec *, void *);
101    
102     #define bot_flags(u) ((long)get_user(&USERENTRY_BOTFL,u))
103     #define is_bot(u) (u && (u->flags & USER_BOT))
104     #define is_master(u) (u && (u->flags & USER_MASTER))
105     #define is_owner(u) (u && (u->flags & USER_OWNER))
106    
107     /* fake users used to store ignores and bans */
108     #define IGNORE_NAME "*ignore"
109     #define BAN_NAME "*ban"
110     #define EXEMPT_NAME "*exempt"
111     #define INVITE_NAME "*invite"
112    
113     /* channel-specific info */
114     struct chanuserrec {
115     struct chanuserrec *next;
116     char channel[81];
117     time_t laston;
118     unsigned long flags;
119     unsigned long flags_udef;
120     char *info;
121     };
122    
123     /* new-style userlist */
124     struct userrec {
125     struct userrec *next;
126     char handle[HANDLEN + 1];
127     unsigned long flags;
128     unsigned long flags_udef;
129     struct chanuserrec *chanrec;
130     struct user_entry *entries;
131     };
132    
133     /* let's get neat, a struct for each */
134     struct banrec {
135     struct banrec *next;
136     char *banmask;
137     time_t expire;
138     time_t added;
139     time_t lastactive;
140     char *user;
141     char *desc;
142     int flags;
143     };
144     extern struct banrec *global_bans;
145    
146     #define BANREC_STICKY 1
147     #define BANREC_PERM 2
148    
149     struct igrec {
150     struct igrec *next;
151     char *igmask;
152     time_t expire;
153     char *user;
154     time_t added;
155     char *msg;
156     int flags;
157     };
158     extern struct igrec *global_ign;
159    
160     #define IGREC_PERM 2
161    
162     /* flags are in eggdrop.h */
163    
164     struct userrec *adduser();
165     struct userrec *get_user_by_handle(struct userrec *, char *);
166     struct userrec *get_user_by_host(char *);
167     struct userrec *check_chanlist();
168     struct userrec *check_chanlist_hand();
169    
170     /* all the default userentry stuff, for code re-use */
171     int def_unpack(struct userrec *u, struct user_entry *e);
172     int def_pack(struct userrec *u, struct user_entry *e);
173     int def_kill(struct user_entry *e);
174     int def_write_userfile(FILE * f, struct userrec *u, struct user_entry *e);
175     void *def_get(struct userrec *u, struct user_entry *e);
176     int def_set(struct userrec *u, struct user_entry *e, void *buf);
177     int def_gotshare(struct userrec *u, struct user_entry *e,
178     char *data, int idx);
179     int def_tcl_get(Tcl_Interp * interp, struct userrec *u,
180     struct user_entry *e, int argc, char **argv);
181     int def_tcl_set(Tcl_Interp * irp, struct userrec *u,
182     struct user_entry *e, int argc, char **argv);
183     int def_expmem(struct user_entry *e);
184     void def_display(int idx, struct user_entry *e);
185     int def_dupuser(struct userrec *new, struct userrec *old,
186     struct user_entry *e);
187    
188     #endif

webmaster@eggheads.org
ViewVC Help
Powered by ViewVC 1.1.23