shuusei24113:ユーザーリストのコラムを追加。共有サイズ/平均サイズ/DL/UL/合計DL/合計UL

diff --dos -urN 24112/console.pas 24113/console.pas
--- 24112/console.pas	Tue Jan 28 20:44:06 2003
+++ 24113/console.pas	Tue Jan 28 22:59:40 2003
@@ -434,7 +434,7 @@
 
 procedure ConsoleListUsers;
 var
- i,j: Integer;
+ i,j,k: Integer;
  user: POnlineUser;
  localuser: TLocalUser;
  item: TListItem;
@@ -475,16 +475,38 @@
       item.Caption:=user^.username;
       item.SubItems.Add(Level2Str(user^.level));
       item.SubItems.Add(IntToStr(user^.shared));
+      if user^.server=nil then begin//local user
+        for k:=0 to db_local.Count-1 do
+          if lowercase(TlocalUser(db_local.Items[k]).nick)=lowercase(user^.username) then
+          begin
+            localuser:=db_local.Items[k];
+            item.SubItems.Add(IntToStr(localuser.shared_size div (1024*1024)));
+            if user^.shared>0 then
+              item.SubItems.Add(IntToStr(localuser.shared_size div user^.shared div (1024*1024)))
+            else
+              item.SubItems.Add('0');
+            break;
+          end;
+      end
+      else//remote user
+      begin
+        item.SubItems.Add('remote');
+        item.SubItems.Add('remote');
+      end;
       item.SubItems.Add(user^.software);
       item.SubItems.Add(Speed2Str(user^.speed));
       item.SubItems.Add(decode_ip(user^.ip));
       item.SubItems.Add(IntToStr(user^.dataport));
       item.SubItems.Add(Time2Str(current_time_t-user^.last_seen_t));
+      item.SubItems.Add(IntToStr(user^.uploads));
+      item.SubItems.Add(IntToStr(user^.downloads));
       str:=IntToStr(user^.uploads);
       if user^.max_up<>-1 then
        str:=str+' ('+IntToStr(user^.max_up)+' max)';
       str:=str+' / '+IntToStr(user^.downloads);
       item.SubItems.Add(str);
+      item.SubItems.Add(IntToStr(user^.total_up));
+      item.SubItems.Add(IntToStr(user^.total_down));
       item.SubItems.Add(IntToStr(user^.total_up)+' / '+IntToStr(user^.total_down));
       item.SubItems.Add(GetServerName(user^.server));
       str:='';
diff --dos -urN 24112/constants.pas 24113/constants.pas
--- 24112/constants.pas	Tue Jan 28 15:09:44 2003
+++ 24113/constants.pas	Tue Jan 28 23:03:00 2003
@@ -168,15 +168,21 @@
  // users list items
  UL_LEVEL                     = 0;
  UL_SHARED                    = 1;
- UL_SOFT                      = 2;
- UL_SPEED                     = 3;
- UL_IP                        = 4;
- UL_PORT                      = 5;
- UL_TIME                      = 6;
- UL_TRANSFERS                 = 7;
- UL_TTRANSFERS                = 8;
- UL_SERVER                    = 9;
- UL_STATUS                    = 10;
+ UL_SIZE                      = 2;
+ UL_AVERAGE                   = 3;
+ UL_SOFT                      = 4;
+ UL_SPEED                     = 5;
+ UL_IP                        = 6;
+ UL_PORT                      = 7;
+ UL_TIME                      = 8;
+ UL_UP                        = 9;
+ UL_DOWN                      = 10;
+ UL_TRANSFERS                 = 11;
+ UL_TUP                       = 12;
+ UL_TDOWN                     = 13;
+ UL_TTRANSFERS                = 14;
+ UL_SERVER                    = 15;
+ UL_STATUS                    = 16;
 
 MSG_SERVER_ERROR		= 0;
 MSG_CLIENT_LOGIN		= 2;
diff --dos -urN 24112/mainform.dfm 24113/mainform.dfm
--- 24112/mainform.dfm	Tue Jan 28 01:55:34 2003
+++ 24113/mainform.dfm	Tue Jan 28 23:35:20 2003
@@ -1067,11 +1067,19 @@
                   Width = 80
                 end
                 item
-                  Alignment = taCenter
+                  Alignment = taRightJustify
                   Caption = 'Shared'
                   Width = 60
                 end
                 item
+                  Alignment = taRightJustify
+                  Caption = 'Size'
+                end
+                item
+                  Alignment = taRightJustify
+                  Caption = 'Average'
+                end
+                item
                   AutoSize = True
                   Caption = 'Software'
                 end
@@ -1096,11 +1104,27 @@
                   Width = 60
                 end
                 item
+                  Alignment = taRightJustify
+                  Caption = 'Up'
+                end
+                item
+                  Alignment = taRightJustify
+                  Caption = 'Down'
+                end
+                item
                   Alignment = taCenter
                   AutoSize = True
                   Caption = 'Up/Down'
                 end
                 item
+                  Alignment = taRightJustify
+                  Caption = 'TotalUp'
+                end
+                item
+                  Alignment = taRightJustify
+                  Caption = 'TotalDown'
+                end
+                item
                   Alignment = taCenter
                   AutoSize = True
                   Caption = 'Total Up/Down'
@@ -3861,6 +3885,18 @@
       OnDrawItem = DrawPopupItem
       OnMeasureItem = MeasurePopupItem
     end
+    object mnu_um_size: TMenuItem
+      Caption = 'size'
+      OnClick = mnu_um_click
+      OnDrawItem = DrawPopupItem
+      OnMeasureItem = MeasurePopupItem
+    end
+    object mnu_um_average: TMenuItem
+      Caption = 'average'
+      OnClick = mnu_um_click
+      OnDrawItem = DrawPopupItem
+      OnMeasureItem = MeasurePopupItem
+    end
     object mnu_um_soft: TMenuItem
       Caption = 'soft'
       OnClick = mnu_um_click
@@ -3891,8 +3927,32 @@
       OnDrawItem = DrawPopupItem
       OnMeasureItem = MeasurePopupItem
     end
+    object mnu_um_up: TMenuItem
+      Caption = 'up'
+      OnClick = mnu_um_click
+      OnDrawItem = DrawPopupItem
+      OnMeasureItem = MeasurePopupItem
+    end
+    object mnu_um_down: TMenuItem
+      Caption = 'down'
+      OnClick = mnu_um_click
+      OnDrawItem = DrawPopupItem
+      OnMeasureItem = MeasurePopupItem
+    end
     object mnu_um_transfers: TMenuItem
       Caption = 'transfers'
+      OnClick = mnu_um_click
+      OnDrawItem = DrawPopupItem
+      OnMeasureItem = MeasurePopupItem
+    end
+    object mnu_um_totalup: TMenuItem
+      Caption = 'totalup'
+      OnClick = mnu_um_click
+      OnDrawItem = DrawPopupItem
+      OnMeasureItem = MeasurePopupItem
+    end
+    object mnu_um_totaldown: TMenuItem
+      Caption = 'totaldown'
       OnClick = mnu_um_click
       OnDrawItem = DrawPopupItem
       OnMeasureItem = MeasurePopupItem
diff --dos -urN 24112/mainform.pas 24113/mainform.pas
--- 24112/mainform.pas	Tue Jan 28 22:46:46 2003
+++ 24113/mainform.pas	Tue Jan 28 23:23:10 2003
@@ -400,6 +400,12 @@
     edit_unban_reason: TEdit;
     btn_reg_unregister: TSpeedButton;
     mnu_reg_unregister: TMenuItem;
+    mnu_um_size: TMenuItem;
+    mnu_um_average: TMenuItem;
+    mnu_um_up: TMenuItem;
+    mnu_um_down: TMenuItem;
+    mnu_um_totalup: TMenuItem;
+    mnu_um_totaldown: TMenuItem;
     procedure FormCreate(Sender: TObject);
     procedure FormCloseQuery(Sender: TObject; var CanClose: Boolean);
     procedure FormClose(Sender: TObject; var Action: TCloseAction);
@@ -1016,12 +1022,18 @@
   for i:=0 to 30 do isHide[i]:=false;
   if ini.ReadBool('Interface','UsersListHideLevel',false) then begin isHide[UL_LEVEL+1]:=true; SetColumnVisible(list_users,UL_LEVEL+1,0,false); end;
   if ini.ReadBool('Interface','UsersListHideShared',false) then begin isHide[UL_SHARED+1]:=true; SetColumnVisible(list_users,UL_SHARED+1,0,false); end;
+  if ini.ReadBool('Interface','UsersListHideSize',true) then begin isHide[UL_SIZE+1]:=true; SetColumnVisible(list_users,UL_SIZE+1,0,false); end;
+  if ini.ReadBool('Interface','UsersListHideAverage',true) then begin isHide[UL_AVERAGE+1]:=true; SetColumnVisible(list_users,UL_AVERAGE+1,0,false); end;
   if ini.ReadBool('Interface','UsersListHideSoft',false) then begin isHide[UL_SOFT+1]:=true; SetColumnVisible(list_users,UL_SOFT+1,0,false); end;
   if ini.ReadBool('Interface','UsersListHideSpeed',false) then begin isHide[UL_SPEED+1]:=true; SetColumnVisible(list_users,UL_SPEED+1,0,false); end;
   if ini.ReadBool('Interface','UsersListHideIP',false) then begin isHide[UL_IP+1]:=true; SetColumnVisible(list_users,UL_IP+1,0,false); end;
   if ini.ReadBool('Interface','UsersListHidePort',true) then begin isHide[UL_PORT+1]:=true; SetColumnVisible(list_users,UL_PORT+1,0,false); end;
   if ini.ReadBool('Interface','UsersListHideTime',true) then begin isHide[UL_TIME+1]:=true; SetColumnVisible(list_users,UL_TIME+1,0,false); end;
+  if ini.ReadBool('Interface','UsersListHideUp',true) then begin isHide[UL_UP+1]:=true; SetColumnVisible(list_users,UL_UP+1,0,false); end;
+  if ini.ReadBool('Interface','UsersListHideDown',true) then begin isHide[UL_DOWN+1]:=true; SetColumnVisible(list_users,UL_DOWN+1,0,false); end;
   if ini.ReadBool('Interface','UsersListHideTransfers',true) then begin isHide[UL_TRANSFERS+1]:=true; SetColumnVisible(list_users,UL_TRANSFERS+1,0,false); end;
+  if ini.ReadBool('Interface','UsersListHideTotalUp',true) then begin isHide[UL_TUP+1]:=true; SetColumnVisible(list_users,UL_TUP+1,0,false); end;
+  if ini.ReadBool('Interface','UsersListHideTotalDown',true) then begin isHide[UL_TDOWN+1]:=true; SetColumnVisible(list_users,UL_TDOWN+1,0,false); end;
   if ini.ReadBool('Interface','UsersListHideTotal',true) then begin isHide[UL_TTRANSFERS+1]:=true; SetColumnVisible(list_users,UL_TTRANSFERS+1,0,false); end;
   if ini.ReadBool('Interface','UsersListHideServer',false) then begin isHide[UL_SERVER+1]:=true; SetColumnVisible(list_users,UL_SERVER+1,0,false); end;
   // colors
@@ -1485,12 +1497,18 @@
   ini.WriteString('Interface','AwayMessage',edit_log_away.Text);
   ini.WriteBool('Interface','UsersListHideLevel',not isColumnVisible(list_users,UL_LEVEL+1));
   ini.WriteBool('Interface','UsersListHideShared',not isColumnVisible(list_users,UL_SHARED+1));
+  ini.WriteBool('Interface','UsersListHideSize',not isColumnVisible(list_users,UL_SIZE+1));
+  ini.WriteBool('Interface','UsersListHideAverage',not isColumnVisible(list_users,UL_AVERAGE+1));
   ini.WriteBool('Interface','UsersListHideSoft',not isColumnVisible(list_users,UL_SOFT+1));
   ini.WriteBool('Interface','UsersListHideSpeed',not isColumnVisible(list_users,UL_SPEED+1));
   ini.WriteBool('Interface','UsersListHideIP',not isColumnVisible(list_users,UL_IP+1));
   ini.WriteBool('Interface','UsersListHidePort',not isColumnVisible(list_users,UL_PORT+1));
   ini.WriteBool('Interface','UsersListHideTime',not isColumnVisible(list_users,UL_TIME+1));
+  ini.WriteBool('Interface','UsersListHideUp',not isColumnVisible(list_users,UL_UP+1));
+  ini.WriteBool('Interface','UsersListHideDown',not isColumnVisible(list_users,UL_DOWN+1));
   ini.WriteBool('Interface','UsersListHideTransfers',not isColumnVisible(list_users,UL_TRANSFERS+1));
+  ini.WriteBool('Interface','UsersListHideTotalUp',not isColumnVisible(list_users,UL_TUP+1));
+  ini.WriteBool('Interface','UsersListHideTotalDown',not isColumnVisible(list_users,UL_TDOWN+1));
   ini.WriteBool('Interface','UsersListHideTotal',not isColumnVisible(list_users,UL_TTRANSFERS+1));
   ini.WriteBool('Interface','UsersListHideServer',not isColumnVisible(list_users,UL_SERVER+1));
   // colors
@@ -1940,11 +1958,17 @@
  mnu_um_level.Caption:=GetLangI(LNG_LIST_MNU2_LEVEL);
  mnu_um_shared.Caption:=GetLangI(LNG_LIST_MNU2_SHARED);
  mnu_um_soft.Caption:=GetLangI(LNG_LIST_MNU2_SOFT);
+ mnu_um_size.Caption:='共有ファイルサイズ(Mb)を表示';
+ mnu_um_average.Caption:='平均ファイルサイズ(Mb)を表示';
  mnu_um_speed.Caption:=GetLangI(LNG_LIST_MNU2_SPEED);
  mnu_um_ip.Caption:=GetLangI(LNG_LIST_MNU2_IP);
  mnu_um_port.Caption:=GetLangI(LNG_LIST_MNU2_PORT);
  mnu_um_time.Caption:=GetLangI(LNG_LIST_MNU2_TIME);
+ mnu_um_up.Caption:='アップロード数を表示';
+ mnu_um_down.Caption:='ダウンロード数を表示';
  mnu_um_transfers.Caption:=GetLangI(LNG_LIST_MNU2_TRANSFERS);
+ mnu_um_totalup.Caption:='アップロードの合計を表示';
+ mnu_um_totaldown.Caption:='ダウンロードの合計を表示';
  mnu_um_total.Caption:=GetLangI(LNG_LIST_MNU2_TOTAL);
  mnu_um_server.Caption:=GetLangI(LNG_LIST_MNU2_SERVER);
  // toolbar
@@ -2016,12 +2040,18 @@
    Items[0].Caption:=GetLangI(LNG_LIST_HEADER_NAME);
    Items[UL_LEVEL+1].Caption:=GetLangI(LNG_LIST_HEADER_LEVEL);
    Items[UL_SHARED+1].Caption:=GetLangI(LNG_LIST_HEADER_SHARED);
+   Items[UL_SIZE+1].Caption:='サイズ(Mb)';
+   Items[UL_AVERAGE+1].Caption:='平均サイズ(Mb)';
    Items[UL_SOFT+1].Caption:=GetLangI(LNG_LIST_HEADER_SOFTWARE);
    Items[UL_SPEED+1].Caption:=GetLangI(LNG_LIST_HEADER_SPEED);
    Items[UL_IP+1].Caption:=GetLangI(LNG_LIST_HEADER_IP);
    Items[UL_PORT+1].Caption:=GetLangI(LNG_LIST_HEADER_PORT);
    Items[UL_TIME+1].Caption:=GetLangI(LNG_LIST_HEADER_TIME);
+   Items[UL_UP+1].Caption:='UL';
+   Items[UL_DOWN+1].Caption:='DL';
    Items[UL_TRANSFERS+1].Caption:=GetLangI(LNG_LIST_HEADER_TRANSFERS);
+   Items[UL_TUP+1].Caption:='合計UL';
+   Items[UL_TDOWN+1].Caption:='合計DL';
    Items[UL_TTRANSFERS+1].Caption:=GetLangI(LNG_LIST_HEADER_TOTAL);
    Items[UL_SERVER+1].Caption:=GetLangI(LNG_LIST_HEADER_SERVER);
    Items[UL_STATUS+1].Caption:='';
@@ -2806,16 +2836,23 @@
     else
       case i of
         0 : list.Columns.Items[i].Width:=120;
-        UL_LEVEL+1 : list.Columns.Items[i].Width:=80;
-        UL_SHARED+1 : list.Columns.Items[i].Width:=60;
-        UL_SOFT+1 : list.Columns.Items[i].Width:=50;
-        UL_SPEED+1 : list.Columns.Items[i].Width:=75;
-        UL_IP+1 : list.Columns.Items[i].Width:=80;
-        UL_PORT+1 : list.Columns.Items[i].Width:=40;
-        UL_TIME+1 : list.Columns.Items[i].Width:=60;
-        UL_TRANSFERS+1 : list.Columns.Items[i].Width:=50;
+        UL_LEVEL+1      : list.Columns.Items[i].Width:=80;
+        UL_SHARED+1     : list.Columns.Items[i].Width:=60;
+        UL_SIZE+1       : list.Columns.Items[i].Width:=60;
+        UL_AVERAGE+1    : list.Columns.Items[i].Width:=60;
+        UL_SOFT+1       : list.Columns.Items[i].Width:=50;
+        UL_SPEED+1      : list.Columns.Items[i].Width:=75;
+        UL_IP+1         : list.Columns.Items[i].Width:=80;
+        UL_PORT+1       : list.Columns.Items[i].Width:=40;
+        UL_TIME+1       : list.Columns.Items[i].Width:=60;
+        UL_UP+1         : list.Columns.Items[i].Width:=30;
+        UL_DOWN+1       : list.Columns.Items[i].Width:=30;
+        UL_TRANSFERS+1  : list.Columns.Items[i].Width:=50;
+        UL_TUP+1        : list.Columns.Items[i].Width:=50;
+        UL_TDOWN+1      : list.Columns.Items[i].Width:=50;
         UL_TTRANSFERS+1 : list.Columns.Items[i].Width:=50;
-        UL_SERVER+1 : list.Columns.Items[i].Width:=50;
+        UL_SERVER+1     : list.Columns.Items[i].Width:=50;
+        17              : list.Columns.Items[i].Width:=50;
        else break;
      end;
   inc(w,list.Columns.Items[i].Width);
@@ -2935,10 +2972,16 @@
  else if (list=list_registered) and (index=4) then Result:=CompareDate(str1,str2)
  else if (list=list_users) and (index=UL_LEVEL+1) then Result:=CompareLevel(str1,str2)
  else if (list=list_users) and (index=UL_SHARED+1) then Result:=CompareDigit(str1,str2)
+ else if (list=list_users) and (index=UL_SIZE+1) then Result:=CompareDigit(str1,str2)
+ else if (list=list_users) and (index=UL_AVERAGE+1) then Result:=CompareDigit(str1,str2)
  else if (list=list_users) and (index=UL_SPEED+1) then Result:=CompareSpeed(str1,str2)
  else if (list=list_users) and (index=UL_IP+1) then Result:=CompareIP(str1,str2)
  else if (list=list_users) and (index=UL_PORT+1) then Result:=CompareDigit(str1,str2)
  else if (list=list_users) and (index=UL_TIME+1) then Result:=CompareTime(str1,str2)
+ else if (list=list_users) and (index=UL_UP+1) then Result:=CompareDigit(str1,str2)
+ else if (list=list_users) and (index=UL_DOWN+1) then Result:=CompareDigit(str1,str2)
+ else if (list=list_users) and (index=UL_TUP+1) then Result:=CompareDigit(str1,str2)
+ else if (list=list_users) and (index=UL_TDOWN+1) then Result:=CompareDigit(str1,str2)
  else if (list=list_users) and (index=12) then Result:=CompareDigit(str1,str2)
  else if (list=list_channels) and (index=1) then Result:=CompareDigit(str1,str2)
  else if (list=list_channels) and (index=2) then Result:=CompareDigit(str1,str2)
@@ -4489,12 +4532,18 @@
 begin
  if Sender=mnu_um_level then n:=UL_LEVEL+1
  else if Sender=mnu_um_shared then n:=UL_SHARED+1
+ else if Sender=mnu_um_size then n:=UL_SIZE+1
+ else if Sender=mnu_um_average then n:=UL_AVERAGE+1
  else if Sender=mnu_um_soft then n:=UL_SOFT+1
  else if Sender=mnu_um_speed then n:=UL_SPEED+1
  else if Sender=mnu_um_ip then n:=UL_IP+1
  else if Sender=mnu_um_port then n:=UL_PORT+1
  else if Sender=mnu_um_time then n:=UL_TIME+1
+ else if Sender=mnu_um_up then n:=UL_UP+1
+ else if Sender=mnu_um_down then n:=UL_DOWN+1
  else if Sender=mnu_um_transfers then n:=UL_TRANSFERS+1
+ else if Sender=mnu_um_totalup then n:=UL_TUP+1
+ else if Sender=mnu_um_totaldown then n:=UL_TDOWN+1
  else if Sender=mnu_um_total then n:=UL_TTRANSFERS+1
  else if Sender=mnu_um_server then n:=UL_SERVER+1
  else exit;
@@ -4506,12 +4555,18 @@
  w:=0;
  if Sender=mnu_um_level then w:=80
  else if Sender=mnu_um_shared then w:=60
+ else if Sender=mnu_um_size then w:=60
+ else if Sender=mnu_um_average then w:=60
  else if Sender=mnu_um_soft then w:=0
  else if Sender=mnu_um_speed then w:=75
  else if Sender=mnu_um_ip then w:=80
  else if Sender=mnu_um_port then w:=40
  else if Sender=mnu_um_time then w:=60
+ else if Sender=mnu_um_up then w:=30
+ else if Sender=mnu_um_down then w:=30
  else if Sender=mnu_um_transfers then w:=0
+ else if Sender=mnu_um_totalup then w:=50
+ else if Sender=mnu_um_totaldown then w:=50
  else if Sender=mnu_um_total then w:=0
  else if Sender=mnu_um_server then w:=0;
  if w=0 then
@@ -4527,12 +4582,18 @@
 begin
  mnu_um_level.Checked:=isColumnVisible(list_users,UL_LEVEL+1);
  mnu_um_shared.Checked:=isColumnVisible(list_users,UL_SHARED+1);
+ mnu_um_size.Checked:=isColumnVisible(list_users,UL_SIZE+1);
+ mnu_um_average.Checked:=isColumnVisible(list_users,UL_AVERAGE+1);
  mnu_um_soft.Checked:=isColumnVisible(list_users,UL_SOFT+1);
  mnu_um_speed.Checked:=isColumnVisible(list_users,UL_SPEED+1);
  mnu_um_ip.Checked:=isColumnVisible(list_users,UL_IP+1);
  mnu_um_port.Checked:=isColumnVisible(list_users,UL_PORT+1);
  mnu_um_time.Checked:=isColumnVisible(list_users,UL_TIME+1);
+ mnu_um_up.Checked:=isColumnVisible(list_users,UL_UP+1);
+ mnu_um_down.Checked:=isColumnVisible(list_users,UL_DOWN+1);
  mnu_um_transfers.Checked:=isColumnVisible(list_users,UL_TRANSFERS+1);
+ mnu_um_totalup.Checked:=isColumnVisible(list_users,UL_TUP+1);
+ mnu_um_totaldown.Checked:=isColumnVisible(list_users,UL_TDOWN+1);
  mnu_um_total.Checked:=isColumnVisible(list_users,UL_TTRANSFERS+1);
  mnu_um_server.Checked:=isColumnVisible(list_users,UL_SERVER+1);
 end;