# data file for the Fltk User Interface Designer (fluid)
version 1.00 
header_name {.h} 
code_name {.cxx} 
gridx 5 
gridy 5 
snap 3
decl {\#include "TextEdit.H"} {public
} 

decl {\#include "sfl.h"} {} 

decl {\#include "FL/fl_ask.H"} {} 

decl {\#include <FL/Fl_Output.H>} {public
} 

decl {\#include <FL/Fl_Pixmap.H>} {} 

decl {extern SYMTAB load_symtab;} {} 

decl {extern void ini_dyn_setvalue(SYMTAB *symtab,const char *section,const char *keyword,const char *value);} {} 

decl {extern char *ini_dyn_assumevalue (SYMTAB *symtab,const char *section,const char *keyword, const char *default_value);} {} 

decl {extern int start_sending();} {public
} 

decl {TextBuffer *b;} {public
} 

decl {TextBuffer *b2;} {public
} 

decl {TextEdit *textedit;} {public
} 

decl {TextEdit *Mail_text;} {public
} 

decl {int abortit;} {public
} 

Function {bufModifiedCB(void *arg)} {open return_type bufModifyCallbackProc
} {
  code {if(progress)
progress->range(0,textedit->mNBufferLines);
return NULL;} {}
} 

Function {fill_text(TextBuffer *texteditobj,char *filename)} {open private
} {
  code {DESCR *descriptor;
if(descriptor=file_slurpl(filename))
{
texteditobj->Insert(descriptor->size,removechars((char *)descriptor->data,"\\r"));
mem_free(descriptor);
}} {}
} 

Function {save_data()} {open
} {
  code {ini_dyn_setvalue(&load_symtab,"Misc","Smtp",SMTPval->value());
ini_dyn_setvalue(&load_symtab,"Misc","Sender",sender->value());
ini_dyn_setvalue(&load_symtab,"Misc","Subject",subject->value());
ini_dyn_setvalue(&load_symtab,"Misc","Port",port->value());
ini_dyn_setvalue(&load_symtab,"Misc","Delay",delay->value());
ini_dyn_setvalue(&load_symtab,"Misc","MailsPerConnection",mailsconnect->value());

FILE * file=file_open ("text.txt",'w');
if(file)
{
fputs (b2->GetAll(),file);
file_close (file);
}

file=file_open ("receivers.txt",'w');
if(file)
{
fputs (b->GetAll(),file);
file_close (file);
}
file=file_open ("log.txt",'w');
if(file)
{
fputs (syslog->value(),file);
file_close (file);
}} {}
} 

Function {log_text(Fl_Output *output,char *text)} {open
} {
  code {char buffie[1000];
timestamp_string(buffie,"%dddd %dd %mmmm, %yyyy %h:%m:%s - ");
output->insert(buffie,strlen(buffie));
output->insert(text,strlen(text));
output->insert("\\n",1);
Fl::flush();} {selected
  }
} 

Function {show_log(Fl_Output *output)} {open private
} {
  code {DESCR *descriptor;
if(descriptor=file_slurpl("log.txt"))
{
char *cleared =removechars((char *)descriptor->data,"\\r"); 
output->insert(cleared,strlen(cleared));
mem_free(descriptor);
log_text(syslog,"Started...");
}else
{
log_text(syslog,"Welcome to MailReactor! Do not abuse this software!");
}} {}
} 

Function {make_window()} {open
} {
  Fl_Window mailwin {
    label MailReactor
    callback {save_data();
delete mailwin;} open
    xywh {241 160 586 517} box UP_BOX resizable visible
  } {
    Fl_Group {} {open
      xywh {5 5 349 115} box ENGRAVED_BOX
    } {
      Fl_Input SMTPval {
        label {SMTP server:}
        xywh {82 10 186 20} labelsize 11 textsize 11
        code0 {char *smtpval=ini_dyn_assumevalue (&load_symtab,"Misc", "SMTP","smtp");}
        code1 {SMTPval->insert(smtpval,strlen(smtpval));}
      }
      Fl_Input port {
        label {Port:}
        xywh {300 10 44 20} type Int labelsize 11 textsize 11
        code0 {char *portval=ini_dyn_assumevalue (&load_symtab,"Misc", "Port","25");}
        code1 {port->insert(portval,strlen(portval));}
      }
      Fl_Input sender {
        label {Sender e-mail:}
        xywh {82 39 186 20} labelsize 11 textsize 11
        code0 {char *senderval=ini_dyn_assumevalue (&load_symtab,"Misc", "Sender","me@here.now");}
        code1 {sender->insert(senderval,strlen(senderval));}
      }
      Fl_Input subject {
        label {Subject:}
        xywh {82 68 186 20} labelsize 11 textsize 11
        code0 {char *subjectval=ini_dyn_assumevalue (&load_symtab,"Misc", "Subject","Very interesting");}
        code1 {subject->insert(subjectval,strlen(subjectval));}
      }
      Fl_Input delay {
        label {Delay (msec):}
        xywh {82 96 44 20} type Int labelsize 11 textsize 11
        code0 {char *delayval=ini_dyn_assumevalue (&load_symtab,"Misc", "Delay","100");}
        code1 {delay->insert(delayval,strlen(delayval));}
      }
      Fl_Input mailsconnect {
        label {Mails/connection:}
        xywh {224 96 44 20} type Int labelsize 11 textsize 11
        code0 {char *mailscon=ini_dyn_assumevalue (&load_symtab,"Misc", "MailsPerConnection","10");}
        code1 {mailsconnect->insert(mailscon,strlen(mailscon));}
      }
    }
    Fl_Group {} {open
      xywh {5 137 575 275}
    } {
      Fl_Group Receivers {
        label {Receivers:} open
        xywh {355 137 225 275} box DOWN_BOX color 7 labelsize 11 align 5 when 1
        code0 {b= new TextBuffer(1);}
        code1 {textedit= new TextEdit(Receivers->x()+2, Receivers->y()+2, Receivers->w()-(v->w())-4, Receivers->h()-(h->h())-4, h, v, b, 0, 0 );}
        code2 {textedit->color( FL_WHITE );textedit->MoveDown();b->AddModifyCB((bufModifyCallbackProc) bufModifiedCB,NULL );}
        code3 {fill_text(b,"receivers.txt");}
      } {
        Fl_Scrollbar h {
          xywh {357 395 206 15} type Horizontal
        }
        Fl_Scrollbar v {
          xywh {563 139 15 256}
        }
        Fl_Box {} {
          xywh {425 292 25 25} resizable
        }
        Fl_Box {} {
          xywh {563 395 15 15} box FLAT_BOX
        }
      }
      Fl_Group Text {
        label {Text:} open
        xywh {5 137 345 275} box DOWN_BOX color 7 labelsize 11 align 5
        code0 {b2= new TextBuffer(1);}
        code1 {Mail_text= new TextEdit(Text->x()+2, Text->y()+2, Text->w()-(Text_v->w())-4, Text->h()-(Text_h->h())-4,Text_h,Text_v, b2, 0, 0 );}
        code2 {Mail_text->color( FL_WHITE );Mail_text->MoveDown();}
        code3 {fill_text(b2,"text.txt");}
      } {
        Fl_Scrollbar Text_v {
          xywh {333 139 15 256}
        }
        Fl_Scrollbar Text_h {
          xywh {7 395 326 15} type Horizontal
        }
        Fl_Box {} {
          xywh {240 297 25 25} resizable
        }
      }
      Fl_Box {} {
        xywh {265 242 25 25} resizable
      }
      Fl_Box {} {
        xywh {333 395 15 15} box FLAT_BOX
      }
    }
    Fl_Output syslog {
      xywh {5 415 575 98} type Multiline labelsize 11 textsize 11
      code0 {show_log(syslog);}
    }
    Fl_Value_Slider progress {
      label {Start from:}
      xywh {355 100 225 20} type {Horz Fill} labelsize 11 align 5 maximum 100 step 1 textsize 11
      code0 {progress->range(0,textedit->mNBufferLines);}
    }
    Fl_Box {} {
      xywh {564 327 6 25} resizable
    }
    Fl_Button Send {
      label {MailReactor.xpm}
      callback {start_sending();}
      xywh {357 5 65 55} labeltype image labelsize 11
    }
    Fl_Button Abort {
      label Abort
      callback {abortit=TRUE;}
      xywh {427 5 65 25} labelsize 11 deactivate
    }
    Fl_Button ExitButton {
      label Exit
      callback {save_data();
mailwin->hide();}
      xywh {497 5 65 25} labelsize 11
    }
    Fl_Button ClearLog {
      label {Clear Log}
      callback {syslog->value("");
log_text(syslog,"Welcome to MailReactor! Do not abuse this software!");}
      xywh {427 35 65 25} labelsize 11
    }
    Fl_Button about {
      label About
      callback {Fl_Window* aboutwindow=about_window();
aboutwindow->show();}
      xywh {497 35 65 25} labelsize 11
    }
  }
} 

Function {about_window()} {open
} {
  Fl_Window aboutwin {
    label {About MailReactor} open
    xywh {541 257 212 203} labelsize 11 align 16 hotspot modal visible
  } {
    Fl_Button {} {
      label {Thanks!}
      callback {delete aboutwin;}
      xywh {75 173 65 25} labelsize 11
    }
    Fl_Box {} {
      label {MailReactor 0.9                          by Niek Albers (nieka@dsv.nl)                     Open Source Software 1999   Build using:                             Fast Light Toolkit (www.fltk.org) Standard Function Library (www.imatix.com) and TextEdit by Maarten de Boer}
      xywh {25 15 165 115} box ENGRAVED_FRAME labelsize 11 align 145
    }
    Fl_Output website {
      xywh {7 140 200 25} labelsize 11 textsize 11
      code0 {website->value("http://www.dsv.nl/~nieka/MailReactor");}
    }
  }
} 
