From 219be3f440ea28870a87547441a6e73cb5da97fc Mon Sep 17 00:00:00 2001 From: Marcos Pinto Date: Sat, 18 Oct 2008 04:48:38 +0000 Subject: [PATCH] account for ipv6 brackets [ip:ip:ip]:port --- deluge/ui/gtkui/common.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/deluge/ui/gtkui/common.py b/deluge/ui/gtkui/common.py index 630ddc5a4..12399e638 100644 --- a/deluge/ui/gtkui/common.py +++ b/deluge/ui/gtkui/common.py @@ -154,8 +154,14 @@ def add_peer_dialog(): response = peer_dialog.run() if response: value = txt_ip.get_text() - ip = value.split(":")[0] - port = value.split(":")[1] + if ']' in value: + #ipv6 + ip = value.split("]")[0][1:] + port = value.split("]")[1][1:] + else: + #ipv4 + ip = value.split(":")[0] + port = value.split(":")[1] if deluge.common.is_ip(ip): id = component.get("TorrentView").get_selected_torrent() log.debug("adding peer %s to %s", value, id)