Commit 82cf88b3 authored by rswindell's avatar rswindell
Browse files

Changed getposts() and getfiles() to be DLL-callable

(no longer members of the C++ class sbbs_t).
parent 61a2a1a9
......@@ -120,7 +120,7 @@ int sbbs_t::atcodes(char *instr)
else if(!strcmp(sp,"TMSG")) {
l=0;
for(i=0;i<cfg.total_subs;i++)
l+=getposts(i); /* l=total posts */
l+=getposts(&cfg,i); /* l=total posts */
bprintf("%lu",l); }
else if(!strcmp(sp,"TUSER"))
......@@ -129,7 +129,7 @@ int sbbs_t::atcodes(char *instr)
else if(!strcmp(sp,"TFILE")) {
l=0;
for(i=0;i<cfg.total_dirs;i++)
l+=getfiles(i);
l+=getfiles(&cfg,i);
bprintf("%lu",l); }
else if(!strcmp(sp,"TCALLS") || !strcmp(sp,"NUMCALLS")) {
......
......@@ -108,12 +108,12 @@ uint sbbs_t::finduser(char *instr)
/****************************************************************************/
/* Returns the number of files in the directory 'dirnum' */
/****************************************************************************/
int sbbs_t::getfiles(uint dirnum)
long getfiles(scfg_t* cfg, uint dirnum)
{
char str[256];
long l;
sprintf(str,"%s%s.ixb",cfg.dir[dirnum]->data_dir, cfg.dir[dirnum]->code);
sprintf(str,"%s%s.ixb",cfg->dir[dirnum]->data_dir, cfg->dir[dirnum]->code);
l=flength(str);
if(l>0L)
return(l/F_IXBSIZE);
......
......@@ -87,7 +87,7 @@ int sbbs_t::exec_file(csi_t *csi)
else outchar(SP);
sprintf(str,text[DirLstFmt],i+1
,cfg.dir[usrdir[j][i]]->lname,nulstr
,getfiles(usrdir[j][i]));
,getfiles(&cfg,usrdir[j][i]));
if(i<9) outchar(SP);
if(i<99) outchar(SP);
bputs(str); } }
......@@ -211,7 +211,7 @@ int sbbs_t::exec_file(csi_t *csi)
else outchar(SP);
sprintf(str,text[DirLstFmt],i+1
,cfg.dir[usrdir[curlib][i]]->lname,nulstr
,getfiles(usrdir[curlib][i]));
,getfiles(&cfg,usrdir[curlib][i]));
if(i<9) outchar(SP);
if(i<99) outchar(SP);
bputs(str); }
......@@ -420,7 +420,7 @@ int sbbs_t::exec_file(csi_t *csi)
case CS_FILE_LIST: /* List files in current dir */
if(!usrlibs) return(0);
csi->logic=LOGIC_FALSE;
if(!getfiles(usrdir[curlib][curdir[curlib]])) {
if(!getfiles(&cfg,usrdir[curlib][curdir[curlib]])) {
bputs(text[EmptyDir]);
return(0); }
padfname(csi->str,str);
......
......@@ -85,7 +85,7 @@ int sbbs_t::exec_msg(csi_t *csi)
else outchar(SP);
sprintf(str,text[SubLstFmt],i+1
,cfg.sub[usrsub[j][i]]->lname,nulstr
,getposts(usrsub[j][i]));
,getposts(&cfg,usrsub[j][i]));
if(i<9) outchar(SP);
if(i<99) outchar(SP);
bputs(str); } }
......@@ -220,7 +220,7 @@ int sbbs_t::exec_msg(csi_t *csi)
else outchar(SP);
sprintf(str,text[SubLstFmt],i+1
,cfg.sub[usrsub[curgrp][i]]->lname,nulstr
,getposts(usrsub[curgrp][i]));
,getposts(&cfg,usrsub[curgrp][i]));
if(i<9) outchar(SP);
if(i<99) outchar(SP);
bputs(str); }
......
......@@ -309,12 +309,12 @@ void sbbs_t::msgtotxt(smbmsg_t* msg, char *str, int header, int tails)
/****************************************************************************/
/* Returns total number of posts in a sub-board */
/****************************************************************************/
ulong sbbs_t::getposts(uint subnum)
ulong getposts(scfg_t* cfg, uint subnum)
{
char str[128];
ulong l;
sprintf(str,"%s%s.sid",cfg.sub[subnum]->data_dir,cfg.sub[subnum]->code);
sprintf(str,"%s%s.sid",cfg->sub[subnum]->data_dir,cfg->sub[subnum]->code);
l=flength(str);
if((long)l==-1)
return(0);
......
......@@ -944,7 +944,7 @@ int sbbs_t::searchsub(uint subnum, char *search)
if((i=smb_stack(&smb,SMB_STACK_PUSH))!=0) {
errormsg(WHERE,ERR_OPEN,cfg.sub[subnum]->code,i);
return(0); }
total=getposts(subnum);
total=getposts(&cfg,subnum);
sprintf(smb.file,"%s%s",cfg.sub[subnum]->data_dir,cfg.sub[subnum]->code);
smb.retry_time=cfg.smb_retry_time;
if((i=smb_open(&smb))!=0) {
......@@ -1074,7 +1074,7 @@ int sbbs_t::searchsub_toyou(uint subnum)
if((i=smb_stack(&smb,SMB_STACK_PUSH))!=0) {
errormsg(WHERE,ERR_OPEN,cfg.sub[subnum]->code,i);
return(0); }
total=getposts(subnum);
total=getposts(&cfg,subnum);
sprintf(smb.file,"%s%s",cfg.sub[subnum]->data_dir,cfg.sub[subnum]->code);
smb.retry_time=cfg.smb_retry_time;
if((i=smb_open(&smb))!=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