| 1 |
/* |
| 2 |
* $Revision: 1.15 $ |
| 3 |
*/ |
| 4 |
#if !defined( COMMONAL_H ) |
| 5 |
#define COMMONAL_H |
| 6 |
|
| 7 |
#include "common.h" |
| 8 |
#include "session.h" |
| 9 |
#include "account.h" |
| 10 |
#include "group.h" |
| 11 |
#include "criteria.h" |
| 12 |
|
| 13 |
#if defined( WIN32 ) |
| 14 |
#define EXPORTDLL extern "C" __declspec(dllexport) |
| 15 |
#else |
| 16 |
#define EXPORTDLL |
| 17 |
#endif |
| 18 |
|
| 19 |
|
| 20 |
#define ACCOUNT_UNAME_LEN 25 |
| 21 |
#define ACCOUNT_NAME_LEN 60 |
| 22 |
#define ACCOUNT_EMAIL_LEN 60 |
| 23 |
#define ACCOUNT_URL_LEN 100 |
| 24 |
#define ACCOUNT_USER_AVATAR_LEN 30 |
| 25 |
#define ACCOUNT_USER_ICQ_LEN 15 |
| 26 |
#define ACCOUNT_USER_FROM_LEN 100 |
| 27 |
#define ACCOUNT_USER_SIG_LEN 255 |
| 28 |
#define ACCOUNT_ACTKEY_LEN 8 |
| 29 |
#define ACCOUNT_USER_AIM_LEN 18 |
| 30 |
#define ACCOUNT_USER_YIM_LEN 25 |
| 31 |
#define ACCOUNT_USER_MSNM_LEN 100 |
| 32 |
#define ACCOUNT_PASS_LEN 32 |
| 33 |
#define ACCOUNT_THEME_LEN 100 |
| 34 |
#define ACCOUNT_UMODE_LEN 10 |
| 35 |
#define ACCOUNT_USER_OCC_LEN 100 |
| 36 |
#define ACCOUNT_BIO_LEN 255 |
| 37 |
#define ACCOUNT_USER_INTREST_LEN 150 |
| 38 |
|
| 39 |
//maximum length for each columns defined in DB tables 'xnpaccount_user' |
| 40 |
#define XNP_ACCOUNT_ADDRESS_LEN 255 |
| 41 |
#define XNP_ACCOUNT_DIVISION_LEN 255 |
| 42 |
#define XNP_ACCOUNT_TEL_LEN 32 |
| 43 |
#define XNP_ACCOUNT_COMPANY_NAME_LEN 255 |
| 44 |
#define XNP_ACCOUNT_COUNTRY_LEN 255 |
| 45 |
#define XNP_ACCOUNT_ZIPCODE_LEN 32 |
| 46 |
#define XNP_ACCOUNT_FAX_LEN 32 |
| 47 |
#define XNP_ACCOUNT_BASE_URL_LEN 255 |
| 48 |
|
| 49 |
#define XNP_GROUP_GNAME_LEN 255 |
| 50 |
#define XNP_GROUP_GDESC_LEN 255 |
| 51 |
|
| 52 |
|
| 53 |
// definition of default IDs |
| 54 |
#define DEFAULT_PLATFORM_GROUP_ID 1 //< |
| 55 |
|
| 56 |
|
| 57 |
EXPORTDLL result_t initializeDB( const char* host, const char* user, const char* password, const char* dbname, const char* prefix ); |
| 58 |
EXPORTDLL result_t uninitializeDB(); |
| 59 |
EXPORTDLL bool isActivated( sessionid_t sid, userid_t uid ); |
| 60 |
EXPORTDLL result_t activate( sessionid_t sid, userid_t uid, bool activate ); |
| 61 |
EXPORTDLL int getAccountCount( sessionid_t sid ); |
| 62 |
EXPORTDLL result_t deleteAccount( sessionid_t sid, userid_t uid ); |
| 63 |
EXPORTDLL result_t getAccount( sessionid_t sid, userid_t uid, const account_t** ); |
| 64 |
EXPORTDLL result_t getAccounts( sessionid_t sid, const userid_t* uids, int uidsLen, criteria_t* cri, const account_t** accounts, int* accountsLen ); |
| 65 |
EXPORTDLL result_t insertAccount( sessionid_t sid, const account_t* account, userid_t* uid ); |
| 66 |
EXPORTDLL result_t updateAccount( sessionid_t sid, const account_t* account ); |
| 67 |
EXPORTDLL result_t dumpUids( sessionid_t sid, criteria_t* cri, userid_t** uids, int* uidsLen ); |
| 68 |
EXPORTDLL int getGroupCount( sessionid_t sid ); |
| 69 |
EXPORTDLL result_t getGroupsByUid( sessionid_t sid, userid_t uid, criteria_t* cri, groupid_t** gids, int* gidsLen ); |
| 70 |
EXPORTDLL bool isGroupAdmin( sessionid_t sid, groupid_t gid, userid_t uid ); |
| 71 |
EXPORTDLL result_t dumpGids( sessionid_t sid, criteria_t* cri, groupid_t** gids, int* gidsLen ); |
| 72 |
EXPORTDLL result_t dumpGroupAdmins( sessionid_t sid, groupid_t gid, criteria_t* cri, userid_t** uids, int* uidsLen ); |
| 73 |
EXPORTDLL result_t deleteMember( sessionid_t sid, groupid_t gid, userid_t uid ); |
| 74 |
EXPORTDLL result_t insertMember( sessionid_t sid, groupid_t gid, userid_t uid, bool admin ); |
| 75 |
EXPORTDLL result_t getMembers( sessionid_t sid, groupid_t gid, criteria_t* cri, userid_t** uids, int* uidsLen ); |
| 76 |
EXPORTDLL result_t deleteGroup( sessionid_t sid, groupid_t gid ); |
| 77 |
EXPORTDLL result_t insertGroup( sessionid_t sid, const group_t* group, groupid_t* gid ); |
| 78 |
EXPORTDLL result_t updateGroup( sessionid_t sid, const group_t* group ); |
| 79 |
EXPORTDLL result_t getGroup( sessionid_t sid, groupid_t gid, const group_t** group ); |
| 80 |
EXPORTDLL result_t getGroups( sessionid_t sid, groupid_t* gids, int gidsLen, criteria_t* cri, const group_t** groups, int* groupsLen ); |
| 81 |
EXPORTDLL bool isModerator( sessionid_t sid, userid_t uid ); |
| 82 |
EXPORTDLL result_t getUid( const char* uname, userid_t* uid ); |
| 83 |
EXPORTDLL result_t loginUser(const char* uname, const char* passwd, sessionid_t* sessions ); |
| 84 |
EXPORTDLL void logoutUser( sessionid_t sid ); |
| 85 |
EXPORTDLL result_t createSession( const char* sessionid, userid_t uid, sessionid_t* sessions ); |
| 86 |
EXPORTDLL result_t getSession( sessionid_t sess_id, const session_t** session ); |
| 87 |
EXPORTDLL bool isValidSessionID( sessionid_t sess_id ); |
| 88 |
|
| 89 |
EXPORTDLL void freeAccount( const account_t* ); |
| 90 |
EXPORTDLL void freeGroup( const group_t* ); |
| 91 |
EXPORTDLL void freeSession( const session_t* ); |
| 92 |
EXPORTDLL void freeUID( const int* ); |
| 93 |
EXPORTDLL void freeGID( const int* ); |
| 94 |
|
| 95 |
EXPORTDLL void setLastErrorString( const char* str ); |
| 96 |
EXPORTDLL const char* getLastErrorString(); |
| 97 |
|
| 98 |
#endif |