/[LeafOK_CVS]/pvpgn-1.7.4/src/bnetd/account.h
ViewVC logotype

Annotation of /pvpgn-1.7.4/src/bnetd/account.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.1.1.1 - (hide annotations) (vendor branch)
Tue Jun 6 03:41:37 2006 UTC (19 years, 9 months ago) by sysadm
Branch: GNU, MAIN
CVS Tags: pvpgn_1-7-4-0_MIL, arelease, HEAD
Changes since 1.1: +0 -0 lines
Content type: text/x-chdr
no message

1 sysadm 1.1 /*
2     * Copyright (C) 1998,1999 Ross Combs (rocombs@cs.nmsu.edu)
3     * Copyright (C) 2000,2001 Marco Ziech (mmz@gmx.net)
4     *
5     * This program is free software; you can redistribute it and/or
6     * modify it under the terms of the GNU General Public License
7     * as published by the Free Software Foundation; either version 2
8     * of the License, or (at your option) any later version.
9     *
10     * This program is distributed in the hope that it will be useful,
11     * but WITHOUT ANY WARRANTY; without even the implied warranty of
12     * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13     * GNU General Public License for more details.
14     *
15     * You should have received a copy of the GNU General Public License
16     * along with this program; if not, write to the Free Software
17     * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18     */
19     #ifndef INCLUDED_ACCOUNT_TYPES
20     #define INCLUDED_ACCOUNT_TYPES
21    
22     #include "storage.h"
23     #ifndef JUST_NEED_TYPES
24     #define JUST_NEED_TYPES
25     #include "common/list.h"
26     #include "common/elist.h"
27     #include "clan.h"
28     #include "team.h"
29     #undef JUST_NEED_TYPES
30     #else
31     #include "common/list.h"
32     #include "common/elist.h"
33     #include "clan.h"
34     #include "team.h"
35     #endif
36    
37     #ifdef ACCOUNT_INTERNAL_ACCESS
38     typedef struct attribute_struct
39     {
40     char const * key;
41     char const * val;
42     int dirty; // 1 = needs to be saved, 0 = unchanged
43     struct attribute_struct * next;
44     } t_attribute;
45     #endif
46    
47     #define ACCOUNT_CLIENTTAG_UNKN 0x00; // used for all non warcraft 3 clients so far
48     #define ACCOUNT_CLIENTTAG_WAR3 0x01;
49     #define ACCOUNT_CLIENTTAG_W3XP 0x02;
50    
51     #define ACCOUNT_FLAG_NONE 0
52     #define ACCOUNT_FLAG_LOADED 1
53     #define ACCOUNT_FLAG_ACCESSED 2
54     #define ACCOUNT_FLAG_DIRTY 4
55     #define ACCOUNT_FLAG_FLOADED 8 /* friend loaded */
56    
57     /* flags controlling flush/save operations */
58     #define FS_NONE 0
59     #define FS_FORCE 1 /* force save/flush no matter of time */
60     /* NOTE: flush with force will trigger save with force in case of dirty */
61     #define FS_ALL 2 /* save/flush all, not in steps */
62    
63     struct connection;
64    
65     typedef struct account_struct
66     #ifdef ACCOUNT_INTERNAL_ACCESS
67     {
68     t_attribute * attrs;
69     char * name; /* profiling proved 99% of getstrattr its from get_name */
70     unsigned int namehash; /* cached from attrs */
71     unsigned int uid; /* cached from attrs */
72     unsigned int flags;
73     struct connection * conn;
74     t_storage_info * storage;
75     t_clanmember * clanmember;
76     t_list * friends;
77     time_t lastaccess; /* timestamp of last access moment */
78     time_t dirtytime; /* timestamp of first dirty moment */
79     t_elist loadedlist; /* link to the list of loaded accounts for
80     * fast flushes */
81     t_elist dirtylist; /* link to the list of dirty accounts for
82     * fast saves */
83     t_list * teams;
84     }
85     #endif
86     t_account;
87    
88     #endif
89    
90     /*****/
91     #ifndef JUST_NEED_TYPES
92     #ifndef INCLUDED_ACCOUNT_PROTOS
93     #define INCLUDED_ACCOUNT_PROTOS
94    
95     #define JUST_NEED_TYPES
96     #include "common/hashtable.h"
97     #include "connection.h"
98     #undef JUST_NEED_TYPES
99    
100     extern unsigned int maxuserid;
101    
102     extern int accountlist_reload(void);
103     extern int account_check_name(char const * name);
104     extern unsigned int account_get_uid(t_account const * account);
105     extern int account_match(t_account * account, char const * username);
106     extern int account_save(t_account *account, unsigned flags);
107     extern char const * account_get_strattr_real(t_account * account, char const * key, char const * fn, unsigned int ln);
108     #define account_get_strattr(A,K) account_get_strattr_real(A,K,__FILE__,__LINE__)
109     extern int account_set_strattr(t_account * account, char const * key, char const * val);
110    
111     extern char const * account_get_first_key(t_account * account);
112     extern char const * account_get_next_key(t_account * account, char const * key);
113    
114     extern int accountlist_create(void);
115     extern int accountlist_destroy(void);
116     extern t_hashtable * accountlist(void);
117     extern t_hashtable * accountlist_uid(void);
118     extern int accountlist_load_default(void);
119     extern void accountlist_unload_default(void);
120     extern int accountlist_load_all(int flag);
121     extern unsigned int accountlist_get_length(void);
122     extern int accountlist_save(unsigned flags);
123     extern int accountlist_flush(unsigned flags);
124     extern t_account * accountlist_find_account(char const * username);
125     extern t_account * accountlist_find_account_by_uid(unsigned int uid);
126     extern int accountlist_allow_add(void);
127     extern t_account * accountlist_create_account(const char *username, const char *passhash1);
128     // aaron
129     //extern int accounts_rank_all(void);
130     extern void accounts_get_attr(char const *);
131     /* names and passwords */
132     extern char const * account_get_name_real(t_account * account, char const * fn, unsigned int ln);
133     # define account_get_name(A) account_get_name_real(A,__FILE__,__LINE__)
134    
135    
136     // THEUNDYING MUTUAL FRIEND CHECK 7/27/02 UPDATED!
137     // moved to account.c/account.h by Soar to direct access struct t_account
138     extern int account_check_mutual( t_account * account, int myuserid);
139     extern t_list * account_get_friends(t_account * account);
140    
141     //clan thingy by DJP & Soar
142     extern int account_set_clanmember(t_account * account, t_clanmember * clanmember);
143     extern t_clanmember * account_get_clanmember(t_account * account);
144     extern t_clanmember * account_get_clanmember_forced(t_account * account);
145     extern t_clan * account_get_clan(t_account * account);
146     extern t_clan * account_get_creating_clan(t_account * account);
147    
148     extern int account_set_conn(t_account * account, t_connection * conn);
149     extern t_connection * account_get_conn(t_account * account);
150    
151     extern void account_add_team(t_account * account, t_team * team);
152     extern t_team * account_find_team_by_accounts(t_account * account, t_account **accounts, t_clienttag clienttag);
153     extern t_team * account_find_team_by_teamid(t_account * account, unsigned int teamid);
154     extern t_list * account_get_teams(t_account * account);
155    
156     #endif
157     #endif

webmaster@leafok.com
ViewVC Help
Powered by ViewVC 1.3.0-beta1