SIZE(10):2003.08.05 (火) 03:16:05 <Heracules> [[shuusei24159>24159]]からの移植です。2.1.1ベースでは使えない関数などを置き換えたり追加したりしたので、[[24159]]よりもパッチ量が増えてます。~
SIZE(10):2003.08.05 (火) 03:17:06 <Heracules> 一応、Utatane 0.25、WinMX 2.6、WinMX 3.31、Napchan 0.79.718でチェック完了しました。~
SIZE(10):2003.08.05 (火) 03:18:57 <Heracules> 2getとXNapの判定はまだ試してません。どなたか試したら報告お願いします(一応、[[24159]]と同等のはずですが)。~
SIZE(10):2003.08.05 (火) 03:20:09 <Heracules> http://cafe-au-lait.ath.cx/files/SlavaDev211112.rar バイナリのみ。~
SIZE(10):2003.08.05 (火) 03:39:46 <Heracules> 本家2.4.1でデフォルトでサポートされてるWinMXHidden等への対応が不完全なので、24159以上に誤判定の可能性があります。~
SIZE(10):2003.08.05 (火) 03:40:11 <Heracules> 2.4.1との差については近いうちに改めて追加パッチをリリースします。~
SIZE(10):2003.08.05 (火) 04:12:19 <Heracules> locPingableがうまく取得できてない模様。2getの判定がMX2.xになる。次のパッチで修正可能なら直す予定。~
&new{2010-03-19 (金) 22:12:49}; COMMENT{<mwiyybu> MIncfmqPdBiWIEXtH}~

#comment
//#comment
shuusei211112:クライアント自動判別機能([[24159]]参照, 移植改変 by Heracules)
 diff --dos -urN 211111/console.pas 211112/console.pas
 --- 211111/console.pas Sun Jul 27 13:47:08 2003
 +++ 211112/console.pas Tue Aug 05 02:40:54 2003
 @@ -474,6 +474,30 @@
          if str<>'' then str:=str+', ';
          str:=str+GetLangI(LNG_LIST_CHATTING);
        end;
 +      if FindLocalUser(user)<>nil then
 +      begin
 +        tmp_pos:=1379;
 +        if TLocalUser(FindLocalUser(user)).softwareID=softWinMXHidden then
 +          if str<>'' then str:=str+', WinMX'
 +        else
 +        {if (TLocalUser(FindLocalUser(user)).softwareID<>softWinMXNormal) and (TLocalUser(FindLocalUser(user)).softwareID<>softWinMXJap) and (not (locPingable in TLocalUser(FindLocalUser(user)).localstate)) and ((current_time-20000)>TLocalUser(FindLocalUser(user)).last_seen) then
 +        begin
 +         if str<>'' then str:=str+', WinMX??';
 +        end;}
 +        if str<>'' then str:=str+', ';
 +        if locPingable in TLocalUser(FindLocalUser(user)).localstate then
 +        begin
 +          if loc326 in TLocalUser(FindLocalUser(user)).detector then str:=str+'2get'
 +          else if loc10300 in TLocalUser(FindLocalUser(user)).detector then str:=str+'XNap';
 +          //else if not (loc208 in TLocalUser(FindLocalUser(user)).detector) then str:=str+'XNap??';
 +        end
 +        else if loc326 in TLocalUser(FindLocalUser(user)).detector then str:=str+'MX2.x'
 +        else if loc110 in TLocalUser(FindLocalUser(user)).detector then str:=str+'Napchan'
 +        else if loc208 in TLocalUser(FindLocalUser(user)).detector then str:=str+'Utatane'
 +        else if locMD5Zeros in TLocalUser(FindLocalUser(user)).detector then str:=str+'Utatane'
 +        else if locMD5NonZero in TLocalUser(FindLocalUser(user)).detector then str:=str+'MX3.x'
 +        else str:=str+'MX3.x??';
 +      end;
        item.SubItems.Add(str);
      end;
    end;
 diff --dos -urN 211111/localusers.pas 211112/localusers.pas
 --- 211111/localusers.pas Tue Jul 22 15:06:40 2003
 +++ 211112/localusers.pas Tue Aug 05 02:41:54 2003
 @@ -26,7 +26,10 @@
   servers, users, registered, lang, slavastrings;
  
  type
 - TLocalUserState = set of (locSwapBytes, locNeedsUpdate, locWriteOnly, locFloodWarning);
 + TLocalUserState = set of (locSwapBytes, locNeedsUpdate, locWriteOnly,
 +   locFloodWarning, locPingable);
 + TLocalUserDetector = set of (loc326, loc110, loc640, loc208,
 +   loc100, loc870, loc10300, locMD5Zero, locMD5NonZero, locMD5Zeros);
   TLocalUser = class(TObject)
    data            : POnlineUser;
    socket          : HSocket;
 @@ -58,6 +61,7 @@
    ratepointcache  : Integer;
    last_channel_time: Integer;
    auto_channel     : Boolean;
 +  detector        : TLocalUserDetector;
    constructor Create;
    destructor Destroy; override;
    function  logged: Boolean;
 @@ -117,6 +121,7 @@
   softwareID:=softUnknown;
   last_channel_time:=3;
   auto_channel:=False;
 + detector:=[];
  {$IFDEF USERS_DOUBLE_QUEUE}
   StrHash_Reset(out_list2);
  {$ENDIF}
 @@ -185,6 +190,8 @@
   wantqueuep3m:=0;
   ratepointcache:=0;
   softwareID:=softUnknown;
 + auto_channel:=False;
 + detector:=[];
  {$IFDEF USERS_DOUBLE_QUEUE}
   StrHash_Clear(out_list2);
  {$ENDIF}
 diff --dos -urN 211111/handler.pas 211112/handler.pas
 --- 211111/handler.pas Wed Jul 30 02:26:24 2003
 +++ 211112/handler.pas Tue Aug 05 03:04:22 2003
 @@ -24,6 +24,7 @@
   constants, users, servers, stypes, blcksock, synsock, localusers, registered,
   slavastrings, class_cmdlist, class_cmdexlist, mmsystem, local2global, mainform;
  
 +function FindLocalUser(data: POnlineUser): TLocalUser; overload;
  function ProcessCommand(usr: TLocalUser; q: TQuery=queryNormal): Boolean;
  procedure ProcessServerCommand(srv: TServer);
  procedure DisconnectUser(usr: TLocalUser; reason, text, sender: String;close_socket: Boolean);
 @@ -1571,6 +1572,9 @@
   if query<>queryNormal then exit;
   if not isLogged then exit;
   if not CheckParams(1) then exit;
 + if gcmd.id=MSG_CLIENT_ADD_HOTLIST_SEQ then
 + if GetTickCount-local.last_seen<30000 then
 +   local.detector:=local.detector+[loc208];
   tmp_pos:=251;
   case gcmd.id of
      MSG_CLIENT_ADD_HOTLIST,
 @@ -1649,6 +1653,8 @@
                                  local.Exec(MSG_SERVER_NOT_IGNORED,gcmd.cmd);
                              end;
      MSG_CLIENT_CLEAR_IGNORE: begin
 +                              if GetTickCount-local.last_seen<30000 then
 +                                local.detector:=local.detector+[loc326];
                                i:=local.ignored.Count;
                                StrHash_Clear(local.ignored);
                                local.Exec(gcmd.id,IntToStr(i));
 @@ -2498,6 +2504,10 @@
      local.Exec(MSG_SERVER_NOSUCH,GetLangT(LNG_SHARE_LARGE,filename));
     exit;
   end;
 + if (dir='') and not valid_dir then local.detector:=local.detector+[loc100];
 + if hlist.Strings[1]='0' then local.detector:=local.detector+[locMD5Zero]
 + else if hlist.Strings[1]='00000000000000000000000000000000' then local.detector:=local.detector+[locMD5Zeros]
 + else local.detector:=local.detector+[locMD5NonZero];
   tmp_pos:=12262;
   if autoban_incomplete then
     if AnsiPos('__INCOMPLETE___',rec.name)<>0 then
 @@ -2563,6 +2573,7 @@
       end;
     exit;
   end;
 + local.detector:=local.detector+[loc870];
   tmp_pos:=302;
   dir:=hlist.Strings[0];
   hlist.Delete(0);
 @@ -2598,6 +2609,10 @@
   if query<>queryNormal then exit;
   if user^.level=napUserLeech then exit;
   if not CheckParams(4) then exit;
 + local.detector:=local.detector+[loc10300];
 + if hlist.Strings[1]='0' then local.detector:=local.detector+[locMD5Zero]
 + else if hlist.Strings[1]='00000000000000000000000000000000' then local.detector:=local.detector+[locMD5Zeros]
 + else local.detector:=local.detector+[locMD5NonZero];
   tmp_pos:=311;
   rec.mime:=StrToType(hlist.Strings[3]);
   if rec.mime=TYPE_INVALID then exit;
 @@ -2684,6 +2699,7 @@
   tmp_pos:=320;
   if not isLocal then exit;
   if not isLogged then exit;
 + if GetTickCount-local.last_seen<30000 then local.detector:=local.detector+[loc110];
   if local.shared=nil then exit;
   if user^.shared=0 then exit;
   tmp_pos:=321;
 @@ -6025,6 +6041,17 @@
    Exec(user2,gcmd.id,user^.nick);
  end;
  
 +procedure Handler_Pong;
 +begin
 + if user^.server=nil then
 +  if (not (locPingable in local.localstate)) and (AnsiLowerCase(gcmd.cmd)='server') then
 +  begin
 +   local.localstate:=local.localstate+[locPingable];
 +   exit;
 +  end;
 + Handler_Relay;
 +end;
 +
  procedure Handler_UserMode;
  var
   st: TUserState;
 @@ -10299,7 +10326,7 @@
     MSG_CLIENT_CHANGE_DATA_PORT        : Handler_SetDataPort; // 703 - change data port
     MSG_CLIENT_PING_SERVER             : Handler_ServerPing; // 750 - ping server
     MSG_CLIENT_PING                    : Handler_Relay2; // 751 - user ping
 -   MSG_CLIENT_PONG                    : Handler_Relay; // 752 - user pong
 +   MSG_CLIENT_PONG                    : Handler_Pong; // 752 - user pong
     MSG_CLIENT_ALTER_PASS              : Handler_AlterPass; // 753 - change password
     MSG_CLIENT_SERVER_RECONFIG         : Handler_Restart; // 800 - reconfig
     MSG_CLIENT_SERVER_VERSION          : Handler_ServerVersion; // 801 - server version
 diff --dos -urN 211111/stypes.pas 211112/stypes.pas
 --- 211111/stypes.pas Fri Aug 01 16:10:11 2003
 +++ 211112/stypes.pas Tue Aug 05 02:54:12 2003
 @@ -1245,7 +1245,7 @@
       end;
     end;
   end;
 - for i:=2 to 5 do
 + for i:=1 to 5 do
     if AnsiPos('$'+IntToStr(i),str)>0 then
     begin
       Result:=false;
 diff --dos -urN 211111/mainform.pas 211112/mainform.pas
 --- 211111/mainform.pas Sun Jul 27 17:01:40 2003
 +++ 211112/mainform.pas Tue Aug 05 02:45:54 2003
 @@ -1559,6 +1559,7 @@
    StrHash_Reset(cons_ignored);
    cons_list:=consFriends;
    cons:=TLocalUser.Create;
 +  cons.localstate:=cons.localstate+[locPingable];
    cons.last_seen:=GetTickCount;
    rec.nick:=ini.ReadString('Console','User','Admin');
    rec.state:=Int2UserState(ini.ReadInteger('Console','UserMode',0),false);