/[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.2 - (hide annotations) (download) (as text)
Sat Oct 9 15:46:35 1999 UTC (20 years ago) by fabian
Branch: MAIN
Changes since 1.1: +1 -49 lines
File MIME type: text/x-csrc
all changes to the 1.3 tree merged with 1.4

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     void *_user_realloc(void *, int, char *, int);
92    
93     #ifndef MAKING_MODS
94     #define user_malloc(x) _user_malloc(x,__FILE__,__LINE__)
95     #define user_realloc(x,y) _user_realloc(x,y,__FILE__,__LINE__)
96     #endif
97     int add_entry_type(struct user_entry_type *);
98     int del_entry_type(struct user_entry_type *);
99     struct user_entry_type *find_entry_type(char *);
100     struct user_entry *find_user_entry(struct user_entry_type *, struct userrec *);
101     void *get_user(struct user_entry_type *, struct userrec *);
102     int set_user(struct user_entry_type *, struct userrec *, void *);
103    
104     #define bot_flags(u) ((long)get_user(&USERENTRY_BOTFL,u))
105     #define is_bot(u) (u && (u->flags & USER_BOT))
106     #define is_master(u) (u && (u->flags & USER_MASTER))
107     #define is_owner(u) (u && (u->flags & USER_OWNER))
108    
109     /* fake users used to store ignores and bans */
110     #define IGNORE_NAME "*ignore"
111     #define BAN_NAME "*ban"
112     #define EXEMPT_NAME "*exempt"
113     #define INVITE_NAME "*Invite"
114    
115     /* channel-specific info */
116     struct chanuserrec {
117     struct chanuserrec *next;
118     char channel[81];
119     time_t laston;
120     unsigned long flags;
121     unsigned long flags_udef;
122     char *info;
123     };
124    
125     /* new-style userlist */
126     struct userrec {
127     struct userrec *next;
128     char handle[HANDLEN + 1];
129     unsigned long flags;
130     unsigned long flags_udef;
131     struct chanuserrec *chanrec;
132     struct user_entry *entries;
133     };
134    
135     struct igrec {
136     struct igrec *next;
137     char *igmask;
138     time_t expire;
139     char *user;
140     time_t added;
141     char *msg;
142     int flags;
143     };
144     extern struct igrec *global_ign;
145    
146     #define IGREC_PERM 2
147    
148     /* flags are in eggdrop.h */
149    
150     struct userrec *adduser();
151     struct userrec *get_user_by_handle(struct userrec *, char *);
152     struct userrec *get_user_by_host(char *);
153 fabian 1.2 struct userrec *get_user_by_nick(char *);
154 segfault 1.1 struct userrec *check_chanlist();
155     struct userrec *check_chanlist_hand();
156    
157     /* all the default userentry stuff, for code re-use */
158     int def_unpack(struct userrec *u, struct user_entry *e);
159     int def_pack(struct userrec *u, struct user_entry *e);
160     int def_kill(struct user_entry *e);
161     int def_write_userfile(FILE * f, struct userrec *u, struct user_entry *e);
162     void *def_get(struct userrec *u, struct user_entry *e);
163     int def_set(struct userrec *u, struct user_entry *e, void *buf);
164     int def_gotshare(struct userrec *u, struct user_entry *e,
165     char *data, int idx);
166     int def_tcl_get(Tcl_Interp * interp, struct userrec *u,
167     struct user_entry *e, int argc, char **argv);
168     int def_tcl_set(Tcl_Interp * irp, struct userrec *u,
169     struct user_entry *e, int argc, char **argv);
170     int def_expmem(struct user_entry *e);
171     void def_display(int idx, struct user_entry *e);
172     int def_dupuser(struct userrec *new, struct userrec *old,
173     struct user_entry *e);
174    
175     #endif

webmaster@eggheads.org
ViewVC Help
Powered by ViewVC 1.1.23