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

Diff of /lbbs/include/user_list.h

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 1.7 by sysadm, Wed Oct 22 10:38:23 2025 UTC Revision 1.22 by sysadm, Tue Nov 4 14:58:55 2025 UTC
# Line 1  Line 1 
1  /***************************************************************************  /* SPDX-License-Identifier: GPL-3.0-or-later */
2                                                   user_list.h  -  description  /*
3                                                           -------------------   * user_list
4          Copyright            : (C) 2004-2025 by Leaflet   *   - data model and basic operations of (online) user list
5          Email                : leaflet@leafok.com   *
6   ***************************************************************************/   * Copyright (C) 2004-2025  Leaflet <leaflet@leafok.com>
7     */
 /***************************************************************************  
  *                                                                         *  
  *   This program is free software; you can redistribute it and/or modify  *  
  *   it under the terms of the GNU General Public License as published by  *  
  *   the Free Software Foundation; either version 3 of the License, or     *  
  *   (at your option) any later version.                                   *  
  *                                                                         *  
  ***************************************************************************/  
8    
9  #ifndef _USER_LIST_H_  #ifndef _USER_LIST_H_
10  #define _USER_LIST_H_  #define _USER_LIST_H_
11    
12  #include "bbs.h"  #include "bbs.h"
13    #include "common.h"
14  #include <mysql/mysql.h>  #include <mysql/mysql.h>
15    
16  #define BBS_user_limit_per_page 20  #define BBS_user_limit_per_page 20
17  #define BBS_session_id_length 32  #define BBS_session_id_length 32
18    
19    #define BBS_user_intro_avg_len 256
20    #define BBS_user_intro_max_len 4096
21    #define BBS_user_intro_max_line 10
22    
23  struct user_info_t  struct user_info_t
24  {  {
25          int32_t id;          int32_t id;
# Line 33  struct user_info_t Line 30  struct user_info_t
30          int8_t gender_pub;          int8_t gender_pub;
31          int32_t life;          int32_t life;
32          int32_t exp;          int32_t exp;
33            int32_t visit_count;
34          time_t signup_dt;          time_t signup_dt;
35          time_t last_login_dt;          time_t last_login_dt;
36            time_t last_logout_dt;
37          time_t birthday;          time_t birthday;
38            const char *intro;
39  };  };
40  typedef struct user_info_t USER_INFO;  typedef struct user_info_t USER_INFO;
41    
# Line 51  struct user_list_t Line 51  struct user_list_t
51          USER_INFO users[BBS_max_user_count];          USER_INFO users[BBS_max_user_count];
52          USER_INFO_INDEX_UID index_uid[BBS_max_user_count];          USER_INFO_INDEX_UID index_uid[BBS_max_user_count];
53          int32_t user_count;          int32_t user_count;
54            char user_intro_buf[BBS_user_intro_avg_len * BBS_max_user_count];
55  };  };
56  typedef struct user_list_t USER_LIST;  typedef struct user_list_t USER_LIST;
57    
# Line 70  typedef struct user_online_info_t USER_O Line 71  typedef struct user_online_info_t USER_O
71  struct user_online_list_t  struct user_online_list_t
72  {  {
73          USER_ONLINE_INFO users[BBS_max_user_online_count];          USER_ONLINE_INFO users[BBS_max_user_online_count];
74          USER_INFO_INDEX_UID index_uid[BBS_max_user_count];          USER_INFO_INDEX_UID index_uid[BBS_max_user_online_count];
75          int32_t user_count;          int32_t user_count;
76            int32_t guest_count;
77  };  };
78  typedef struct user_online_list_t USER_ONLINE_LIST;  typedef struct user_online_list_t USER_ONLINE_LIST;
79    
80  extern int user_list_pool_init(void);  extern int user_list_pool_init(const char *filename);
81  extern void user_list_pool_cleanup(void);  extern void user_list_pool_cleanup(void);
82  extern int set_user_list_pool_shm_readonly(void);  extern int set_user_list_pool_shm_readonly(void);
83  extern int detach_user_list_pool_shm(void);  extern int detach_user_list_pool_shm(void);
# Line 85  extern int user_list_pool_reload(int onl Line 87  extern int user_list_pool_reload(int onl
87  extern int query_user_list(int page_id, USER_INFO *p_users, int *p_user_count, int *p_page_count);  extern int query_user_list(int page_id, USER_INFO *p_users, int *p_user_count, int *p_page_count);
88  extern int query_user_online_list(int page_id, USER_ONLINE_INFO *p_online_users, int *p_user_count, int *p_page_count);  extern int query_user_online_list(int page_id, USER_ONLINE_INFO *p_online_users, int *p_user_count, int *p_page_count);
89    
90    extern int get_user_list_count(int *p_user_cnt);
91    extern int get_user_online_list_count(int *p_user_cnt, int *p_guest_cnt);
92    extern int get_user_login_count(int *p_login_cnt);
93    
94  extern int query_user_info(int32_t id, USER_INFO *p_user);  extern int query_user_info(int32_t id, USER_INFO *p_user);
95  extern int query_user_info_by_uid(int32_t uid, USER_INFO *p_user);  extern int query_user_info_by_uid(int32_t uid, USER_INFO *p_user, char *p_intro_buf, size_t intro_buf_len);
96    extern int query_user_info_by_username(const char *username_prefix, int max_user_cnt,
97                                                                               int32_t uid_list[], char username_list[][BBS_username_max_len + 1]);
98    
99  extern int query_user_online_info(int32_t id, USER_ONLINE_INFO *p_user);  extern int query_user_online_info(int32_t id, USER_ONLINE_INFO *p_user);
100    extern int query_user_online_info_by_uid(int32_t uid, USER_ONLINE_INFO *p_users, int *p_user_cnt, int start_id);
101    
102    extern int get_user_id_list(int32_t *p_uid_list, int *p_user_cnt, int start_uid);
103    
104    extern int user_stat_update(void);
105    extern int user_article_cnt_inc(int32_t uid, int n);
106    extern int get_user_article_cnt(int32_t uid);
107    
108  #endif //_USER_LIST_H_  #endif //_USER_LIST_H_


Legend:
Removed lines/characters  
Changed lines/characters
  Added lines/characters

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