/[LeafOK_CVS]/lbbs/include/user_list.h
ViewVC logotype

Contents of /lbbs/include/user_list.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.6 - (show annotations)
Wed Oct 22 07:16:48 2025 UTC (4 months, 3 weeks ago) by sysadm
Branch: MAIN
Changes since 1.5: +13 -1 lines
Content type: text/x-chdr
Set sort order of user list as by username
Add query_user_info_by_uid()

1 /***************************************************************************
2 user_list.h - description
3 -------------------
4 Copyright : (C) 2004-2025 by Leaflet
5 Email : leaflet@leafok.com
6 ***************************************************************************/
7
8 /***************************************************************************
9 * *
10 * This program is free software; you can redistribute it and/or modify *
11 * it under the terms of the GNU General Public License as published by *
12 * the Free Software Foundation; either version 3 of the License, or *
13 * (at your option) any later version. *
14 * *
15 ***************************************************************************/
16
17 #ifndef _USER_LIST_H_
18 #define _USER_LIST_H_
19
20 #include "bbs.h"
21 #include <mysql/mysql.h>
22
23 #define BBS_user_limit_per_page 20
24 #define BBS_session_id_length 32
25
26 struct user_info_t
27 {
28 int32_t id;
29 int32_t uid;
30 char username[BBS_username_max_len + 1];
31 char nickname[BBS_nickname_max_len + 1];
32 char gender;
33 int8_t gender_pub;
34 int32_t life;
35 int32_t exp;
36 time_t signup_dt;
37 time_t last_login_dt;
38 time_t birthday;
39 };
40 typedef struct user_info_t USER_INFO;
41
42 struct user_info_index_uid_t
43 {
44 int32_t uid;
45 int32_t id;
46 };
47 typedef struct user_info_index_uid_t USER_INFO_INDEX_UID;
48
49 struct user_list_t
50 {
51 USER_INFO users[BBS_max_user_count];
52 USER_INFO_INDEX_UID index_uid[BBS_max_user_count];
53 int32_t user_count;
54 };
55 typedef struct user_list_t USER_LIST;
56
57 struct user_online_info_t
58 {
59 int32_t id;
60 char session_id[BBS_session_id_length + 1];
61 USER_INFO user_info;
62 char ip[IP_ADDR_LEN];
63 char current_action[BBS_current_action_max_len + 1];
64 const char *current_action_title;
65 time_t login_tm;
66 time_t last_tm;
67 };
68 typedef struct user_online_info_t USER_ONLINE_INFO;
69
70 struct user_online_list_t
71 {
72 USER_ONLINE_INFO users[BBS_max_user_online_count];
73 int32_t user_count;
74 };
75 typedef struct user_online_list_t USER_ONLINE_LIST;
76
77 extern int user_list_pool_init(void);
78 extern void user_list_pool_cleanup(void);
79 extern int set_user_list_pool_shm_readonly(void);
80 extern int detach_user_list_pool_shm(void);
81
82 extern int user_list_pool_reload(int online_user);
83
84 extern int query_user_list(int page_id, USER_INFO *p_users, int *p_user_count, int *p_page_count);
85 extern int query_user_online_list(int page_id, USER_ONLINE_INFO *p_online_users, int *p_user_count, int *p_page_count);
86
87 extern int query_user_info(int32_t id, USER_INFO *p_user);
88 extern int query_user_info_by_uid(int32_t uid, USER_INFO *p_user);
89 extern int query_user_online_info(int32_t id, USER_ONLINE_INFO *p_user);
90
91 #endif //_USER_LIST_H_

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