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 d18bd3bd authored by rswindell's avatar rswindell
Browse files

New feature: control of SPAM visibility when reading mail on the Terminal

Server via the new 'V' command from the Reading Mail prompt allows you to
toggle between all mail (including SPAM, the default), SPAM only, or HAM only.
Also added a new '/' (search text) command from the reading mail prompts.
Mail imported before the mailsrvr added support (recently) for the MSG_SPAM
attribute flag will not be counted/filtered as SPAM.
SBBSecho will have a commit (next) to support the new loadmail() usage, it
will not compile until then.
parent 6cdb6d6a
......@@ -886,22 +886,32 @@ const char* sbbs_t::atcode(char* sp, char* str, size_t maxlen)
}
if(!strcmp(sp,"MAILW")) {
safe_snprintf(str,maxlen,"%u",getmail(&cfg,useron.number,0));
safe_snprintf(str,maxlen,"%u",getmail(&cfg,useron.number, /* Sent: */FALSE, /* SPAM */FALSE));
return(str);
}
if(!strcmp(sp,"MAILP")) {
safe_snprintf(str,maxlen,"%u",getmail(&cfg,useron.number,1));
safe_snprintf(str,maxlen,"%u",getmail(&cfg,useron.number,/* Sent: */TRUE, /* SPAM: */FALSE));
return(str);
}
if(!strcmp(sp,"SPAMW")) {
safe_snprintf(str,maxlen,"%u",getmail(&cfg,useron.number, /* Sent: */FALSE, /* SPAM: */TRUE));
return(str);
}
if(!strncmp(sp,"MAILW:",6)) {
safe_snprintf(str,maxlen,"%u",getmail(&cfg,atoi(sp+6),0));
safe_snprintf(str,maxlen,"%u",getmail(&cfg,atoi(sp+6), /* Sent: */FALSE, /* SPAM: */FALSE));
return(str);
}
if(!strncmp(sp,"MAILP:",6)) {
safe_snprintf(str,maxlen,"%u",getmail(&cfg,atoi(sp+6),1));
safe_snprintf(str,maxlen,"%u",getmail(&cfg,atoi(sp+6), /* Sent: */TRUE, /* SPAM: */FALSE));
return(str);
}
if(!strncmp(sp,"SPAMW:",6)) {
safe_snprintf(str,maxlen,"%u",getmail(&cfg,atoi(sp+6), /* Sent: */FALSE, /* SPAM: */TRUE));
return(str);
}
......
/* getmail.c */
/* Synchronet DLL-exported mail-related routines */
/* $Id$ */
......@@ -42,7 +40,7 @@
/* If sent is non-zero, it returns the number of mail sent by usernumber */
/* If usernumber is 0, it returns all mail on the system */
/****************************************************************************/
int DLLCALL getmail(scfg_t* cfg, int usernumber, BOOL sent)
int DLLCALL getmail(scfg_t* cfg, int usernumber, BOOL sent, BOOL spam_only)
{
char path[MAX_PATH+1];
int i=0;
......@@ -71,6 +69,8 @@ int DLLCALL getmail(scfg_t* cfg, int usernumber, BOOL sent)
continue;
if(idx.attr&MSG_DELETE)
continue;
if(spam_only && !(idx.attr&MSG_SPAM))
continue;
if((!sent && idx.to==usernumber)
|| (sent && idx.from==usernumber))
i++;
......@@ -156,6 +156,10 @@ mail_t* DLLCALL loadmail(smb_t* smb, uint32_t* msgs, uint usernumber
continue;
if(mode&LM_UNREAD && idx.attr&MSG_READ)
continue;
if(mode&LM_NOSPAM && idx.attr&MSG_SPAM)
continue;
if(mode&LM_SPAMONLY && !(idx.attr&MSG_SPAM))
continue;
if((mail=(mail_t *)realloc(mail,sizeof(mail_t)*(l+1)))
==NULL) {
smb_unlocksmbhdr(smb);
......
......@@ -97,6 +97,7 @@ void sbbs_t::show_msgattr(smbmsg_t* msg)
bprintf(text[MsgAttr]
,attr&MSG_PRIVATE ? "Private " :nulstr
,attr&MSG_SPAM ? "SPAM " :nulstr
,attr&MSG_READ ? "Read " :nulstr
,attr&MSG_DELETE ? "Deleted " :nulstr
,attr&MSG_KILLREAD ? "Kill " :nulstr
......@@ -112,7 +113,6 @@ void sbbs_t::show_msgattr(smbmsg_t* msg)
,nulstr
,nulstr
,nulstr
,nulstr
);
}
......
......@@ -638,12 +638,12 @@ static JSBool js_sysstats_get(JSContext *cx, JSObject *obj, jsid id, jsval *vp)
break;
case SYSSTAT_PROP_TOTALMAIL:
rc=JS_SUSPENDREQUEST(cx);
*vp = INT_TO_JSVAL(getmail(cfg, 0,0));
*vp = INT_TO_JSVAL(getmail(cfg, /* user: */0, /* Sent: */FALSE, /* SPAM: */FALSE));
JS_RESUMEREQUEST(cx, rc);
break;
case SYSSTAT_PROP_FEEDBACK:
rc=JS_SUSPENDREQUEST(cx);
*vp = INT_TO_JSVAL(getmail(cfg, 1,0));
*vp = INT_TO_JSVAL(getmail(cfg, /* user: */1, /* Sent: */FALSE, /* SPAM: */FALSE));
JS_RESUMEREQUEST(cx, rc);
break;
}
......
......@@ -374,10 +374,10 @@ static JSBool js_user_get(JSContext *cx, JSObject *obj, jsid id, jsval *vp)
val=scfg->level_freecdtperday[p->user->level];
break;
case USER_PROP_MAIL_WAITING:
val=getmail(scfg,p->user->number,/* sent? */FALSE);
val=getmail(scfg,p->user->number,/* sent? */FALSE, /* SPAM: */FALSE);
break;
case USER_PROP_MAIL_PENDING:
val=getmail(scfg,p->user->number,/* sent? */TRUE);
val=getmail(scfg,p->user->number,/* sent? */TRUE, /* SPAM: */FALSE);
break;
case USER_PROP_CACHED:
......
......@@ -442,7 +442,7 @@ bool sbbs_t::logon()
return(true);
sys_status|=SS_PAUSEON; /* always force pause on during this section */
mailw=getmail(&cfg,useron.number,0);
mailw=getmail(&cfg,useron.number,/* Sent: */FALSE, /* SPAM: */FALSE);
if(!(cfg.sys_misc&SM_NOSYSINFO)) {
bprintf(text[SiSysName],cfg.sys_name);
......
......@@ -159,7 +159,7 @@ void sbbs_t::telluser(smbmsg_t* msg)
/************************************************************************/
/* Deletes all mail waiting for user number 'usernumber' */
/************************************************************************/
void sbbs_t::delallmail(uint usernumber, int which, bool permanent)
void sbbs_t::delallmail(uint usernumber, int which, bool permanent, long lm_mode)
{
int i;
long deleted=0;
......@@ -180,7 +180,7 @@ void sbbs_t::delallmail(uint usernumber, int which, bool permanent)
return;
}
mail=loadmail(&smb,&msgs,usernumber,which,0);
mail=loadmail(&smb,&msgs,usernumber,which,lm_mode);
if(!msgs) {
smb_close(&smb);
smb_stack(&smb,SMB_STACK_POP);
......
......@@ -3029,6 +3029,8 @@ static void smtp_thread(void* arg)
smb_error=SMB_FAILURE;
break;
}
if(stricmp(field, "X-Spam-Flag") == 0 && stricmp(p, "Yes") == 0)
msg.hdr.attr |= MSG_SPAM; /* e.g. flagged by SpamAssasin */
}
if((smb_error=parse_header_field((char*)buf,&msg,&hfield_type))!=SMB_SUCCESS) {
if(smb_error==SMB_ERR_HDR_LEN)
......@@ -3866,7 +3868,7 @@ static void smtp_thread(void* arg)
continue;
}
if(relay_user.number!=0 && !(relay_user.exempt&FLAG('M'))
&& rcpt_count+(waiting=getmail(&scfg,relay_user.number,/* sent: */TRUE)) > startup->max_recipients) {
&& rcpt_count+(waiting=getmail(&scfg,relay_user.number,/* sent: */TRUE, /* SPAM: */FALSE)) > startup->max_recipients) {
lprintf(LOG_NOTICE,"%04d !SMTP MAXIMUM PENDING SENT EMAILS (%u) REACHED for User #%u (%s)"
,socket, waiting, relay_user.number, relay_user.alias);
sockprintf(socket, "452 Too many pending emails sent");
......@@ -4205,7 +4207,7 @@ static void smtp_thread(void* arg)
continue;
}
if(startup->max_msgs_waiting && !(user.exempt&FLAG('W'))
&& (waiting=getmail(&scfg, user.number, /* sent: */FALSE)) > startup->max_msgs_waiting) {
&& (waiting=getmail(&scfg, user.number, /* sent: */FALSE, /* spam: */FALSE)) > startup->max_msgs_waiting) {
lprintf(LOG_NOTICE,"%04d !SMTP User #%u (%s) mailbox (%u msgs) exceeds the maximum (%u) msgs waiting"
,socket, user.number, user.alias, waiting, startup->max_msgs_waiting);
sockprintf(socket, "450 Mailbox full: %s", rcpt_to);
......
......@@ -40,6 +40,7 @@
static char mail_listing_flag(smbmsg_t* msg)
{
if(msg->hdr.attr&MSG_DELETE) return '-';
if(msg->hdr.attr&MSG_SPAM) return 'S';
if(msg->hdr.attr&MSG_REPLIED) return 'R';
if(msg->hdr.attr&MSG_READ) return ' ';
if(msg->hdr.attr&MSG_PERMANENT) return 'p';
......@@ -65,12 +66,13 @@ void sbbs_t::readmail(uint usernumber, int which)
int error;
int mismatches=0,act;
uint unum;
long length,l,lm_mode;
long length,l,lm_mode, last_mode;
ulong last;
bool replied;
file_t fd;
mail_t *mail;
smbmsg_t msg;
char search_str[128] = "";
if(cfg.readmail_mod[0] && !readmail_inside) {
char cmdline[256];
......@@ -109,13 +111,14 @@ void sbbs_t::readmail(uint usernumber, int which)
else
lm_mode=0;
mail=loadmail(&smb,&smb.msgs,usernumber,which,lm_mode);
last_mode = lm_mode;
if(!smb.msgs) {
if(which==MAIL_SENT)
bputs(text[NoMailSent]);
else if(which==MAIL_ALL)
bputs(text[NoMailOnSystem]);
else
bputs(text[NoMailWaiting]);
bprintf(text[NoMailWaiting], "mail");
smb_close(&smb);
smb_stack(&smb,SMB_STACK_POP);
return;
......@@ -220,12 +223,13 @@ void sbbs_t::readmail(uint usernumber, int which)
}
smb_unlocksmbhdr(&smb);
if(smb.status.last_msg!=last) { /* New messages */
if(smb.status.last_msg!=last || lm_mode != last_mode) { /* New messages */
last=smb.status.last_msg;
free(mail);
mail=loadmail(&smb,&smb.msgs,usernumber,which,lm_mode); /* So re-load */
if(!smb.msgs)
break;
last_mode = lm_mode;
for(smb.curmsg=0;smb.curmsg<smb.msgs;smb.curmsg++)
if(mail[smb.curmsg].number==msg.idx.number)
break;
......@@ -243,6 +247,7 @@ void sbbs_t::readmail(uint usernumber, int which)
mail=loadmail(&smb,&smb.msgs,usernumber,which,lm_mode);
if(!smb.msgs)
break;
last_mode = lm_mode;
if(smb.curmsg>(smb.msgs-1))
smb.curmsg=(smb.msgs-1);
mismatches++;
......@@ -370,11 +375,15 @@ void sbbs_t::readmail(uint usernumber, int which)
bprintf(text[ReadingAllMail],smb.curmsg+1,smb.msgs);
else
bprintf(text[ReadingMail],smb.curmsg+1,smb.msgs);
sprintf(str,"ADKFLNQRT?<>[]{}-+");
sprintf(str,"ADFLNQRT?<>[]{}-+/");
if(SYSOP)
strcat(str,"CUSPH");
if(which!=MAIL_YOUR)
strcat(str,"E");
if(which == MAIL_YOUR)
strcat(str,"K"); // kill all (visible)
else
strcat(str,"E"); // edit msg
if(which != MAIL_SENT)
strcat(str,"V"); // View SPAM toggle
l=getkeys(str,smb.msgs);
if(l&0x80000000L) {
if(l==-1) /* ctrl-c */
......@@ -490,7 +499,7 @@ void sbbs_t::readmail(uint usernumber, int which)
case 'K': /* Kill All Mail */
SAFEPRINTF(str,text[DeleteMailQ],"everyone");
if(!noyes(str))
delallmail(usernumber, MAIL_YOUR, /* permanent: */false);
delallmail(usernumber, which, /* permanent: */false, lm_mode);
domsg=false;
break;
case 'F': /* Forward last piece */
......@@ -752,6 +761,36 @@ void sbbs_t::readmail(uint usernumber, int which)
} else
useredit(unum);
break;
case 'V': /* View SPAM (toggle) */
{
domsg = false;
int spam = getmail(&cfg, usernumber, /* Sent: */FALSE, /* SPAM */TRUE);
if(!spam) {
bprintf(text[NoMailWaiting], "SPAM");
break;
}
if(spam >= (int)smb.msgs) {
bprintf(text[NoMailWaiting], "HAM");
break;
}
bprintf(text[SPAMVisibilityIsNow]);
switch(lm_mode&(LM_SPAMONLY | LM_NOSPAM)) {
case 0:
lm_mode |= LM_NOSPAM;
bputs(text[Off]);
break;
case LM_NOSPAM:
lm_mode ^= (LM_SPAMONLY | LM_NOSPAM);
bputs(text[Only]);
break;
case LM_SPAMONLY:
lm_mode &= ~LM_SPAMONLY;
bputs(text[On]);
break;
}
CRLF;
break;
}
case 'P': /* Purge author and all mail to/from */
if(noyes(text[UeditDeleteQ]))
break;
......@@ -765,6 +804,16 @@ void sbbs_t::readmail(uint usernumber, int which)
if(smb.curmsg<smb.msgs-1) smb.curmsg++;
}
break;
case '/':
domsg = false;
int64_t i64;
if((i64=get_start_msgnum(&smb))<0)
break;
bputs(text[SearchStringPrompt]);
if(!getstr(search_str,40,K_LINE|K_UPPER|K_EDIT|K_AUTODEL))
break;
searchmail(mail, (long)i64, smb.msgs, which, search_str);
break;
case '?':
strcpy(str,which==MAIL_YOUR ? "mailread" : which==MAIL_ALL
? "allmail" : "sentmail");
......@@ -801,3 +850,54 @@ void sbbs_t::readmail(uint usernumber, int which)
current_msg=NULL;
}
long sbbs_t::searchmail(mail_t *mail, long start, long msgs, int which, const char *search)
{
char* buf;
char subj[128];
long l,found=0;
smbmsg_t msg;
msg.total_hfields=0;
for(l=start;l<msgs && !msgabort();l++) {
msg.idx.offset=mail[l].offset;
if(loadmsg(&msg,mail[l].number) < 0)
continue;
smb_unlockmsghdr(&smb,&msg);
buf=smb_getmsgtxt(&smb,&msg,GETMSGTXT_ALL);
if(!buf) {
smb_freemsgmem(&msg);
continue;
}
strupr(buf);
strip_ctrl(buf, buf);
SAFECOPY(subj,msg.subj);
strupr(subj);
if(strstr(buf,search) || strstr(subj,search)) {
if(!found) {
if(which==MAIL_SENT)
bputs(text[MailSentLstHdr]);
else if(which==MAIL_ALL)
bputs(text[MailOnSystemLstHdr]);
else
bputs(text[MailWaitingLstHdr]);
}
if(which==MAIL_ALL)
bprintf(text[MailOnSystemLstFmt]
,l+1,msg.from,msg.to
,mail_listing_flag(&msg)
,msg.subj);
else
bprintf(text[MailWaitingLstFmt],l+1
,which==MAIL_SENT ? msg.to
: (msg.hdr.attr&MSG_ANONYMOUS) && !SYSOP
? text[Anonymous] : msg.from
,mail_listing_flag(&msg)
,msg.subj);
found++;
}
free(buf);
smb_freemsgmem(&msg);
}
return(found);
}
......@@ -390,17 +390,17 @@ post_t * sbbs_t::loadposts(uint32_t *posts, uint subnum, ulong ptr, long mode, u
return(post);
}
static int64_t get_start_msg(sbbs_t* sbbs, smb_t* smb)
int64_t sbbs_t::get_start_msgnum(smb_t* smb, int next)
{
uint32_t j=smb->curmsg+1;
uint32_t j=smb->curmsg + next;
int64_t i;
if(j<smb->msgs)
j++;
else
j=1;
sbbs->bprintf(sbbs->text[StartWithN],j);
if((i=sbbs->getnum(smb->msgs))<0)
bprintf(text[StartWithN],j);
if((i = getnum(smb->msgs)) < 0)
return(i);
if(i==0)
return(j-1);
......@@ -1050,7 +1050,7 @@ int sbbs_t::scanposts(uint subnum, long mode, const char *find)
case 'F': /* find text in messages */
domsg=0;
mode&=~SCAN_FIND; /* turn off find mode */
if((i64=get_start_msg(this,&smb))<0)
if((i64=get_start_msgnum(&smb, 1))<0)
break;
i=(int)i64;
bputs(text[SearchStringPrompt]);
......@@ -1085,7 +1085,7 @@ int sbbs_t::scanposts(uint subnum, long mode, const char *find)
break;
case 'L': /* List messages */
domsg=0;
if((i64=get_start_msg(this,&smb))<0)
if((i64=get_start_msgnum(&smb, 1))<0)
break;
i=(int)i64;
listmsgs(subnum,0,post,i,smb.msgs);
......@@ -1694,7 +1694,7 @@ long sbbs_t::listsub(uint subnum, long mode, long start, const char* search)
}
/****************************************************************************/
/* Will search the messages pointed to by 'msg' for the occurance of the */
/* Will search the messages pointed to by 'msg' for the occurrence of the */
/* string 'search' and display any messages (number of message, author and */
/* title). 'msgs' is the total number of valid messages. */
/* Returns number of messages found. */
......
......@@ -637,7 +637,7 @@ public:
/* mail.cpp */
int delmail(uint usernumber,int which);
void telluser(smbmsg_t* msg);
void delallmail(uint usernumber, int which, bool permanent=true);
void delallmail(uint usernumber, int which, bool permanent=true, long lm_mode = 0);
/* getmsg.cpp */
int loadmsg(smbmsg_t *msg, ulong number);
......@@ -650,8 +650,9 @@ public:
ulong getmsgnum(uint subnum, time_t t);
/* readmail.cpp */
void readmail(uint usernumber, int sent);
void readmail(uint usernumber, int which);
bool readmail_inside;
long searchmail(mail_t*, long start, long msgss, int which, const char *search);
/* bulkmail.cpp */
bool bulkmail(uchar *ar);
......@@ -762,6 +763,7 @@ public:
void show_thread(uint32_t msgnum, post_t* post, unsigned curmsg, int thread_depth = 0, uint64_t reply_mask = 0);
void msghdr(smbmsg_t* msg);
uchar msg_listing_flag(uint subnum, smbmsg_t*, post_t*);
int64_t get_start_msgnum(smb_t*, int next=0);
/* chat.cpp */
void chatsection(void);
......@@ -1004,7 +1006,7 @@ extern "C" {
DLLEXPORT long DLLCALL getfiles(scfg_t* cfg, uint dirnum);
/* getmail.c */
DLLEXPORT int DLLCALL getmail(scfg_t* cfg, int usernumber, BOOL sent);
DLLEXPORT int DLLCALL getmail(scfg_t* cfg, int usernumber, BOOL sent, BOOL spam_only);
DLLEXPORT mail_t * DLLCALL loadmail(smb_t* smb, uint32_t* msgs, uint usernumber
,int which, long mode);
DLLEXPORT void DLLCALL freemail(mail_t* mail);
......
......@@ -771,6 +771,8 @@ typedef enum { /* Values for xtrn_t.event */
/* Bits in the mode of loadmail() */
#define LM_UNREAD (1<<0) /* Include un-read mail only */
#define LM_INCDEL (1<<1) /* Include deleted mail */
#define LM_NOSPAM (1<<2) /* Exclude SPAM */
#define LM_SPAMONLY (1<<3) /* Load SPAM only */
enum { /* readmail and delmailidx which types */
MAIL_YOUR /* mail sent to you */
......
......@@ -915,7 +915,7 @@ void sbbs_t::user_info()
,useron.ptoday);
bprintf(text[UserEmails]
,useron.emails,useron.fbacks
,getmail(&cfg,useron.number,0),useron.etoday);
,getmail(&cfg,useron.number,/* Sent: */FALSE, /* SPAM: */FALSE),useron.etoday);
CRLF;
bprintf(text[UserUploads]
,ultoac(useron.ulb,tmp),useron.uls);
......
......@@ -804,6 +804,8 @@ enum {
,BallotHdr
,BallotAnswerFmt
,BallotVoteWhich
,Only
,SPAMVisibilityIsNow
,TOTAL_TEXT
};
......
......@@ -77,7 +77,7 @@ const char * const text_defaults[TOTAL_TEXT]={
"\x6f\x72\x20\x7e\x51\x75\x69\x74\x3a\x20" // 043 AutoMsg
,"\x01\x6e\x0d\x0a\x59\x6f\x75\x20\x63\x61\x6e\x27\x74\x20\x77\x72\x69\x74\x65\x20\x74\x6f\x20\x74\x68\x65\x20\x61\x75\x74\x6f\x2d"
"\x6d\x65\x73\x73\x61\x67\x65\x2e\x0d\x0a" // 044 R_AutoMsg
,"\x01\x6e\x0d\x0a\x59\x6f\x75\x20\x68\x61\x76\x65\x20\x6e\x6f\x20\x6d\x61\x69\x6c\x2e\x0d\x0a" // 045 NoMailWaiting
,"\x01\x6e\x0d\x0a\x59\x6f\x75\x20\x68\x61\x76\x65\x20\x6e\x6f\x20\x25\x73\x2e\x0d\x0a" // 045 NoMailWaiting
,"\x01\x5f\x0d\x0a\x01\x71\x01\x67\x01\x68\x4d\x61\x69\x6c\x20\x57\x61\x69\x74\x69\x6e\x67\x3a\x0d\x0a\x0d\x0a" // 046 MailWaitingLstHdr
,"\x01\x67\x01\x68\x25\x33\x64\x3a\x20\x01\x6e\x01\x67\x25\x2d\x32\x35\x2e\x32\x35\x73\x20\x01\x68\x25\x63\x01\x6e\x01\x67\x20\x25"
"\x2e\x34\x36\x73\x0d\x0a" // 047 MailWaitingLstFmt
......@@ -1313,4 +1313,7 @@ const char * const text_defaults[TOTAL_TEXT]={
,"\x01\x6e\x01\x63\x01\x68\x25\x32\x75\x01\x6e\x01\x63\x3a\x20\x25\x2d\x2a\x2e\x2a\x73\x20\x01\x68\x25\x73\x0d\x0a" // 792 BallotAnswerFmt
,"\x0d\x0a\x54\x6f\x67\x67\x6c\x65\x20\x77\x68\x69\x63\x68\x20\x76\x6f\x74\x65\x20\x28\x75\x70\x20\x74\x6f\x20\x25\x75\x29\x2c\x20"
"\x7e\x51\x75\x69\x74\x20\x6f\x72\x20\x5b\x43\x61\x73\x74\x5d\x3a\x20" // 793 BallotVoteWhich
,"\x4f\x6e\x6c\x79" // 794 Only
,"\x01\x6e\x01\x68\x01\x63\x0d\x0a\x53\x50\x41\x4d\x20\x56\x69\x73\x69\x62\x69\x6c\x69\x74\x79\x20\x69\x73\x20\x6e\x6f\x77\x3a\x20"
"\x01\x77" // 795 SPAMVisibilityIsNow
};
/* useredit.cpp */
/* Synchronet online sysop user editor */
/* $Id$ */
......@@ -143,7 +141,7 @@ void sbbs_t::useredit(int usernumber)
,f ? (uint)(100/f) : user.posts>user.logons ? 100 : 0
,user.ptoday);
bprintf(text[UserEmails]
,user.emails,user.fbacks,getmail(&cfg,user.number,0),user.etoday);
,user.emails,user.fbacks,getmail(&cfg,user.number,/* Sent: */FALSE, /* SPAM: */FALSE),user.etoday);
bprintf(text[UserUploads],ultoac(user.ulb,tmp),user.uls);
if(user.leech)
......@@ -217,11 +215,11 @@ void sbbs_t::useredit(int usernumber)
}
if(!noyes(text[UeditDeleteQ])) {
getsmsg(user.number);
if(getmail(&cfg,user.number,0)) {
if(getmail(&cfg,user.number, /* Sent: */FALSE, /* SPAM: */FALSE)) {
if(yesno(text[UeditReadUserMailWQ]))
readmail(user.number,MAIL_YOUR);
}
if(getmail(&cfg,user.number,1)) {
if(getmail(&cfg,user.number, /* Sent: */TRUE, /* SPAM: */FALSE)) {
if(yesno(text[UeditReadUserMailSQ]))
readmail(user.number,MAIL_SENT);
}
......@@ -231,11 +229,11 @@ void sbbs_t::useredit(int usernumber)
break;
}
if(!noyes(text[UeditDeactivateUserQ])) {
if(getmail(&cfg,user.number,0)) {
if(getmail(&cfg,user.number, /* Sent: */FALSE, /* SPAM: */FALSE)) {
if(yesno(text[UeditReadUserMailWQ]))
readmail(user.number,MAIL_YOUR);
}
if(getmail(&cfg,user.number,1)) {
if(getmail(&cfg,user.number, /* Sent: */TRUE, /* SPAM: */FALSE)) {
if(yesno(text[UeditReadUserMailSQ]))
readmail(user.number,MAIL_SENT);
}
......@@ -984,14 +982,14 @@ void sbbs_t::maindflts(user_t* user)
putuserrec(&cfg,user->number,U_MISC,8,ultoa(user->misc,str,16));
break;
case 'M': /* NetMail address */
if(noyes(text[ForwardMailQ]))
bputs(text[EnterNetMailAddress]);
if(getstr(user->netmail,LEN_NETMAIL,K_EDIT|K_AUTODEL|K_LINE) < 0)
break;
putuserrec(&cfg,user->number,U_NETMAIL,LEN_NETMAIL,user->netmail);
if(user->netmail[0] == 0 || noyes(text[ForwardMailQ]))
user->misc&=~NETMAIL;
else {
user->misc|=NETMAIL;
bputs(text[EnterNetMailAddress]);
if(!getstr(user->netmail,LEN_NETMAIL,K_EDIT|K_AUTODEL|K_LINE))
break;
putuserrec(&cfg,user->number,U_NETMAIL,LEN_NETMAIL,user->netmail);
}
putuserrec(&cfg,user->number,U_MISC,8,ultoa(user->misc,str,16));
break;
......
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