Commit 2bc211ec authored by rswindell's avatar rswindell
Browse files

New feature: similar to setting New User's new-msg-scan initial values (days of

messages), you can now set the Guest accounts new-msg-scan values. The default
is 0 (no new messages).
Using a value of 0 for this or the New User Days of Messages value results in a
very fast message pointer initialization (no "Loading Message Pointers..."
delay).
parent e84eebb6
......@@ -47,13 +47,13 @@ void sbbs_t::getmsgptrs()
if(!useron.number)
return;
bputs(text[LoadingMsgPtrs]);
::getmsgptrs(&cfg,useron.number,subscan);
::getmsgptrs(&cfg,(useron.rest&FLAG('G')) ? 0:useron.number,subscan);
bputs(text[LoadedMsgPtrs]);
}
void sbbs_t::putmsgptrs()
{
::putmsgptrs(&cfg,useron.number,subscan);
::putmsgptrs(&cfg,(useron.rest&FLAG('G')) ? 0:useron.number,subscan);
}
/****************************************************************************/
......
......@@ -499,6 +499,7 @@ typedef struct
uint16_t new_expire; /* Expiration days for new user */
uchar new_prot; /* New User Default Download Protocol */
uint16_t new_msgscan_init; /* Uew User new-scan pointers initialized to msgs this old (in days) */
uint16_t guest_msgscan_init; /* Guest new-scan pointers initialized to msgs this old (in days) */
char val_level[10]; /* Validation User Main Level */
uint32_t val_flags1[10]; /* Validation User Flags from set #1*/
uint32_t val_flags2[10]; /* Validation User Flags from set #2*/
......
......@@ -277,7 +277,8 @@ BOOL read_main_cfg(scfg_t* cfg, char* error)
cfg->new_prot=' ';
get_int(cfg->new_install,instream);
get_int(cfg->new_msgscan_init,instream);
for(i=0;i<6;i++)
get_int(cfg->guest_msgscan_init,instream);
for(i=0;i<5;i++)
get_int(n,instream);
/*************************/
......
......@@ -352,8 +352,9 @@ BOOL DLLCALL write_main_cfg(scfg_t* cfg, int backup_level)
put_int(cfg->new_prot,stream);
put_int(cfg->new_install,stream);
put_int(cfg->new_msgscan_init, stream);
put_int(cfg->guest_msgscan_init, stream);
n=0;
for(i=0;i<6;i++)
for(i=0;i<5;i++)
put_int(n,stream);
put_int(cfg->expired_level,stream);
......
......@@ -2837,7 +2837,8 @@ ulong DLLCALL loginFailure(link_list_t* list, const union xp_sockaddr* addr, con
}
/****************************************************************************/
/* Message-new-scan pointer functions (moved from data_ovl.cpp): */
/* Message-new-scan pointer/configuration functions */
/* Pass usernumber value of 0 to indicate "Guest" login */
/****************************************************************************/
BOOL DLLCALL getmsgptrs(scfg_t* cfg, uint usernumber, subscan_t* subscan)
{
......@@ -2859,9 +2860,9 @@ BOOL DLLCALL getmsgptrs(scfg_t* cfg, uint usernumber, subscan_t* subscan)
subscan[i].sav_cfg=subscan[i].cfg;
}
if(!usernumber)
return(FALSE);
if(usernumber == 0) /* guest */
return initmsgptrs(cfg, subscan, cfg->guest_msgscan_init);
SAFEPRINTF2(path,"%suser/ptrs/%4.4u.ixb", cfg->data_dir, usernumber);
if((stream=fnopen(&file,path,O_RDONLY))==NULL) {
if(fexist(path))
......@@ -2886,8 +2887,8 @@ BOOL DLLCALL getmsgptrs(scfg_t* cfg, uint usernumber, subscan_t* subscan)
}
/****************************************************************************/
/* Writes to DATA\USER\PTRS\xxxx.DAB the msgptr array for the current user */
/* Called from functions main and newuser */
/* Writes to data/user/ptrs/*.ixb the msgptr array for the current user */
/* Pass usernumber value of 0 to indicate "Guest" login */
/****************************************************************************/
BOOL DLLCALL putmsgptrs(scfg_t* cfg, uint usernumber, subscan_t* subscan)
{
......@@ -2899,8 +2900,8 @@ BOOL DLLCALL putmsgptrs(scfg_t* cfg, uint usernumber, subscan_t* subscan)
ulong length;
uint32_t l=0L;
if(!usernumber)
return(FALSE);
if(usernumber == 0) /* Guest */
return(TRUE);
SAFEPRINTF2(path,"%suser/ptrs/%4.4u.ixb", cfg->data_dir, usernumber);
if((file=nopen(path,O_WRONLY|O_CREAT))==-1) {
return(FALSE);
......@@ -2954,6 +2955,10 @@ BOOL DLLCALL initmsgptrs(scfg_t* cfg, subscan_t* subscan, unsigned days)
time_t t = time(NULL) - (days * 24 * 60 * 60);
for(i=0;i<cfg->total_subs;i++) {
if(days == 0) {
subscan[i].sav_ptr = subscan[i].ptr = ~0;
continue;
}
ZERO_VAR(smb);
SAFEPRINTF2(smb.file,"%s%s",cfg->sub[i]->data_dir,cfg->sub[i]->code);
smb.retry_time=cfg->smb_retry_time;
......
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