Synchronet now requires the libarchive development package (e.g. libarchive-dev on Debian-based Linux distros, libarchive.org for more info) to build successfully.

Commit fa6d1ee3 authored by rswindell's avatar rswindell

Changed delfattach() to an exported C function that now deletes netmail

file attachments as well as local mail file attachments.
parent bfeb0d5e
......@@ -79,11 +79,23 @@ int DLLCALL getmail(scfg_t* cfg, int usernumber, BOOL sent)
/***************************/
/* Delete file attachments */
/***************************/
void sbbs_t::delfattach(uint to, char *title)
extern "C" void delfattach(scfg_t* cfg, smbmsg_t* msg)
{
char str[128],str2[128],*tp,*sp,*p;
char str[MAX_PATH+1];
char str2[MAX_PATH+1];
char *tp,*sp,*p;
strcpy(str,title);
if(msg->idx.to==0) { /* netmail */
sprintf(str,"%s%04u.out/%s"
,cfg->data_dir,msg->idx.from,getfname(msg->subj));
remove(str);
sprintf(str,"%s%04u.out"
,cfg->data_dir,msg->idx.from);
rmdir(str);
return;
}
strcpy(str,msg->subj);
tp=str;
while(1) {
p=strchr(tp,SP);
......@@ -92,12 +104,12 @@ void sbbs_t::delfattach(uint to, char *title)
if(!sp) sp=strrchr(tp,'\\');
if(sp) tp=sp+1;
sprintf(str2,"%sfile/%04u.in/%s" /* str2 is path/fname */
,cfg.data_dir,to,tp);
,cfg->data_dir,msg->idx.to,tp);
remove(str2);
if(!p)
break;
tp=p+1; }
sprintf(str,"%sfile/%04u.in",cfg.data_dir,to);
sprintf(str,"%sfile/%04u.in",cfg->data_dir,msg->idx.to);
rmdir(str); /* remove the dir if it's empty */
}
......@@ -157,7 +169,7 @@ int sbbs_t::delmail(uint usernumber, int which)
if((i=smb_freemsg(&smb,&msg))!=0)
errormsg(WHERE,ERR_REMOVE,smb.file,i,smb.last_error);
if(msg.hdr.auxattr&MSG_FILEATTACH)
delfattach(msg.idx.to,msg.subj);
delfattach(&cfg,&msg);
smb_freemsgmem(&msg); }
continue; }
idxbuf[l]=msg.idx;
......
......@@ -424,7 +424,6 @@ public:
/* mail.cpp */
int delmail(uint usernumber,int which);
void delfattach(uint to, char *title);
void telluser(smbmsg_t* msg);
void delallmail(uint usernumber);
......@@ -723,7 +722,7 @@ extern "C" {
DLLEXPORT mail_t * DLLCALL loadmail(smb_t* smb, ulong* msgs, uint usernumber
,int which, long mode);
DLLEXPORT void DLLCALL freemail(mail_t* mail);
DLLEXPORT void DLLCALL delfattach(scfg_t*, smbmsg_t*);
/* postmsg.cpp */
DLLEXPORT int DLLCALL savemsg(scfg_t* cfg, smb_t* smb
,uint subnum, smbmsg_t* msg, char* msgbuf);
......
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