diff --git a/plugins/TorrentPeers/__init__.py b/plugins/TorrentPeers/__init__.py
index ee7188a..64a1f67 100644
a
|
b
|
class TorrentPeers:
|
89 | 89 | |
90 | 90 | self.tab_peers = PeersTabManager(tree_view, core) |
91 | 91 | self.tab_peers.build_peers_view() |
| 92 | self.tab_peers.build_popup() |
92 | 93 | |
93 | 94 | self.config_updated() |
94 | 95 | |
diff --git a/plugins/TorrentPeers/tab_peers.py b/plugins/TorrentPeers/tab_peers.py
index d181aaa..38b9d65 100644
a
|
b
|
class PeersTabManager(object):
|
59 | 59 | str, str, float, int, int) |
60 | 60 | # Stores IP -> gtk.TreeIter's iter mapping for quick look up |
61 | 61 | # in update_torrent_info_widget |
62 | | self.peer_store_dict = {} |
| 62 | self.peer_store_dict = {} |
63 | 63 | self._cached_flags = {} |
64 | 64 | self.show_flags = None |
65 | 65 | self.flag_size = "" |
… |
… |
class PeersTabManager(object):
|
91 | 91 | up = dgtk.add_func_column(self.peer_view, _("Up Speed"), |
92 | 92 | dgtk.cell_data_speed, 6, width=115) |
93 | 93 | |
| 94 | def build_popup(self): |
| 95 | menu = gtk.Menu() |
| 96 | menuItem = gtk.MenuItem("Block user for this session") |
| 97 | menuItem.connect("button-release-event", self.cb_block_user) |
| 98 | menu.append(menuItem) |
| 99 | menu.show_all() |
| 100 | self.menu = menu |
| 101 | self.peer_view.connect("button-release-event", self.cb_view_popup) |
| 102 | |
| 103 | def cb_block_user(self, widget, event): |
| 104 | sel = self.peer_view.get_selection() |
| 105 | (model, iter) = sel.get_selected() |
| 106 | # FIXME |
| 107 | # How to get the column by name? |
| 108 | # It is possible that the user moved the IP Address column |
| 109 | str_ip = model.get_value(iter, 2) |
| 110 | self.manager.add_range_to_ip_filter(str_ip, str_ip) |
| 111 | self.manager.set_ip_filter() |
| 112 | print "Block IP: %s" % str_ip |
| 113 | |
| 114 | def cb_view_popup(self, widget, event): |
| 115 | if (event.button != 3): |
| 116 | return |
| 117 | self.menu.popup(None, None, None, event.button, event.time) |
| 118 | |
94 | 119 | def enable_flags(self): |
95 | 120 | self.show_flags = True |
96 | 121 | |
diff --git a/src/deluge_core.cpp b/src/deluge_core.cpp
index 64f79a1..bb20b1d 100644
a
|
b
|
timeinfo = localtime(&rawtime);
|
2089 | 2089 | std::cout << asctime(timeinfo) << " torrent_add_range_to_IP_filter()" << std::endl; |
2090 | 2090 | #endif |
2091 | 2091 | if (M_the_filter == NULL) { |
2092 | | RAISE_PTR(DelugeError, "No filter defined, use reset_IP_filter"); |
| 2092 | M_the_filter = new ip_filter(); |
2093 | 2093 | } |
2094 | 2094 | |
2095 | 2095 | char *start, *end; |
… |
… |
timeinfo = localtime(&rawtime);
|
2113 | 2113 | std::cout << asctime(timeinfo) << " torrent_set_IP_filter()" << std::endl; |
2114 | 2114 | #endif |
2115 | 2115 | if (M_the_filter == NULL) { |
2116 | | RAISE_PTR(DelugeError, "No filter defined, use reset_IP_filter"); |
| 2116 | M_the_filter = new ip_filter(); |
2117 | 2117 | } |
| 2118 | |
2118 | 2119 | M_ses->set_ip_filter(*M_the_filter); |
2119 | 2120 | |
2120 | 2121 | Py_INCREF(Py_None); return Py_None; |