| 1 |
sysadm |
1.2 |
/* SPDX-License-Identifier: GPL-3.0-or-later */
|
| 2 |
|
|
/*
|
| 3 |
|
|
* user_stat
|
| 4 |
|
|
* - data model and basic operations of user related statistics
|
| 5 |
|
|
*
|
| 6 |
|
|
* Copyright (C) 2004-2025 by Leaflet <leaflet@leafok.com>
|
| 7 |
|
|
*/
|
| 8 |
sysadm |
1.1 |
|
| 9 |
|
|
#ifndef _USER_STAT_H_
|
| 10 |
|
|
#define _USER_STAT_H_
|
| 11 |
|
|
|
| 12 |
|
|
#include "bbs.h"
|
| 13 |
|
|
#include <sys/types.h>
|
| 14 |
|
|
|
| 15 |
|
|
struct user_stat_t
|
| 16 |
|
|
{
|
| 17 |
|
|
int32_t uid;
|
| 18 |
|
|
int article_count;
|
| 19 |
|
|
};
|
| 20 |
|
|
typedef struct user_stat_t USER_STAT;
|
| 21 |
|
|
|
| 22 |
|
|
struct user_stat_map_t
|
| 23 |
|
|
{
|
| 24 |
|
|
USER_STAT stat_list[BBS_max_user_count];
|
| 25 |
|
|
int user_count;
|
| 26 |
|
|
int32_t last_uid;
|
| 27 |
|
|
int last_article_index;
|
| 28 |
|
|
};
|
| 29 |
|
|
typedef struct user_stat_map_t USER_STAT_MAP;
|
| 30 |
|
|
|
| 31 |
|
|
extern int user_stat_map_init(USER_STAT_MAP *p_map);
|
| 32 |
|
|
extern int user_stat_map_update(USER_STAT_MAP *p_map);
|
| 33 |
|
|
|
| 34 |
|
|
extern int user_stat_article_cnt_inc(USER_STAT_MAP *p_map, int32_t uid, int n);
|
| 35 |
|
|
extern int user_stat_get(USER_STAT_MAP *p_map, int32_t uid, const USER_STAT **pp_stat);
|
| 36 |
|
|
|
| 37 |
|
|
#endif //_USER_STAT_H_
|