I modifiyed it some time ago for Linux, do you want it ???

                Mircea C.


Lord Soth wrote:
> Ups! forgot to mention I'm on linux, not windows (i'll try to compile the .c
> file, though)
> 
> -----Mensaje original-----
> De: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
> nombre de Frederik Gallon
> Enviado el: lunes, 26 de mayo de 2003 13:35
> Para: '[EMAIL PROTECTED]'
> Asunto: [xmail] Re: Redirect function
> 
> 
> 
> Use the outgoing filter structure.
> With xarchive from http://software.dolist.net/xarchive.asp you can catch all
> mail and copy it into a 'keep' directory.
> 
> Good luck
> 
> 
>>-----Oorspronkelijk bericht-----
>>Van: Lord Soth [mailto:[EMAIL PROTECTED]
>>Verzonden: maandag 26 mei 2003 13:20
>>Aan: [EMAIL PROTECTED]
>>Onderwerp: [xmail] Redirect function
>>
>>
>>
>>Hi ppl!
>>
>>I can see you can "redirect" (making a copy) of all incoming
>>mail of one or more users but, my question is, can you make a
>>copy of all OUTGOING mail?
>>
>>Thanks!
>>
>>-
>>To unsubscribe from this list: send the line "unsubscribe
>>xmail" in the body of a message to [EMAIL PROTECTED]
>>For general help: send the line "help" in the body of a
>>message to [EMAIL PROTECTED]
>>
> 
> -
> To unsubscribe from this list: send the line "unsubscribe xmail" in
> the body of a message to [EMAIL PROTECTED]
> For general help: send the line "help" in the body of a message to
> [EMAIL PROTECTED]
> 
> -
> To unsubscribe from this list: send the line "unsubscribe xmail" in
> the body of a message to [EMAIL PROTECTED]
> For general help: send the line "help" in the body of a message to
> [EMAIL PROTECTED]
> 
> 



-- Attached file included as plaintext by Ecartis --
-- File: xarchive.c

#include <stdio.h>
#include <string.h>

#define NB_ENTRY 1000
#define BUFFER_LEN 255
#define LINE_LEN 2048


#if defined __linux__

#include <ctype.h>

char* strlwr( char* string ){

    char *workptr=string;
        while(*workptr){
        *workptr=tolower(*workptr);
        workptr++;
        }
    return string;
}


#endif

int main(int argc, char *argv[]){

    char Entry[NB_ENTRY][BUFFER_LEN];
    char Buffer[BUFFER_LEN+1];
    char Line[LINE_LEN+1];
    char *Msg=NULL, *Ptr=NULL;
    int i=0, NbEntry=0, Found=0;
    FILE *fMsg=NULL, *fDat=NULL, *fKeep=NULL, *fLog=NULL;


    if (argc<5) return 0;

    strcpy(Line,argv[1]);
    strcat(Line,"/xarchive.log");
    fLog=fopen(Line,"a+");
    fMsg=fopen(argv[2],"r+");

    if (fMsg==NULL){
        fcloseall();
        return 0;
    }

  strcpy(Line,argv[1]);
  strcat(Line,"/xarchive.dat");

  fDat=fopen(Line,"rb");
  if (fDat==NULL) {
        fcloseall();
        return 0;
  }


  Msg=strstr(argv[2],"mess/");

  if (Msg==NULL) {
        fcloseall();
        return 0;
  }
  Msg+=5;

  strcpy(Line,argv[1]);
  strcat(Line,"/keep/");
  strcat(Line,Msg);
  fKeep=fopen(Line,"w+");

  while (fgets(Buffer,BUFFER_LEN,fDat)) {
        if (i>=NB_ENTRY) break;
        Buffer[BUFFER_LEN]='\0';
        while ((Ptr=strpbrk(Buffer,"\r\n"))!=NULL) *Ptr='\0'; // remove '\n\r'
        if (*Buffer!='\n') {
                strcpy(Entry[i],Buffer);
          i++;
        }
  }
  fclose(fDat);

  NbEntry=i-1;
  
  for (i=0;i<=NbEntry;i++) {
    if (strstr(strlwr(argv[3]),strlwr(Entry[i]))!=NULL || 
strstr(strlwr(argv[4]),strlwr(Entry[i]))!=NULL) {
        Found=1;
          if (fLog!=NULL) fprintf(fLog,"%s,%s,%s - match 
[%s]\n",Msg,argv[3],argv[4],Entry[i]);
          if (fKeep!=NULL) {
        while (fgets(Line,LINE_LEN,fMsg)) {
            if (fKeep!=NULL) fputs(Line,fKeep);
          }
      }
    }
  }
  
  fcloseall();
  
  if (Found==0 && fKeep!=NULL) {
        strcpy(Line,argv[1]);
    strcat(Line,"/keep/");
    strcat(Line,Msg);
        remove(Line);
  }

  return 0;
}


-
To unsubscribe from this list: send the line "unsubscribe xmail" in
the body of a message to [EMAIL PROTECTED]
For general help: send the line "help" in the body of a message to
[EMAIL PROTECTED]

Reply via email to