/* Copyright (C) 1995 EGLE Magic, New Zealand, All rights reserved. */ #include #include #include #include #include #ifndef NO_FCNTL #include #else #include #endif #include "emsg.h" #include "dnews.h" #include "sary.h" #include "str.h" #include "lib.h" #include "group.h" #include "hist.h" #include "suck.h" #include "feed.h" #include "item.h" #include "control.h" /* If suck sees a message is a control item, then it calls this routine */ /* Possibilities are: cancel rmgroup newgroup version All other control messages are logged but not actioned. */ #define TEMP_ITEM file_work("control.email") #define CONTROL file_config("control.conf") #define VERSION_FILE file_config("version.file") #define BFSZ 200 static char action[BFSZ],gname[BFSZ],from[BFSZ],thecmd[BFSZ]; void fix_address(char *in); int ctl_process(char *chead, String *xitem) { int i; int lvl; char *ismod; char bf[BFSZ],approved[BFSZ]; char subj[BFSZ+100],title[BFSZ]; Sary *cfile; FILE *f; char *s; #ifdef VMS char *vx="$ "; char *vxc="$ !"; #else char *vx=""; char *vxc=""; #endif ncpy(thecmd,get_word(chead,0),50); strlwr(thecmd); imsg("control: Control message {%s} \n",chead); if (strcmp(thecmd,"cancel")==0) return ctl_cancel(chead,xitem); ncpy(from,get_ahead(xitem,"Sender:"),BFSZ-1); if (strlen(from)==0) ncpy(from,get_ahead(xitem,"From:"),BFSZ-1); fix_address(from); ncpy(gname,get_word(chead,1),BFSZ-1); /* Proces control.conf */ cfile = s_alloc(); strcpy(action,"mail"); /* Default action, mail it*/ s_read(cfile,CONTROL); for (i=0; i or a@x.y.z (joe) output: a@x.y.z */ void fix_address(char *in) { char bf[200]; char *s; ncpy(bf,in,199); s = strtok(bf," \t\n<>"); for (;s!=NULL;) { if (*s!='(') { /* Because users can edit this bit!!!*/ if (strstr(s,"@")!=NULL) {strcpy(in,s); return;} } s = strtok(NULL," \t\n<>()"); } emsg("control: Invalid address {%s} \n",in); return; }