[tuxdroid-svn] r5320 - software_suite_v3/software/tool/tool-second-installer/trunk/tool-second-inst
Status: Beta
Brought to you by:
ks156
|
From: jerome <c2m...@c2...> - 2009-09-02 10:08:30
|
Author: jerome
Date: 2009-09-02 12:08:17 +0200 (Wed, 02 Sep 2009)
New Revision: 5320
Modified:
software_suite_v3/software/tool/tool-second-installer/trunk/tool-second-installer/Report.pas
software_suite_v3/software/tool/tool-second-installer/trunk/tool-second-installer/Unit1.dfm
Log:
* Checking internet connection before sending email.
Modified: software_suite_v3/software/tool/tool-second-installer/trunk/tool-second-installer/Report.pas
===================================================================
--- software_suite_v3/software/tool/tool-second-installer/trunk/tool-second-installer/Report.pas 2009-09-01 13:40:26 UTC (rev 5319)
+++ software_suite_v3/software/tool/tool-second-installer/trunk/tool-second-installer/Report.pas 2009-09-02 10:08:17 UTC (rev 5320)
@@ -27,7 +27,7 @@
ShellAPI, Windows, TuxUtils, Dialogs, zLib, SysUtils, Controls, Classes,
StdCtrls, ShlObj, Msinfo32Wrapper, KAZip, Forms, IdComponent, IdMessageCoder,
IdMessageCoderMIME, IdBaseComponent, IdMessage, IdSMTP, IdIOHandler,
- IdIOHandlerSocket, IdSSLOpenSSL;
+ IdIOHandlerSocket, IdSSLOpenSSL, WinInet, IdHttp;
{#### This object manage the Complete report creation ####}
type
@@ -61,6 +61,8 @@
private
Adress : string;
ReportFile : string;
+ function isInternetConnected() : boolean;
+
public
constructor Create; overload;
procedure setReport(AReportFile : string);
@@ -287,6 +289,30 @@
end;
+ //Check if internet connection was detected.
+ function TReportSender.isInternetConnected() : boolean;
+ var
+ idHTTP : TIdHTTP;
+ begin
+ idHTTP := TIdHTTP.Create(nil);
+ idHTTP.ConnectTimeout := 6400;
+ idHTTP.Request.CacheControl := 'no-cache';
+ idHTTP.Request.UserAgent:= 'Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)';
+ result := false;
+
+ try
+ idHTTP.Head('http://www.ftp.kysoh.com/');
+ result := true;
+ except
+ Result := false;
+ end;
+
+ idHttp.Disconnect;
+ idHttp.DisconnectSocket;
+ idHTTP.Free;
+ end;
+
+
//#### Send the report to tux...@ky... ####
procedure TReportSender.send(MsgType : Integer; IdSSLIOHandlerSocket1 : TIdSSLIOHandlerSocket);
var
@@ -330,7 +356,7 @@
Report.INFO :
begin
IdMessage1.Subject := 'Info log';
- body.Add('User is sending installation information on for his computer');
+ body.Add('User is sending installation information for his computer');
end;
end;
@@ -346,14 +372,18 @@
//Connectig and sending email.
try
try
- IdSMTP1.Connect;
- IdSMTP1.Authenticate;
- IdSMTP1.Send(IdMessage1);
+ if isInternetConnected() then
+ begin
+ IdSMTP1.Connect(60);
+ IdSMTP1.Authenticate;
+ IdSMTP1.Send(IdMessage1);
+ end
+ else
+ showmessage('internet is not connected');
except
on E : Exception do
begin
Application.Terminate;
- showmessage('error');
end;
end;
finally
Modified: software_suite_v3/software/tool/tool-second-installer/trunk/tool-second-installer/Unit1.dfm
===================================================================
--- software_suite_v3/software/tool/tool-second-installer/trunk/tool-second-installer/Unit1.dfm 2009-09-01 13:40:26 UTC (rev 5319)
+++ software_suite_v3/software/tool/tool-second-installer/trunk/tool-second-installer/Unit1.dfm 2009-09-02 10:08:17 UTC (rev 5320)
@@ -1,6 +1,6 @@
object Form1: TForm1
- Left = 490
- Top = 179
+ Left = 491
+ Top = 180
BorderIcons = [biSystemMenu, biMinimize]
BorderStyle = bsNone
Caption = 'TuxBox 2.0'
|