~fuzzgun/emailgraph/trunk-1

« back to all changes in this revision

Viewing changes to read_email.c

  • Committer: Bob Mottram
  • Date: 2011-09-06 16:34:19 UTC
  • Revision ID: fuzzgun@gmail.com-20110906163419-5akyvirowpto77v0
Inclusion from sender and recipient details in sentence export

Show diffs side-by-side

added added

removed removed

Lines of Context:
689
689
  struct tm contact_date;
690
690
  int semantics_sentence_state=0,semantics_sentence_buffer_ctr=0;
691
691
  char semantics_sentence_buffer[256];
 
692
  int semantics_from_to=0;
 
693
  contact * cont;
692
694
#ifdef STYLOMETRICS
693
695
  int stylometrics_sentence_state=0,stylometrics_sentence_buffer_ctr=0;
694
696
  char stylometrics_sentence_buffer[256];
756
758
                                             stylometrics_sentence_buffer, &stylometrics_sentence_buffer_ctr,
757
759
                                             stylometrics_process_sentence);
758
760
#endif
 
761
          }
 
762
 
 
763
          /* read From: To: and Cc: lines */
 
764
          contact_from = read_from_line(linestr, buffer, i, gender, contact_from);
 
765
          contact_to = read_to_line(linestr, buffer, i, gender, contact_to);
 
766
          contact_cc = read_cc_line(linestr, buffer, i, gender, contact_cc);
 
767
 
 
768
          /* read the date */
 
769
          if (strncmp(buffer,DATE,i)==0) {
 
770
            contact_date = read_email_date(linestr);
 
771
          }
 
772
 
 
773
          /* read the subject line */
 
774
          if (strncmp(buffer,SUBJECT,i)==0) {
 
775
            email_processed=0;
 
776
            semantics_from_to=0;
 
777
          }
 
778
 
 
779
          if (email_processed==0) {
759
780
            /* semantic analysis */
760
781
            if ((sentence_dump!=0) &&
 
782
                (contact_from!=NULL) && ((contact_to!=NULL) || (contact_cc!=NULL)) &&
761
783
                ((keywords[0]==NULL) || (keywords_found!=0)) &&
762
784
                ((start_date.tm_year==0) ||
763
785
                 ((start_date.tm_year>0) && (end_date.tm_year==0) && (datedays(contact_date)>=datedays(start_date))) ||
764
786
                 ((start_date.tm_year>0) && (end_date.tm_year>0) && (datedays(contact_date)>=datedays(start_date)) && (datedays(contact_date)<=datedays(end_date))))) {
 
787
 
 
788
              if (semantics_from_to==0) {
 
789
                /* Show the sensers and recipients */
 
790
                printf("\n%s",FROM);
 
791
                cont = contact_from;            
 
792
                while (cont!=NULL) {
 
793
                  printf("%s,%s,",cont->name,cont->email);
 
794
                  cont = (contact*)(cont->next);
 
795
                }
 
796
                printf("\n%s",TO);
 
797
                cont = contact_to;              
 
798
                while (cont!=NULL) {
 
799
                  printf("%s,%s,",cont->name,cont->email);
 
800
                  cont = (contact*)(cont->next);
 
801
                }
 
802
                printf("\n");
 
803
                if (contact_cc!=NULL) {
 
804
                  printf("%s",CC);
 
805
                  cont = contact_cc;            
 
806
                  while (cont!=NULL) {
 
807
                    printf("%s,%s,",cont->name,cont->email);
 
808
                    cont = (contact*)(cont->next);
 
809
                  }
 
810
                  printf("\n");
 
811
                }
 
812
 
 
813
                semantics_from_to=1;
 
814
              }
 
815
 
765
816
              semantics_sentence_state = detect_sentence(
766
817
                                                         (char*)linestr,
767
818
                                                         semantics_sentence_state,
768
819
                                                         semantics_sentence_buffer, &semantics_sentence_buffer_ctr,
769
820
                                                         semantics_process_sentence);
 
821
 
770
822
            }
771
823
          }
772
824
 
773
 
          /* read From: To: and Cc: lines */
774
 
          contact_from = read_from_line(linestr, buffer, i, gender, contact_from);
775
 
          contact_to = read_to_line(linestr, buffer, i, gender, contact_to);
776
 
          contact_cc = read_cc_line(linestr, buffer, i, gender, contact_cc);
777
 
 
778
 
          /* read the date */
779
 
          if (strncmp(buffer,DATE,i)==0) {
780
 
            contact_date = read_email_date(linestr);
781
 
          }
782
 
 
783
 
          /* read the subject line */
784
 
          if (strncmp(buffer,SUBJECT,i)==0) {
785
 
            email_processed=0;
786
 
          }
787
825
        }
788
826
 
789
827
        line_number++;