Commit 9ae0448c authored by Rob Swindell's avatar Rob Swindell 💬
Browse files

Call can_user_post() rather than manual checks

Eliminate some redundant code. Use the userdat lib function provided for this purpose.
parent cac09153
......@@ -1596,8 +1596,7 @@ int sbbs_t::scanposts(uint subnum, long mode, const char *find)
free(post);
if(!quit
&& !(org_mode&(SCAN_CONST|SCAN_TOYOU|SCAN_FIND|SCAN_POLLS)) && !(cfg.sub[subnum]->misc&SUB_PONLY)
&& reads && chk_ar(cfg.sub[subnum]->post_ar,&useron,&client) && text[Post][0]
&& !(useron.rest&FLAG('P'))) {
&& reads && can_user_post(&cfg, subnum, &useron, &client, /* reason: */NULL) && text[Post][0]) {
SAFEPRINTF2(str,text[Post],cfg.grp[cfg.sub[subnum]->grp]->sname
,cfg.sub[subnum]->lname);
if(!noyes(str))
......
......@@ -409,28 +409,11 @@ bool sbbs_t::unpack_rep(char* repfile)
continue;
}
if(useron.rest&FLAG('P')) {
bputs(text[R_Post]);
logline(LOG_NOTICE,"P!","QWK Post attempted");
continue;
}
if(useron.ptoday>=cfg.level_postsperday[useron.level]
&& !(useron.rest&FLAG('Q'))) {
bputs(text[TooManyPostsToday]);
continue;
}
if(useron.rest&FLAG('N')
&& cfg.sub[n]->misc&(SUB_FIDO|SUB_PNET|SUB_QNET|SUB_INET)) {
bputs(text[CantPostOnSub]);
logline(LOG_NOTICE,"P!","QWK Networked post attempted");
continue;
}
if(!chk_ar(cfg.sub[n]->post_ar,&useron,&client)) {
bputs(text[CantPostOnSub]);
logline(LOG_NOTICE,"P!","QWK Post attempted");
uint reason = CantPostOnSub;
if(!can_user_post(&cfg, n, &useron, &client, &reason)) {
bputs(text[reason]);
SAFEPRINTF2(str, "QWK Post not allowed, reason = %u (%s)", reason, text[reason]);
logline(LOG_NOTICE, "P!", str);
continue;
}
......
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