| 1 |
/* SPDX-License-Identifier: GPL-3.0-or-later */
|
| 2 |
/*
|
| 3 |
* section_list_loader
|
| 4 |
* - load and query operations of section articles
|
| 5 |
*
|
| 6 |
* Copyright (C) 2004-2026 Leaflet <leaflet@leafok.com>
|
| 7 |
*/
|
| 8 |
|
| 9 |
#ifndef _SECTION_LIST_LOADER_H_
|
| 10 |
#define _SECTION_LIST_LOADER_H_
|
| 11 |
|
| 12 |
#include "menu.h"
|
| 13 |
#include "section_list.h"
|
| 14 |
#include <mysql.h>
|
| 15 |
|
| 16 |
enum section_list_loader_constant_t
|
| 17 |
{
|
| 18 |
ERR_UNKNOWN_SECTION = -101,
|
| 19 |
LOAD_ARTICLE_COUNT_LIMIT = 1000,
|
| 20 |
};
|
| 21 |
|
| 22 |
extern int section_list_loader_pid;
|
| 23 |
extern int last_article_op_log_mid;
|
| 24 |
|
| 25 |
extern int load_section_config_from_db(int update_gen_ex);
|
| 26 |
|
| 27 |
// Input global_lock = 0 : lock / unlock corresponding section per article
|
| 28 |
// 1 : lock / unlock all sections per invocation
|
| 29 |
// Return on success : count of appended articles (>= 0)
|
| 30 |
// failure : lock / unlock error (-1)
|
| 31 |
// : unknown section found (ERR_UNKNOWN_SECTION)
|
| 32 |
extern int append_articles_from_db(int32_t start_aid, int global_lock, int article_count_limit);
|
| 33 |
|
| 34 |
extern int set_last_article_op_log_from_db(void);
|
| 35 |
|
| 36 |
// Return on success : count of appended articles (>= 0)
|
| 37 |
// failure : lock / unlock error (-1)
|
| 38 |
// : unknown section found (ERR_UNKNOWN_SECTION)
|
| 39 |
extern int apply_article_op_log_from_db(int op_count_limit);
|
| 40 |
|
| 41 |
extern int section_list_loader_launch(void);
|
| 42 |
|
| 43 |
// Return on success : real page_id (>= 0)
|
| 44 |
// failure : error number (< 0)
|
| 45 |
extern int query_section_articles(SECTION_LIST *p_section, int page_id, const ARTICLE *p_articles[],
|
| 46 |
int *p_article_count, int *p_page_count, int *p_ontop_start_offset);
|
| 47 |
|
| 48 |
// Input direction = 0 : locate p_article_cur
|
| 49 |
// -1 : p_article_cur->p_topic_prior
|
| 50 |
// 1 : p_article_cur->p_topic_next
|
| 51 |
// Return on success : found (1)
|
| 52 |
// : not found (0)
|
| 53 |
// failure : error number (< 0)
|
| 54 |
extern int locate_article_in_section(SECTION_LIST *p_section, const ARTICLE *p_article_cur, int direction, int step,
|
| 55 |
int *p_page_id, int *p_visible_offset, int *p_article_count);
|
| 56 |
|
| 57 |
extern int last_article_in_section(SECTION_LIST *p_section, const ARTICLE **pp_article);
|
| 58 |
|
| 59 |
// Return on success : found (1)
|
| 60 |
// : not found (0)
|
| 61 |
// failure : error number (< 0)
|
| 62 |
extern int scan_unread_article_in_section(SECTION_LIST *p_section, const ARTICLE *p_article_cur, const ARTICLE **pp_article_unread);
|
| 63 |
|
| 64 |
extern int scan_article_in_section_by_uid(SECTION_LIST *p_section, const ARTICLE *p_article_cur,
|
| 65 |
int direction, int32_t uid, const ARTICLE **pp_article);
|
| 66 |
extern int scan_article_in_section_by_username(SECTION_LIST *p_section, const ARTICLE *p_article_cur,
|
| 67 |
int direction, const char *username, const ARTICLE **pp_article);
|
| 68 |
extern int scan_article_in_section_by_title(SECTION_LIST *p_section, const ARTICLE *p_article_cur,
|
| 69 |
int direction, const char *title, const ARTICLE **pp_article);
|
| 70 |
|
| 71 |
extern int get_section_ex_menu_set(SECTION_LIST *p_section, MENU_SET *p_ex_menu_set);
|
| 72 |
|
| 73 |
#endif //_SECTION_LIST_LOADER_H_
|