Commit 39a77d9a authored by Rob Swindell's avatar Rob Swindell 💬
Browse files

For subs that allow voting, getposts() will exclude vote messages from total.

Vote messages and poll closures are not displayed to users as messages, so
exclude them from the total "posts" returned from getposts(). This uses
the new smb_msg_count() function which is slower than simply checking the
size of the index file (*.sid) and dividing by the index record size. So
for sub-boards that don't support voting, use the old/faster scheme.
parent 17b7aee1
Pipeline #241 passed with stage
in 19 minutes and 7 seconds
......@@ -79,14 +79,25 @@ long DLLCALL getfiles(scfg_t* cfg, uint dirnum)
ulong DLLCALL getposts(scfg_t* cfg, uint subnum)
char str[128];
ulong l;
if(cfg->sub[subnum]->misc & SUB_NOVOTING) {
char path[MAX_PATH + 1];
off_t l;
SAFEPRINTF2(path, "%s%s.sid", cfg->sub[subnum]->data_dir, cfg->sub[subnum]->code);
l = flength(path);
if(l < sizeof(idxrec_t))
return 0;
return l / sizeof(idxrec_t);
smb_t smb = {{0}};
SAFEPRINTF2(smb.file, "%s%s", cfg->sub[subnum]->data_dir, cfg->sub[subnum]->code);
smb.retry_time = cfg->smb_retry_time;
smb.subnum = subnum;
if(smb_open_index(&smb) != SMB_SUCCESS)
return 0;
size_t result = smb_msg_count(&smb, (1 << SMB_MSG_TYPE_NORMAL) | (1 << SMB_MSG_TYPE_POLL));
return result;
BOOL inc_sys_upload_stats(scfg_t* cfg, ulong files, ulong bytes)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment