[gtorrentviewer: 6/6] Improve tracker support (#674726)

Paul Howarth pghmcfc at fedoraproject.org
Thu Feb 3 12:52:12 UTC 2011


commit 1dfa1348144d6d2f21b217b087c4ddd830fccf8a
Author: Paul Howarth <paul at city-fan.org>
Date:   Thu Feb 3 12:51:34 2011 +0000

    Improve tracker support (#674726)

 .gitignore                               |    2 +-
 gtorrentviewer-0.2b-trackerdetails.patch |   56 ++++++++++++++++++++++++++++++
 gtorrentviewer.spec                      |    9 ++++-
 3 files changed, 65 insertions(+), 2 deletions(-)
---
diff --git a/.gitignore b/.gitignore
index 0d62612..a3b7e56 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1 +1 @@
-GTorrentViewer-0.2b.tar.gz
+/GTorrentViewer-0.2b.tar.gz
diff --git a/gtorrentviewer-0.2b-trackerdetails.patch b/gtorrentviewer-0.2b-trackerdetails.patch
new file mode 100644
index 0000000..dbdb68d
--- /dev/null
+++ b/gtorrentviewer-0.2b-trackerdetails.patch
@@ -0,0 +1,56 @@
+diff --git a/src/main.c b/src/main.c
+index fc51205..a770768 100644
+--- a/src/main.c
++++ b/src/main.c
+@@ -336,12 +336,8 @@ tracker_scrape(gpointer tracker)
+     SHA1((guint8*)string, number, (guint8*)torrent_sha);
+     g_free(string);
+ 
+-    if(g_str_has_suffix((gchar*)tracker, "info_hash="))
+-      string = util_convert_to_hex(torrent_sha, SHA_DIGEST_LENGTH, "%"); 
+-    else
+-      string = g_strdup(" ");
+-
+-    host = g_strdup_printf("%s%s", (gchar*)tracker, string);
++    string = util_convert_to_hex(torrent_sha, SHA_DIGEST_LENGTH, "%");
++    host = g_strdup_printf("%s?info_hash=%s", (gchar*)tracker, string);
+     g_free(string);
+ 
+     string = g_strrstr(host, "announce");
+diff --git a/src/mainwindow.c b/src/mainwindow.c
+index 6b1bbf0..415098e 100644
+--- a/src/mainwindow.c
++++ b/src/mainwindow.c
+@@ -421,23 +421,23 @@ mainwindow_fill_trackers_tab(MainWindow const *mwin, BencNode *torrent)
+ 
+   gtk_combo_box_set_active(mwin->TrackerComboBox, -1); 
+ 
++  node = benc_node_find_key(torrent, "announce");
++  gtk_list_store_append(liststore, &iter);
++  gtk_list_store_set(liststore, &iter, 0, benc_node_data(node), -1);
++
+   node = benc_node_find_key(torrent, "announce-list");
+-  if(node == NULL) /* no multi-tracker */
+-  {
+-    node = benc_node_find_key(torrent, "announce");
+-    gtk_list_store_append(liststore, &iter);
+-    gtk_list_store_set(liststore, &iter, 0, benc_node_data(node), -1);
+-  }
+-  else /* multi-tracker  support */
++  if(node != NULL) /* multi-tracker support */
+   {
+-    node = benc_node_first_child(node);
+-    if(node != NULL)
++    for (node = benc_node_first_child(node); node != NULL;
++         node = benc_node_next_sibling(node))
++    {
+       for(subnode = benc_node_first_child(node); subnode != NULL; 
+           subnode = benc_node_next_sibling(subnode))
+       {
+         gtk_list_store_append(liststore, &iter);
+         gtk_list_store_set(liststore, &iter, 0, benc_node_data(subnode), -1);
+       }
++    }
+   }
+   
+   gtk_combo_box_set_model(mwin->TrackerComboBox, GTK_TREE_MODEL(liststore));
diff --git a/gtorrentviewer.spec b/gtorrentviewer.spec
index f9737b4..936cf73 100644
--- a/gtorrentviewer.spec
+++ b/gtorrentviewer.spec
@@ -1,6 +1,6 @@
 Name:		gtorrentviewer
 Version:	0.2b
-Release:	20%{?dist}
+Release:	21%{?dist}
 Summary:	A GTK2-based viewer and editor for BitTorrent meta files
 Group:		Applications/Internet
 License:	GPL+
@@ -9,6 +9,7 @@ Source0:	http://downloads.sf.net/gtorrentviewer/GTorrentViewer-%{version}.tar.gz
 Patch0:		gtorrentviewer-0.2b-desktop.patch
 Patch1:		gtorrentviewer-0.2b-dso-linking.patch
 Patch2:		GTorrentViewer-0.2b-tracker-details-refresh.patch
+Patch3:		gtorrentviewer-0.2b-trackerdetails.patch
 BuildRoot:	%{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
 BuildRequires:	curl-devel, gtk2-devel >= 2.4, desktop-file-utils, gettext, intltool
 
@@ -34,6 +35,9 @@ download.
 # Fix crash due to use of uninitialized GValue (#542502, #572806)
 %patch2 -p1
 
+# Improve tracker support (#674726)
+%patch3 -p1
+
 %build
 %configure
 %{__make} %{?_smp_mflags}
@@ -69,6 +73,9 @@ download.
 %{_mandir}/man1/gtorrentviewer.1*
 
 %changelog
+* Thu Feb  3 2011 Paul Howarth <paul at city-fan.org> 0.2b-21
+- Improve tracker support (#674726)
+
 * Fri Jun 25 2010 Paul Howarth <paul at city-fan.org> 0.2b-20
 - Fix crash when "Refresh" button in "Tracker Details" tab is pressed
   (#542502, #572806)


More information about the scm-commits mailing list