diff options
-rwxr-xr-x | emails | bin | 0 -> 19908416 bytes | |||
-rw-r--r-- | emails.ico | bin | 0 -> 137040 bytes | |||
-rw-r--r-- | emails.lpi | 84 | ||||
-rw-r--r-- | emails.lpr | 19 | ||||
-rw-r--r-- | emails.lps | 188 | ||||
-rw-r--r-- | emails.res | bin | 0 -> 138696 bytes | |||
-rw-r--r-- | unit1.lfm | 98 | ||||
-rw-r--r-- | unit1.pas | 215 |
8 files changed, 604 insertions, 0 deletions
Binary files differ diff --git a/emails.ico b/emails.ico Binary files differnew file mode 100644 index 0000000..0341321 --- /dev/null +++ b/emails.ico diff --git a/emails.lpi b/emails.lpi new file mode 100644 index 0000000..32a0c91 --- /dev/null +++ b/emails.lpi @@ -0,0 +1,84 @@ +<?xml version="1.0" encoding="UTF-8"?> +<CONFIG> + <ProjectOptions> + <Version Value="9"/> + <General> + <SessionStorage Value="InProjectDir"/> + <MainUnit Value="0"/> + <Title Value="emails"/> + <ResourceType Value="res"/> + <UseXPManifest Value="True"/> + <Icon Value="0"/> + </General> + <i18n> + <EnableI18N LFM="False"/> + </i18n> + <VersionInfo> + <StringTable ProductVersion=""/> + </VersionInfo> + <BuildModes Count="1"> + <Item1 Name="Default" Default="True"/> + </BuildModes> + <PublishOptions> + <Version Value="2"/> + </PublishOptions> + <RunParams> + <local> + <FormatVersion Value="1"/> + </local> + </RunParams> + <RequiredPackages Count="1"> + <Item1> + <PackageName Value="LCL"/> + </Item1> + </RequiredPackages> + <Units Count="3"> + <Unit0> + <Filename Value="emails.lpr"/> + <IsPartOfProject Value="True"/> + </Unit0> + <Unit1> + <Filename Value="unit1.pas"/> + <IsPartOfProject Value="True"/> + <ComponentName Value="Form1"/> + <ResourceBaseClass Value="Form"/> + <UnitName Value="Unit1"/> + </Unit1> + <Unit2> + <Filename Value="../units/popunit.pas"/> + <IsPartOfProject Value="True"/> + </Unit2> + </Units> + </ProjectOptions> + <CompilerOptions> + <Version Value="11"/> + <Target> + <Filename Value="emails"/> + </Target> + <SearchPaths> + <IncludeFiles Value="$(ProjOutDir)"/> + <OtherUnitFiles Value="../units"/> + <UnitOutputDirectory Value="lib/$(TargetCPU)-$(TargetOS)"/> + </SearchPaths> + <Linking> + <Options> + <Win32> + <GraphicApplication Value="True"/> + </Win32> + </Options> + </Linking> + </CompilerOptions> + <Debugging> + <Exceptions Count="3"> + <Item1> + <Name Value="EAbort"/> + </Item1> + <Item2> + <Name Value="ECodetoolError"/> + </Item2> + <Item3> + <Name Value="EFOpenError"/> + </Item3> + </Exceptions> + </Debugging> +</CONFIG> diff --git a/emails.lpr b/emails.lpr new file mode 100644 index 0000000..b139b94 --- /dev/null +++ b/emails.lpr @@ -0,0 +1,19 @@ +program emails; + +{$mode objfpc}{$H+} + +uses + cthreads, + Interfaces, // this includes the LCL widgetset + Forms, Unit1, popunit + { you can add units after this }; + +{$R *.res} + +begin + RequireDerivedFormResource := True; + Application.Initialize; + Application.CreateForm(TForm1, Form1); + Application.Run; +end. + diff --git a/emails.lps b/emails.lps new file mode 100644 index 0000000..a3942ed --- /dev/null +++ b/emails.lps @@ -0,0 +1,188 @@ +<?xml version="1.0" encoding="UTF-8"?> +<CONFIG> + <ProjectSession> + <Version Value="9"/> + <BuildModes Active="Default"/> + <Units Count="7"> + <Unit0> + <Filename Value="emails.lpr"/> + <IsPartOfProject Value="True"/> + <EditorIndex Value="-1"/> + <CursorPos Y="7"/> + <UsageCount Value="20"/> + </Unit0> + <Unit1> + <Filename Value="unit1.pas"/> + <IsPartOfProject Value="True"/> + <ComponentName Value="Form1"/> + <ResourceBaseClass Value="Form"/> + <UnitName Value="Unit1"/> + <TopLine Value="169"/> + <CursorPos X="30" Y="73"/> + <UsageCount Value="20"/> + <Loaded Value="True"/> + <LoadedDesigner Value="True"/> + </Unit1> + <Unit2> + <Filename Value="Hashes.pas"/> + <EditorIndex Value="-1"/> + <TopLine Value="85"/> + <UsageCount Value="10"/> + </Unit2> + <Unit3> + <Filename Value="../units/popunit.pas"/> + <IsPartOfProject Value="True"/> + <IsVisibleTab Value="True"/> + <EditorIndex Value="1"/> + <TopLine Value="348"/> + <CursorPos Y="369"/> + <UsageCount Value="20"/> + <Loaded Value="True"/> + </Unit3> + <Unit4> + <Filename Value="/usr/lib/fpc/src/packages/fcl-process/src/process.pp"/> + <EditorIndex Value="-1"/> + <TopLine Value="10"/> + <CursorPos X="48" Y="25"/> + <UsageCount Value="10"/> + </Unit4> + <Unit5> + <Filename Value="../units/mystringlistunit.pas"/> + <EditorIndex Value="2"/> + <TopLine Value="192"/> + <CursorPos Y="42"/> + <UsageCount Value="10"/> + <Loaded Value="True"/> + </Unit5> + <Unit6> + <Filename Value="../units/lowlevelunit.pas"/> + <EditorIndex Value="-1"/> + <TopLine Value="77"/> + <CursorPos Y="99"/> + <UsageCount Value="10"/> + </Unit6> + </Units> + <JumpHistory Count="30" HistoryIndex="29"> + <Position1> + <Filename Value="../units/popunit.pas"/> + <Caret Line="400" Column="21" TopLine="372"/> + </Position1> + <Position2> + <Filename Value="../units/popunit.pas"/> + <Caret Line="404" Column="17" TopLine="372"/> + </Position2> + <Position3> + <Filename Value="../units/popunit.pas"/> + <Caret Line="405" Column="24" TopLine="372"/> + </Position3> + <Position4> + <Filename Value="../units/popunit.pas"/> + <Caret Line="414" Column="15" TopLine="379"/> + </Position4> + <Position5> + <Filename Value="../units/popunit.pas"/> + <Caret Line="425" Column="27" TopLine="397"/> + </Position5> + <Position6> + <Filename Value="../units/popunit.pas"/> + <Caret Line="428" Column="19" TopLine="397"/> + </Position6> + <Position7> + <Filename Value="../units/popunit.pas"/> + <Caret Line="430" TopLine="397"/> + </Position7> + <Position8> + <Filename Value="unit1.pas"/> + <Caret Line="89" Column="18" TopLine="83"/> + </Position8> + <Position9> + <Filename Value="../units/popunit.pas"/> + <Caret Line="53" Column="15" TopLine="32"/> + </Position9> + <Position10> + <Filename Value="../units/popunit.pas"/> + <Caret Line="433" Column="16" TopLine="416"/> + </Position10> + <Position11> + <Filename Value="../units/popunit.pas"/> + <Caret Line="55" TopLine="21"/> + </Position11> + <Position12> + <Filename Value="../units/popunit.pas"/> + <Caret Line="548" Column="70" TopLine="521"/> + </Position12> + <Position13> + <Filename Value="../units/popunit.pas"/> + <Caret Line="265" Column="3" TopLine="245"/> + </Position13> + <Position14> + <Filename Value="../units/popunit.pas"/> + <Caret Line="48" Column="29" TopLine="5"/> + </Position14> + <Position15> + <Filename Value="../units/popunit.pas"/> + <Caret Line="99" Column="15" TopLine="77"/> + </Position15> + <Position16> + <Filename Value="../units/popunit.pas"/> + <Caret Line="152" Column="33" TopLine="130"/> + </Position16> + <Position17> + <Filename Value="../units/popunit.pas"/> + <Caret Line="157" Column="30" TopLine="135"/> + </Position17> + <Position18> + <Filename Value="../units/popunit.pas"/> + <Caret Line="234" Column="12" TopLine="346"/> + </Position18> + <Position19> + <Filename Value="../units/popunit.pas"/> + <Caret Line="18" Column="33"/> + </Position19> + <Position20> + <Filename Value="../units/popunit.pas"/> + <Caret Line="98" TopLine="76"/> + </Position20> + <Position21> + <Filename Value="../units/popunit.pas"/> + <Caret Line="149" TopLine="127"/> + </Position21> + <Position22> + <Filename Value="../units/popunit.pas"/> + <Caret Line="181" TopLine="160"/> + </Position22> + <Position23> + <Filename Value="../units/popunit.pas"/> + <Caret Line="199" TopLine="178"/> + </Position23> + <Position24> + <Filename Value="../units/popunit.pas"/> + <Caret Line="204" TopLine="183"/> + </Position24> + <Position25> + <Filename Value="../units/popunit.pas"/> + <Caret Line="312" TopLine="272"/> + </Position25> + <Position26> + <Filename Value="../units/popunit.pas"/> + <Caret Line="233" TopLine="213"/> + </Position26> + <Position27> + <Filename Value="../units/popunit.pas"/> + <Caret Line="270" TopLine="249"/> + </Position27> + <Position28> + <Filename Value="../units/popunit.pas"/> + <Caret Line="286" TopLine="265"/> + </Position28> + <Position29> + <Filename Value="../units/popunit.pas"/> + <Caret Line="302" TopLine="281"/> + </Position29> + <Position30> + <Filename Value="../units/popunit.pas"/> + <Caret Line="318" TopLine="297"/> + </Position30> + </JumpHistory> + </ProjectSession> +</CONFIG> diff --git a/emails.res b/emails.res Binary files differnew file mode 100644 index 0000000..e994dfa --- /dev/null +++ b/emails.res diff --git a/unit1.lfm b/unit1.lfm new file mode 100644 index 0000000..e391902 --- /dev/null +++ b/unit1.lfm @@ -0,0 +1,98 @@ +object Form1: TForm1 + Left = 1462 + Height = 756 + Top = 167 + Width = 999 + Caption = 'Form1' + ClientHeight = 756 + ClientWidth = 999 + OnClose = FormClose + OnCreate = FormCreate + OnResize = FormResize + OnShow = FormShow + LCLVersion = '1.4.4.0' + object Memo1: TMemo + Left = 0 + Height = 584 + Top = 0 + Width = 616 + Lines.Strings = ( + 'Memo1' + ) + TabOrder = 0 + end + object emailsDaIcon: TImage + Left = 48 + Height = 18 + Top = 8 + Width = 18 + Picture.Data = { + 055449636F6E3E01000000000100010010101000000000002801000016000000 + 2800000010000000200000000100040000000000C00000000000000000000000 + 0000000000000000000000000000800000800000008080008000000080008000 + 8080000080808000C0C0C0000000FF0000FF000000FFFF00FF000000FF00FF00 + FFFF0000FFFFFF00000008000000000000808887000000000080F8F807000000 + 0087F8FF007000000080F8FF070700000087FF8F0070700000807FF807070700 + 000807F070707070010088870707070009109877777070700991998787070700 + 0999991877777070009999108787070000099910087777700000991000878700 + 0000090000088800F87F0000C03F0000C01F0000C00F0000C0070000C0030000 + C0010000E0000000B0000000900000008000000080000000C1000000E1800000 + F1C10000FBE30000 + } + Visible = False + end + object nichtsDaIcon: TImage + Left = 76 + Height = 18 + Top = 8 + Width = 18 + Picture.Data = { + 055449636F6E3E01000000000100010010101000000000002801000016000000 + 2800000010000000200000000100040000000000C00000000000000000000000 + 0000000000000000000000000000800000800000008080008000000080008000 + 8080000080808000C0C0C0000000FF0000FF000000FFFF00FF000000FF00FF00 + FFFF0000FFFFFF00000000000000000000800777000000000080777707000000 + 0087077700700000008070770707000000870707007070000080707007070700 + 0008070070707070000088870707070000000877777070700000008787070700 + 0000000877777070000000008787070000000000087777700000000000878700 + 0000000000088800F87F0000C03F0000C01F0000C00F0000C0070000C0030000 + C0010000E0000000F0000000F8000000FC000000FE000000FF000000FF800000 + FFC10000FFE30000 + } + Visible = False + end + object Button1: TButton + Left = 8 + Height = 25 + Top = 592 + Width = 200 + Caption = 'Benachrichtigung löschen' + OnClick = Button1Click + TabOrder = 1 + end + object CheckBox1: TCheckBox + Left = 272 + Height = 21 + Top = 596 + Width = 93 + Caption = 'aufploppen' + OnClick = CheckBox1Click + TabOrder = 2 + end + object CheckBox2: TCheckBox + Left = 416 + Height = 21 + Top = 596 + Width = 86 + Caption = 'Ton geben' + OnClick = CheckBox1Click + TabOrder = 3 + end + object TrayIcon1: TTrayIcon + OnClick = TrayIcon1Click + OnDblClick = TrayIcon1DblClick + OnMouseDown = TrayIcon1MouseDown + left = 8 + top = 8 + end +end diff --git a/unit1.pas b/unit1.pas new file mode 100644 index 0000000..f61a2c9 --- /dev/null +++ b/unit1.pas @@ -0,0 +1,215 @@ +unit Unit1; + +{$mode objfpc}{$H+} + +interface + +uses + Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, StdCtrls, + ExtCtrls, popunit; + +type + + { TForm1 } + + TForm1 = class(TForm) + Button1: TButton; + CheckBox1: TCheckBox; + CheckBox2: TCheckBox; + emailsDaIcon: TImage; + nichtsDaIcon: TImage; + Memo1: TMemo; + TrayIcon1: TTrayIcon; + procedure Button1Click(Sender: TObject); + procedure CheckBox1Click(Sender: TObject); + procedure FormClose(Sender: TObject; var CloseAction: TCloseAction); + procedure FormCreate(Sender: TObject); + procedure FormResize(Sender: TObject); + procedure FormShow(Sender: TObject); + procedure TrayIcon1Click(Sender: TObject); + procedure TrayIcon1DblClick(Sender: TObject); + procedure TrayIcon1MouseDown(Sender: TObject; Button: TMouseButton; + Shift: TShiftState; X, Y: Integer); + private + { private declarations } + lb: tMouseButton; + public + { public declarations } + pc: tPopClient; + procedure neueNachrichten(sender: tObject); + end; + +var + Form1: TForm1; + +implementation + +uses myStringListUnit, lowLevelUnit, process; + +{$R *.lfm} + +{ TForm1 } + +procedure TForm1.FormCreate(Sender: TObject); +var + sl: tMyStringList; + s: string; +begin + 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.free; + end; + + pc:=tPopClient.create; + pc.timeout:=10; + pc.neueNachrichten:=@neueNachrichten; + pc.sshUser:='erich'; + pc.host:='eckner.net'; + pc.user:='notify@eckner.net'; + pc.pass:='C7sd7k8*'; + pc.port:=995; +end; + +procedure TForm1.FormClose(Sender: TObject; var CloseAction: TCloseAction); +begin + pc.threadAnhalten; + pc.aufThreadWarten; +end; + +procedure TForm1.CheckBox1Click(Sender: TObject); +var + sl: tMyStringList; +begin + sl:=tMyStringList.create; + + if checkBox1.checked then + sl.add('aufploppen = JA') + else + sl.add('aufploppen = NEIN'); + + if checkBox2.checked then + sl.add('Ton geben = JA') + else + sl.add('Ton geben = NEIN'); + + sl.saveToFile(extractfilepath(application.exename)+'optionen.konf'); + sl.free; +end; + +procedure TForm1.Button1Click(Sender: TObject); +begin + pc.loeschen; + form1.visible:=false; +end; + +procedure TForm1.FormResize(Sender: TObject); +begin + button1.top:=form1.clientHeight-button1.height; + checkBox1.top:=button1.top + (button1.height-checkBox1.height) div 2; + checkBox2.top:=button1.top + (button1.height-checkBox2.height) div 2; + button1.left:=(form1.clientWidth - button1.width - checkBox1.width - checkBox2.width) div 6; + checkBox1.left:=button1.left+button1.width + (form1.clientWidth - button1.width - checkBox1.width - checkBox2.width) div 3; + checkBox2.left:=checkBox1.left+checkBox1.width + (form1.clientWidth - button1.width - checkBox1.width - checkBox2.width) div 3; + memo1.width:=form1.clientWidth-memo1.left; + memo1.height:=button1.top-memo1.top; +end; + +const __erstesMal: boolean = true; + +procedure TForm1.FormShow(Sender: TObject); +begin + if __erstesMal then begin + __erstesMal:=false; + form1.visible:=false; + end; + if form1.visible then begin + form1.top:=screen.monitors[screen.monitorCount-1].top + (screen.monitors[screen.monitorCount-1].height-form1.height-24) div 2; + form1.left:=screen.monitors[screen.monitorCount-1].left + (screen.monitors[screen.monitorCount-1].width-form1.width) div 2; + end; +end; + +procedure TForm1.TrayIcon1Click(Sender: TObject); +begin + form1.visible:=not form1.visible; +end; + +procedure TForm1.TrayIcon1DblClick(Sender: TObject); +begin + if (lb=mbRight) or + ((lb=mbLeft) and + (messageDlg('Email-Tool beenden?',mtConfirmation,[mbYes,mbNo],0)=mrYes)) then + form1.close; +end; + +procedure TForm1.TrayIcon1MouseDown(Sender: TObject; Button: TMouseButton; + Shift: TShiftState; X, Y: Integer); +begin + lb:=button; +end; + +procedure tForm1.neueNachrichten(sender: tObject); +var + i,mitMarkeDa: longint; + argumente: array of string; + ausgabe: string; +begin + mitMarkeDa:=0; + memo1.lines.clear; + for i:=pc.nAnz-1 downto 0 do + case pc.marke(i) of + mvUngueltig: + pc.loesche(i); + mvGueltig: begin + inc(mitMarkeDa); + memo1.lines.add('! '+pc.zeit(i)+' '+pc.von(i)+': '+pc.betreff(i)); + end; + mvKeine: + memo1.lines.add(pc.zeit(i)+' '+pc.von(i)+': '+pc.betreff(i)); + end{of case}; + if pc.nAnz=0 then begin + trayIcon1.icon:=nichtsDaIcon.picture.icon; + trayIcon1.hint:='keine Post'; + end + else begin + trayIcon1.icon:=emailsDaIcon.picture.icon; + trayIcon1.hint:=inttostr(pc.nAnz)+' neue Nachrichten'; + if mitMarkeDa>0 then begin + trayIcon1.hint:=trayIcon1.hint+', davon '+inttostr(mitMarkeDa)+' mit Marke'; + if checkBox1.checked then + form1.visible:=true; + if checkBox2.checked then begin + setlength(argumente,1); + argumente[0]:=extractFilePath(application.exename)+'gotmail.wav'; + ausgabe:=''; + runCommand('play',argumente,ausgabe); + setlength(argumente,0); + end; + end; + end; + trayIcon1.visible:=true; + form1.icon:=trayIcon1.icon; + form1.caption:=trayIcon1.hint; +end; + +end. + |