network/transgui: Fix duplicate object status error.

Fix "Duplicate object member: status" error

Thanks to Ku33ma

https://github.com/transmission-remote-gui/transgui/pull/1329

Signed-off-by: Andrew Clemons <andrew.clemons@gmail.com>

Signed-off-by: Willy Sudiarto Raharjo <willysr@slackbuilds.org>
This commit is contained in:
Jeremy Hansen 2023-03-29 20:17:00 -07:00 committed by Willy Sudiarto Raharjo
parent 2b2a4fb056
commit aec811a4c3
No known key found for this signature in database
GPG Key ID: 3F617144D7238786
2 changed files with 56 additions and 2 deletions

View File

@ -0,0 +1,49 @@
From 8d63a310cbdc99ff8d565e2429c0740a8be5c3cb Mon Sep 17 00:00:00 2001
From: Kuzz <Kuzz@ThinkPad.localdomain>
Date: Wed, 29 Jul 2020 21:24:21 +0300
Subject: [PATCH] Deduplicate RequestInfo params. #1325
---
rpc.pas | 17 ++++++++++++++---
1 file changed, 14 insertions(+), 3 deletions(-)
diff --git a/rpc.pas b/rpc.pas
index 2cbfeee0..7f9254c8 100644
--- a/rpc.pas
+++ b/rpc.pas
@@ -816,21 +816,32 @@ function TRpc.RequestInfo(TorrentId: integer; const Fields: array of const; cons
req, args: TJSONObject;
_fields: TJSONArray;
i: integer;
+ sl: TStringList;
begin
Result:=nil;
req:=TJSONObject.Create;
+ sl:=TStringList.Create;
try
req.Add('method', 'torrent-get');
args:=TJSONObject.Create;
if TorrentId <> 0 then
args.Add('ids', TJSONArray.Create([TorrentId]));
- _fields:=TJSONArray.Create(Fields);
- for i:=Low(ExtraFields) to High(ExtraFields) do
- _fields.Add(ExtraFields[i]);
+ _fields:=TJSONArray.Create;
+ for i:=Low(Fields) to High(Fields) do
+ if (Fields[i].VType=vtAnsiString) then
+ sl.Add(String(Fields[i].VAnsiString));
+ sl.AddStrings(ExtraFields);
+ sl.Sort;
+ for i:=sl.Count-2 downto 0 do
+ if (sl[i]=sl[i+1]) then
+ sl.Delete(i+1);
+ for i:=0 to sl.Count-1 do
+ _fields.Add(sl[i]);
args.Add('fields', _fields);
req.Add('arguments', args);
Result:=SendRequest(req);
finally
+ sl.Free;
req.Free;
end;
end;

View File

@ -2,7 +2,7 @@
# Slackware build script for transgui # Slackware build script for transgui
# Copyright 2016-2019 Jeremy Brent Hansen <jebrhansen+SBo -at- gmail.com> # Copyright 2016-2023 Jeremy Brent Hansen <jebrhansen+SBo -at- gmail.com>
# All rights reserved. # All rights reserved.
# #
# Redistribution and use of this script, with or without modification, is # Redistribution and use of this script, with or without modification, is
@ -26,7 +26,7 @@ cd $(dirname $0) ; CWD=$(pwd)
PRGNAM=transgui PRGNAM=transgui
VERSION=${VERSION:-5.18.0} VERSION=${VERSION:-5.18.0}
BUILD=${BUILD:-1} BUILD=${BUILD:-2}
TAG=${TAG:-_SBo} TAG=${TAG:-_SBo}
PKGTYPE=${PKGTYPE:-tgz} PKGTYPE=${PKGTYPE:-tgz}
@ -79,6 +79,11 @@ find -L . \
\( -perm 666 -o -perm 664 -o -perm 640 -o -perm 600 -o -perm 444 \ \( -perm 666 -o -perm 664 -o -perm 640 -o -perm 600 -o -perm 444 \
-o -perm 440 -o -perm 400 \) -exec chmod 644 {} \; -o -perm 440 -o -perm 400 \) -exec chmod 644 {} \;
# Fix "Duplicate object member: status" error
# Thanks to Ku33ma
# https://github.com/transmission-remote-gui/transgui/pull/1329
patch -p1 < $CWD/dup-obj-status.patch
# Build transgui # Build transgui
lazbuild "transgui.lpi" --lazarusdir=/usr/share/lazarus --widgetset=gtk2 lazbuild "transgui.lpi" --lazarusdir=/usr/share/lazarus --widgetset=gtk2