diff options
author | Erich Eckner <git@eckner.net> | 2019-04-05 14:16:12 +0200 |
---|---|---|
committer | Erich Eckner <git@eckner.net> | 2019-04-05 14:16:12 +0200 |
commit | 97d06f3e79bbdf4941b4d7144d06c6051811a5bf (patch) | |
tree | a8c61bedcbbe960683e3a9e24aa46bffb9ef8eba | |
parent | 3fe6a75b12da9df0b86843b058bb8e127c1520f1 (diff) | |
download | Emails-97d06f3e79bbdf4941b4d7144d06c6051811a5bf.tar.xz |
geht nun auch mit imap
-rw-r--r-- | emails.lpi | 20 | ||||
-rw-r--r-- | emails.lpr | 2 | ||||
-rw-r--r-- | emails.lps | 231 | ||||
-rw-r--r-- | emails.res | bin | 138932 -> 139052 bytes | |||
-rw-r--r-- | unit1.lfm | 10 | ||||
-rw-r--r-- | unit1.pas | 163 |
6 files changed, 255 insertions, 171 deletions
@@ -1,7 +1,7 @@ <?xml version="1.0" encoding="UTF-8"?> <CONFIG> <ProjectOptions> - <Version Value="9"/> + <Version Value="11"/> <General> <SessionStorage Value="InProjectDir"/> <MainUnit Value="0"/> @@ -13,9 +13,6 @@ <i18n> <EnableI18N LFM="False"/> </i18n> - <VersionInfo> - <StringTable ProductVersion=""/> - </VersionInfo> <BuildModes Count="1"> <Item1 Name="Default" Default="True"/> </BuildModes> @@ -23,16 +20,17 @@ <Version Value="2"/> </PublishOptions> <RunParams> - <local> - <FormatVersion Value="1"/> - </local> + <FormatVersion Value="2"/> + <Modes Count="1"> + <Mode0 Name="default"/> + </Modes> </RunParams> <RequiredPackages Count="1"> <Item1> <PackageName Value="LCL"/> </Item1> </RequiredPackages> - <Units Count="3"> + <Units Count="4"> <Unit0> <Filename Value="emails.lpr"/> <IsPartOfProject Value="True"/> @@ -46,9 +44,13 @@ <UnitName Value="Unit1"/> </Unit1> <Unit2> - <Filename Value="../units/popunit.pas"/> + <Filename Value="../units/popimapunit.pas"/> <IsPartOfProject Value="True"/> </Unit2> + <Unit3> + <Filename Value="../units/deencrypt.pas"/> + <IsPartOfProject Value="True"/> + </Unit3> </Units> </ProjectOptions> <CompilerOptions> @@ -5,7 +5,7 @@ program emails; uses cthreads, Interfaces, // this includes the LCL widgetset - Forms, Unit1, popunit + Forms, Unit1, popimapunit, deencrypt { you can add units after this }; {$R *.res} @@ -1,15 +1,16 @@ <?xml version="1.0" encoding="UTF-8"?> <CONFIG> <ProjectSession> - <Version Value="10"/> + <Version Value="11"/> <BuildModes Active="Default"/> - <Units Count="10"> + <Units Count="14"> <Unit0> <Filename Value="emails.lpr"/> <IsPartOfProject Value="True"/> - <EditorIndex Value="-1"/> - <CursorPos Y="7"/> - <UsageCount Value="26"/> + <EditorIndex Value="1"/> + <CursorPos X="24" Y="8"/> + <UsageCount Value="37"/> + <Loaded Value="True"/> </Unit0> <Unit1> <Filename Value="unit1.pas"/> @@ -18,191 +19,225 @@ <HasResources Value="True"/> <ResourceBaseClass Value="Form"/> <UnitName Value="Unit1"/> - <IsVisibleTab Value="True"/> - <TopLine Value="54"/> - <CursorPos X="20" Y="59"/> - <UsageCount Value="26"/> + <TopLine Value="129"/> + <CursorPos Y="149"/> + <UsageCount Value="37"/> <Loaded Value="True"/> <LoadedDesigner Value="True"/> </Unit1> <Unit2> - <Filename Value="../units/popunit.pas"/> + <Filename Value="../units/popimapunit.pas"/> <IsPartOfProject Value="True"/> - <EditorIndex Value="3"/> - <TopLine Value="196"/> - <CursorPos X="54" Y="196"/> - <UsageCount Value="26"/> + <IsVisibleTab Value="True"/> + <EditorIndex Value="4"/> + <TopLine Value="601"/> + <CursorPos Y="632"/> + <UsageCount Value="30"/> <Loaded Value="True"/> </Unit2> <Unit3> - <Filename Value="Hashes.pas"/> + <Filename Value="../units/popunit.pas"/> <EditorIndex Value="-1"/> - <TopLine Value="85"/> - <UsageCount Value="10"/> + <TopLine Value="209"/> + <CursorPos X="18" Y="398"/> + <UsageCount Value="25"/> </Unit3> <Unit4> - <Filename Value="/usr/lib/fpc/src/packages/fcl-process/src/process.pp"/> + <Filename Value="Hashes.pas"/> <EditorIndex Value="-1"/> - <TopLine Value="10"/> - <CursorPos X="48" Y="25"/> - <UsageCount Value="10"/> + <TopLine Value="85"/> + <UsageCount Value="9"/> </Unit4> <Unit5> + <Filename Value="/usr/lib/fpc/src/packages/fcl-process/src/process.pp"/> + <EditorIndex Value="-1"/> + <TopLine Value="612"/> + <CursorPos X="39" Y="27"/> + <UsageCount Value="10"/> + </Unit5> + <Unit6> <Filename Value="../units/mystringlistunit.pas"/> - <EditorIndex Value="1"/> + <EditorIndex Value="2"/> + <TopLine Value="578"/> <CursorPos X="35" Y="618"/> - <UsageCount Value="11"/> + <UsageCount Value="16"/> <Loaded Value="True"/> - </Unit5> - <Unit6> + </Unit6> + <Unit7> <Filename Value="../units/lowlevelunit.pas"/> - <EditorIndex Value="2"/> + <EditorIndex Value="3"/> <TopLine Value="367"/> <CursorPos X="47" Y="403"/> - <UsageCount Value="10"/> + <UsageCount Value="15"/> <Loaded Value="True"/> - </Unit6> - <Unit7> + </Unit7> + <Unit8> <Filename Value="../units/gitupdateunit.pas"/> <EditorIndex Value="-1"/> <CursorPos Y="39"/> - <UsageCount Value="10"/> - </Unit7> - <Unit8> + <UsageCount Value="9"/> + </Unit8> + <Unit9> <Filename Value="../units/refreshexecutableunit.pas"/> <EditorIndex Value="-1"/> <TopLine Value="31"/> <CursorPos X="21" Y="70"/> - <UsageCount Value="10"/> - </Unit8> - <Unit9> + <UsageCount Value="9"/> + </Unit9> + <Unit10> <Filename Value="/usr/lib/fpc/src/rtl/objpas/classes/classesh.inc"/> <EditorIndex Value="-1"/> - <TopLine Value="753"/> - <CursorPos X="20" Y="774"/> - <UsageCount Value="10"/> - </Unit9> + <TopLine Value="691"/> + <CursorPos X="14" Y="710"/> + <UsageCount Value="9"/> + </Unit10> + <Unit11> + <Filename Value="../units/deencrypt.pas"/> + <IsPartOfProject Value="True"/> + <EditorIndex Value="-1"/> + <TopLine Value="22"/> + <CursorPos X="97" Y="25"/> + <UsageCount Value="30"/> + </Unit11> + <Unit12> + <Filename Value="../epost/werteunit.pas"/> + <EditorIndex Value="-1"/> + <TopLine Value="46"/> + <UsageCount Value="9"/> + </Unit12> + <Unit13> + <Filename Value="../epost/epostunit.pas"/> + <EditorIndex Value="-1"/> + <TopLine Value="1469"/> + <CursorPos X="20" Y="1463"/> + <UsageCount Value="9"/> + </Unit13> </Units> <JumpHistory Count="30" HistoryIndex="29"> <Position1> - <Filename Value="../units/popunit.pas"/> - <Caret Line="278" Column="39" TopLine="257"/> + <Filename Value="../units/popimapunit.pas"/> + <Caret Line="83" Column="29" TopLine="66"/> </Position1> <Position2> - <Filename Value="../units/popunit.pas"/> - <Caret Line="25" Column="25" TopLine="5"/> + <Filename Value="../units/popimapunit.pas"/> + <Caret Line="84" Column="29" TopLine="66"/> </Position2> <Position3> - <Filename Value="../units/popunit.pas"/> - <Caret Line="173" Column="32" TopLine="164"/> + <Filename Value="../units/popimapunit.pas"/> + <Caret Line="85" Column="29" TopLine="66"/> </Position3> <Position4> - <Filename Value="../units/popunit.pas"/> - <Caret Line="23" Column="23" TopLine="23"/> + <Filename Value="../units/popimapunit.pas"/> + <Caret Line="435" Column="66" TopLine="410"/> </Position4> <Position5> - <Filename Value="../units/popunit.pas"/> - <Caret Line="56" Column="13" TopLine="29"/> + <Filename Value="../units/popimapunit.pas"/> + <Caret Line="430" TopLine="409"/> </Position5> <Position6> - <Filename Value="../units/popunit.pas"/> - <Caret Line="22" Column="12" TopLine="2"/> + <Filename Value="../units/popimapunit.pas"/> + <Caret Line="48" Column="61" TopLine="19"/> </Position6> <Position7> - <Filename Value="../units/popunit.pas"/> - <Caret Line="162" Column="34" TopLine="129"/> + <Filename Value="../units/popimapunit.pas"/> + <Caret Line="424" Column="72" TopLine="404"/> </Position7> <Position8> - <Filename Value="../units/popunit.pas"/> - <Caret Line="163" Column="10" TopLine="151"/> + <Filename Value="../units/popimapunit.pas"/> + <Caret Line="433" Column="35" TopLine="413"/> </Position8> <Position9> - <Filename Value="../units/popunit.pas"/> - <Caret Line="169" Column="10" TopLine="151"/> + <Filename Value="../units/popimapunit.pas"/> + <Caret Line="21" TopLine="21"/> </Position9> <Position10> - <Filename Value="../units/popunit.pas"/> - <Caret Line="180" Column="21" TopLine="151"/> + <Filename Value="../units/popimapunit.pas"/> + <Caret Line="424" Column="25" TopLine="404"/> </Position10> <Position11> - <Filename Value="../units/popunit.pas"/> - <Caret Line="521" Column="52" TopLine="508"/> + <Filename Value="../units/popimapunit.pas"/> + <Caret Line="49" Column="36" TopLine="40"/> </Position11> <Position12> - <Filename Value="unit1.pas"/> - <Caret Line="39" Column="5" TopLine="39"/> + <Filename Value="../units/popimapunit.pas"/> + <Caret Line="604" Column="20" TopLine="585"/> </Position12> <Position13> - <Filename Value="unit1.pas"/> - <Caret Line="107" Column="11" TopLine="75"/> + <Filename Value="../units/popimapunit.pas"/> + <Caret Line="424" Column="45" TopLine="410"/> </Position13> <Position14> - <Filename Value="unit1.pas"/> + <Filename Value="../units/popimapunit.pas"/> + <Caret Line="438" Column="92" TopLine="428"/> </Position14> <Position15> - <Filename Value="../units/popunit.pas"/> - <Caret Line="159" Column="68" TopLine="139"/> + <Filename Value="../units/popimapunit.pas"/> + <Caret Line="49" Column="22" TopLine="22"/> </Position15> <Position16> - <Filename Value="../units/popunit.pas"/> - <Caret Line="29" Column="26" TopLine="9"/> + <Filename Value="../units/popimapunit.pas"/> + <Caret Line="459" Column="44" TopLine="456"/> </Position16> <Position17> - <Filename Value="unit1.pas"/> - <Caret Line="101" TopLine="62"/> + <Filename Value="../units/popimapunit.pas"/> + <Caret Line="457" Column="43" TopLine="448"/> </Position17> <Position18> - <Filename Value="unit1.pas"/> - <Caret Line="147" Column="105" TopLine="82"/> + <Filename Value="../units/popimapunit.pas"/> + <Caret Line="459" Column="44" TopLine="448"/> </Position18> <Position19> - <Filename Value="../units/lowlevelunit.pas"/> - <Caret Line="82" Column="24" TopLine="60"/> + <Filename Value="../units/popimapunit.pas"/> + <Caret Line="477" Column="37" TopLine="461"/> </Position19> <Position20> - <Filename Value="../units/lowlevelunit.pas"/> - <Caret Line="631" Column="47" TopLine="599"/> + <Filename Value="../units/popimapunit.pas"/> + <Caret Line="570" Column="19" TopLine="541"/> </Position20> <Position21> - <Filename Value="../units/lowlevelunit.pas"/> - <Caret Line="647" Column="12" TopLine="609"/> + <Filename Value="../units/popimapunit.pas"/> + <Caret Line="615" Column="23" TopLine="601"/> </Position21> <Position22> - <Filename Value="../units/lowlevelunit.pas"/> - <Caret Line="637" Column="30" TopLine="613"/> + <Filename Value="../units/popimapunit.pas"/> + <Caret Line="21" Column="26"/> </Position22> <Position23> - <Filename Value="../units/lowlevelunit.pas"/> - <Caret Line="635" Column="51" TopLine="613"/> + <Filename Value="../units/popimapunit.pas"/> + <Caret Line="229" Column="33" TopLine="214"/> </Position23> <Position24> - <Filename Value="../units/lowlevelunit.pas"/> - <Caret Line="637" Column="51" TopLine="588"/> + <Filename Value="../units/popimapunit.pas"/> + <Caret Line="18" Column="3"/> </Position24> <Position25> - <Filename Value="../units/lowlevelunit.pas"/> - <Caret Line="83" Column="19" TopLine="61"/> + <Filename Value="../units/popimapunit.pas"/> + <Caret Line="612" Column="42" TopLine="592"/> </Position25> <Position26> - <Filename Value="../units/lowlevelunit.pas"/> - <Caret Line="647" Column="21" TopLine="612"/> + <Filename Value="../units/popimapunit.pas"/> + <Caret Line="616" Column="102" TopLine="592"/> </Position26> <Position27> - <Filename Value="unit1.pas"/> - <Caret Line="146" Column="23" TopLine="121"/> + <Filename Value="../units/popimapunit.pas"/> + <Caret Line="628" Column="26" TopLine="599"/> </Position27> <Position28> - <Filename Value="../units/mystringlistunit.pas"/> - <Caret Line="45" TopLine="7"/> + <Filename Value="../units/popimapunit.pas"/> + <Caret Line="619" TopLine="604"/> </Position28> <Position29> - <Filename Value="../units/lowlevelunit.pas"/> - <Caret Line="115" Column="18" TopLine="88"/> + <Filename Value="../units/popimapunit.pas"/> + <Caret Line="635" TopLine="599"/> </Position29> <Position30> - <Filename Value="unit1.pas"/> - <Caret Line="146" Column="23" TopLine="121"/> + <Filename Value="../units/popimapunit.pas"/> + <Caret Line="629" Column="35" TopLine="604"/> </Position30> </JumpHistory> + <RunParams> + <FormatVersion Value="2"/> + <Modes Count="0" ActiveMode="default"/> + </RunParams> </ProjectSession> </CONFIG> Binary files differ@@ -11,7 +11,7 @@ object Form1: TForm1 OnDestroy = FormDestroy OnResize = FormResize OnShow = FormShow - LCLVersion = '1.8.4.0' + LCLVersion = '2.0.0.4' object Memo1: TMemo Left = 0 Height = 584 @@ -73,18 +73,18 @@ object Form1: TForm1 end object CheckBox1: TCheckBox Left = 272 - Height = 21 + Height = 23 Top = 596 - Width = 93 + Width = 96 Caption = 'aufploppen' OnClick = CheckBox1Click TabOrder = 2 end object CheckBox2: TCheckBox Left = 416 - Height = 21 + Height = 23 Top = 596 - Width = 86 + Width = 91 Caption = 'Ton geben' Checked = True OnClick = CheckBox1Click @@ -6,7 +6,7 @@ interface uses Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, StdCtrls, - ExtCtrls, popunit, gitUpdateUnit; + ExtCtrls, popimapunit, gitUpdateUnit; type @@ -36,7 +36,7 @@ type lb: tMouseButton; public { public declarations } - pc: tPopClient; + pc: tPopImapClient; procedure neueNachrichten(sender: tObject); end; @@ -53,68 +53,99 @@ uses myStringListUnit, lowLevelUnit, process; procedure TForm1.FormCreate(Sender: TObject); var - sl: tMyStringList; - s,ga: string; + sl: tMyStringList; + s,ga: string; + found: boolean; begin __ausgabenMaske:=1; - ga:='.*@eckner\.net' +'|'+ - '(ee|intern|vorstand)@wurzel\.org' +'|'+ - 'erich\.eckner@uni-jena\.de' +'|'+ - 'erich\.eckner@gmx\.de' +'|'+ - '(ioq_(nlo|staff)|alle_mitarbeiter|fsr-physik-newsletter)@listserv\.uni-jena\.de' +'|'+ - '(sox-users|logwatch-devel)@lists\.sourceforge\.net' +'|'+ - 'gmp-discuss@gmplib\.org' +'|'+ - 'hashcash@freelists\.org' +'|'+ - 'crux(-commits)?@lists\.crux\.nu' +'|'+ - 'radvd-devel-l@lists\.litech\.org' +'|'+ - 'arch-general-request@archlinux\.org'; - if fileexists(extractfilepath(application.exename)+'optionen.konf') then begin - sl:=tMyStringList.create; - sl.loadFromFile(extractfilepath(application.exename)+'optionen.konf'); - - s:=sl.grepFirst('^aufploppen\s*='); - erstesArgument(s,'='); - if uppercase(s)='JA' then - checkBox1.checked:=true - else if uppercase(s)='NEIN' then - checkBox1.checked:=false - else if s<>'' then - raise exception.create(''''+s+''' ist kein gültiger Wert für ''aufploppen'' (ja|nein)!'); - - s:=sl.grepFirst('^Ton\s+geben\s*='); - erstesArgument(s,'='); - if uppercase(s)='JA' then - checkBox2.checked:=true - else if uppercase(s)='NEIN' then - checkBox2.checked:=false - else if s<>'' then - raise exception.create(''''+s+''' ist kein gültiger Wert für ''Ton geben'' (ja|nein)!'); - - sl.grep('^gültiger\s+Adressat\s*='); - if sl.count>0 then begin - ga:=''; - sl.rewind; - while sl.readln(s) do begin - erstesArgument(s,'='); - ga:=ga+'|'+s; - end; - delete(ga,1,1); - end; - sl.free; - end; + if not fileexists(extractfilepath(application.exename)+'optionen.konf') then + raise exception.create('Kann Optionendatei ''' + extractfilepath(application.exename) + 'optionen.konf' + ''' nicht finden!'); - writeln(ga); - - pc:=tPopClient.create; - pc.timeout:=10; + sl:=tMyStringList.create; + sl.loadFromFile(extractfilepath(application.exename)+'optionen.konf'); + + s:=sl.grepFirst('^aufploppen\s*='); + erstesArgument(s,'='); + if uppercase(s)='JA' then + checkBox1.checked:=true + else if uppercase(s)='NEIN' then + checkBox1.checked:=false + else if s<>'' then + raise exception.create(''''+s+''' ist kein gültiger Wert für ''aufploppen'' (ja|nein)!'); + + s:=sl.grepFirst('^Ton\s+geben\s*='); + erstesArgument(s,'='); + if uppercase(s)='JA' then + checkBox2.checked:=true + else if uppercase(s)='NEIN' then + checkBox2.checked:=false + else if s<>'' then + raise exception.create(''''+s+''' ist kein gültiger Wert für ''Ton geben'' (ja|nein)!'); + + pc:=tPopImapClient.create; + s:=sl.grepFirst('^Timeout\s*='); + if erstesArgument(s,'=')<>'' then + pc.timeout:=strToFloat(s); pc.neueNachrichten:=@neueNachrichten; -// pc.sshUser:='erich'; - pc.host:='eckner.net'; - pc.user:='notify@eckner.net'; - pc.pass:='C7sd7k8*'; + s:=sl.grepFirst('^ssh-User\s*='); + if erstesArgument(s,'=')<>'' then + pc.sshUser:=s; + s:=sl.grepFirst('^Host\s*='); + if erstesArgument(s,'=')<>'' then + pc.host:=s + else + raise exception.create('Kein Host in '''+extractfilepath(application.exename)+'optionen.konf'' angegeben!'); + s:=sl.grepFirst('^User\s*='); + if erstesArgument(s,'=')<>'' then + pc.user:=s + else + raise exception.create('Kein User in '''+extractfilepath(application.exename)+'optionen.konf'' angegeben!'); + s:=sl.grepFirst('^Pass\s*='); + if erstesArgument(s,'=')<>'' then + pc.pass:=s + else + raise exception.create('Kein Pass in '''+extractfilepath(application.exename)+'optionen.konf'' angegeben!'); + found:=false; + s:=sl.grepFirst('^Port\s*='); + if erstesArgument(s,'=')<>'' then begin + pc.port:=strToInt(s); + found:=true; + end; + s:=sl.grepFirst('^Protocol\s*='); + erstesArgument(s,'='); + if s='pop' then begin + pc.mailProtocol:=mpPop; + if not found then + pc.port:=995; + end + else if s='imap' then begin + pc.mailProtocol:=mpImap; + if not found then + pc.port:=993; + end + else begin + if not found then + raise exception.create('Kein Port und kein Protocol in '''+extractfilepath(application.exename)+'optionen.konf'' angegeben!'); + if pc.port=993 then + pc.mailProtocol:=mpImap + else if pc.port=995 then + pc.mailProtocol:=mpPop + else + raise exception.create('Ungültiges/unbekanntes Mail-Protokoll '''+s+'''!'); + end; + + sl.grep('^gültiger\s+Adressat\s*='); + if sl.count>0 then begin + ga:=''; + sl.rewind; + while sl.readln(s) do begin + erstesArgument(s,'='); + ga:=ga+'|'+s; + end; + delete(ga,1,1); + end; pc.gueltigerAdressat:='('+ga+')'; - pc.port:=995; end; procedure TForm1.FormDestroy(Sender: TObject); @@ -148,6 +179,22 @@ begin sl.addWithLineBreaks('gültiger Adressat = '+umbrechen(copy(pc.gueltigerAdressat,2,length(pc.gueltigerAdressat)-2),'|',true,'gültiger Adressat = ')); + sl.add('Timeout = ' + floatToStr(pc.timeOut)); + if pc.sshUser<>'' then + sl.add('ssh-User = ' + pc.sshUser); + sl.add('Host = ' + pc.host); + sl.add('User = ' + pc.user); + sl.add('Pass = ' + pc.pass); + sl.add('Port = ' + intToStr(pc.port)); + case pc.mailProtocol of + mpPop: + sl.add('Protocol = pop'); + mpImap: + sl.add('Protocol = pop'); + else + raise exception.create('unbekanntes Mail-Protokoll!'); + end{of Case}; + sl.saveToFile(extractfilepath(application.exename)+'optionen.konf'); sl.free; end; |