2004.01.16 (金) 02:40:38 <u*j*2*6*> 異常に長くなっていますが、設定の読み込みなどよりもメインフォームの表示/隠しを先にやるようにしたということです。
2004.01.16 (金) 02:41:47 <u*j*2*6*> あとは、設定ファイルをまとめてよんだり書いたりするときはTIniFile?じゃなくてTMemIniFile?をつかうようにしました
2004.01.16 (金) 02:44:21 <u*j*2*6*> 終了にかかる時間をしらべるために、DebugLog?のメッセージに時刻を入れました。せっかくなのでこのまま残します
2004.01.16 (金) 02:46:05 <u*j*2*6*> FreeKeywords?関数(25000回ぐらいループする。終了処理のボトルネック)にかかる時間をこっそりはかってdebug.logに書き込んでます。これも残します

shuusei241104:起動・終了・設定ダイアログの表示を高速化

diff --dos -urN 241103/SlavaNap.dpr 241104/SlavaNap.dpr
--- 241103/SlavaNap.dpr	Wed Dec 10 00:30:04 2003
+++ 241104/SlavaNap.dpr	Fri Jan 16 02:27:08 2004
@@ -108,6 +108,11 @@
   Application.CreateForm(TSlavaNapLanguage, SlavaNapLanguage);
   LogStartup('slavanap: Application.CreateForm(TSlavaNapWindow, SlavaNapWindow);');
   Application.CreateForm(TSlavaNapWindow, SlavaNapWindow);
+  LogStartup('slavanap: SetWindowLong(Application.Handle, GWL_EXSTYLE, GetWindowLong(Application.Handle, GWL_EXSTYLE) or WS_EX_TOOLWINDOW);');
+  SetWindowLong(Application.Handle, GWL_EXSTYLE, GetWindowLong(Application.Handle, GWL_EXSTYLE) or WS_EX_TOOLWINDOW);
+  LogStartup('slavanap: SlavaNapWindow.Show;');
+  SlavaNapWindow.Show;
+
   LogStartup('slavanap: Application.CreateForm(TSlavaNapSettings, SlavaNapSettings);');
   Application.CreateForm(TSlavaNapSettings, SlavaNapSettings);
   LogStartup('slavanap: Application.CreateForm(TSlavaNapQueryOption, SlavaNapQueryOption);');
@@ -122,10 +127,10 @@
   Application.CreateForm(TSlavaNapChatWindow, SlavaNapChatWindow);
   LogStartup('slavanap: Application.CreateForm(TSlavaNapAbout, SlavaNapAbout);');
   Application.CreateForm(TSlavaNapAbout, SlavaNapAbout);
-  LogStartup('slavanap: SetWindowLong(Application.Handle, GWL_EXSTYLE, GetWindowLong(Application.Handle, GWL_EXSTYLE) or WS_EX_TOOLWINDOW);');
-  SetWindowLong(Application.Handle, GWL_EXSTYLE, GetWindowLong(Application.Handle, GWL_EXSTYLE) or WS_EX_TOOLWINDOW);
-  LogStartup('slavanap: SlavaNapWindow.Show;');
-  SlavaNapWindow.Show;
+  // LogStartup('slavanap: SetWindowLong(Application.Handle, GWL_EXSTYLE, GetWindowLong(Application.Handle, GWL_EXSTYLE) or WS_EX_TOOLWINDOW);');
+  // SetWindowLong(Application.Handle, GWL_EXSTYLE, GetWindowLong(Application.Handle, GWL_EXSTYLE) or WS_EX_TOOLWINDOW);
+  // LogStartup('slavanap: SlavaNapWindow.Show;');
+  // SlavaNapWindow.Show;
   LogStartup('slavanap: if not ShowForm then SlavaNapWindow.Hide;');
   if not ShowForm then SlavaNapWindow.Hide;
   LogStartup('slavanap: Application.Run;');
diff --dos -urN 241103/constants.pas 241104/constants.pas
--- 241103/constants.pas	Fri Jan 02 13:15:22 2004
+++ 241104/constants.pas	Fri Jan 16 02:06:10 2004
@@ -27,8 +27,8 @@
  SLAVANAP_VERSION             = '2.4.1';
  SLAVANAP_BUILD               = '108';
  SLAVANAP_BUILD_DATE          = '24 January 2003';
- SLAVANAP_SHUUSEI             = '102';
- SLAVANAP_SHUUSEI_DATE        = '02 January 2004';
+ SLAVANAP_SHUUSEI             = '104';
+ SLAVANAP_SHUUSEI_DATE        = '16 January 2004';
  SLAVANAP_VERSION_SHORT       = SLAVANAP_TITLE+' '+SLAVANAP_VERSION;
  SLAVANAP_FULL                = SLAVANAP_TITLE+' '+SLAVANAP_VERSION+
                                 ' (build '+SLAVANAP_BUILD+
diff --dos -urN 241103/keywords.pas 241104/keywords.pas
--- 241103/keywords.pas	Thu Aug 07 09:54:32 2003
+++ 241104/keywords.pas	Fri Jan 16 02:27:10 2004
@@ -348,7 +348,9 @@
 procedure FreeKeywords;
 var
  i,j,k: Integer;
+ ATime: Integer;
 begin
+ ATime := GetTickCount;
  for i:=0 to SHARED_ARRAY-1 do
   for j:=0 to KEYWORDS_FIRST_COUNT-1 do
    for k:=KEYWORD_LEN_MIN to KEYWORD_LEN_MAX do
@@ -356,6 +358,7 @@
     KWList_FreeList(db_keywords[i,j,k]);
     db_keywords[i,j,k]:=nil;
    end;
+ DebugLog('Raptime of FreeKeywords=' + IntToStr(GetTickCount - ATime), True);
 end;
 
 procedure LoadDirs;
diff --dos -urN 241103/lang.pas 241104/lang.pas
--- 241103/lang.pas	Sat Oct 25 12:23:52 2003
+++ 241104/lang.pas	Fri Jan 16 01:02:40 2004
@@ -20,7 +20,7 @@
 interface
 
 uses
- SysUtils, Classes2, windows, inifiles, constants;
+ SysUtils, Classes2, windows, inifiles, constants, stypes;
 
 const
  LNG_UNKNOWN                 = '未定義';
@@ -1356,7 +1356,7 @@
  STR_CHHLP_S_ALLOWED        = '>server allowed '#9#9#9'- リモートのadmin+がリンクできるサーバーの一覧を表示';
 
 
-procedure LoadLanguage(name: String='');
+procedure LoadLanguage(name: String=''; LoadMode: ConfigLoadMode = lmAll);
 function  GetLangEx(str: String; arg1: String; arg2: String=''; arg3: string=''; arg4: string=''; arg5: String=''): String;
 // should be accessed from main thread
 function  GetLangT(id: Integer): String; overload;
@@ -1390,7 +1390,7 @@
 implementation
 
 uses
- stypes, vars;
+ vars;
 
 var
  // using 3 lists because compiling with Delphi 4. in d4 strings are not thread-safe
@@ -1578,7 +1578,7 @@
  Result:=str;
 end;
 
-procedure GetIni(ini: TIniFile; num: Integer; section, variable: String);
+procedure GetIni(ini: TMemIniFile; num: Integer; section, variable: String);
 var
  str: String;
 begin
@@ -1603,106 +1603,139 @@
  end;
 end;
 
-procedure LoadLanguage(name: String='');
+procedure LoadLanguage(name: String=''; LoadMode: ConfigLoadMode = lmAll);
 var
- ini: TIniFile;
+ ini: TMemIniFile;
 begin
  if name='' then name:='english';
- try // log and console messages
-  ini:=TIniFile.Create(ApplicationDir+name+'.lng');
-  GetIni(ini,LNG_LNGFILE_VERSION          ,'Version','BUILD');
-  GetIni(ini,LNG_LOG_STARTING             ,'Log','SERVER_INIT');
-  GetIni(ini,LNG_SERVER_LISTEN            ,'Log','SERVER_LISTEN');
-  GetIni(ini,LNG_SERVER_LISTENERR         ,'Log','SERVER_LISTENERR');
-  GetIni(ini,LNG_USERONLINE               ,'Log','USERONLINE');
-  GetIni(ini,LNG_USEROFFLINE              ,'Log','USEROFFLINE');
-  GetIni(ini,LNG_USEROFFLINE2             ,'Log','USEROFFLINE2');
-  GetIni(ini,LNG_USERREGISTER             ,'Log','USERREGISTER');
-  GetIni(ini,LNG_SERVER_LISTENSTATS       ,'Log','SERVER_LISTENSTATS');
-  GetIni(ini,LNG_DISCONNECT_INVCMD        ,'Log','DISCONNECT_INVCMD');
-  GetIni(ini,LNG_DISCONNECT_SOCKETERR     ,'Log','DISCONNECT_SOCKETERR');
-  GetIni(ini,LNG_DISCONNECT_SENDTIMEOUT   ,'Log','DISCONNECT_SENDTIMEOUT');
-  GetIni(ini,LNG_DISCONNECT_WINMX         ,'Log','DISCONNECT_WINMX');
-  GetIni(ini,LNG_KILLED                   ,'Log','KILLED');
-  GetIni(ini,LNG_NUKED                    ,'Log','NUKED');
-  GetIni(ini,LNG_SEARCHLOG3               ,'Log','SEARCHLOG3');
-  GetIni(ini,LNG_SEARCHLOG4               ,'Log','SEARCHLOG4');
-  GetIni(ini,LNG_BROWSELOG1               ,'Log','BROWSELOG1');
-  GetIni(ini,LNG_BROWSELOG2               ,'Log','BROWSELOG2');
-  GetIni(ini,LNG_TRANSFERLOG3             ,'Log','TRANSFERLOG3');
-  GetIni(ini,LNG_TRANSFERLOG4             ,'Log','TRANSFERLOG4');
-  GetIni(ini,LNG_TRANSFERLOG5             ,'Log','TRANSFERLOG5');
-  GetIni(ini,LNG_SAVINGDATA               ,'Log','SAVINGDATA');
-  GetIni(ini,LNG_SERVERGHOST              ,'Log','SERVERGHOST');
-  GetIni(ini,LNG_MINSHARE2                ,'Log','MINSHARE2');
-  GetIni(ini,LNG_MINSHARE4                ,'Log','MINSHARE4');
-  GetIni(ini,LNG_CONSOLEPONG              ,'Log','CONSOLEPONG');
-  GetIni(ini,LNG_INVALIDLNGFILE           ,'Log','INVALIDLNGFILE');
-  GetIni(ini,LNG_CHAT                     ,'Chat','CAPTION');
-  GetIni(ini,LNG_CMNU_CLOSE               ,'Chat','MNU_CLOSE');
-  GetIni(ini,LNG_CMNU_HOTLIST             ,'Chat','MNU_HOTLIST');
-  GetIni(ini,LNG_CMNU_FRIEND              ,'Chat','MNU_FRIEND');
-  GetIni(ini,LNG_CMNU_WHOIS               ,'Chat','MNU_WHOIS');
-  GetIni(ini,LNG_CMNU_IGNORE              ,'Chat','MNU_IGNORE');
-  GetIni(ini,LNG_TB_BTN_LOG               ,'Toolbar','BTN_LOG');
-  GetIni(ini,LNG_TB_BTN_USERS             ,'Toolbar','BTN_USERS');
-  GetIni(ini,LNG_TB_BTN_SERVERS           ,'Toolbar','BTN_SERVERS');
-  GetIni(ini,LNG_TB_BTN_CHANNELS          ,'Toolbar','BTN_CHANNELS');
-  GetIni(ini,LNG_TB_BTN_FRIENDS           ,'Toolbar','BTN_FRIENDS');
-  GetIni(ini,LNG_TB_BTN_BANS              ,'Toolbar','BTN_BANS');
-  GetIni(ini,LNG_TB_BTN_HOTLIST           ,'Toolbar','BTN_HOTLIST');
-  GetIni(ini,LNG_TB_BTN_IGNORE            ,'Toolbar','BTN_IGNORE');
-  GetIni(ini,LNG_TB_BTN_BLOCKS            ,'Toolbar','BTN_BLOCKS');
-  GetIni(ini,LNG_TB_BTN_CONSOLEONLINE     ,'Toolbar','BTN_CONSOLEONLINE');
-  GetIni(ini,LNG_TB_BTN_REGISTERED        ,'Toolbar','BTN_REGISTERED');
-  GetIni(ini,LNG_TB_BTN_LOG_HINT          ,'Toolbar','BTN_LOG_HINT');
-  GetIni(ini,LNG_TB_BTN_USERS_HINT        ,'Toolbar','BTN_USERS_HINT');
-  GetIni(ini,LNG_TB_BTN_REGISTERED_HINT   ,'Toolbar','BTN_REGISTERED_HINT');
-  GetIni(ini,LNG_TB_BTN_SERVERS_HINT      ,'Toolbar','BTN_SERVERS_HINT');
-  GetIni(ini,LNG_TB_BTN_CHANNELS_HINT     ,'Toolbar','BTN_CHANNELS_HINT');
-  GetIni(ini,LNG_TB_BTN_FRIENDS_HINT      ,'Toolbar','BTN_FRIENDS_HINT');
-  GetIni(ini,LNG_TB_BTN_BANS_HINT         ,'Toolbar','BTN_BANS_HINT');
-  GetIni(ini,LNG_TB_BTN_HOTLIST_HINT      ,'Toolbar','BTN_HOTLIST_HINT');
-  GetIni(ini,LNG_TB_BTN_IGNORE_HINT       ,'Toolbar','BTN_IGNORE_HINT');
-  GetIni(ini,LNG_TB_BTN_BLOCKS_HINT       ,'Toolbar','BTN_BLOCKS_HINT');
-  GetIni(ini,LNG_TB_BTN_CONSOLEONLINE_HINT,'Toolbar','BTN_CONSOLEONLINE_HINT');
-  GetIni(ini,LNG_TB_TOOLBAR_TOTAL         ,'Toolbar','TOOLBAR_TOTAL');
-  GetIni(ini,LNG_MENU_SERVER              ,'Menu','MENU_SERVER');
-  GetIni(ini,LNG_MENU_SETTINGS            ,'Menu','MENU_SETTINGS');
-  GetIni(ini,LNG_MENU_LANGUAGES           ,'Menu','MENU_LANGUAGES');
-  GetIni(ini,LNG_MENU_SAVE                ,'Menu','MENU_SAVE');
-  GetIni(ini,LNG_MENU_RESTART             ,'Menu','MENU_RESTART');
-  GetIni(ini,LNG_MENU_EXIT                ,'Menu','MENU_EXIT');
-  GetIni(ini,LNG_MENU_LOG                 ,'Menu','MENU_LOG');
-  GetIni(ini,LNG_MENU_CLEAR               ,'Menu','MENU_CLEAR');
-  GetIni(ini,LNG_MENU_COPY                ,'Menu','MENU_COPY');
-  GetIni(ini,LNG_MENU_LOGIN               ,'Menu','MENU_LOGIN');
-  GetIni(ini,LNG_MENU_NAPIGATOR           ,'Menu','MENU_NAPIGATOR');
-  GetIni(ini,LNG_MENU_DAGSTA              ,'Menu','MENU_DAGSTA');
-  GetIni(ini,LNG_MENU_SEARCH              ,'Menu','MENU_SEARCH');
-  GetIni(ini,LNG_MENU_BROWSE              ,'Menu','MENU_BROWSE');
-  GetIni(ini,LNG_MENU_TRANSFER            ,'Menu','MENU_TRANSFER');
-  GetIni(ini,LNG_MENU_RESET               ,'Menu','MENU_RESET');
-  GetIni(ini,LNG_MENU_WINDOW              ,'Menu','MENU_WINDOW');
-  GetIni(ini,LNG_MENU_BLOCK               ,'Menu','MENU_BLOCK');
-  GetIni(ini,LNG_MENU_REGISTERED          ,'Menu','MENU_REGISTERED');
-  GetIni(ini,LNG_MENU_LOGWIN              ,'Menu','MENU_LOGWIN');
-  GetIni(ini,LNG_MENU_USERS               ,'Menu','MENU_USERS');
-  GetIni(ini,LNG_MENU_SERVERS             ,'Menu','MENU_SERVERS');
-  GetIni(ini,LNG_MENU_CHANNELS            ,'Menu','MENU_CHANNELS');
-  GetIni(ini,LNG_MENU_FRIENDS             ,'Menu','MENU_FRIENDS');
-  GetIni(ini,LNG_MENU_BANS                ,'Menu','MENU_BANS');
-  GetIni(ini,LNG_MENU_HOTLIST             ,'Menu','MENU_HOTLIST');
-  GetIni(ini,LNG_MENU_IGNORE              ,'Menu','MENU_IGNORE');
-  GetIni(ini,LNG_MENU_HELP                ,'Menu','MENU_HELP');
-  GetIni(ini,LNG_MENU_FAQ                 ,'Menu','MENU_FAQ');
-  GetIni(ini,LNG_MENU_MANUAL              ,'Menu','MENU_MANUAL');
-  GetIni(ini,LNG_MENU_FORUMS              ,'Menu','MENU_FORUMS');
-  GetIni(ini,LNG_MENU_UPDATE              ,'Menu','MENU_UPDATE');
-  GetIni(ini,LNG_MENU_ABOUT               ,'Menu','MENU_ABOUT');
-  GetIni(ini,LNG_MENU_SHOW                ,'Menu','MENU_SHOW');
-  GetIni(ini,LNG_MENU_HIDE                ,'Menu','MENU_HIDE');
-  GetIni(ini,LNG_MENU_WEB                 ,'Menu','MENU_WEB');
+ try // log and console messacges
+  ini:=TMemIniFile.Create(ApplicationDir+name+'.lng');
+  if LoadMode <> lmRest then
+  begin
+    GetIni(ini,LNG_LNGFILE_VERSION          ,'Version','BUILD');
+    GetIni(ini,LNG_LOG_STARTING             ,'Log','SERVER_INIT');
+    GetIni(ini,LNG_SERVER_LISTEN            ,'Log','SERVER_LISTEN');
+    GetIni(ini,LNG_SERVER_LISTENERR         ,'Log','SERVER_LISTENERR');
+    GetIni(ini,LNG_USERONLINE               ,'Log','USERONLINE');
+    GetIni(ini,LNG_USEROFFLINE              ,'Log','USEROFFLINE');
+    GetIni(ini,LNG_USEROFFLINE2             ,'Log','USEROFFLINE2');
+    GetIni(ini,LNG_USERREGISTER             ,'Log','USERREGISTER');
+    GetIni(ini,LNG_SERVER_LISTENSTATS       ,'Log','SERVER_LISTENSTATS');
+    GetIni(ini,LNG_DISCONNECT_INVCMD        ,'Log','DISCONNECT_INVCMD');
+    GetIni(ini,LNG_DISCONNECT_SOCKETERR     ,'Log','DISCONNECT_SOCKETERR');
+    GetIni(ini,LNG_DISCONNECT_SENDTIMEOUT   ,'Log','DISCONNECT_SENDTIMEOUT');
+    GetIni(ini,LNG_DISCONNECT_WINMX         ,'Log','DISCONNECT_WINMX');
+    GetIni(ini,LNG_KILLED                   ,'Log','KILLED');
+    GetIni(ini,LNG_NUKED                    ,'Log','NUKED');
+    GetIni(ini,LNG_SEARCHLOG3               ,'Log','SEARCHLOG3');
+    GetIni(ini,LNG_SEARCHLOG4               ,'Log','SEARCHLOG4');
+    GetIni(ini,LNG_BROWSELOG1               ,'Log','BROWSELOG1');
+    GetIni(ini,LNG_BROWSELOG2               ,'Log','BROWSELOG2');
+    GetIni(ini,LNG_TRANSFERLOG3             ,'Log','TRANSFERLOG3');
+    GetIni(ini,LNG_TRANSFERLOG4             ,'Log','TRANSFERLOG4');
+    GetIni(ini,LNG_TRANSFERLOG5             ,'Log','TRANSFERLOG5');
+    GetIni(ini,LNG_SAVINGDATA               ,'Log','SAVINGDATA');
+    GetIni(ini,LNG_SERVERGHOST              ,'Log','SERVERGHOST');
+    GetIni(ini,LNG_MINSHARE2                ,'Log','MINSHARE2');
+    GetIni(ini,LNG_MINSHARE4                ,'Log','MINSHARE4');
+    GetIni(ini,LNG_CONSOLEPONG              ,'Log','CONSOLEPONG');
+    GetIni(ini,LNG_INVALIDLNGFILE           ,'Log','INVALIDLNGFILE');
+    GetIni(ini,LNG_CHAT                     ,'Chat','CAPTION');
+    GetIni(ini,LNG_CMNU_CLOSE               ,'Chat','MNU_CLOSE');
+    GetIni(ini,LNG_CMNU_HOTLIST             ,'Chat','MNU_HOTLIST');
+    GetIni(ini,LNG_CMNU_FRIEND              ,'Chat','MNU_FRIEND');
+    GetIni(ini,LNG_CMNU_WHOIS               ,'Chat','MNU_WHOIS');
+    GetIni(ini,LNG_CMNU_IGNORE              ,'Chat','MNU_IGNORE');
+    GetIni(ini,LNG_TB_BTN_LOG               ,'Toolbar','BTN_LOG');
+    GetIni(ini,LNG_TB_BTN_USERS             ,'Toolbar','BTN_USERS');
+    GetIni(ini,LNG_TB_BTN_SERVERS           ,'Toolbar','BTN_SERVERS');
+    GetIni(ini,LNG_TB_BTN_CHANNELS          ,'Toolbar','BTN_CHANNELS');
+    GetIni(ini,LNG_TB_BTN_FRIENDS           ,'Toolbar','BTN_FRIENDS');
+    GetIni(ini,LNG_TB_BTN_BANS              ,'Toolbar','BTN_BANS');
+    GetIni(ini,LNG_TB_BTN_HOTLIST           ,'Toolbar','BTN_HOTLIST');
+    GetIni(ini,LNG_TB_BTN_IGNORE            ,'Toolbar','BTN_IGNORE');
+    GetIni(ini,LNG_TB_BTN_BLOCKS            ,'Toolbar','BTN_BLOCKS');
+    GetIni(ini,LNG_TB_BTN_CONSOLEONLINE     ,'Toolbar','BTN_CONSOLEONLINE');
+    GetIni(ini,LNG_TB_BTN_REGISTERED        ,'Toolbar','BTN_REGISTERED');
+    GetIni(ini,LNG_TB_BTN_LOG_HINT          ,'Toolbar','BTN_LOG_HINT');
+    GetIni(ini,LNG_TB_BTN_USERS_HINT        ,'Toolbar','BTN_USERS_HINT');
+    GetIni(ini,LNG_TB_BTN_REGISTERED_HINT   ,'Toolbar','BTN_REGISTERED_HINT');
+    GetIni(ini,LNG_TB_BTN_SERVERS_HINT      ,'Toolbar','BTN_SERVERS_HINT');
+    GetIni(ini,LNG_TB_BTN_CHANNELS_HINT     ,'Toolbar','BTN_CHANNELS_HINT');
+    GetIni(ini,LNG_TB_BTN_FRIENDS_HINT      ,'Toolbar','BTN_FRIENDS_HINT');
+    GetIni(ini,LNG_TB_BTN_BANS_HINT         ,'Toolbar','BTN_BANS_HINT');
+    GetIni(ini,LNG_TB_BTN_HOTLIST_HINT      ,'Toolbar','BTN_HOTLIST_HINT');
+    GetIni(ini,LNG_TB_BTN_IGNORE_HINT       ,'Toolbar','BTN_IGNORE_HINT');
+    GetIni(ini,LNG_TB_BTN_BLOCKS_HINT       ,'Toolbar','BTN_BLOCKS_HINT');
+    GetIni(ini,LNG_TB_BTN_CONSOLEONLINE_HINT,'Toolbar','BTN_CONSOLEONLINE_HINT');
+    GetIni(ini,LNG_TB_TOOLBAR_TOTAL         ,'Toolbar','TOOLBAR_TOTAL');
+    GetIni(ini,LNG_MENU_SERVER              ,'Menu','MENU_SERVER');
+    GetIni(ini,LNG_MENU_SETTINGS            ,'Menu','MENU_SETTINGS');
+    GetIni(ini,LNG_MENU_LANGUAGES           ,'Menu','MENU_LANGUAGES');
+    GetIni(ini,LNG_MENU_SAVE                ,'Menu','MENU_SAVE');
+    GetIni(ini,LNG_MENU_RESTART             ,'Menu','MENU_RESTART');
+    GetIni(ini,LNG_MENU_EXIT                ,'Menu','MENU_EXIT');
+    GetIni(ini,LNG_MENU_LOG                 ,'Menu','MENU_LOG');
+    GetIni(ini,LNG_MENU_CLEAR               ,'Menu','MENU_CLEAR');
+    GetIni(ini,LNG_MENU_COPY                ,'Menu','MENU_COPY');
+    GetIni(ini,LNG_MENU_LOGIN               ,'Menu','MENU_LOGIN');
+    GetIni(ini,LNG_MENU_NAPIGATOR           ,'Menu','MENU_NAPIGATOR');
+    GetIni(ini,LNG_MENU_DAGSTA              ,'Menu','MENU_DAGSTA');
+    GetIni(ini,LNG_MENU_SEARCH              ,'Menu','MENU_SEARCH');
+    GetIni(ini,LNG_MENU_BROWSE              ,'Menu','MENU_BROWSE');
+    GetIni(ini,LNG_MENU_TRANSFER            ,'Menu','MENU_TRANSFER');
+    GetIni(ini,LNG_MENU_RESET               ,'Menu','MENU_RESET');
+    GetIni(ini,LNG_MENU_WINDOW              ,'Menu','MENU_WINDOW');
+    GetIni(ini,LNG_MENU_BLOCK               ,'Menu','MENU_BLOCK');
+    GetIni(ini,LNG_MENU_REGISTERED          ,'Menu','MENU_REGISTERED');
+    GetIni(ini,LNG_MENU_LOGWIN              ,'Menu','MENU_LOGWIN');
+    GetIni(ini,LNG_MENU_USERS               ,'Menu','MENU_USERS');
+    GetIni(ini,LNG_MENU_SERVERS             ,'Menu','MENU_SERVERS');
+    GetIni(ini,LNG_MENU_CHANNELS            ,'Menu','MENU_CHANNELS');
+    GetIni(ini,LNG_MENU_FRIENDS             ,'Menu','MENU_FRIENDS');
+    GetIni(ini,LNG_MENU_BANS                ,'Menu','MENU_BANS');
+    GetIni(ini,LNG_MENU_HOTLIST             ,'Menu','MENU_HOTLIST');
+    GetIni(ini,LNG_MENU_IGNORE              ,'Menu','MENU_IGNORE');
+    GetIni(ini,LNG_MENU_HELP                ,'Menu','MENU_HELP');
+    GetIni(ini,LNG_MENU_FAQ                 ,'Menu','MENU_FAQ');
+    GetIni(ini,LNG_MENU_MANUAL              ,'Menu','MENU_MANUAL');
+    GetIni(ini,LNG_MENU_FORUMS              ,'Menu','MENU_FORUMS');
+    GetIni(ini,LNG_MENU_UPDATE              ,'Menu','MENU_UPDATE');
+    GetIni(ini,LNG_MENU_ABOUT               ,'Menu','MENU_ABOUT');
+    GetIni(ini,LNG_MENU_SHOW                ,'Menu','MENU_SHOW');
+    GetIni(ini,LNG_MENU_HIDE                ,'Menu','MENU_HIDE');
+    GetIni(ini,LNG_MENU_WEB                 ,'Menu','MENU_WEB');
+    GetIni(ini,LNG_LOG_LABEL                ,'LogWin','LABEL');
+    GetIni(ini,LNG_LOG_CLEAR                ,'LogWin','CLEAR');
+    GetIni(ini,LNG_LOG_MODE                 ,'LogWin','MODE');
+    GetIni(ini,LNG_LOG_PAUSE                ,'LogWin','PAUSE');
+    GetIni(ini,LNG_LOG_RESUME               ,'LogWin','RESUME');
+    GetIni(ini,LNG_LOG_CB_AWAY              ,'LogWin','CB_AWAY');
+    GetIni(ini,LNG_LOG_LBL_AWAY             ,'LogWin','LBL_AWAY');
+    GetIni(ini,LNG_LOG_CB_AWAYPOPUP         ,'LogWin','CB_AWAYPOPUP');
+    GetIni(ini,LNG_LOG_CB_SOUND             ,'LogWin','CB_SOUND');
+    GetIni(ini,LNG_ST_BYTES                 ,'Status','ST_BYTES');
+    GetIni(ini,LNG_ST_TIME                  ,'Status','ST_TIME');
+    GetIni(ini,LNG_ST_LOCAL                 ,'Status','ST_LOCAL');
+    GetIni(ini,LNG_ST_LOCALMAX              ,'Status','ST_LOCALMAX');
+    GetIni(ini,LNG_ST_TOTAL                 ,'Status','ST_TOTAL');
+    GetIni(ini,LNG_ST_TOTALMAX              ,'Status','ST_TOTALMAX');
+    GetIni(ini,LNG_ST_LASTTRANSFER          ,'Status','ST_LASTTRANSFER');
+    Getini(ini,LNG_ST_LASTDATA              ,'Status','ST_LASTDATA');
+    GetIni(ini,LNG_ST_TOTALTRANSFER         ,'Status','ST_TOTALTRANSFER');
+    GetIni(ini,LNG_ST_TOTALDATA             ,'Status','ST_TOTALDATA');
+    GetIni(ini,LNG_ST_NOLINK                ,'Status','ST_NOLINK');
+    GetIni(ini,LNG_ST_LINK                  ,'Status','ST_LINK');
+    GetIni(ini,LNG_ST_BPS                   ,'Status','ST_BPS');
+    GetIni(ini,LNG_ST_BANDWIDTHLIMIT        ,'Status','ST_BANDWIDTHLIMIT');
+    if LoadMode = lmInitial then
+    begin
+      // 起動にかかる時間を短縮するため、ここでおわる
+      ini.Free;
+      Exit;
+    end;
+  end;
+
   GetIni(ini,LNG_USERS_LABEL              ,'Users','LABEL');
   GetIni(ini,LNG_LIST_MUZZLED             ,'Users','LIST_MUZZLED');
   GetIni(ini,LNG_LIST_CONSOLE             ,'Users','LIST_CONSOLE');
@@ -1774,15 +1807,6 @@
   GetIni(ini,LNG_LIST_LBL_AUTOREFRESH     ,'Users','LIST_LBL_AUTOREFRESH');
   GetIni(ini,LNG_OK                       ,'Interface','OK');
   GetIni(ini,LNG_CANCEL                   ,'Interface','CANCEL');
-  GetIni(ini,LNG_LOG_LABEL                ,'LogWin','LABEL');
-  GetIni(ini,LNG_LOG_CLEAR                ,'LogWin','CLEAR');
-  GetIni(ini,LNG_LOG_MODE                 ,'LogWin','MODE');
-  GetIni(ini,LNG_LOG_PAUSE                ,'LogWin','PAUSE');
-  GetIni(ini,LNG_LOG_RESUME               ,'LogWin','RESUME');
-  GetIni(ini,LNG_LOG_CB_AWAY              ,'LogWin','CB_AWAY');
-  GetIni(ini,LNG_LOG_LBL_AWAY             ,'LogWin','LBL_AWAY');
-  GetIni(ini,LNG_LOG_CB_AWAYPOPUP         ,'LogWin','CB_AWAYPOPUP');
-  GetIni(ini,LNG_LOG_CB_SOUND             ,'LogWin','CB_SOUND');
   GetIni(ini,LNG_MODE_ERROR               ,'UserMode','ERROR');
   GetIni(ini,LNG_MODE_ANNOUNCE            ,'UserMode','ANNOUNCE');
   GetIni(ini,LNG_MODE_MBAN                ,'UserMode','MBAN');
@@ -1813,20 +1837,6 @@
   GetIni(ini,LNG_MODE_NONE                ,'UserMode','NONE');
   GetIni(ini,LNG_MODE_CANCEL              ,'UserMode','CANCEL');
   GetIni(ini,LNG_MODE_CAPTION             ,'UserMode','CAPTION');
-  GetIni(ini,LNG_ST_BYTES                 ,'Status','ST_BYTES');
-  GetIni(ini,LNG_ST_TIME                  ,'Status','ST_TIME');
-  GetIni(ini,LNG_ST_LOCAL                 ,'Status','ST_LOCAL');
-  GetIni(ini,LNG_ST_LOCALMAX              ,'Status','ST_LOCALMAX');
-  GetIni(ini,LNG_ST_TOTAL                 ,'Status','ST_TOTAL');
-  GetIni(ini,LNG_ST_TOTALMAX              ,'Status','ST_TOTALMAX');
-  GetIni(ini,LNG_ST_LASTTRANSFER          ,'Status','ST_LASTTRANSFER');
-  Getini(ini,LNG_ST_LASTDATA              ,'Status','ST_LASTDATA');
-  GetIni(ini,LNG_ST_TOTALTRANSFER         ,'Status','ST_TOTALTRANSFER');
-  GetIni(ini,LNG_ST_TOTALDATA             ,'Status','ST_TOTALDATA');
-  GetIni(ini,LNG_ST_NOLINK                ,'Status','ST_NOLINK');
-  GetIni(ini,LNG_ST_LINK                  ,'Status','ST_LINK');
-  GetIni(ini,LNG_ST_BPS                   ,'Status','ST_BPS');
-  GetIni(ini,LNG_ST_BANDWIDTHLIMIT        ,'Status','ST_BANDWIDTHLIMIT');
   GetIni(ini,LNG_REG_TRANSFERS            ,'Registered','TRANSFERS');
   GetIni(ini,LNG_REG_MUZZLED              ,'Registered','MUZZLED');
   GetIni(ini,LNG_REG_USER                 ,'Registered','REG_USER');
@@ -2601,7 +2611,7 @@
   except
  end;
  try // client messages
-  ini:=TIniFile.Create(ApplicationDir+'slavanap.msg');
+  ini:=TMemIniFile.Create(ApplicationDir+'slavanap.msg');
   GetIni(ini,LNG_MSGFILE_VERSION          ,'Version','BUILD');
   SetConstant(LNG_INVALIDCOMMAND          ,'不正なコマンドです [$1]');
   SetConstant(LNG_INVALIDARGS             ,'引数の数がおかしいです');
diff --dos -urN 241103/languages.dfm 241104/languages.dfm
--- 241103/languages.dfm	Mon Jan 27 19:12:04 2003
+++ 241104/languages.dfm	Fri Jan 16 02:13:12 2004
@@ -3,8 +3,8 @@
   Top = 110
   BorderStyle = bsToolWindow
   Caption = '言語の選択:'
-  ClientHeight = 352
-  ClientWidth = 530
+  ClientHeight = 325
+  ClientWidth = 489
   Color = clBtnFace
   Font.Charset = SHIFTJIS_CHARSET
   Font.Color = clWindowText
@@ -15,46 +15,47 @@
   Position = poDesktopCenter
   OnShow = FormShow
   PixelsPerInch = 96
-  TextHeight = 13
+  TextHeight = 12
   object Label1: TLabel
-    Left = 8
-    Top = 16
-    Width = 128
-    Height = 13
+    Left = 7
+    Top = 15
+    Width = 95
+    Height = 12
     Caption = '使える言語の一覧:'
   end
   object Label2: TLabel
-    Left = 8
-    Top = 320
-    Width = 364
-    Height = 13
+    Left = 7
+    Top = 295
+    Width = 293
+    Height = 12
     Caption = '他の言語で使いたい人は"english.lng"を翻訳してください。'
   end
   object ksoOfficePanel1: TPanel
-    Left = 8
-    Top = 40
-    Width = 513
-    Height = 273
+    Left = 7
+    Top = 37
+    Width = 474
+    Height = 252
     Caption = 'ksoOfficePanel1'
     TabOrder = 0
     object list: TListView
       Left = 1
       Top = 1
-      Width = 511
-      Height = 271
+      Width = 472
+      Height = 250
       Align = alClient
       BorderStyle = bsNone
       Columns = <
         item
           Caption = '言語'
-          Width = 139
+          Width = 128
         end
         item
           Caption = 'ファイル名'
-          Width = 100
+          Width = 92
         end
         item
           Caption = 'バージョン'
+          Width = 46
         end
         item
           AutoSize = True
@@ -62,7 +63,6 @@
         end>
       FlatScrollBars = True
       HideSelection = False
-      HotTrackStyles = []
       ReadOnly = True
       RowSelect = True
       TabOrder = 0
@@ -71,20 +71,20 @@
     end
   end
   object btn_ok: TButton
-    Left = 456
-    Top = 320
-    Width = 67
-    Height = 25
+    Left = 421
+    Top = 295
+    Width = 62
+    Height = 23
     Caption = 'OK'
     Default = True
     TabOrder = 1
     OnClick = btn_okClick
   end
   object btn_cancel: TButton
-    Left = 384
-    Top = 320
-    Width = 67
-    Height = 25
+    Left = 354
+    Top = 295
+    Width = 62
+    Height = 23
     Cancel = True
     Caption = 'キャンセル'
     TabOrder = 2
diff --dos -urN 241103/languages.pas 241104/languages.pas
--- 241103/languages.pas	Tue Aug 05 07:29:08 2003
+++ 241104/languages.pas	Fri Jan 16 00:38:48 2004
@@ -49,7 +49,7 @@
 
 implementation
 
-uses mainform, vars, stypes, lang;
+uses mainform, vars, stypes, lang, settings;
 
 {$R *.DFM}
 
@@ -159,6 +159,7 @@
  begin
   LoadLanguage(language);
   SlavaNapWindow.ChangeInterface;
+  SlavaNapSettings.ChangeInterface;
  end;
 end;
 
diff --dos -urN 241103/mainform.dfm 241104/mainform.dfm
--- 241103/mainform.dfm	Wed Oct 22 07:09:28 2003
+++ 241104/mainform.dfm	Fri Jan 16 02:21:58 2004
@@ -705,7 +705,7 @@
           object dock_log: TksoOfficeDock
             Left = 0
             Top = 0
-            Width = 688
+            Width = 680
             Height = 74
             Align = alTop
             object bar_log: TksoOfficeToolBar
@@ -799,8 +799,8 @@
           object panel_log: TSlavaPanel
             Left = 0
             Top = 74
-            Width = 688
-            Height = 174
+            Width = 680
+            Height = 166
             BorderColor1 = clWhite
             BorderColor2 = clGray
             Align = alClient
@@ -812,8 +812,8 @@
             object log_main: TRichEdit
               Left = 1
               Top = 1
-              Width = 686
-              Height = 172
+              Width = 678
+              Height = 164
               Align = alClient
               BorderStyle = bsNone
               ReadOnly = True
@@ -1079,129 +1079,123 @@
                   AutoSize = True
                   Caption = 'User'
                   WidthType = (
-                    -68)
+                    -117)
                 end
                 item
                   Alignment = taCenter
                   Caption = 'Level'
-                  Width = 74
+                  Width = 70
                 end
                 item
                   Alignment = taRightJustify
                   Caption = 'Shared'
-                  Width = 55
+                  Width = 70
                 end
                 item
                   Alignment = taRightJustify
                   Caption = 'Size'
-                  Width = 46
+                  Width = 80
                 end
                 item
                   Alignment = taRightJustify
                   Caption = 'Average'
-                  Width = 46
+                  Width = 70
                 end
                 item
                   AutoSize = True
                   Caption = 'Software'
                   WidthType = (
-                    -67)
+                    -117)
                 end
                 item
                   Alignment = taCenter
                   Caption = 'Speed'
-                  Width = 69
+                  Width = 70
                 end
                 item
                   Alignment = taCenter
                   Caption = 'IP'
-                  Width = 74
+                  Width = 100
                 end
                 item
                   Alignment = taRightJustify
                   Caption = 'RemoteHost'
-                  Width = 250
+                  Width = 150
                 end
                 item
                   Alignment = taCenter
                   Caption = 'Port'
-                  Width = 37
                 end
                 item
                   Alignment = taRightJustify
                   Caption = 'Time'
-                  Width = 55
+                  Width = 80
                 end
                 item
                   Alignment = taRightJustify
                   Caption = 'Up'
-                  Width = 46
+                  Width = 80
                 end
                 item
                   Alignment = taRightJustify
                   Caption = 'Down'
-                  Width = 46
+                  Width = 80
                 end
                 item
                   Alignment = taCenter
                   AutoSize = True
                   Caption = 'Up/Down'
                   WidthType = (
-                    -67)
+                    -117)
                 end
                 item
                   Alignment = taRightJustify
                   Caption = 'TotalUp'
-                  Width = 46
+                  Width = 80
                 end
                 item
                   Alignment = taRightJustify
                   Caption = 'TotalDown'
-                  Width = 46
+                  Width = 80
                 end
                 item
                   Alignment = taCenter
                   AutoSize = True
                   Caption = 'Total Up/Down'
                   WidthType = (
-                    -67)
+                    -117)
                 end
                 item
                   AutoSize = True
                   Caption = 'Server'
                   WidthType = (
-                    -67)
+                    -117)
                 end
                 item
                   Alignment = taRightJustify
                   Caption = 'ULReqs'
-                  Width = 30
+                  Width = 80
                 end
                 item
                   Alignment = taRightJustify
                   Caption = 'DLReqs'
-                  Width = 30
+                  Width = 80
                 end
                 item
                   Alignment = taRightJustify
                   Caption = 'SearchReqs'
-                  Width = 40
+                  Width = 80
                 end
                 item
                   Alignment = taRightJustify
                   Caption = 'BlockFiles'
-                  Width = 40
-                end
-                item
-                  Alignment = taCenter
-                  Caption = 'ブロック'
-                  Width = 51
+                  Width = 80
                 end
                 item
                   AutoSize = True
                   Caption = 'Comments'
                   WidthType = (
-                    -67)
+                    -117)
                 end>
               FlatScrollBars = True
               HideSelection = False
@@ -1228,13 +1222,13 @@
           object ksoOfficeDock2: TksoOfficeDock
             Left = 0
             Top = 0
-            Width = 688
+            Width = 680
             Height = 93
             Align = alTop
             object ksoOfficeToolBar2: TksoOfficeToolBar
               Left = 0
               Top = 0
-              Width = 688
+              Width = 680
               Height = 74
               Rolled = False
               object lbl_registered: TLabel
@@ -1431,8 +1425,8 @@
             object list_registered: TListView
               Left = 1
               Top = 1
-              Width = 686
-              Height = 153
+              Width = 678
+              Height = 145
               Align = alClient
               BorderStyle = bsNone
               Columns = <
@@ -1667,7 +1661,7 @@
           object ksoOfficeDock3: TksoOfficeDock
             Left = 0
             Top = 0
-            Width = 688
+            Width = 680
             Height = 55
             Align = alTop
             object ksoOfficeToolBar3: TksoOfficeToolBar
@@ -1786,8 +1780,8 @@
           object SlavaPanel3: TSlavaPanel
             Left = 0
             Top = 55
-            Width = 688
-            Height = 193
+            Width = 680
+            Height = 185
             BorderColor1 = clWhite
             BorderColor2 = clGray
             Align = alClient
@@ -1799,8 +1793,8 @@
             object list_servers: TListView
               Left = 1
               Top = 1
-              Width = 686
-              Height = 191
+              Width = 678
+              Height = 183
               Align = alClient
               BorderStyle = bsNone
               Columns = <
@@ -1874,7 +1868,7 @@
           object ksoOfficeDock4: TksoOfficeDock
             Left = 0
             Top = 0
-            Width = 688
+            Width = 680
             Height = 55
             Align = alTop
             object ksoOfficeToolBar4: TksoOfficeToolBar
@@ -1957,8 +1951,8 @@
           object SlavaPanel4: TSlavaPanel
             Left = 0
             Top = 55
-            Width = 688
-            Height = 193
+            Width = 680
+            Height = 185
             BorderColor1 = clWhite
             BorderColor2 = clGray
             Align = alClient
@@ -1970,8 +1964,8 @@
             object list_channels: TListView
               Left = 1
               Top = 1
-              Width = 686
-              Height = 191
+              Width = 678
+              Height = 183
               Align = alClient
               BorderStyle = bsNone
               Columns = <
@@ -2040,13 +2034,13 @@
           object ksoOfficeDock5: TksoOfficeDock
             Left = 0
             Top = 0
-            Width = 688
+            Width = 680
             Height = 55
             Align = alTop
             object ksoOfficeToolBar5: TksoOfficeToolBar
               Left = 0
               Top = 0
-              Width = 688
+              Width = 680
               Height = 55
               Rolled = False
               object lbl_bans: TLabel
@@ -2149,8 +2143,8 @@
             object list_bans: TListView
               Left = 1
               Top = 1
-              Width = 686
-              Height = 191
+              Width = 678
+              Height = 183
               Align = alClient
               BorderStyle = bsNone
               Columns = <
@@ -2190,7 +2184,7 @@
                   AutoSize = True
                   Caption = 'reason'
                   WidthType = (
-                    -95)
+                    -103)
                 end>
               FlatScrollBars = True
               HideSelection = False
@@ -2217,7 +2211,7 @@
           object ksoOfficeDock6: TksoOfficeDock
             Left = 0
             Top = 0
-            Width = 688
+            Width = 680
             Height = 55
             Align = alTop
             object ksoOfficeToolBar6: TksoOfficeToolBar
@@ -2300,8 +2294,8 @@
           object SlavaPanel6: TSlavaPanel
             Left = 0
             Top = 55
-            Width = 688
-            Height = 193
+            Width = 680
+            Height = 185
             BorderColor1 = clWhite
             BorderColor2 = clGray
             Align = alClient
@@ -2313,8 +2307,8 @@
             object list_lists: TListView
               Left = 1
               Top = 1
-              Width = 686
-              Height = 191
+              Width = 678
+              Height = 183
               Align = alClient
               BorderStyle = bsNone
               Columns = <
@@ -2346,7 +2340,7 @@
           object ksoOfficeDock7: TksoOfficeDock
             Left = 0
             Top = 0
-            Width = 688
+            Width = 680
             Height = 55
             Align = alTop
             object ksoOfficeToolBar7: TksoOfficeToolBar
@@ -2419,8 +2413,8 @@
           object SlavaPanel7: TSlavaPanel
             Left = 0
             Top = 55
-            Width = 688
-            Height = 193
+            Width = 680
+            Height = 185
             BorderColor1 = clWhite
             BorderColor2 = clGray
             Align = alClient
@@ -2432,8 +2426,8 @@
             object list_hotlist: TListView
               Left = 1
               Top = 1
-              Width = 686
-              Height = 191
+              Width = 678
+              Height = 183
               Align = alClient
               BorderStyle = bsNone
               Columns = <
diff --dos -urN 241103/mainform.pas 241104/mainform.pas
--- 241103/mainform.pas	Sat Dec 27 14:35:54 2003
+++ 241104/mainform.pas	Fri Jan 16 02:19:56 2004
@@ -425,7 +425,7 @@
     procedure CreateParams(Var params: TCreateParams);override;
     procedure log_Change(Sender: TObject);
     procedure log_URLClick(Sender: TObject; const URLText: String; Button: TMouseButton);
-    procedure LoadConfig;
+    procedure LoadConfig(LoadMode: ConfigLoadMode = lmAll);
     procedure SaveConfig;
     procedure Timer1Timer(Sender: TObject);
     procedure UpdateTray;
@@ -602,10 +602,11 @@
     function  CompareRemoteHost(str1,str2: String): Integer;
     procedure AppException(Sender: TObject; E: Exception);
     function  CompareDigit2(str1,str2: String): Integer;
+    procedure CMShowingChanged(var Msg: TMessage); message CM_SHOWINGCHANGED;
   public
     { Public declarations }
     console_log_file: TFileStream;
-    procedure ChangeInterface;
+    procedure ChangeInterface(LoadMode: ConfigLoadMode = lmAll);
     procedure LogMain(color: Integer; text: String; add_time: Boolean=true);
     procedure LogConsole(color: Integer; text: String; add_time: Boolean=true);
     procedure ResizeHeader(list: TListView);
@@ -701,7 +702,6 @@
 
 procedure TSlavaNapWindow.FormCreate(Sender: TObject);
 var
- i: Integer;
  r: TRect;
  logfilename: String;
  ini: TIniFile;
@@ -735,6 +735,7 @@
  Application.OnException:=AppException;
  current_time:=GetTickCount;
  current_time_t:=GetTickCountT;
+
  {Create the "And" mask}
  LogStartup('mainform::create: creating bitmaps');
  tray_AndMask := CreateTBitmap;
@@ -745,6 +746,7 @@
  tray_XOrMask := CreateTBitmap;
  tray_XOrMask.Width := 16;
  tray_XOrMask.Height := 16;
+
  SystemParametersInfo(SPI_GETWORKAREA,0,@r,0);
  LogStartup('mainform::create: resizing window');
  Top:=(r.Top+r.Bottom-Height) div 2;
@@ -757,134 +759,13 @@
  showform:=true;
  console_log_file:=nil;
  if startup_hide then showform:=false;
- LogStartup('mainform::create: resetting sockets');
- for i:=0 to MAX_LISTEN_SOCKET do
- begin
-  server_port[i]:=0;
-  server_socket[i]:=INVALID_SOCKET;
- end;
- for i:=0 to MAX_LISTEN_TRAPSOCKET do
- begin
-  trap_port[i]:=0;
-  trap_socket[i]:=INVALID_SOCKET;
- end;
- napigator_socket:=INVALID_SOCKET;
- dagsta_socket:=INVALID_SOCKET;
- stats_socket:=INVALID_SOCKET;
- server_port[0]:=DEF_LISTEN_PORT;
- LogStartup('mainform::create: clearing log');
- log_main.Lines.Clear;
- MainThread:=nil;
- LogStartup('mainform::create: creating main lists');
- sync_reply_list:=TNapDoubleCmdList.Create;
- cmd_list:=TNapDoubleCmdList.Create;
- debug_file:=nil;
- db_online:=TOnlineUsers.Create;
- db_local:=TMyList.Create;
- db_servers:=TMyList.Create;
- LogStartup('mainform::create: loading servers list');
- LoadServers;
- db_channels:=TMyList.Create;
- db_registered:=TRegUserDataBase.Create;
- LogStartup('mainform::create: loading registered users');
- db_registered.LoadFromFile(ApplicationDir+'users');
- db_bans:=TBanList.Create;
- LogStartup('mainform::create: loading bans');
- db_bans.LoadFromFile(ApplicationDir+'bans');
- LogStartup('mainform::create: loading MOTD');
- StrHash_Reset(db_motd);
- StrHash_LoadFromFile(db_motd,ApplicationDir+'motd');
- LogStartup('mainform::create: loading friends list');
- StrHash_Reset(db_friends);
- StrHash_LoadFromFile(db_friends,ApplicationDir+'friends');
- db_software:=TNapCmd2List.Create;
- LogStartup('mainform::create: loading clientstats');
- try
-  db_software.LoadFromFile(ApplicationDir+'clientstats',cmd2ID2CRCLC);
-  except
- end;
- LogStartup('mainform::create: creating other lists...');
- db_invitations:=TNapCmdExList.Create;
- db_whowas:=TNapCmdExList.Create;
- db_reconnect:=TMyStringList.Create;
- db_reconnect.Duplicates:=classes2.dupIgnore;
- db_reconnect.Sorted:=true;
- db_login:=TMyList.Create;
- null_password:=null_pass;
- local_users:=0;
- total_users:=0;
- local_users_max:=0;
- total_users_max:=0;
- total_users_limit:=0;
- local_files:=0;
- total_files:=0;
- total_files_max:=0;
- local_files_max:=0;
- local_bytes:=0;
- total_bytes:=0;
- local_bytes_max:=0;
- total_bytes_max:=0;
- total_connections:=0;
- bytes_in:=0;
- bytes_out:=0;
- total_bytes_in:=0;
- total_bytes_out:=0;
- last_bytes_in:=0;
- last_bytes_out:=0;
- total_searches:=0;
- num_searches:=0;
- last_searches:=0;
- successful_searches:=0;
- total_search_results:=0;
- total_transfers:=0;
- num_transfers:=0;
- last_transfers:=0;
- total_browses:=0;
- num_browses:=0;
- last_browses:=0;
- total_browse_results:=0;
- num_login:=0;
- last_login:=0;
- last_rejects:=0;
- num_rejects:=0;
- num_servers:=0;
- napigator_socket:=INVALID_SOCKET;
- napigator_salt:='';
- dagsta_socket:=INVALID_SOCKET;
- dagsta_salt:='';
- // load config
- LogStartup('mainform::create: loading english.msg and english.lng');
- LoadLanguage('english');
+
  LogStartup('mainform::create: LoadConfig;');
- LoadConfig;
- LogStartup('mainform::create: loading channels');
- LoadChannels(ApplicationDir+'channels');
+ LoadConfig(lmInitial);
  LogStartup('mainform::create: ChangeInterface;');
- ChangeInterface;
+ ChangeInterface(lmInitial);
  LogStartup('mainform::create: LogMain...');
  LogMain(slText,GetLangI(LNG_LOG_STARTING,SLAVANAP_FULL));
- {$IFDEF TEST_VERSION}
- LogMain(clRed,'-----');
- LogMain(clRed,'This is a test version.');
- LogMain(clRed,'Some features are disabled or not implemented yet.');
- LogMain(clRed,'-----');
- {$ENDIF}
- LogStartup('mainform::create: refreshing lists');
- cmd_list.AddDoubleCmd(MSG_CMD_LISTREGISTERED,0,'','');
- cmd_list.AddDoubleCmd(MSG_CMD_LISTUSERS,0,'','');
- cmd_list.AddDoubleCmd(MSG_CMD_LISTSERVERS,0,'','');
- cmd_list.AddDoubleCmd(MSG_CMD_LISTCHANNELS,0,'','');
- cmd_list.AddDoubleCmd(MSG_CMD_LISTBANS,0,'','');
- cmd_list.AddDoubleCmd(MSG_CMD_LISTHOTLIST,0,'','');
- cmd_list.AddDoubleCmd(MSG_CMD_REFRESHLISTS,0,'0','');
- LogStartup('mainform::create: activating timer');
- Timer1Timer(nil);
- running:=true;
- start_time:=GetTickCount;
- start_time_t:=GetTickCountT;
- LogStartup('mainform::create: creating main thread');
- MainThread:=TMainThread.Create;
- LogStartup('mainform::create: RUNNING !!!!!');
 end;
 
 procedure TSlavaNapWindow.FormCloseQuery(Sender: TObject; var CanClose: Boolean);
@@ -948,11 +829,11 @@
  FreeTBitmap(tray_XOrMask);
 end;
 
-procedure TSlavaNapWindow.LoadConfig;
+procedure TSlavaNapWindow.LoadConfig(LoadMode: ConfigLoadMode = lmAll);
 var
  i: Integer;
  str: String;
- ini: TIniFile;
+ ini: TMemIniFile;
  list, list2: TMyStringList;
  b: Boolean;
  rec: TOnlineUser;
@@ -962,15 +843,15 @@
    Result:=StrToInt64Def(ini.ReadString(section,value,IntToStr(def)),def);
  end;
 begin
- LogStartup('mainform::loadconfig: loading config'); 
+ LogStartup('mainform::loadconfig: loading config');
  if not FileExists(ApplicationDir+'config') then ShowSetup;
- ini:=TIniFile.Create(ApplicationDir+'config');
+ ini:=TMemIniFile.Create(ApplicationDir+'config');
  LogStartup('mainform::loadconfig: checking config version');
  if ini.ReadString('Server','Version',SLAVANAP_VERSION)<'1.9.9' then
  begin
    ini.Free;
    ShowSetup;
-   ini:=TIniFile.Create(ApplicationDir+'config');
+   ini:=TMemIniFile.Create(ApplicationDir+'config');
  end
  else if ini.ReadString('Server','Version',SLAVANAP_VERSION)<>SLAVANAP_VERSION then
  begin // one of previous builds. convert old config
@@ -1004,28 +885,67 @@
     ini.EraseSection('Report0');
     ini.WriteBool('Share','Inform',false);
   end;
-  // interface
-  LogStartup('mainform::loadconfig: loading interface configuration');
-  ToolBar.Rolled:=not ini.ReadBool('Interface','ShowToolBar',true);
-  bar_bottom2.Rolled:=ini.ReadBool('Interface','HideStatus2',false);
-  bar_bottom3.Rolled:=ini.ReadBool('Interface','HideStatus3',false);
-  bar_bottom4.Rolled:=ini.ReadBool('Interface','HideStatus4',false);
-  bar_bottom5.Rolled:=ini.ReadBool('Interface','HideStatus5',false);
-  tb_register.Rolled:=ini.ReadBool('Interface','HideRegisterBtn',true);
-  tray.Active:=ini.ReadBool('Interface','ShowTray',true);
-  Left:=ini.ReadInteger('Interface','Left',Left);
-  Top:=ini.ReadInteger('Interface','Top',Top);
-  Width:=ini.ReadInteger('Interface','Width',Width);
-  Height:=ini.ReadInteger('Interface','Height',Height);
-  try
-   WindowState:=TWindowState(ini.ReadInteger('Interface','State',Ord(wsNormal)));
-   except
-  end;
-  try
-   i:=ini.ReadInteger('Interface','Splitter',panel_console.Height);
-    if i<ClientHeight then panel_console.Height:=i;
-   except
+  if LoadMode <> lmRest then
+  begin
+    // colors
+    LogStartup('mainform::loadconfig: loading colors');
+    slBackground:=ini.ReadInteger('Colors','clBackground',$FFFFFF);
+    slText:=ini.ReadInteger('Colors','clText',0);
+    slError:=ini.ReadInteger('Colors','clError',$0000FF);
+    slWallop:=ini.ReadInteger('Colors','clWallop',$A06000);
+    slAnnounce:=ini.ReadInteger('Colors','clAnnounce',$A00060);
+    slWhowas:=ini.ReadInteger('Colors','clWhowas',$600060);
+    slPong:=ini.ReadInteger('Colors','clPong',$600060);
+    slOffline:=ini.ReadInteger('Colors','clOffline',$603000);
+    slOnline:=ini.ReadInteger('Colors','clOnline',$A06000);
+    slDebugData:=ini.ReadInteger('Colors','clDebugData',$000060);
+    slNapigator:=ini.ReadInteger('Colors','clNapigator',$006000);
+    slDagsta:=ini.ReadInteger('Colors','clDagsta',$008000);
+    slSearch:=ini.ReadInteger('Colors','clSearch',$A000A0);
+    slBrowse:=ini.ReadInteger('Colors','clBrowse',$E000E0);
+    slTransfer:=ini.ReadInteger('Colors','clTransfer',$600060);
+    slTopic:=ini.ReadInteger('Colors','clTopic',$B00060);
+    slChannelMessage:=ini.ReadInteger('Colors','clChannelMessage',0);
+    slChannelMyMessage:=ini.ReadInteger('Colors','clChannelMyMessage',$404040);
+    slChannelEmote:=ini.ReadInteger('Colors','clChannelEmote',$606000);
+    slChannelMyEmote:=ini.ReadInteger('Colors','clChannelMyEmote',$808000);
+    slChannelJoin:=ini.ReadInteger('Colors','clChannelJoin',$A06000);
+    slChannelPart:=ini.ReadInteger('Colors','clChannelPart',$603000);
+    slChatMessage:=ini.ReadInteger('Colors','clChatMessage',$A00000);
+    slChatMyMessage:=ini.ReadInteger('Colors','clChatMyMessage',0);
+    // interface
+    LogStartup('mainform::loadconfig: loading interface configuration');
+    ToolBar.Rolled:=not ini.ReadBool('Interface','ShowToolBar',true);
+    bar_bottom2.Rolled:=ini.ReadBool('Interface','HideStatus2',false);
+    bar_bottom3.Rolled:=ini.ReadBool('Interface','HideStatus3',false);
+    bar_bottom4.Rolled:=ini.ReadBool('Interface','HideStatus4',false);
+    bar_bottom5.Rolled:=ini.ReadBool('Interface','HideStatus5',false);
+    tb_register.Rolled:=ini.ReadBool('Interface','HideRegisterBtn',true);
+    tray.Active:=ini.ReadBool('Interface','ShowTray',true);
+    Left:=ini.ReadInteger('Interface','Left',Left);
+    Top:=ini.ReadInteger('Interface','Top',Top);
+    Width:=ini.ReadInteger('Interface','Width',Width);
+    Height:=ini.ReadInteger('Interface','Height',Height);
+    try
+     WindowState:=TWindowState(ini.ReadInteger('Interface','State',Ord(wsNormal)));
+     except
+    end;
+    try
+     i:=ini.ReadInteger('Interface','Splitter',panel_console.Height);
+      if i<ClientHeight then panel_console.Height:=i;
+     except
+    end;
+    language:=ini.ReadString('Server','Language','');
+    if language='' then
+    begin
+     LogStartup('mainform::loadconfig: selecting language for the first time');
+     SlavaNapLanguage.ShowModal;
+    end;
+    LogStartup('mainform::loadconfig: loading custom language(initial) - '+language);
+    LoadLanguage(language, lmInitial);
+    if LoadMode = lmInitial then Exit; // 起動時間の短縮のため
   end;
+
   b3_canclose:=Bool3(ini.ReadInteger('Interface','CloseWindow',0));
   switch_chat:=ini.ReadBool('Interface','SwitchChat',true);
   cb_users_mods.Checked:=ini.ReadBool('Interface','CBUsersModes',true);
@@ -1083,32 +1003,6 @@
   if ini.ReadBool('Interface','UsersListHideDLRequests',false) then begin isHide[UL_DLREQUESTS+1]:=true; SetColumnVisible(list_users,UL_DLREQUESTS+1,0,false); end;
   if ini.ReadBool('Interface','UsersListHideSearchReqs',false) then begin isHide[UL_SEARCHREQS+1]:=true; SetColumnVisible(list_users,UL_SEARCHREQS+1,0,false); end;
   if ini.ReadBool('Interface','UsersListHideBlockFiles',false) then begin isHide[UL_BLOCKFILES+1]:=true; SetColumnVisible(list_users,UL_BLOCKFILES+1,0,false); end;
-  // colors
-  LogStartup('mainform::loadconfig: loading colors');
-  slBackground:=ini.ReadInteger('Colors','clBackground',$FFFFFF);
-  slText:=ini.ReadInteger('Colors','clText',0);
-  slError:=ini.ReadInteger('Colors','clError',$0000FF);
-  slWallop:=ini.ReadInteger('Colors','clWallop',$A06000);
-  slAnnounce:=ini.ReadInteger('Colors','clAnnounce',$A00060);
-  slWhowas:=ini.ReadInteger('Colors','clWhowas',$600060);
-  slPong:=ini.ReadInteger('Colors','clPong',$600060);
-  slOffline:=ini.ReadInteger('Colors','clOffline',$603000);
-  slOnline:=ini.ReadInteger('Colors','clOnline',$A06000);
-  slDebugData:=ini.ReadInteger('Colors','clDebugData',$000060);
-  slNapigator:=ini.ReadInteger('Colors','clNapigator',$006000);
-  slDagsta:=ini.ReadInteger('Colors','clDagsta',$008000);
-  slSearch:=ini.ReadInteger('Colors','clSearch',$A000A0);
-  slBrowse:=ini.ReadInteger('Colors','clBrowse',$E000E0);
-  slTransfer:=ini.ReadInteger('Colors','clTransfer',$600060);
-  slTopic:=ini.ReadInteger('Colors','clTopic',$B00060);
-  slChannelMessage:=ini.ReadInteger('Colors','clChannelMessage',0);
-  slChannelMyMessage:=ini.ReadInteger('Colors','clChannelMyMessage',$404040);
-  slChannelEmote:=ini.ReadInteger('Colors','clChannelEmote',$606000);
-  slChannelMyEmote:=ini.ReadInteger('Colors','clChannelMyEmote',$808000);
-  slChannelJoin:=ini.ReadInteger('Colors','clChannelJoin',$A06000);
-  slChannelPart:=ini.ReadInteger('Colors','clChannelPart',$603000);
-  slChatMessage:=ini.ReadInteger('Colors','clChatMessage',$A00000);
-  slChatMyMessage:=ini.ReadInteger('Colors','clChatMyMessage',0);
   // server data
   LogStartup('mainform::loadconfig: loading server data');
   str:=ini.ReadString('Server','Ports',DEF_LISTEN_PORTS);
@@ -1170,12 +1064,12 @@
   if clear_clientstats then
    if db_software<>nil then
     db_software.Clear;
-  language:=ini.ReadString('Server','Language','');
+  {language:=ini.ReadString('Server','Language','');
   if language='' then
   begin
    LogStartup('mainform::loadconfig: selecting language for the first time');
    SlavaNapLanguage.ShowModal;
-  end;
+  end;}
   max_users:=ini.ReadInteger('Server','MaxConnections',500);
   max_users_per_minute:=ini.ReadInteger('Server','MaxUsersPerMinute',100);
   stats_delay:=ini.ReadInteger('Server','Stats',60000);
@@ -1327,11 +1221,11 @@
   minshare_fullonly:=ini.ReadBool('Share','MinShareFullOnly',true);
   minshare_only10:=ini.ReadBool('Share','MinShareKick10',true);
   minshare_kickchat:=ini.ReadBool('Share','MinShareKickChat',false);
-  if language<>'english' then
-  begin
+  //if language<>'english' then
+  //begin
     LogStartup('mainform::loadconfig: loading custom language - '+language);
-    LoadLanguage(language);
-  end;
+    LoadLanguage(language, lmRest);
+  //end;
   napigator_host:=ini.ReadString('Napigator','Host','stat.napigator.com');
   napigator_port:=ini.ReadString('Napigator','Port','8890');
   napigator_user:=ini.ReadString('Napigator','User','');
@@ -1585,6 +1479,7 @@
   inc(total_users);
   inc(local_users_max);
   inc(total_users_max);
+  ini.UpdateFile;
   finally
   ini.Free;
  end;
@@ -1594,16 +1489,15 @@
 
 procedure TSlavaNapWindow.SaveConfig;
 var
- ini: TIniFile;
+ ini: TMemIniFile;
  i: Integer;
  list: TMyStringList;
- str: String;
  procedure PutInt64(section,value: String; val: Int64);
  begin
    ini.WriteString(section,value,IntToStr(val));
  end;
 begin
- ini:=TIniFile.Create(ApplicationDir+'config');
+ ini:=TMemIniFile.Create(ApplicationDir+'config');
  try
   ini.WriteString('Server','Version',SLAVANAP_VERSION);
   // interface
@@ -2025,12 +1919,13 @@
   ini.WriteString('Other2', 'MetaPort', metaport);
   ini.WriteString('Other2', 'RedirectedServer', redirected_server);
   ini.WriteString('Other2', 'RedirectedServerCheckList', redirected_server_chk);
+  ini.UpdateFile;
   finally
   ini.Free;
  end;
 end;
 
-procedure TSlavaNapWindow.ChangeInterface;
+procedure TSlavaNapWindow.ChangeInterface(LoadMode: ConfigLoadMode = lmAll);
 var
  i,j: Integer;
  function SetWidth(btn: TSpeedButton; l: Integer): Integer;
@@ -2043,53 +1938,121 @@
   Result:=l+i+20;
  end;
 begin
- SetFont(Self.Font);
- SetFont(lbl_log.Font,8);
- SetFont(lbl_users.Font,8);
- SetFont(lbl_registered.Font,8);
- SetFont(lbl_servers.Font,8);
- SetFont(lbl_channels.Font,8);
- SetFont(lbl_bans.Font,8);
- SetFont(lbl_list.Font,8);
- SetFont(lbl_hotlist.Font,8);
- SetFont(log_main.Font);
- log_main.SelectAll;
- log_main.SelAttributes.Size:=log_main.Font.Size;
- log_main.SelLength:=0;
- StatusBar1.Panels[1].Width:=0;
- // menu
- mnu_server.Caption:=GetLangI(LNG_MENU_SERVER);
- mnu_settings.Caption:=GetLangI(LNG_MENU_SETTINGS);
- mnu_languages.Caption:=GetLangI(LNG_MENU_LANGUAGES);
- mnu_save.Caption:=GetLangI(LNG_MENU_SAVE);
- mnu_restart.Caption:=GetLangI(LNG_MENU_RESTART);
- mnu_close.Caption:=GetLangI(LNG_MENU_EXIT);
- mnu_log.Caption:=GetLangI(LNG_MENU_LOG);
- mnu_log_clear2.Caption:=GetLangI(LNG_MENU_CLEAR);
- mnu_log_login.Caption:=GetLangI(LNG_MENU_LOGIN);
- mnu_log_search.Caption:=GetLangI(LNG_MENU_SEARCH);
- mnu_log_browse.Caption:=GetLangI(LNG_MENU_BROWSE);
- mnu_log_transfers.Caption:=GetLangI(LNG_MENU_TRANSFER);
- mnu_log_napigator.Caption:=GetLangI(LNG_MENU_NAPIGATOR);
- mnu_log_dagsta.Caption:=GetLangI(LNG_MENU_DAGSTA);
- mnu_log_reset.Caption:=GetLangI(LNG_MENU_RESET);
- mnu_window.Caption:=GetLangI(LNG_MENU_WINDOW);
- mnu_win_log.Caption:=GetLangI(LNG_MENU_LOGWIN);
- mnu_win_users.Caption:=GetLangI(LNG_MENU_USERS);
- mnu_win_registered.Caption:=GetLangI(LNG_MENU_REGISTERED);
- mnu_win_servers.Caption:=GetLangI(LNG_MENU_SERVERS);
- mnu_win_channels.Caption:=GetLangI(LNG_MENU_CHANNELS);
- mnu_win_bans.Caption:=GetLangI(LNG_MENU_BANS);
- mnu_win_hotlist.Caption:=GetLangI(LNG_MENU_HOTLIST);
- mnu_win_friends.Caption:=GetLangI(LNG_MENU_FRIENDS);
- mnu_win_ignored.Caption:=GetLangI(LNG_MENU_IGNORE);
- mnu_win_blocked.Caption:=GetLangI(LNG_MENU_BLOCK);
- mnu_help.Caption:=GetLangI(LNG_MENU_HELP);
- mnu_help_manual.Caption:=GetLangI(LNG_MENU_MANUAL);
- mnu_help_faq.Caption:=GetLangI(LNG_MENU_FAQ);
- mnu_help_forums.Caption:=GetLangI(LNG_MENU_FORUMS);
- mnu_help_web.Caption:=GetLangI(LNG_MENU_WEB);
- mnu_help_about.Caption:=GetLangI(LNG_MENU_ABOUT);
+ if LoadMode <> lmRest then
+ begin
+   SetFont(Self.Font);
+   SetFont(lbl_log.Font,8);
+   SetFont(lbl_users.Font,8);
+   SetFont(lbl_registered.Font,8);
+   SetFont(lbl_servers.Font,8);
+   SetFont(lbl_channels.Font,8);
+   SetFont(lbl_bans.Font,8);
+   SetFont(lbl_list.Font,8);
+   SetFont(lbl_hotlist.Font,8);
+   SetFont(log_main.Font);
+   log_main.SelectAll;
+   log_main.SelAttributes.Size:=log_main.Font.Size;
+   log_main.SelLength:=0;
+   StatusBar1.Panels[1].Width:=0;
+   // menu
+   mnu_server.Caption:=GetLangI(LNG_MENU_SERVER);
+   mnu_settings.Caption:=GetLangI(LNG_MENU_SETTINGS);
+   mnu_languages.Caption:=GetLangI(LNG_MENU_LANGUAGES);
+   mnu_save.Caption:=GetLangI(LNG_MENU_SAVE);
+   mnu_restart.Caption:=GetLangI(LNG_MENU_RESTART);
+   mnu_close.Caption:=GetLangI(LNG_MENU_EXIT);
+   mnu_log.Caption:=GetLangI(LNG_MENU_LOG);
+   mnu_log_clear2.Caption:=GetLangI(LNG_MENU_CLEAR);
+   mnu_log_login.Caption:=GetLangI(LNG_MENU_LOGIN);
+   mnu_log_search.Caption:=GetLangI(LNG_MENU_SEARCH);
+   mnu_log_browse.Caption:=GetLangI(LNG_MENU_BROWSE);
+   mnu_log_transfers.Caption:=GetLangI(LNG_MENU_TRANSFER);
+   mnu_log_napigator.Caption:=GetLangI(LNG_MENU_NAPIGATOR);
+   mnu_log_dagsta.Caption:=GetLangI(LNG_MENU_DAGSTA);
+   mnu_log_reset.Caption:=GetLangI(LNG_MENU_RESET);
+   mnu_window.Caption:=GetLangI(LNG_MENU_WINDOW);
+   mnu_win_log.Caption:=GetLangI(LNG_MENU_LOGWIN);
+   mnu_win_users.Caption:=GetLangI(LNG_MENU_USERS);
+   mnu_win_registered.Caption:=GetLangI(LNG_MENU_REGISTERED);
+   mnu_win_servers.Caption:=GetLangI(LNG_MENU_SERVERS);
+   mnu_win_channels.Caption:=GetLangI(LNG_MENU_CHANNELS);
+   mnu_win_bans.Caption:=GetLangI(LNG_MENU_BANS);
+   mnu_win_hotlist.Caption:=GetLangI(LNG_MENU_HOTLIST);
+   mnu_win_friends.Caption:=GetLangI(LNG_MENU_FRIENDS);
+   mnu_win_ignored.Caption:=GetLangI(LNG_MENU_IGNORE);
+   mnu_win_blocked.Caption:=GetLangI(LNG_MENU_BLOCK);
+   mnu_help.Caption:=GetLangI(LNG_MENU_HELP);
+   mnu_help_manual.Caption:=GetLangI(LNG_MENU_MANUAL);
+   mnu_help_faq.Caption:=GetLangI(LNG_MENU_FAQ);
+   mnu_help_forums.Caption:=GetLangI(LNG_MENU_FORUMS);
+   mnu_help_web.Caption:=GetLangI(LNG_MENU_WEB);
+   mnu_help_about.Caption:=GetLangI(LNG_MENU_ABOUT);
+   // toolbar
+   i:=10;
+   btn_tb_log.Caption:=GetLangI(LNG_TB_BTN_LOG);
+   btn_tb_log.Hint:=GetLangI(LNG_TB_BTN_LOG_HINT);
+   i:=SetWidth(btn_tb_log,i);
+   btn_tb_users.Caption:=GetLangI(LNG_TB_BTN_USERS);
+   btn_tb_users.Hint:=GetLangI(LNG_TB_BTN_USERS_HINT);
+   i:=SetWidth(btn_tb_users,i);
+   btn_tb_registered.Caption:=GetLangI(LNG_TB_BTN_REGISTERED);
+   btn_tb_registered.Hint:=GetLangI(LNG_TB_BTN_REGISTERED_HINT);
+   i:=SetWidth(btn_tb_registered,i);
+   btn_tb_servers.Caption:=GetLangI(LNG_TB_BTN_SERVERS);
+   btn_tb_servers.hint:=GetLangI(LNG_TB_BTN_SERVERS_HINT);
+   i:=SetWidth(btn_tb_servers,i);
+   btn_tb_channels.Caption:=GetLangI(LNG_TB_BTN_CHANNELS);
+   btn_tb_channels.Hint:=GetLangI(LNG_TB_BTN_CHANNELS_HINT);
+   i:=SetWidth(btn_tb_channels,i);
+   btn_tb_bans.Caption:=GetLangI(LNG_TB_BTN_BANS);
+   btn_tb_bans.hint:=GetLangI(LNG_TB_BTN_BANS_HINT);
+   i:=SetWidth(btn_tb_bans,i);
+   btn_tb_friends.Caption:=GetLangI(LNG_TB_BTN_FRIENDS);
+   btn_tb_friends.Hint:=GetLangI(LNG_TB_BTN_FRIENDS_HINT);
+   i:=SetWidth(btn_tb_friends,i);
+   btn_tb_hotlist.Caption:=GetLangI(LNG_TB_BTN_HOTLIST);
+   btn_tb_hotlist.Hint:=GetLangI(LNG_TB_BTN_HOTLIST_HINT);
+   i:=Setwidth(btn_tb_hotlist,i);
+   btn_tb_ignored.Caption:=GetLangI(LNG_TB_BTN_IGNORE);
+   btn_tb_ignored.Hint:=GetLangI(LNG_TB_BTN_IGNORE_HINT);
+   i:=SetWidth(btn_tb_ignored,i);
+   btn_tb_blocks.Caption:=GetLangI(LNG_TB_BTN_BLOCKS);
+   btn_tb_blocks.Hint:=GetLangI(LNG_TB_BTN_BLOCKS_HINT);
+   i:=SetWidth(btn_tb_blocks,i);
+   // log window
+   lbl_log.Caption:=GetLangI(LNG_LOG_LABEL);
+   i:=btn_log_clear.Left;
+   btn_log_clear.Caption:=GetLangI(LNG_LOG_CLEAR);
+   btn_log_clear.Width:=Canvas.TextWidth(btn_log_clear.Caption)+20;
+   inc(i,btn_log_clear.Width);
+   btn_log_mode.Left:=i;
+   btn_log_mode.Caption:=GetLangI(LNG_LOG_MODE);
+   btn_log_mode.Width:=Canvas.TextWidth(btn_log_mode.Caption)+20;
+   inc(i,btn_log_mode.Width);
+   btn_log_pause.Left:=i;
+   btn_log_pause.Caption:=GetLangI(LNG_LOG_PAUSE);
+   btn_log_pause.Width:=Canvas.TextWidth(btn_log_pause.Caption)+20;
+   i:=cb_log_sound.Left;
+   cb_log_sound.Caption:=GetLangI(LNG_LOG_CB_SOUND);
+   cb_log_sound.Width:=Canvas.TextWidth(cb_log_sound.Caption)+25;
+   inc(i,cb_log_sound.Width+10);
+   cb_log_away.Left:=i;
+   cb_log_away.Caption:=GetLangI(LNG_LOG_CB_AWAY);
+   cb_log_away.Width:=Canvas.TextWidth(cb_log_away.Caption)+25;
+   inc(i,cb_log_away.Width+5);
+   lbl_log_away.Left:=i;
+   lbl_log_away.Caption:=GetLangI(LNG_LOG_LBL_AWAY);
+   inc(i,lbl_log_away.Width+5);
+   edit_log_away.Left:=i;
+   inc(i,edit_log_away.Width+10);
+   cb_log_awaypopup.Left:=i;
+   cb_log_awaypopup.Caption:=GetLangI(LNG_LOG_CB_AWAYPOPUP);
+   cb_log_awaypopup.Width:=Canvas.TextWidth(cb_log_awaypopup.Caption)+25;
+   last_away_user:='';
+   last_away_time:=GetTickCount;
+   if LoadMode = lmInitial then Exit; // 起動時間の短縮のため
+ end;
+
  // popup menus
  mnu_tray_settings.Caption:=GetLangI(LNG_MENU_SETTINGS);
  mnu_tray_restart.Caption:=GetLangI(LNG_MENU_RESTART);
@@ -2220,69 +2183,7 @@
  mnu_um_dlrequests.Caption:='ダウンロード要求の合計を表示';
  mnu_um_searchreqs.Caption:='検索要求の合計を表示';
  mnu_um_blockfiles.Caption:='ブロックされたファイルの合計を表示';
- // toolbar
- i:=10;
- btn_tb_log.Caption:=GetLangI(LNG_TB_BTN_LOG);
- btn_tb_log.Hint:=GetLangI(LNG_TB_BTN_LOG_HINT);
- i:=SetWidth(btn_tb_log,i);
- btn_tb_users.Caption:=GetLangI(LNG_TB_BTN_USERS);
- btn_tb_users.Hint:=GetLangI(LNG_TB_BTN_USERS_HINT);
- i:=SetWidth(btn_tb_users,i);
- btn_tb_registered.Caption:=GetLangI(LNG_TB_BTN_REGISTERED);
- btn_tb_registered.Hint:=GetLangI(LNG_TB_BTN_REGISTERED_HINT);
- i:=SetWidth(btn_tb_registered,i);
- btn_tb_servers.Caption:=GetLangI(LNG_TB_BTN_SERVERS);
- btn_tb_servers.hint:=GetLangI(LNG_TB_BTN_SERVERS_HINT);
- i:=SetWidth(btn_tb_servers,i);
- btn_tb_channels.Caption:=GetLangI(LNG_TB_BTN_CHANNELS);
- btn_tb_channels.Hint:=GetLangI(LNG_TB_BTN_CHANNELS_HINT);
- i:=SetWidth(btn_tb_channels,i);
- btn_tb_bans.Caption:=GetLangI(LNG_TB_BTN_BANS);
- btn_tb_bans.hint:=GetLangI(LNG_TB_BTN_BANS_HINT);
- i:=SetWidth(btn_tb_bans,i);
- btn_tb_friends.Caption:=GetLangI(LNG_TB_BTN_FRIENDS);
- btn_tb_friends.Hint:=GetLangI(LNG_TB_BTN_FRIENDS_HINT);
- i:=SetWidth(btn_tb_friends,i);
- btn_tb_hotlist.Caption:=GetLangI(LNG_TB_BTN_HOTLIST);
- btn_tb_hotlist.Hint:=GetLangI(LNG_TB_BTN_HOTLIST_HINT);
- i:=Setwidth(btn_tb_hotlist,i);
- btn_tb_ignored.Caption:=GetLangI(LNG_TB_BTN_IGNORE);
- btn_tb_ignored.Hint:=GetLangI(LNG_TB_BTN_IGNORE_HINT);
- i:=SetWidth(btn_tb_ignored,i);
- btn_tb_blocks.Caption:=GetLangI(LNG_TB_BTN_BLOCKS);
- btn_tb_blocks.Hint:=GetLangI(LNG_TB_BTN_BLOCKS_HINT);
- i:=SetWidth(btn_tb_blocks,i);
- // log window
- lbl_log.Caption:=GetLangI(LNG_LOG_LABEL);
- i:=btn_log_clear.Left;
- btn_log_clear.Caption:=GetLangI(LNG_LOG_CLEAR);
- btn_log_clear.Width:=Canvas.TextWidth(btn_log_clear.Caption)+20;
- inc(i,btn_log_clear.Width);
- btn_log_mode.Left:=i;
- btn_log_mode.Caption:=GetLangI(LNG_LOG_MODE);
- btn_log_mode.Width:=Canvas.TextWidth(btn_log_mode.Caption)+20;
- inc(i,btn_log_mode.Width);
- btn_log_pause.Left:=i;
- btn_log_pause.Caption:=GetLangI(LNG_LOG_PAUSE);
- btn_log_pause.Width:=Canvas.TextWidth(btn_log_pause.Caption)+20;
- i:=cb_log_sound.Left;
- cb_log_sound.Caption:=GetLangI(LNG_LOG_CB_SOUND);
- cb_log_sound.Width:=Canvas.TextWidth(cb_log_sound.Caption)+25;
- inc(i,cb_log_sound.Width+10);
- cb_log_away.Left:=i;
- cb_log_away.Caption:=GetLangI(LNG_LOG_CB_AWAY);
- cb_log_away.Width:=Canvas.TextWidth(cb_log_away.Caption)+25;
- inc(i,cb_log_away.Width+5);
- lbl_log_away.Left:=i;
- lbl_log_away.Caption:=GetLangI(LNG_LOG_LBL_AWAY);
- inc(i,lbl_log_away.Width+5);
- edit_log_away.Left:=i;
- inc(i,edit_log_away.Width+10);
- cb_log_awaypopup.Left:=i;
- cb_log_awaypopup.Caption:=GetLangI(LNG_LOG_CB_AWAYPOPUP);
- cb_log_awaypopup.Width:=Canvas.TextWidth(cb_log_awaypopup.Caption)+25;
- last_away_user:='';
- last_away_time:=GetTickCount;
+
  // users tree
  with list_users.Columns do
  begin
@@ -2914,7 +2815,7 @@
 procedure TSlavaNapWindow.sh_show(Sender: TObject);
 begin
   (Sender as TTabSheet).Realign;
-  (Sender as TTabSheet).Realign;
+  // (Sender as TTabSheet).Realign;
 end;
 
 procedure TSlavaNapWindow.DrawPopupItem2(Sender: TObject; ACanvas: TCanvas;
@@ -5085,7 +4986,6 @@
 procedure TSlavaNapWindow.mnu_users_announceClick(Sender: TObject);
 var
   users: TStringList;
-  i: Integer;
   item: TListItem;
 begin
  if not running then exit;
@@ -5102,7 +5002,6 @@
 
 function TSlavaNapWindow.CreateAnnounceWindow(users: TStringList): TSlavaNapAnnounceWindow;
 var
- i: Integer;
  form: TSlavaNapAnnounceWindow;
 begin
  Result:=nil;
@@ -5128,6 +5027,148 @@
 begin
   edit_servers_refresh.Visible := cb_servers_refresh.Checked;
   lbl_servers_refresh.Visible := cb_servers_refresh.Checked;
+end;
+
+procedure TSlavaNapWindow.CMShowingChanged(var Msg: TMessage);
+var
+  i: Integer;
+begin
+  inherited;
+
+  if Visible and not running then
+  begin
+    Update;
+
+    LogStartup('mainform::create: resetting sockets');
+    for i:=0 to MAX_LISTEN_SOCKET do
+    begin
+      server_port[i]:=0;
+      server_socket[i]:=INVALID_SOCKET;
+    end;
+    for i:=0 to MAX_LISTEN_TRAPSOCKET do
+    begin
+      trap_port[i]:=0;
+      trap_socket[i]:=INVALID_SOCKET;
+    end;
+    napigator_socket:=INVALID_SOCKET;
+    dagsta_socket:=INVALID_SOCKET;
+    stats_socket:=INVALID_SOCKET;
+    server_port[0]:=DEF_LISTEN_PORT;
+    LogStartup('mainform::create: clearing log');
+    log_main.Lines.Clear;
+    MainThread:=nil;
+    LogStartup('mainform::create: creating main lists');
+    sync_reply_list:=TNapDoubleCmdList.Create;
+    cmd_list:=TNapDoubleCmdList.Create;
+    debug_file:=nil;
+    db_online:=TOnlineUsers.Create;
+    db_local:=TMyList.Create;
+    db_servers:=TMyList.Create;
+    LogStartup('mainform::create: loading servers list');
+    LoadServers;
+    db_channels:=TMyList.Create;
+    db_registered:=TRegUserDataBase.Create;
+    LogStartup('mainform::create: loading registered users');
+    db_registered.LoadFromFile(ApplicationDir+'users');
+    db_bans:=TBanList.Create;
+    LogStartup('mainform::create: loading bans');
+    db_bans.LoadFromFile(ApplicationDir+'bans');
+    LogStartup('mainform::create: loading MOTD');
+    StrHash_Reset(db_motd);
+    StrHash_LoadFromFile(db_motd,ApplicationDir+'motd');
+    LogStartup('mainform::create: loading friends list');
+    StrHash_Reset(db_friends);
+    StrHash_LoadFromFile(db_friends,ApplicationDir+'friends');
+    db_software:=TNapCmd2List.Create;
+    LogStartup('mainform::create: loading clientstats');
+    try
+      db_software.LoadFromFile(ApplicationDir+'clientstats',cmd2ID2CRCLC);
+    except
+    end;
+    LogStartup('mainform::create: creating other lists...');
+    db_invitations:=TNapCmdExList.Create;
+    db_whowas:=TNapCmdExList.Create;
+    db_reconnect:=TMyStringList.Create;
+    db_reconnect.Duplicates:=classes2.dupIgnore;
+    db_reconnect.Sorted:=true;
+    db_login:=TMyList.Create;
+    null_password:=null_pass;
+    local_users:=0;
+    total_users:=0;
+    local_users_max:=0;
+    total_users_max:=0;
+    total_users_limit:=0;
+    local_files:=0;
+    total_files:=0;
+    total_files_max:=0;
+    local_files_max:=0;
+    local_bytes:=0;
+    total_bytes:=0;
+    local_bytes_max:=0;
+    total_bytes_max:=0;
+    total_connections:=0;
+    bytes_in:=0;
+    bytes_out:=0;
+    total_bytes_in:=0;
+    total_bytes_out:=0;
+    last_bytes_in:=0;
+    last_bytes_out:=0;
+    total_searches:=0;
+    num_searches:=0;
+    last_searches:=0;
+    successful_searches:=0;
+    total_search_results:=0;
+    total_transfers:=0;
+    num_transfers:=0;
+    last_transfers:=0;
+    total_browses:=0;
+    num_browses:=0;
+    last_browses:=0;
+    total_browse_results:=0;
+    num_login:=0;
+    last_login:=0;
+    last_rejects:=0;
+    num_rejects:=0;
+    num_servers:=0;
+    napigator_socket:=INVALID_SOCKET;
+    napigator_salt:='';
+    dagsta_socket:=INVALID_SOCKET;
+    dagsta_salt:='';
+
+    // load config
+    // LogStartup('mainform::create: loading english.msg and english.lng');
+    // LoadLanguage('english');
+    LogStartup('mainform::create: LoadConfig;');
+    LoadConfig(lmRest);
+    LogStartup('mainform::create: loading channels');
+    LoadChannels(ApplicationDir+'channels');
+    LogStartup('mainform::create: ChangeInterface;');
+    ChangeInterface(lmRest);
+    LogStartup('mainform::create: LogMain...');
+    LogMain(slText,GetLangI(LNG_LOG_STARTING,SLAVANAP_FULL));
+    {$IFDEF TEST_VERSION}
+    LogMain(clRed,'-----');
+    LogMain(clRed,'This is a test version.');
+    LogMain(clRed,'Some features are disabled or not implemented yet.');
+    LogMain(clRed,'-----');
+    {$ENDIF}
+    LogStartup('mainform::create: refreshing lists');
+    cmd_list.AddDoubleCmd(MSG_CMD_LISTREGISTERED,0,'','');
+    cmd_list.AddDoubleCmd(MSG_CMD_LISTUSERS,0,'','');
+    cmd_list.AddDoubleCmd(MSG_CMD_LISTSERVERS,0,'','');
+    cmd_list.AddDoubleCmd(MSG_CMD_LISTCHANNELS,0,'','');
+    cmd_list.AddDoubleCmd(MSG_CMD_LISTBANS,0,'','');
+    cmd_list.AddDoubleCmd(MSG_CMD_LISTHOTLIST,0,'','');
+    cmd_list.AddDoubleCmd(MSG_CMD_REFRESHLISTS,0,'0','');
+    LogStartup('mainform::create: activating timer');
+    Timer1Timer(nil);
+    running:=true;
+    start_time:=GetTickCount;
+    start_time_t:=GetTickCountT;
+    LogStartup('mainform::create: creating main thread');
+    MainThread:=TMainThread.Create;
+    LogStartup('mainform::create: RUNNING !!!!!');
+  end;
 end;
 
 end.
diff --dos -urN 241103/settings.dfm 241104/settings.dfm
--- 241103/settings.dfm	Sat Oct 25 14:21:52 2003
+++ 241104/settings.dfm	Fri Jan 16 02:22:22 2004
@@ -146,6 +146,7 @@
   OldCreateOrder = False
   Position = poDesktopCenter
   OnCreate = FormCreate
+  OnDestroy = FormDestroy
   OnShow = FormShow
   PixelsPerInch = 96
   TextHeight = 12
diff --dos -urN 241103/settings.pas 241104/settings.pas
--- 241103/settings.pas	Sat Oct 25 14:14:18 2003
+++ 241104/settings.pas	Fri Jan 16 02:19:06 2004
@@ -23,7 +23,7 @@
   Windows, Messages, SysUtils, Classes2, Graphics, Controls, Forms, Dialogs,
   ExtCtrls, OfficePanel, ComCtrls, StdCtrls, inifiles, registry,
   SpectrumCombo, ShellApi, Buttons, Spin, basecombo, Pages, Classes,
-  ActiveX, ShlObj, slavastrings, CheckLst;
+  ActiveX, ShlObj, slavastrings, CheckLst, stypes;
 
 type
   TSlavaNapSettings = class(TForm)
@@ -723,16 +723,18 @@
     procedure cb_enable_metaserverClick(Sender: TObject);
     procedure btn_add_redirected_serverClick(Sender: TObject);
     procedure btn_delete_redirected_serverClick(Sender: TObject);
+    procedure FormDestroy(Sender: TObject);
   private
     { Private declarations }
     procedure SetBanItems(control: TComboBox);
     function  GetBanID(control: TComboBox): Integer;
     function  GetBanIndex(t: Integer): Integer;
+    procedure CMShowingChanged(var Msg: TMessage); message CM_SHOWINGCHANGED;
   public
     { Public declarations }
     top_text: String;
     procedure ChangeColors;
-    procedure ChangeInterface;
+    procedure ChangeInterface(LoadMode: ConfigLoadMode = lmAll);
   end;
 
 function BrowseCallbackProc(hWnd: HWND; uMsg: UINT; lParam, lpData: lParam): Integer stdCall;
@@ -740,11 +742,12 @@
 var
   SlavaNapSettings: TSlavaNapSettings;
   BrowseInfo: TBrowseInfo;
+  Ini: TMemIniFile;
 
 implementation
 
 uses
- stypes, vars, constants, mainform, bans, handler, lang, users, editdialog,
+ vars, constants, mainform, bans, handler, lang, users, editdialog,
  servers, channels, winsock, blcksock, memory_manager, languages;
 
 {$R *.DFM}
@@ -883,19 +886,20 @@
   edit_console_speed.Items.Add(Speed2Str(TNapSpeed(i)));
  SetBanItems(edit_dlfloodblock_bantime);
  SetBanItems(edit_wqfloodblock_bantime);
+ Ini := TMemIniFile.Create(ApplicationDir + 'config');
 end;
 
 procedure TSlavaNapSettings.FormShow(Sender: TObject);
 var
  t,item,it1: TTreeNode;
 begin
- ChangeInterface;
+ ChangeInterface(lmInitial);
  Caption:=GetLangI(LNG_S_CAPTION);
  btn_restore.Caption:=GetLangI(LNG_S_BTN_RESTORE);
  btn_close.Caption:=GetLangI(LNG_S_BTN_CLOSE);
  lbl_change.Caption:=GetLangI(LNG_S_LBL_NOTE);
- pages.ActivePage:=sh_main;
- sh_mainShow(nil);
+// pages.ActivePage:=sh_main;
+// sh_mainShow(nil);
  ChangeColors;
  tree.Items.Clear;
  item:=tree.Items.AddChild(nil, GetLangI(LNG_S_ITEM_MAIN));
@@ -969,6 +973,8 @@
        t.Data:=DATA_OTHER4;
  item.Expand(true);
  it1.Expand(true); // expand first item and focus it
+ pages.ActivePage:=sh_main;
+ sh_mainShow(nil);
 end;
 
 procedure TSlavaNapSettings.btn_closeClick(Sender: TObject);
@@ -1049,25 +1055,17 @@
 end;
 
 procedure TSlavaNapSettings.sh_mainShow(Sender: TObject);
-var
- ini: TIniFile;
 begin
  SetTopText(GetLangI(LNG_S_TEXT_MAIN));
  SetChange(false);
  lbl_handle.Caption:='(current handle = '+IntToStr(myserverhandle)+')';
  lbl_handle.Font.Color:=clPurple;
  edit_main_remoteadmin.Text:=cons_reg_user;
- try
-  ini:=TIniFile.Create(ApplicationDir+'config');
-  except
-  exit;
- end;
- edit_main_ports.Text:=ini.ReadString('Server','Ports',DEF_LISTEN_PORTS);
- edit_main_host.Text:=ini.ReadString('Server','ReportHost','localhost');
- edit_main_handle.Value:=ini.ReadInteger('Server','ServerHandle',0);
- edit_main_listenip.Text:=ini.ReadString('Server','SocketsInterface','0.0.0.0');
- edit_main_alias.Text:=trim(ini.ReadString('Server','Alias',''));
- ini.Free;
+ edit_main_ports.Text:=Ini.ReadString('Server','Ports',DEF_LISTEN_PORTS);
+ edit_main_host.Text:=Ini.ReadString('Server','ReportHost','localhost');
+ edit_main_handle.Value:=Ini.ReadInteger('Server','ServerHandle',0);
+ edit_main_listenip.Text:=Ini.ReadString('Server','SocketsInterface','0.0.0.0');
+ edit_main_alias.Text:=trim(Ini.ReadString('Server','Alias',''));
 end;
 
 procedure TSlavaNapSettings.sh_usersShow(Sender: TObject);
@@ -1367,8 +1365,6 @@
 end;
 
 procedure TSlavaNapSettings.sh_channelsShow(Sender: TObject);
-var
- ini: TIniFile;
 begin
  SetTopText(GetLangI(LNG_S_TEXT_CHANNELS));
  SetChange(true);
@@ -1386,33 +1382,19 @@
  cb_channels_flood_warn.Checked:=flood_warning;
  cb_channels_floodenable.Checked:=flood_enable;
  cb_channels_floodenableClick(nil);
- try
-  ini:=TIniFile.Create(ApplicationDir+'config');
-  except
-  exit;
- end;
- cb_channels_timestamp.Checked:=ini.ReadBool('Channels','TimeStamp',false);
- cb_channels_low.Checked:=ini.ReadBool('Channels','LowerCase',false);
- ini.Free;
+ cb_channels_timestamp.Checked:=Ini.ReadBool('Channels','TimeStamp',false);
+ cb_channels_low.Checked:=Ini.ReadBool('Channels','LowerCase',false);
 end;
 
 procedure TSlavaNapSettings.sh_consoleShow(Sender: TObject);
-var
- ini: TIniFile;
 begin
  SetTopText(GetLangI(LNG_S_TEXT_CONSOLE));
  SetChange(false);
- try
-  ini:=TIniFile.Create(ApplicationDir+'config');
-  except
-  exit;
- end;
- edit_console_user.Text:=ini.ReadString('Console','User','Admin');
+ edit_console_user.Text:=Ini.ReadString('Console','User','Admin');
  if running then edit_console_speed.ItemIndex:=Ord(cons.data^.speed);
- edit_cons_autojoin1.text:=ini.ReadString('Console','AutoJoinRoom1','');
- edit_cons_autojoin2.text:=ini.ReadString('Console','AutoJoinRoom2','');
- edit_cons_autojoin3.text:=ini.ReadString('Console','AutoJoinRoom3','');
- ini.Free;
+ edit_cons_autojoin1.text:=Ini.ReadString('Console','AutoJoinRoom1','');
+ edit_cons_autojoin2.text:=Ini.ReadString('Console','AutoJoinRoom2','');
+ edit_cons_autojoin3.text:=Ini.ReadString('Console','AutoJoinRoom3','');
 end;
 
 procedure TSlavaNapSettings.sh_blockedShow(Sender: TObject);
@@ -1527,8 +1509,6 @@
 end;
 
 procedure TSlavaNapSettings.sh_other2Show(Sender: TObject);
-var
-  ini: TIniFile;
 begin
  SetTopText(GetLangI(LNG_S_TEXT_OTHER2));
  SetChange(true);
@@ -1575,12 +1555,7 @@
  edit_fakeext.Visible:=cb_disable_fakeext.Checked;
  edit_fakeext.Text:=fakeext;
  cb_enable_trapport.Checked:=enable_trapport;
- ini:=TIniFile.Create(Applicationdir+'config');
- try
-   edit_trapport.Text:=ini.ReadString('Other2','TrapPort','8888 8875 7743');
-  finally
-   ini.Free;
- end;
+ edit_trapport.Text:=Ini.ReadString('Other2','TrapPort','8888 8875 7743');
  cb_block_transferport.Checked:=block_transferport;
  edit_blocked_transferport.Visible:=cb_block_transferport.Checked;
  edit_blocked_transferport.Text:=blocked_transferport;
@@ -1751,7 +1726,6 @@
 
 procedure TSlavaNapSettings.btn_changeClick(Sender: TObject);
 var
- ini: TIniFile;
  reg: TRegistry;
  i: Integer;
  logfilename: String;
@@ -1763,16 +1737,14 @@
  try
    listen_interface:=edit_main_listenip.Text;
    cons_reg_user:=edit_main_remoteadmin.Text;
-   ini:=TIniFile.Create(ApplicationDir+'config');
-   ini.WriteString('Server','Ports',edit_main_ports.Text);
-   ini.WriteString('Server','ReportHost',edit_main_host.Text);
-   ini.WriteInteger('Server','ServerHandle',edit_main_handle.Value);
-   ini.WriteString('Server','SocketsInterface',listen_interface);
+   Ini.WriteString('Server','Ports',edit_main_ports.Text);
+   Ini.WriteString('Server','ReportHost',edit_main_host.Text);
+   Ini.WriteInteger('Server','ServerHandle',edit_main_handle.Value);
+   Ini.WriteString('Server','SocketsInterface',listen_interface);
    if edit_main_alias.Text=servername_i then
-    ini.DeleteKey('Server','Alias')
+    Ini.DeleteKey('Server','Alias')
    else
-    ini.WriteString('Server','Alias',edit_main_alias.Text);
-   ini.Free;
+    Ini.WriteString('Server','Alias',edit_main_alias.Text);
   except
  end else if pages.ActivePage=sh_colors then
  try
@@ -1959,10 +1931,8 @@
    flood_max_user_message:=edit_channels_flood_user.Value;
    flood_max_same_message:=edit_channels_flood_same.Value;
    flood_warning:=cb_channels_flood_warn.Checked;
-   ini:=TIniFile.Create(ApplicationDir+'config');
-   ini.WriteBool('Channels','TimeStamp',cb_channels_timestamp.Checked);
-   ini.WriteBool('Channels','LowerCase',cb_channels_low.Checked);
-   ini.Free;
+   Ini.WriteBool('Channels','TimeStamp',cb_channels_timestamp.Checked);
+   Ini.WriteBool('Channels','LowerCase',cb_channels_low.Checked);
   except
  end else if pages.ActivePage=sh_interface then
  try
@@ -2088,12 +2058,10 @@
      ShowMessage('不正なユーザー名です');
      exit;
    end;
-   ini:=TIniFile.Create(ApplicationDir+'config');
-   ini.WriteString('Console','User',edit_console_user.Text);
-   ini.WriteString('Console','AutoJoinRoom1',edit_cons_autojoin1.Text);
-   ini.WriteString('Console','AutoJoinRoom2',edit_cons_autojoin2.Text);
-   ini.WriteString('Console','AutoJoinRoom3',edit_cons_autojoin3.Text);
-   ini.Free;
+   Ini.WriteString('Console','User',edit_console_user.Text);
+   Ini.WriteString('Console','AutoJoinRoom1',edit_cons_autojoin1.Text);
+   Ini.WriteString('Console','AutoJoinRoom2',edit_cons_autojoin2.Text);
+   Ini.WriteString('Console','AutoJoinRoom3',edit_cons_autojoin3.Text);
    if running then
    if Ord(cons.data^.speed)<>edit_console_speed.ItemIndex then
     cmd_list.AddDoubleCmd(MSG_CLIENT_CHANGE_SPEED,0,IntToStr(edit_console_speed.ItemIndex),'');
@@ -2211,12 +2179,7 @@
    disable_fakeext:=cb_disable_fakeext.Checked;
    fakeext:=edit_fakeext.Text;
    enable_trapport:=cb_enable_trapport.Checked;
-   ini:=TIniFile.Create(Applicationdir+'config');
-   try
-     ini.WriteString('Other2','TrapPort',edit_trapport.Text);
-    finally
-     ini.Free;
-   end;
+   Ini.WriteString('Other2','TrapPort',edit_trapport.Text);
    block_transferport:=cb_block_transferport.Checked;
    blocked_transferport:=edit_blocked_transferport.Text;
    StrHash_Reset(blocked_transferport_list);
@@ -2327,6 +2290,7 @@
      end;
   except
  end;
+ Ini.UpdateFile;
  btn_restoreClick(nil);
 end;
 
@@ -2791,27 +2755,31 @@
   edit_minshare_bantime.Visible:=cb_minshare_ban.Checked;
 end;
 
-procedure TSlavaNapSettings.ChangeInterface;
+procedure TSlavaNapSettings.ChangeInterface(LoadMode: ConfigLoadMode = lmAll);
 begin
-  SetFont(Self.Font);
-  SetFont(tree.Font);
-  SetFont(header.Font,10);
-  SetFont(lbl_change.Font,10);
-  SetFont(lbl_note.Font,9);
-  SetFont(Label55.Font);
-  SetFont(lbl_handle.Font);
-  SetFont(Label137.Font);
-  //sh_main
-  Label1.Caption                       :=GetLangI(LNG_S_SHMAIN_LABEL1);
-  Label3.Caption                       :=GetLangI(LNG_S_SHMAIN_LABEL3);
-  Label4.Caption                       :=GetLangI(LNG_S_SHMAIN_LABEL4);
-  Label66.Caption                      :=GetLangI(LNG_S_SHMAIN_LABEL66);
-  Label67.Caption                      :=GetLangI(LNG_S_SHMAIN_LABEL67);
-  Label75.Caption                      :=GetLangI(LNG_S_SHMAIN_LABEL75);
-  Label76.Caption                      :=GetLangI(LNG_S_SHMAIN_LABEL76);
-  lbl_handle.Caption                   :=GetLangI(LNG_S_SHMAIN_LBL_HANDLE);
-  Label127.Caption                     :=GetLangI(LNG_S_SHMAIN_LABEL127);
-  Label138.Caption                     :=GetLangI(LNG_S_SHMAIN_LABEL138);
+  if LoadMode <> lmRest then
+  begin
+    SetFont(Self.Font);
+    SetFont(tree.Font);
+    SetFont(header.Font,10);
+    SetFont(lbl_change.Font,10);
+    SetFont(lbl_note.Font,9);
+    SetFont(Label55.Font);
+    SetFont(lbl_handle.Font);
+    SetFont(Label137.Font);
+    //sh_main
+    Label1.Caption                       :=GetLangI(LNG_S_SHMAIN_LABEL1);
+    Label3.Caption                       :=GetLangI(LNG_S_SHMAIN_LABEL3);
+    Label4.Caption                       :=GetLangI(LNG_S_SHMAIN_LABEL4);
+    Label66.Caption                      :=GetLangI(LNG_S_SHMAIN_LABEL66);
+    Label67.Caption                      :=GetLangI(LNG_S_SHMAIN_LABEL67);
+    Label75.Caption                      :=GetLangI(LNG_S_SHMAIN_LABEL75);
+    Label76.Caption                      :=GetLangI(LNG_S_SHMAIN_LABEL76);
+    lbl_handle.Caption                   :=GetLangI(LNG_S_SHMAIN_LBL_HANDLE);
+    Label127.Caption                     :=GetLangI(LNG_S_SHMAIN_LABEL127);
+    Label138.Caption                     :=GetLangI(LNG_S_SHMAIN_LABEL138);
+    if LoadMode = lmInitial then Exit;
+  end;
   //sh_users
   Label5.Caption                       :=GetLangI(LNG_S_SHUSERS_LABEL5);
   Label9.Caption                       :=GetLangI(LNG_S_SHUSERS_LABEL9);
@@ -3300,6 +3268,21 @@
     DeleteSelected;
     if Count > 0 then
       Selected[0] := True;
+  end;
+end;
+
+procedure TSlavaNapSettings.FormDestroy(Sender: TObject);
+begin
+  Ini.Free;
+end;
+
+procedure TSlavaNapSettings.CMShowingChanged(var Msg: TMessage);
+begin
+  inherited;
+  if Visible and running then
+  begin
+    Update;
+    ChangeInterface(lmRest);
   end;
 end;
 
diff --dos -urN 241103/stypes.pas 241104/stypes.pas
--- 241103/stypes.pas	Sat Dec 27 03:20:44 2003
+++ 241104/stypes.pas	Fri Jan 16 02:16:38 2004
@@ -28,6 +28,7 @@
 type
   time_t          = LongWord;
   Bool3           = (Unknown3, True3, False3);
+  ConfigLoadMode  = (lmInitial, lmRest, lmAll);
   TQuery          = (queryNormal, queryOperServ, queryNickServ, queryChanServ,
                      queryMsgServ, queryChannel, queryServer, queryRemoteUser);
   TUserState      = set of (userMuzzled, // user is muzzled
@@ -1651,7 +1652,7 @@
    if not log_to_file then exit;
    if not file_only then Log(slDebugData,cmd,false);
    if debug_file=nil then exit;
-   cmd:=cmd+#13#10;
+   cmd := GetLogTime + cmd + #13#10;
    debug_file.Write(cmd[1],Length(cmd));
   except
  end;
diff --dos -urN 241103/thread.pas 241104/thread.pas
--- 241103/thread.pas	Sat Dec 27 14:49:58 2003
+++ 241104/thread.pas	Fri Jan 16 02:27:12 2004
@@ -134,6 +134,7 @@
  srv: TServer;
  ch: TChannel;
 begin
+SlavaNapWindow.Visible := False;
 DebugLog('ShutDown - start debug',true);
  try
   DisconnectNapigator(0);
@@ -363,7 +364,7 @@
  DebugLog('ShutDown - 11.2',true);
   db_registered.Free;
   db_registered:=nil;
- DebugLog('ShutDown - 11.3',true);
+ DebugLog('ShutDown - 11.3(FreeKeywords)',true);
   {$I checksync.pas}
   FreeKeywords;
   {$I checksync.pas}