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

Contents of /lbbs/include/article_favor.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.4 - (show annotations)
Tue Nov 4 14:58:55 2025 UTC (4 months, 1 week ago) by sysadm
Branch: MAIN
Changes since 1.3: +1 -1 lines
Content type: text/x-chdr
Refine file header information comments

1 /* SPDX-License-Identifier: GPL-3.0-or-later */
2 /*
3 * article_favor
4 * - data model and basic operations of user favorite articles
5 *
6 * Copyright (C) 2004-2025 Leaflet <leaflet@leafok.com>
7 */
8
9 #ifndef _ARTICLE_FAVOR_H_
10 #define _ARTICLE_FAVOR_H_
11
12 #include "section_list.h"
13 #include <stdint.h>
14
15 #define MAX_FAVOR_AID_BASE_CNT 10000
16 #define MAX_FAVOR_AID_INC_CNT 1000
17
18 struct article_favor_t
19 {
20 int uid;
21 int32_t aid_base[MAX_FAVOR_AID_BASE_CNT];
22 int aid_base_cnt;
23 int32_t aid_inc[MAX_FAVOR_AID_INC_CNT];
24 int aid_inc_cnt;
25 };
26 typedef struct article_favor_t ARTICLE_FAVOR;
27
28 extern ARTICLE_FAVOR BBS_article_favor;
29
30 // Load baseline article favorite from DB
31 extern int article_favor_load(int uid, ARTICLE_FAVOR *p_favor, int keep_inc);
32 // Clear data
33 extern int article_favor_unload(ARTICLE_FAVOR *p_favor);
34 // Save incremental article favorite to DB
35 extern int article_favor_save_inc(const ARTICLE_FAVOR *p_favor);
36 // Merge incremental article favorite to baseline, without DB read / write
37 extern int article_favor_merge_inc(ARTICLE_FAVOR *p_favor);
38
39 // Check if specific article was set as favorite
40 extern int article_favor_check(int32_t aid, const ARTICLE_FAVOR *p_favor);
41 // Set specific article as favorite
42 extern int article_favor_set(int32_t aid, ARTICLE_FAVOR *p_favor, int state);
43
44 extern int query_favor_articles(ARTICLE_FAVOR *p_favor, int page_id, ARTICLE **p_articles,
45 char p_snames[][BBS_section_name_max_len + 1], int *p_article_count, int *p_page_count);
46
47 #endif //_ARTICLE_FAVOR_H_

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