| 1 |
sysadm |
1.1 |
/***************************************************************************
|
| 2 |
|
|
article_favor.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 _ARTICLE_FAVOR_H_
|
| 18 |
|
|
#define _ARTICLE_FAVOR_H_
|
| 19 |
|
|
|
| 20 |
|
|
#include "section_list.h"
|
| 21 |
|
|
#include <stdint.h>
|
| 22 |
|
|
|
| 23 |
|
|
#define MAX_FAVOR_AID_INC_CNT 1000
|
| 24 |
|
|
|
| 25 |
|
|
struct article_favor_t
|
| 26 |
|
|
{
|
| 27 |
|
|
int uid;
|
| 28 |
|
|
int32_t *aid_base;
|
| 29 |
|
|
int aid_base_cnt;
|
| 30 |
|
|
int32_t aid_inc[MAX_FAVOR_AID_INC_CNT];
|
| 31 |
|
|
int aid_inc_cnt;
|
| 32 |
|
|
};
|
| 33 |
|
|
typedef struct article_favor_t ARTICLE_FAVOR;
|
| 34 |
|
|
|
| 35 |
|
|
extern ARTICLE_FAVOR BBS_article_favor;
|
| 36 |
|
|
|
| 37 |
|
|
// Load baseline article favorite from DB
|
| 38 |
|
|
extern int article_favor_load(int uid, ARTICLE_FAVOR *p_favor, int keep_inc);
|
| 39 |
|
|
// Clear data
|
| 40 |
|
|
extern int article_favor_unload(ARTICLE_FAVOR *p_favor);
|
| 41 |
|
|
// Save incremental article favorite to DB
|
| 42 |
|
|
extern int article_favor_save_inc(const ARTICLE_FAVOR *p_favor);
|
| 43 |
|
|
// Merge incremental article favorite to baseline, without DB read / write
|
| 44 |
|
|
extern int article_favor_merge_inc(ARTICLE_FAVOR *p_favor);
|
| 45 |
|
|
|
| 46 |
|
|
// Check if specific article was set as favorite
|
| 47 |
|
|
extern int article_favor_check(int32_t aid, const ARTICLE_FAVOR *p_favor);
|
| 48 |
|
|
// Set specific article as favorite
|
| 49 |
|
|
extern int article_favor_set(int32_t aid, ARTICLE_FAVOR *p_favor, int state);
|
| 50 |
|
|
|
| 51 |
|
|
extern int query_favor_articles(ARTICLE_FAVOR *p_favor, int page_id, ARTICLE **p_articles,
|
| 52 |
|
|
char p_snames[][BBS_section_name_max_len + 1], int *p_article_count, int *p_page_count);
|
| 53 |
|
|
|
| 54 |
|
|
#endif //_ARTICLE_FAVOR_H_
|