| 1 |
/*************************************************************************** |
/* SPDX-License-Identifier: GPL-3.0-or-later */ |
| 2 |
bbs.c - description |
/* |
| 3 |
------------------- |
* bbs |
| 4 |
Copyright : (C) 2004-2025 by Leaflet |
* - BBS related common definitions |
| 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 |
#include "bbs.h" |
#include "bbs.h" |
| 10 |
#include "common.h" |
#include "common.h" |
| 14 |
#include <signal.h> |
#include <signal.h> |
| 15 |
#include <time.h> |
#include <time.h> |
| 16 |
|
|
| 17 |
#define BBS_port_default 23 |
enum _bbs_port_constant_t |
| 18 |
#define BBS_ssh_port_default 22 |
{ |
| 19 |
|
BBS_port_default = 23, |
| 20 |
|
BBS_ssh_port_default = 22, |
| 21 |
|
}; |
| 22 |
|
|
| 23 |
// BBS enviroment |
// BBS enviroment |
| 24 |
char BBS_id[BBS_id_max_len + 1] = "Example BBS"; |
char BBS_id[BBS_id_max_len + 1] = "Example BBS"; |
| 31 |
char BBS_start_dt[BBS_start_dt_max_len + 1] = "2000年 1月 1日"; |
char BBS_start_dt[BBS_start_dt_max_len + 1] = "2000年 1月 1日"; |
| 32 |
int BBS_sys_id = 1; |
int BBS_sys_id = 1; |
| 33 |
|
|
| 34 |
const int BBS_section_list_load_interval = 5; // second |
const int BBS_section_list_load_interval = 1; // second |
| 35 |
|
|
| 36 |
// User |
// User |
| 37 |
const int BBS_user_list_load_interval = 60; // 1 minute |
const int BBS_user_list_load_interval = 60; // 1 minute |
| 74 |
80000, // 13 |
80000, // 13 |
| 75 |
90000, // 14 |
90000, // 14 |
| 76 |
100000, // 15 |
100000, // 15 |
|
INT_MAX, // 16 |
|
| 77 |
}; |
}; |
| 78 |
|
|
| 79 |
static const char *BBS_user_level_names[] = { |
static const char *BBS_user_level_names[] = { |
| 123 |
while (left < right) |
while (left < right) |
| 124 |
{ |
{ |
| 125 |
mid = (left + right) / 2; |
mid = (left + right) / 2; |
| 126 |
if (point < BBS_user_level_points[mid + 1]) |
if (point < BBS_user_level_points[mid]) |
| 127 |
{ |
{ |
| 128 |
right = mid; |
right = mid - 1; |
| 129 |
} |
} |
| 130 |
else if (point > BBS_user_level_points[mid + 1]) |
else if (point > BBS_user_level_points[mid]) |
| 131 |
{ |
{ |
| 132 |
left = mid + 1; |
left = mid + 1; |
| 133 |
} |
} |
| 134 |
else // if (point == user_level_points[mid]) |
else // if (point == user_level_points[mid]) |
| 135 |
{ |
{ |
| 136 |
left = mid + 1; |
left = mid; |
| 137 |
break; |
break; |
| 138 |
} |
} |
| 139 |
} |
} |
| 140 |
|
|
| 141 |
|
if (point < BBS_user_level_points[left]) |
| 142 |
|
{ |
| 143 |
|
left--; |
| 144 |
|
} |
| 145 |
|
|
| 146 |
return left; |
return left; |
| 147 |
} |
} |
| 148 |
|
|