Skip to content

Commit 2eeaeff

Browse files
committedFeb 23, 2017
implemented MASQUERADE command
1 parent 888bbac commit 2eeaeff

File tree

2 files changed

+36
-0
lines changed

2 files changed

+36
-0
lines changed
 

‎doc/filter.txt

+5
Original file line numberDiff line numberDiff line change
@@ -260,6 +260,11 @@ REMAPMSG <new name> <destination pattern>
260260
FILTER TYPE=NETMAIL and TOADDR=2:999/*.*
261261
REMAPMSG "*" 2:200/*.*
262262

263+
MASQUERADE <new name> <origin pattern>
264+
265+
This command can change the origin name and node of a message. If
266+
the new name is "*", the old name will be kept.
267+
263268
Additional examples
264269
-------------------
265270
Copy all talk about me to a special area:

‎src/crashmail/filter.c

+31
Original file line numberDiff line numberDiff line change
@@ -832,6 +832,32 @@ bool Filter_Remap(struct MemMessage *mm,char *namepat,struct Node4DPat *destpat)
832832
return(TRUE);
833833
}
834834

835+
bool Filter_Masquerade(struct MemMessage *mm,char *namepat,struct Node4DPat *destpat)
836+
{
837+
char buf[100];
838+
char oldfrom[36],newfrom[36];
839+
struct Node4D oldorig4d, neworig4d;
840+
841+
strcpy(oldfrom, mm->From);
842+
Copy4D(&oldorig4d,&mm->OrigNode);
843+
844+
ExpandNodePat(destpat,&mm->OrigNode,&neworig4d);
845+
846+
if(strcmp(namepat,"*")==0) strcpy(newfrom,mm->From);
847+
else strcpy(newfrom,namepat);
848+
849+
strcpy (mm->From, newfrom);
850+
sprintf(buf,"\x01Masquerade as %s at %u:%u/%u.%u \x0d",
851+
newfrom, neworig4d.Zone, neworig4d.Net, neworig4d.Node, neworig4d.Point);
852+
mmAddLine(mm,buf);
853+
854+
sprintf(buf,"\x01Message originally from %s at %u:%u/%u.%ud",
855+
oldfrom, oldorig4d.Zone, oldorig4d.Net, oldorig4d.Node, oldorig4d.Point);
856+
mmAddLine(mm,buf);
857+
858+
return TRUE;
859+
}
860+
835861
bool Filter(struct MemMessage *mm)
836862
{
837863
struct Filter *filter;
@@ -915,6 +941,11 @@ bool Filter(struct MemMessage *mm)
915941
return(FALSE);
916942

917943
break;
944+
case COMMAND_MASQUERADE:
945+
if(!Filter_Masquerade(mm,command->string,&command->n4ddestpat))
946+
return(FALSE);
947+
948+
break;
918949
}
919950

920951
if(mm->Flags & MMFLAG_KILL)

0 commit comments

Comments
 (0)