Diff for /mozptch/datamodul.pas between versions 1.6 and 1.7

version 1.6, 2004/05/30 19:51:15 version 1.7, 2004/10/08 17:17:36
Line 9 Line 9
 # ========  # ========
 #  #
 # $Log$  # $Log$
# Revision 1.6  2004/05/30 19:51:15  oertel# Revision 1.7  2004/10/08 17:17:36  oertel
# -Linux support ready for delivery (beta)# win ver 9.30.1
# -New Variables for EmailAddress, ncoming and outgoing server# suporting profiles.ini for TB >= 0.8 and FF >= 0.9
# -INI-Files debuged#
# - new bin zip file# Revision 1.6  2004/05/30 19:51:15  oertel
 # -Linux support ready for delivery (beta)
 # -New Variables for EmailAddress, ncoming and outgoing server
 # -INI-Files debuged
 # - new bin zip file
 #  #
 # Revision 1.4  2004/04/16 16:52:52  oertel  # Revision 1.4  2004/04/16 16:52:52  oertel
 # src: terminated with multi language interface: (nearly)all messeges now in mozptch.msg  # src: terminated with multi language interface: (nearly)all messeges now in mozptch.msg
Line 125  var  Line 129  var 
   mozptchmsgfile : string;    mozptchmsgfile : string;
   widemozptchmsg: TWideStrings;    widemozptchmsg: TWideStrings;
   syslang, logfilename : string;    syslang, logfilename : string;
     mozregpath, mozregname : string;
   
 implementation  implementation
   
Line 527  begin  Line 532  begin 
     writelog(Format(getMsg('verify_user_success'),[sOutgoingServer,sUname]));      writelog(Format(getMsg('verify_user_success'),[sOutgoingServer,sUname]));
     DataModule1.sendmail.Disconnect;      DataModule1.sendmail.Disconnect;
    except     except
    writelog(Format(getMsg('verify_user_failed'),[sUname,sOutgoingServer]));     writelog(Format(getMsg('verify_user_failed'),[sUname,sOutgoingServer,mozptchiniFileName]));
    showMessage(Format(getMsg('verify_user_failed'),[sUname,sOutgoingServer]));     showMessage(Format(getMsg('verify_user_failed'),[sUname,sOutgoingServer,mozptchiniFileName]));
     checkInputData := false;      checkInputData := false;
     exit;      exit;
    end;     end;
Line 683  end;  Line 688  end; 
 procedure delRegAndCreateNew;  procedure delRegAndCreateNew;
 const  const
 {$IFDEF MSWINDOWS}  {$IFDEF MSWINDOWS}
  regdat='\registry.dat';  
  pluginregdat='\pluginreg.dat';   pluginregdat='\pluginreg.dat';
  xulmufl='\xul.mfl';   xulmufl='\xul.mfl';
 {$ENDIF}  {$ENDIF}
 {$IFDEF LINUX}  {$IFDEF LINUX}
  regdat='/appreg';  
  pluginregdat='/pluginreg.dat';   pluginregdat='/pluginreg.dat';
  xulmufl='/XUL.mfasl';   xulmufl='/XUL.mfasl';
 {$ENDIF}  {$ENDIF}
   var
    regdat : string;
    profini : text;
    Fehler : string;
   
 begin  begin
    {$IFDEF MSWINDOWS}
     regdat :='\'+mozregname;
    {$ENDIF}
    {$IFDEF LINUX}
     regdat :='/'+mozregname;
    {$ENDIF}
   
 // evtl. alte registry.dat löschen  // evtl. alte registry.dat löschen
  if FileExists(localMozAppdataDir+regdat) then   if FileExists(localMozAppdataDir+regdat) then
  begin   begin
Line 715  begin  Line 730  begin 
  begin   begin
   writelog(Format(getMsg('no_old_registry_will_create'),    writelog(Format(getMsg('no_old_registry_will_create'),
                           [localMozAppdataDir]));                            [localMozAppdataDir]));
  // Are there white spaces in the path ?   if mozregname = 'profiles.ini' then
  if pos(' ',mozprofparentdir+PS+mozmaildir) > 0 then  
   begin    begin
   writelog(getMsg('whitespace_in_path'));    // new mode
   if (mozprofparentdir=localMozAppdatadir) then    AssignFile(profini,localMozAppdataDir+regdat);
   begin    rewrite(profini);
    writelog(getMsg('start_mozilla_to_create_registry'));    writeln(profini,'[General]');
    writelog(getMsg('create_profile_in_win_app_dir'));    writeln(profini,'StartWithLastProfile=1');
    writelog(Format(getMsg('start_mozilla_with_1s'),[mozmailsubdir]));    writeln(profini,'');
    startmozilla('-CreateProfile '+mozmailsubdir);    writeln(profini,'[Profile0]');
    writelog(getMsg('creating_mozilla_registry_finished'));    writeln(profini,'Name=default');
   end    writeln(profini,'IsRelative=0');
   else    writeln(profini,'Path='+mozprofparentdir+PS+mozmaildir
                           +PS+mozmailsubdir+PS+mozmailsltdir);
    CloseFile(profini);
    // dateien reinkopieren z.B. user.js
    writelog('copy new default profile from '+mozprogdir+PS
              +'defaults'+PS+'profile'+'....');
    if not AllCopy(mozprogdir+PS+'defaults'+PS+'profile'+PS,
            mozprofparentdir+PS+mozmaildir+PS+mozmailsubdir+PS+mozmailsltdir,
      cpCreateEmptySubdirectories + cpRecursive,
      true,false,Fehler) then
    begin     begin
    writelog(getMsg('no_whitespace_in_path_allowed'));     writelog(Format(getMsg('error_copying_files_from'),[mozprogdir+PS+'defaults'+PS+'profile'+PS]));
    ShowMessage(getMsg('no_whitespace_in_path_allowed'));  
     exit;      exit;
    application.Terminate;    end;
   (*    writelog(Format(getMsg('copy_from_succeed'),[mozprogdir+PS+'defaults'+PS+'profile'+PS]));
    writelog('starte mozilla um registry anzulegen  ....');  
    writelog('starting mozilla with -CreateProfile "'+mozmailsubdir+' '+stmp+'"');  
    startmozilla('-CreateProfile "'+mozmailsubdir+' '+stmp+'"');  
    writelog('mozilla zum registry erzeugen beendet.');  
    changeProfiledir(stmp+'\'+mozmailsubdir+'\'+getMozSltDir(stmp+'\'+mozmailsubdir),  
           mozprofparentdir+'\'+mozmaildir+'\'+mozmailsubdir+'\'+MOZMAILSLTDIR);  
   *)  
   end  
   end    end
   else    else
   begin    begin
   writelog(getMsg('start_mozilla_to_create_registry'));    //old mode
   writelog(Format(getMsg('start_mozilla_with_3s'),    // Are there white spaces in the path ?
              [mozmailsubdir, mozprofparentdir, mozmaildir]));    if pos(' ',mozprofparentdir+PS+mozmaildir) > 0 then
   startmozilla('-CreateProfile "'+mozmailsubdir+' '+mozprofparentdir+PS+mozmaildir+'"');    begin
   writelog(getMsg('creating_mozilla_registry_finished'));     writelog(getMsg('whitespace_in_path'));
     if (mozprofparentdir=localMozAppdatadir) then
     begin
      writelog(getMsg('start_mozilla_to_create_registry'));
      writelog(getMsg('create_profile_in_win_app_dir'));
      writelog(Format(getMsg('start_mozilla_with_1s'),[mozmailsubdir]));
      startmozilla('-CreateProfile '+mozmailsubdir);
      writelog(getMsg('creating_mozilla_registry_finished'));
     end
     else
     begin
      writelog(getMsg('no_whitespace_in_path_allowed'));
      ShowMessage(getMsg('no_whitespace_in_path_allowed'));
      exit;
      application.Terminate;
     (*
      writelog('starte mozilla um registry anzulegen  ....');
      writelog('starting mozilla with -CreateProfile "'+mozmailsubdir+' '+stmp+'"');
      startmozilla('-CreateProfile "'+mozmailsubdir+' '+stmp+'"');
      writelog('mozilla zum registry erzeugen beendet.');
      changeProfiledir(stmp+'\'+mozmailsubdir+'\'+getMozSltDir(stmp+'\'+mozmailsubdir),
             mozprofparentdir+'\'+mozmaildir+'\'+mozmailsubdir+'\'+MOZMAILSLTDIR);
     *)
     end
    end
    else
    begin
     writelog(getMsg('start_mozilla_to_create_registry'));
     writelog(Format(getMsg('start_mozilla_with_3s'),
                [mozmailsubdir, mozprofparentdir, mozmaildir]));
     startmozilla('-CreateProfile "'+mozmailsubdir+' '+mozprofparentdir+PS+mozmaildir+'"');
     writelog(getMsg('creating_mozilla_registry_finished'));
    end;
   end;    end;
   
   if not FileExists(localMozAppdataDir+regdat) then    if not FileExists(localMozAppdataDir+regdat) then
   begin    begin
    writelog(getMsg('still_no_registry_found'));     writelog(getMsg('still_no_registry_found'));
Line 1075  begin  Line 1122  begin 
  if howtofind = 'error' then   if howtofind = 'error' then
  begin   begin
   writelog(Format(getMsg('no_rule_to_find_value_of'),[name, mozptchiniFileName]));    writelog(Format(getMsg('no_rule_to_find_value_of'),[name, mozptchiniFileName]));
  ShowMessage(Format(getMsg('no_rule_to_find_value_of'),[name, mozptchiniFileName]));   //ShowMessage(Format(getMsg('no_rule_to_find_value_of'),[name, mozptchiniFileName]));
   resultstr := 'mozptch_ini_variable_error';    resultstr := 'mozptch_ini_variable_error';
  getVariableValue := resolve_variables(resultstr,false);   //getVariableValue := resolve_variables(resultstr,false);
  writelog(Format(getMsg('got_value_for_varable_with'),   //writelog(Format(getMsg('got_value_for_varable_with'),
                                   [name, howtofind, resultstr]));   //                                 [name, howtofind, resultstr]));
  exit;   //exit;
 end   // ok, let's ask for the value
 else   howtofind:='ask';
 begin   writelog('trying to ask for the value...');
  end;
 
   if uppercase(howtofind) = 'DETECT' then    if uppercase(howtofind) = 'DETECT' then
   begin    begin
    resultstr := 'detect';     resultstr := 'detect';
Line 1102  begin  Line 1151  begin 
     writelog(Format(getMsg('got_value_for_varable_with'),      writelog(Format(getMsg('got_value_for_varable_with'),
                                 [name, howtofind, envname, resultstr]));                                  [name, howtofind, envname, resultstr]));
     exit;      exit;
      // ok, let's ask for the value
      howtofind:='ask';
      writelog('trying to ask for the value...');
    end;     end;
    resultstr := ValueOfEnvVar (resolve_variables(envname,false));     resultstr := ValueOfEnvVar (resolve_variables(envname,false));
    writelog(Format(getMsg('got_value_for_varable_with'),     writelog(Format(getMsg('got_value_for_varable_with'),
Line 1118  begin  Line 1170  begin 
     ShowMessage(Format(getMsg('value_for_varable_not_found_with'),      ShowMessage(Format(getMsg('value_for_varable_not_found_with'),
             [name, howtofind, resultstr, mozptchiniFileName]));              [name, howtofind, resultstr, mozptchiniFileName]));
     exit;      exit;
      // ok, let's ask for the value
      howtofind:='ask';
      writelog('trying to ask for the value...');
    end;     end;
    resultstr := resolve_variables(resultstr, false);     resultstr := resolve_variables(resultstr, false);
    writelog(Format(getMsg('got_value_for_varable_with'),     writelog(Format(getMsg('got_value_for_varable_with'),
Line 1148  begin  Line 1203  begin 
     writelog(Format(getMsg('got_value_for_varable_with'),      writelog(Format(getMsg('got_value_for_varable_with'),
                [name, howtofind, '', resultstr]));                 [name, howtofind, '', resultstr]));
     exit;      exit;
      // ok, let's ask for the value
      howtofind:='ask';
      writelog('trying to ask for the value...');
    end;     end;
    specialini := TMemIniFile.Create(resolve_variables(filename,false));     specialini := TMemIniFile.Create(resolve_variables(filename,false));
    resultstr := specialini.ReadString(resolve_variables(section,false),     resultstr := specialini.ReadString(resolve_variables(section,false),
Line 1171  begin  Line 1229  begin 
                            +', Section: '+resolve_variables(section,false)                             +', Section: '+resolve_variables(section,false)
                            +', Key: '+resolve_variables(key,false)                             +', Key: '+resolve_variables(key,false)
             , resultstr]));              , resultstr]));
      // ok, let's ask for the value
      howtofind:='ask';
      writelog('trying to ask for the value...');
    end;     end;
   end;    end;
   
Line 1189  begin  Line 1250  begin 
     writelog(Format(getMsg('got_value_for_varable_with'),      writelog(Format(getMsg('got_value_for_varable_with'),
                [name, howtofind, filename, resultstr]));                 [name, howtofind, filename, resultstr]));
     *)      *)
    exit;    //exit;
    // ok, let's ask for the value
    howtofind:='ask';
    writelog('trying to ask for the value...');
    end;     end;
    if FileExists(resolve_variables(filename,false)) then     if FileExists(resolve_variables(filename,false)) then
    begin     begin
Line 1204  begin  Line 1268  begin 
    begin     begin
     writelog(Format(getMsg('value_for_varable_not_found_with'),      writelog(Format(getMsg('value_for_varable_not_found_with'),
      [name, howtofind, resolve_variables(filename,false)+': Error: not found', resultstr]));       [name, howtofind, resolve_variables(filename,false)+': Error: not found', resultstr]));
    showmessage(Format(getMsg('value_for_varable_not_found_with'), //   showmessage(Format(getMsg('value_for_varable_not_found_with'),
     [name, howtofind, resolve_variables(filename,false)+': Error: not found', resultstr])); //    [name, howtofind, resolve_variables(filename,false)+': Error: not found', resultstr]));
     resultstr := 'mozptch_ini_variable_error';      resultstr := 'mozptch_ini_variable_error';
      // ok, let's ask for the value
      howtofind:='ask';
      writelog('trying to ask for the value...');
    end;     end;
   end;    end;
   
Line 1226  begin  Line 1293  begin 
     *)      *)
     exit;      exit;
    end;     end;
   resultstr := InputBox('Bitte Eingeben',question,'');   resultstr := InputBox(getMsg('please_insert'),question,'');
    writelog(Format(getMsg('got_value_for_varable_with'),     writelog(Format(getMsg('got_value_for_varable_with'),
           [name, howtofind, question, resultstr]));            [name, howtofind, question, resultstr]));
   end;    end;
   getVariableValue := resolve_variables(resultstr,false);    getVariableValue := resolve_variables(resultstr,false);
  end;  
 end;  end;
   
 (*####################################################################  (*####################################################################
Line 1405  begin  Line 1471  begin 
   
  // find old profile or create new....   // find old profile or create new....
 {$IFDEF MSWINDOWS}  {$IFDEF MSWINDOWS}
  localMozAppdataDir := getAppdataDir+PS+mozaplication_internal;   localMozAppdataDir := getAppdataDir+PS+mozregpath;
 {$ENDIF}  {$ENDIF}
 {$IFDEF LINUX}  {$IFDEF LINUX}
  localMozAppdataDir := getAppdataDir+PS+'.'+mozaplication_internal;   localMozAppdataDir := getAppdataDir+PS+'.'+mozregpath;
 {$ENDIF}  {$ENDIF}
  writelog('localMozAppdataDir is '+localMozAppdataDir);   writelog('localMozAppdataDir is '+localMozAppdataDir);
  completeMozDir := findOrCreateMozProf;   completeMozDir := findOrCreateMozProf;
Line 1857  begin  Line 1923  begin 
   sTmp := ValueOfEnvVar ('TEMP');    sTmp := ValueOfEnvVar ('TEMP');
   mozaplication := getVariableValue('%mozaplication%');    mozaplication := getVariableValue('%mozaplication%');
   mozaplication_internal := getVariableValue('%mozaplication_internal%');    mozaplication_internal := getVariableValue('%mozaplication_internal%');
     mozregname := getVariableValue('%mozregname%');
     mozregpath := getVariableValue('%mozregpath%');
   
   sHelpVar1 := getVariableValue('%HelpVar1%');    sHelpVar1 := getVariableValue('%HelpVar1%');
   sHelpVar2 := getVariableValue('%HelpVar2%');    sHelpVar2 := getVariableValue('%HelpVar2%');
   sUname := getVariableValue('%sUname%');    sUname := getVariableValue('%sUname%');
Line 1878  begin  Line 1947  begin 
   if sFullName = '' then    if sFullName = '' then
       sFullName := sUname;        sFullName := sUname;
   {$IFDEF MSWINDOWS}    {$IFDEF MSWINDOWS}
   localMozAppdataDir := getAppdataDir+PS+mozaplication_internal;    localMozAppdataDir := getAppdataDir+PS+mozregpath;
   {$ENDIF}    {$ENDIF}
   {$IFDEF LINUX}    {$IFDEF LINUX}
   localMozAppdataDir := getAppdataDir+'/.'+mozaplication_internal;    localMozAppdataDir := getAppdataDir+'/.'+mozregpath;
   {$ENDIF}    {$ENDIF}
   writelog('localMozAppdataDir is '+localMozAppdataDir);    writelog('localMozAppdataDir is '+localMozAppdataDir);
   sHelpVar9 := getVariableValue('%HelpVar9%');    sHelpVar9 := getVariableValue('%HelpVar9%');

Removed from v.1.6  
changed lines
  Added in v.1.7


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>