Commit 1d847ed3 authored by rswindell's avatar rswindell

Introduce new node status (NODE_LOGOUT), which is used for the status of a node

after a user (has been) disconnected and before the node transitions to waiting
for connection (WFC) status. Usually the duration of this status is very short,
but it can be longer (e.g. for running log-out module and event) and for (new)
msg-scan pointer fix-ups.
Updated logout() to remove some cruft and add some more log/debug output.
Automatic new-scan pointer fix-ups when performing new-message scans (if the
current pointer is greater than the last message number, set it to the last
message number) and when saving message pointers.
Passing user_t* to get/putmsgptrs() instead of message number now (to better
detect Guest account).
parent 228274a9
......@@ -47,13 +47,13 @@ void sbbs_t::getmsgptrs()
if(!useron.number)
return;
bputs(text[LoadingMsgPtrs]);
::getmsgptrs(&cfg,(useron.rest&FLAG('G')) ? 0:useron.number,subscan);
::getmsgptrs(&cfg,&useron,subscan);
bputs(text[LoadedMsgPtrs]);
}
void sbbs_t::putmsgptrs()
{
::putmsgptrs(&cfg,(useron.rest&FLAG('G')) ? 0:useron.number,subscan);
::putmsgptrs(&cfg,&useron,subscan);
}
/****************************************************************************/
......
......@@ -447,6 +447,10 @@ void sbbs_t::printnodedat(uint number, node_t* node)
bputs(text[NodeStatusLogon]);
bputs(node_connection_desc(this, node->connection, tmp));
break;
case NODE_LOGOUT:
bprintf(text[NodeStatusLogout]
,(node->misc&NODE_ANON) && !SYSOP ? text[UNKNOWN_USER] : username(&cfg,node->useron,tmp));
break;
case NODE_EVENT_WAITING:
bputs(text[NodeStatusEventWaiting]);
break;
......
......@@ -43,6 +43,7 @@
/****************************************************************************/
void sbbs_t::logout()
{
char path[MAX_PATH+1];
char str[256];
char tmp[512];
int i,j;
......@@ -52,18 +53,23 @@ void sbbs_t::logout()
now=time(NULL);
if(localtime_r(&now,&tm)==NULL)
return;
errormsg(WHERE,ERR_CHK,"localtime",(ulong)now);
if(!useron.number) { /* Not logged in, so do nothing */
if(!online) {
sprintf(str,"%s T:%3u sec\r\n"
SAFEPRINTF2(str,"%s T:%3u sec\r\n"
,hhmmtostr(&cfg,&tm,tmp)
,(uint)(now-answertime));
logline("@-",str);
}
return;
}
strcpy(lastuseron,useron.alias); /* for use with WFC status display */
lprintf(LOG_INFO, "Node %d %s logout initiated", cfg.node_num, useron.alias);
SAFECOPY(lastuseron,useron.alias);
if(!online && getnodedat(cfg.node_num, &node, /* lock: */true) == 0) {
node.status = NODE_LOGOUT;
putnodedat(cfg.node_num, &node);
}
if(useron.rest&FLAG('G')) {
putuserrec(&cfg,useron.number,U_NAME,LEN_NAME,nulstr);
......@@ -78,47 +84,28 @@ void sbbs_t::logout()
getnodedat(i,&node,0);
if((node.status==NODE_INUSE || node.status==NODE_QUIET)
&& !(node.misc&NODE_AOFF) && node.useron!=useron.number) {
sprintf(str,text[NodeLoggedOff],cfg.node_num
SAFEPRINTF2(str,text[NodeLoggedOff],cfg.node_num
,thisnode.misc&NODE_ANON
? text[UNKNOWN_USER] : useron.alias);
putnmsg(&cfg,i,str); }
putnmsg(&cfg,i,str);
}
}
if(!online) { /* NOT re-login */
#if 0 /* too soon, handled in node_thread */
getnodedat(cfg.node_num,&thisnode,1);
thisnode.status=NODE_WFC;
thisnode.misc&=~(NODE_INTR|NODE_MSGW|NODE_NMSG
|NODE_UDAT|NODE_POFF|NODE_AOFF|NODE_EXT);
putnodedat(cfg.node_num,&thisnode);
#endif
#if 0 /* beep? */
if(sys_status&SS_SYSALERT) {
mswait(500);
offhook();
CLS;
lputs("\r\n\r\nAlerting Sysop...");
while(!lkbrd(1)) {
sbbs_beep(1000,200);
nosound();
mswait(200);
}
lkbrd(0);
}
#endif
sys_status&=~SS_SYSALERT;
if(cfg.sys_logout[0]) /* execute system logout event */
if(cfg.sys_logout[0]) { /* execute system logout event */
lprintf(LOG_DEBUG, "Node %d executing logout event", cfg.node_num);
external(cmdstr(cfg.sys_logout,nulstr,nulstr,NULL),EX_OUTL|EX_OFFLINE);
}
}
if(cfg.logout_mod[0])
if(cfg.logout_mod[0]) {
lprintf(LOG_DEBUG, "Node %d executing logout module", cfg.node_num);
exec_bin(cfg.logout_mod,&main_csi);
}
backout();
sprintf(str,"%smsgs/%4.4u.msg",cfg.data_dir,useron.number);
if(!flength(str)) /* remove any 0 byte message files */
remove(str);
SAFEPRINTF2(path,"%smsgs/%4.4u.msg",cfg.data_dir,useron.number);
if(fexistcase(path) && !flength(path)) /* remove any 0 byte message files */
remove(path);
delfiles(cfg.temp_dir,ALLFILES);
putmsgptrs();
......@@ -139,7 +126,7 @@ void sbbs_t::logout()
if(useron.min && j>i) {
j-=i; /* j=time to deduct from min */
sprintf(str,"Minute Adjustment: %d",-j);
SAFEPRINTF(str,"Minute Adjustment: %d",-j);
logline(">>",str);
if(useron.min>(ulong)j)
useron.min-=j;
......@@ -165,18 +152,20 @@ void sbbs_t::logout()
hhmmtostr(&cfg,&tm,str);
strcat(str," ");
if(sys_status&SS_USERON)
sprintf(tmp,"T:%3u R:%3lu P:%3lu E:%3lu F:%3lu "
safe_snprintf(tmp,sizeof(tmp),"T:%3u R:%3lu P:%3lu E:%3lu F:%3lu "
"U:%3luk %lu D:%3luk %lu"
,(uint)(now-logontime)/60,posts_read,logon_posts
,logon_emails,logon_fbacks,logon_ulb/1024UL,logon_uls
,logon_dlb/1024UL,logon_dls);
else
sprintf(tmp,"T:%3u sec",(uint)(now-answertime));
SAFEPRINTF(tmp,"T:%3u sec",(uint)(now-answertime));
strcat(str,tmp);
strcat(str,"\r\n");
logline("@-",str);
sys_status&=~SS_USERON;
answertime=now; // Incase we're relogging on
lprintf(LOG_DEBUG, "Node %d %s logout completed", cfg.node_num, useron.alias);
}
/****************************************************************************/
......@@ -184,30 +173,30 @@ void sbbs_t::logout()
/****************************************************************************/
void sbbs_t::backout()
{
char str[256],code[128],*buf;
char path[MAX_PATH+1],code[128],*buf;
int i,file;
long length,l;
file_t f;
sprintf(str,"%sbackout.dab",cfg.node_dir);
if(flength(str)<1L) {
remove(str);
SAFEPRINTF(path,"%sbackout.dab",cfg.node_dir);
if(flength(path)<1L) {
remove(path);
return;
}
if((file=nopen(str,O_RDONLY))==-1) {
errormsg(WHERE,ERR_OPEN,str,O_RDONLY);
if((file=nopen(path,O_RDONLY))==-1) {
errormsg(WHERE,ERR_OPEN,path,O_RDONLY);
return;
}
length=(long)filelength(file);
if((buf=(char *)malloc(length))==NULL) {
close(file);
errormsg(WHERE,ERR_ALLOC,str,length);
errormsg(WHERE,ERR_ALLOC,path,length);
return;
}
if(read(file,buf,length)!=length) {
close(file);
free(buf);
errormsg(WHERE,ERR_READ,str,length);
errormsg(WHERE,ERR_READ,path,length);
return;
}
close(file);
......@@ -226,10 +215,11 @@ void sbbs_t::backout()
}
break;
default:
errormsg(WHERE,ERR_CHK,str,buf[l]); }
errormsg(WHERE,ERR_CHK,path,buf[l]);
}
}
free(buf);
remove(str); /* always remove the backout file */
remove(path); /* always remove the backout file */
}
/****************************************************************************/
......@@ -245,13 +235,13 @@ void sbbs_t::logofflist()
return;
if(localtime_r(&logontime,&tm)==NULL)
return;
sprintf(str,"%slogs/%2.2d%2.2d%2.2d.lol",cfg.logs_dir,tm.tm_mon+1,tm.tm_mday
SAFEPRINTF4(str,"%slogs/%2.2d%2.2d%2.2d.lol",cfg.logs_dir,tm.tm_mon+1,tm.tm_mday
,TM_YEAR(tm.tm_year));
if((file=nopen(str,O_WRONLY|O_CREAT|O_APPEND))==-1) {
errormsg(WHERE,ERR_OPEN,str,O_WRONLY|O_CREAT|O_APPEND);
return;
}
sprintf(str,"%-*.*s %-2d %-8.8s %2.2d:%2.2d %2.2d:%2.2d %3d%3ld%3ld%3ld%3ld"
safe_snprintf(str,sizeof(str),"%-*.*s %-2d %-8.8s %2.2d:%2.2d %2.2d:%2.2d %3d%3ld%3ld%3ld%3ld"
"%3ld%3ld\r\n",LEN_ALIAS,LEN_ALIAS,useron.alias,cfg.node_num,connection
,tm.tm_hour,tm.tm_min,tm_now.tm_hour,tm_now.tm_min
,(int)(now-logontime)/60,posts_read,logon_posts,logon_emails
......
......@@ -8,7 +8,7 @@
* @format.tab-size 4 (Plain Text/Source Code File Header) *
* @format.use-tabs true (see http://www.synchro.net/ptsc_hdr.html) *
* *
* Copyright 2013 Rob Swindell - http://www.synchro.net/copyright.html *
* Copyright Rob Swindell - http://www.synchro.net/copyright.html *
* *
* This program is free software; you can redistribute it and/or *
* modify it under the terms of the GNU General Public License *
......@@ -260,7 +260,10 @@ void printnodedat(int number, node_t node)
printf("Networking");
break;
case NODE_LOGON:
printf("At logon prompt");
printf("At login prompt");
break;
case NODE_LOGOUT:
printf("Logging out");
break;
case NODE_EVENT_WAITING:
printf("Waiting for all nodes to become inactive");
......
......@@ -8,7 +8,7 @@
* @format.tab-size 4 (Plain Text/Source Code File Header) *
* @format.use-tabs true (see http://www.synchro.net/ptsc_hdr.html) *
* *
* Copyright 2007 Rob Swindell - http://www.synchro.net/copyright.html *
* Copyright Rob Swindell - http://www.synchro.net/copyright.html *
* *
* This program is free software; you can redistribute it and/or *
* modify it under the terms of the GNU General Public License *
......@@ -45,7 +45,7 @@
#include "smbdefs.h" /* uchar, ushort, ulong and _PACK */
#include "limits.h"
enum { /* Node Status */
enum node_status { /* Node Status */
NODE_WFC /* Waiting for Call */
,NODE_LOGON /* at logon prompt */
,NODE_NEWUSER /* New user applying */
......@@ -56,6 +56,7 @@ enum { /* Node Status */
,NODE_EVENT_WAITING /* Waiting for all nodes to be inactive */
,NODE_EVENT_RUNNING /* Running an external event */
,NODE_EVENT_LIMBO /* Allowing another node to run an event */
,NODE_LOGOUT /* Logging out */
};
#define NODE_INVALID_STATUS 0xff /* Invalid status value */
......@@ -76,7 +77,7 @@ enum { /* Node Status */
#define NODE_EXT (1<<12) /* Extended info on node action */
#define NODE_LCHAT (1<<13) /* Being pulled into local chat */
enum { /* Node Action */
enum node_action { /* Node Action */
NODE_MAIN /* Main Prompt */
,NODE_RMSG /* Reading Messages */
,NODE_RMAL /* Reading Mail */
......@@ -112,20 +113,20 @@ enum { /* Node Action */
#define SIZEOF_NODE_T 15 /* Must == sizeof(node_t) */
typedef struct _PACK { /* Node information kept in node.dab */
uchar status, /* Current Status of Node */
errors, /* Number of Critical Errors */
action; /* Action User is doing on Node */
uint16_t useron, /* User on Node */
connection, /* Connection rate of Node */
#define NODE_CONNECTION_LOCAL 0
#define NODE_CONNECTION_TELNET USHRT_MAX /* 0xffff */
#define NODE_CONNECTION_RLOGIN (USHRT_MAX-1)
#define NODE_CONNECTION_SSH (USHRT_MAX-2)
misc, /* Miscellaneous bits for node */
aux; /* Auxillary word for node */
uint32_t extaux; /* Extended aux dword for node */
} node_t;
typedef struct _PACK { /* Node information kept in node.dab */
uchar status, /* Current Status of Node (enum node_status) */
errors, /* Number of Critical Errors */
action; /* Action User is doing on Node (enum node_action) */
uint16_t useron, /* User on Node */
connection, /* Connection rate of Node */
#define NODE_CONNECTION_LOCAL 0
#define NODE_CONNECTION_TELNET USHRT_MAX /* 0xffff */
#define NODE_CONNECTION_RLOGIN (USHRT_MAX-1)
#define NODE_CONNECTION_SSH (USHRT_MAX-2)
misc, /* Miscellaneous bits for node */
aux; /* Auxillary word for node */
uint32_t extaux; /* Extended aux dword for node */
} node_t;
#if defined(_WIN32) || defined(__BORLANDC__)
#pragma pack(pop) /* original packing */
......
......@@ -425,11 +425,10 @@ bool sbbs_t::pack_qwk(char *packet, ulong *msgcnt, bool prepack)
subs_scanned++;
msgs=getlastmsg(usrsub[i][j],&lastmsg,0);
if(!msgs || lastmsg<=subscan[usrsub[i][j]].ptr) { /* no msgs */
if(subscan[usrsub[i][j]].ptr>lastmsg) { /* corrupted ptr */
outchar('*');
subscan[usrsub[i][j]].ptr=lastmsg; /* so fix automatically */
if(subscan[usrsub[i][j]].ptr>lastmsg) /* corrupted ptr */
subscan[usrsub[i][j]].ptr=lastmsg; /* so fix automatically */
if(subscan[usrsub[i][j]].last>lastmsg)
subscan[usrsub[i][j]].last=lastmsg;
}
bprintf(text[NScanStatusFmt]
,cfg.grp[cfg.sub[usrsub[i][j]]->grp]->sname
,cfg.sub[usrsub[i][j]]->lname,0L,msgs);
......
......@@ -413,7 +413,9 @@ int sbbs_t::scanposts(uint subnum, long mode, const char *find)
}
if(mode&SCAN_NEW && subscan[subnum].ptr>=last && !(mode&SCAN_BACK)) {
if(subscan[subnum].ptr>last)
subscan[subnum].ptr=subscan[subnum].last=last;
subscan[subnum].ptr=last;
if(subscan[subnum].last>last)
subscan[subnum].last=last;
bprintf(text[NScanStatusFmt]
,cfg.grp[cfg.sub[subnum]->grp]->sname,cfg.sub[subnum]->lname,0L,msgs);
return(0);
......
......@@ -373,7 +373,7 @@ js_login(JSContext *cx, uintN argc, jsval *arglist)
/* ToDo Deuce: did you mean to do this *before* the above memset(0) ? */
if(client->user.number) {
if(client->subscan!=NULL)
putmsgptrs(&scfg, client->user.number, client->subscan);
putmsgptrs(&scfg, &client->user, client->subscan);
}
if(isdigit(*user))
......@@ -428,7 +428,7 @@ js_login(JSContext *cx, uintN argc, jsval *arglist)
lprintf(LOG_CRIT,"!MALLOC FAILURE");
}
if(client->subscan!=NULL) {
getmsgptrs(&scfg,client->user.number,client->subscan);
getmsgptrs(&scfg,&client->user,client->subscan);
}
JS_RESUMEREQUEST(cx, rc);
......@@ -1133,7 +1133,7 @@ static void js_service_thread(void* arg)
if(service_client.user.number) {
if(service_client.subscan!=NULL)
putmsgptrs(&scfg, service_client.user.number, service_client.subscan);
putmsgptrs(&scfg, &service_client.user, service_client.subscan);
lprintf(LOG_INFO,"%04d %s Logging out %s"
,socket, service->protocol, service_client.user.alias);
logoutuserdat(&scfg,&service_client.user,time(NULL),service_client.logintime);
......
......@@ -821,6 +821,7 @@ enum {
,InThePast
,InTheFuture
,AgeOfPostedItem
,NodeStatusLogout
,TOTAL_TEXT
};
......
......@@ -1182,7 +1182,7 @@ const char * const text_defaults[TOTAL_TEXT]={
,"\x41\x72\x63\x68\x69\x76\x65\x20\x54\x79\x70\x65"
,"\x56\x61\x6c\x69\x64\x61\x74\x65\x20\x6d\x65\x73\x73\x61\x67\x65\x20\x23\x25\x75\x20\x27\x25\x73\x27"
,"\x57\x61\x69\x74\x69\x6e\x67\x20\x66\x6f\x72\x20\x63\x6f\x6e\x6e\x65\x63\x74\x69\x6f\x6e"
,"\x41\x74\x20\x6c\x6f\x67\x6f\x6e\x20\x70\x72\x6f\x6d\x70\x74"
,"\x41\x74\x20\x6c\x6f\x67\x69\x6e\x20\x70\x72\x6f\x6d\x70\x74"
,"\x4e\x65\x77\x20\x75\x73\x65\x72\x20\x61\x70\x70\x6c\x79\x69\x6e\x67\x20\x66\x6f\x72\x20\x61\x63\x63\x65\x73\x73"
,"\x4f\x66\x66\x6c\x69\x6e\x65"
,"\x57\x61\x69\x74\x69\x6e\x67\x20\x66\x6f\x72\x20\x61\x6c\x6c\x20\x6e\x6f\x64\x65\x73\x20\x74\x6f\x20\x62\x65\x63\x6f\x6d\x65\x20"
......@@ -1281,4 +1281,5 @@ const char * const text_defaults[TOTAL_TEXT]={
,"\x61\x67\x6f"
,"\x66\x72\x6f\x6d\x20\x6e\x6f\x77"
,"\x25\x73\x20\x25\x73\x20\x25\x73"
,"\x6c\x6f\x67\x67\x69\x6e\x67\x20\x6f\x75\x74\x20\x01\x68\x25\x73"
};
......@@ -845,29 +845,33 @@ char* DLLCALL nodestatus(scfg_t* cfg, node_t* node, char* buf, size_t buflen)
return(buf);
}
str[0]=0;
switch(node->status) {
case NODE_WFC:
strcpy(str,"Waiting for connection");
SAFECOPY(str,"Waiting for connection");
break;
case NODE_OFFLINE:
strcpy(str,"Offline");
break;
case NODE_NETTING: /* Obsolete */
strcpy(str,"Networking");
SAFECOPY(str,"Networking");
break;
case NODE_LOGON:
SAFEPRINTF(str,"At logon prompt %s"
SAFEPRINTF(str,"At login prompt %s"
,node_connection_desc(node->connection, tmp));
break;
case NODE_LOGOUT:
SAFEPRINTF(str,"Logging out %s", username(cfg,node->useron,tmp));
break;
case NODE_EVENT_WAITING:
strcpy(str,"Waiting for all nodes to become inactive");
SAFECOPY(str,"Waiting for all nodes to become inactive");
break;
case NODE_EVENT_LIMBO:
SAFEPRINTF(str,"Waiting for node %d to finish external event"
,node->aux);
break;
case NODE_EVENT_RUNNING:
strcpy(str,"Running external event");
SAFECOPY(str,"Running external event");
break;
case NODE_NEWUSER:
SAFEPRINTF(str,"New user applying for access %s"
......@@ -2838,9 +2842,8 @@ ulong DLLCALL loginFailure(link_list_t* list, const union xp_sockaddr* addr, con
/****************************************************************************/
/* 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)
BOOL DLLCALL getmsgptrs(scfg_t* cfg, user_t* user, subscan_t* subscan)
{
char path[MAX_PATH+1];
uint i;
......@@ -2860,10 +2863,13 @@ BOOL DLLCALL getmsgptrs(scfg_t* cfg, uint usernumber, subscan_t* subscan)
subscan[i].sav_cfg=subscan[i].cfg;
}
if(usernumber == 0) /* guest */
if(user->number == 0)
return 0;
if(user->rest&FLAG('G'))
return initmsgptrs(cfg, subscan, cfg->guest_msgscan_init);
SAFEPRINTF2(path,"%suser/ptrs/%4.4u.ixb", cfg->data_dir, usernumber);
SAFEPRINTF2(path,"%suser/ptrs/%4.4u.ixb", cfg->data_dir, user->number);
if((stream=fnopen(&file,path,O_RDONLY))==NULL) {
if(fexist(path))
return(FALSE); /* file exists, but couldn't be opened? */
......@@ -2890,7 +2896,7 @@ BOOL DLLCALL getmsgptrs(scfg_t* cfg, uint usernumber, subscan_t* subscan)
/* 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)
BOOL DLLCALL putmsgptrs(scfg_t* cfg, user_t* user, subscan_t* subscan)
{
char path[MAX_PATH+1];
ushort idx;
......@@ -2900,12 +2906,13 @@ BOOL DLLCALL putmsgptrs(scfg_t* cfg, uint usernumber, subscan_t* subscan)
ulong length;
uint32_t l=0L;
if(usernumber == 0) /* Guest */
if(user->number==0 || (user->rest&FLAG('G'))) /* Guest */
return(TRUE);
SAFEPRINTF2(path,"%suser/ptrs/%4.4u.ixb", cfg->data_dir, usernumber);
SAFEPRINTF2(path,"%suser/ptrs/%4.4u.ixb", cfg->data_dir, user->number);
if((file=nopen(path,O_WRONLY|O_CREAT))==-1) {
return(FALSE);
}
fixmsgptrs(cfg, subscan);
length=(ulong)filelength(file);
for(i=0;i<cfg->total_subs;i++) {
if(subscan[i].sav_ptr==subscan[i].ptr
......@@ -2956,7 +2963,8 @@ BOOL DLLCALL initmsgptrs(scfg_t* cfg, subscan_t* subscan, unsigned days)
for(i=0;i<cfg->total_subs;i++) {
if(days == 0) {
subscan[i].sav_ptr = subscan[i].ptr = ~0;
/* This value will be "fixed" (changed to the last msg) when saving */
subscan[i].ptr = ~0;
continue;
}
ZERO_VAR(smb);
......@@ -2966,9 +2974,38 @@ BOOL DLLCALL initmsgptrs(scfg_t* cfg, subscan_t* subscan, unsigned days)
if(smb_open(&smb) != SMB_SUCCESS)
continue;
if(days == 0)
subscan[i].sav_ptr = subscan[i].ptr = smb.status.last_msg;
subscan[i].ptr = smb.status.last_msg;
else if(smb_getmsgidx_by_time(&smb, &idx, t) == SMB_SUCCESS)
subscan[i].sav_ptr = subscan[i].ptr = idx.number;
subscan[i].ptr = idx.number;
smb_close(&smb);
}
return TRUE;
}
/****************************************************************************/
/* Insure message new-scan pointers are within the range of the msgs in */
/* the sub-board. */
/****************************************************************************/
BOOL DLLCALL fixmsgptrs(scfg_t* cfg, subscan_t* subscan)
{
uint i;
smb_t smb;
for(i=0;i<cfg->total_subs;i++) {
if(subscan[i].ptr == 0)
continue;
if(subscan[i].sav_ptr == subscan[i].ptr)
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;
smb.subnum=i;
if(smb_open(&smb) != SMB_SUCCESS)
continue;
if(subscan[i].ptr > smb.status.last_msg)
subscan[i].ptr = smb.status.last_msg;
if(subscan[i].last > smb.status.last_msg)
subscan[i].last = smb.status.last_msg;
smb_close(&smb);
}
return TRUE;
......
......@@ -122,8 +122,9 @@ DLLEXPORT BOOL DLLCALL filter_ip(scfg_t* cfg, const char* prot, const char* reas
,const char* ip_addr, const char* username, const char* fname);
/* New-message-scan pointer functions: */
DLLEXPORT BOOL DLLCALL getmsgptrs(scfg_t*, uint usernumber, subscan_t*);
DLLEXPORT BOOL DLLCALL putmsgptrs(scfg_t*, uint usernumber, subscan_t*);
DLLEXPORT BOOL DLLCALL getmsgptrs(scfg_t*, user_t*, subscan_t*);
DLLEXPORT BOOL DLLCALL putmsgptrs(scfg_t*, user_t*, subscan_t*);
DLLEXPORT BOOL DLLCALL fixmsgptrs(scfg_t*, subscan_t*);
DLLEXPORT BOOL DLLCALL initmsgptrs(scfg_t*, subscan_t*, unsigned days);
......
......@@ -1072,7 +1072,7 @@ static void close_request(http_session_t * session)
JS_ENDREQUEST(session->js_cx);
}
if(session->subscan!=NULL)
putmsgptrs(&scfg, session->user.number, session->subscan);
putmsgptrs(&scfg, &session->user, session->subscan);
if(session->req.fp!=NULL)
fclose(session->req.fp);
......@@ -1511,7 +1511,7 @@ void http_logon(http_session_t * session, user_t *usr)
lprintf(LOG_DEBUG,"%04d HTTP Logon (user #%d)",session->socket,session->user.number);
if(session->subscan!=NULL)
getmsgptrs(&scfg,session->user.number,session->subscan);
getmsgptrs(&scfg,&session->user,session->subscan);
session->logon_time=time(NULL);
if(session->user.number==0)
......
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