summaryrefslogtreecommitdiffstats
path: root/network/gtorrentviewer/patches/gtorrentviewer-0.2b-trackerdetails.patch
blob: dbdb68d62cc5825ca208d031b6088bb6054eb57d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
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));