Jingle file transfer broken on trunk
Some GTK3 fixes and a few Python2/3 string incompatibility hacks to fix Jingle file transfer in trunk:
diff -r 2a21b97baa30 src/chat_control.py
--- a/src/chat_control.py Wed Jan 14 22:18:04 2015 +0100
+++ b/src/chat_control.py Thu Jan 15 16:30:23 2015 -0500
@@ -2951,7 +2951,7 @@
def _on_drag_data_received(self, widget, context, x, y, selection,
target_type, timestamp):
- if not selection.data:
+ if not selection.get_data():
return
if self.TYPE_ID == message_control.TYPE_PM:
c = self.gc_contact
@@ -2960,7 +2960,7 @@
if target_type == self.TARGET_TYPE_URI_LIST:
if not c.resource: # If no resource is known, we can't send a file
return
- uri = selection.data.strip()
+ uri = selection.get_data().strip()
uri_splitted = uri.split() # we may have more than one file dropped
for uri in uri_splitted:
path = helpers.get_file_path_from_dnd_dropped_uri(uri)
@@ -2972,7 +2972,7 @@
# chat2muc
treeview = gajim.interface.roster.tree
model = treeview.get_model()
- data = selection.data
+ data = selection.get_data()
path = treeview.get_selection().get_selected_rows()[1][0]
iter_ = model.get_iter(path)
type_ = model[iter_][2]
diff -r 2a21b97baa30 src/common/helpers.py
--- a/src/common/helpers.py Wed Jan 14 22:18:04 2015 +0100
+++ b/src/common/helpers.py Thu Jan 15 16:30:23 2015 -0500
@@ -410,7 +410,9 @@
return command
def get_file_path_from_dnd_dropped_uri(uri):
- path = urllib.parse.unquote(uri) # escape special chars
+ path = urllib.parse.unquote(
+ str(uri, encoding='utf-8')
+ ) # escape special chars
path = path.strip('\r\n\x00') # remove \r\n and NULL
# get the path to file
if re.match('^file:///[a-zA-Z]:/', path): # windows
diff -r 2a21b97baa30 src/common/jingle_content.py
--- a/src/common/jingle_content.py Wed Jan 14 22:18:04 2015 +0100
+++ b/src/common/jingle_content.py Thu Jan 15 16:30:23 2015 -0500
@@ -222,7 +222,9 @@
cert = load_cert_file(certpath)
if cert:
try:
- digest_algo = cert.get_signature_algorithm().split('With')[0]
+ digest_algo = str(
+ cert.get_signature_algorithm(), encoding='utf-8'
+ ).split('With')[0]
except AttributeError as e:
# Old py-OpenSSL is missing get_signature_algorithm
digest_algo = "sha256"
diff -r 2a21b97baa30 src/groupchat_control.py
--- a/src/groupchat_control.py Wed Jan 14 22:18:04 2015 +0100
+++ b/src/groupchat_control.py Thu Jan 15 16:30:23 2015 -0500
@@ -2276,10 +2276,10 @@
# Invite contact to groupchat
treeview = gajim.interface.roster.tree
model = treeview.get_model()
- if not selection.data or target_type == 80:
+ if not selection.get_data() or target_type == 80:
# target_type = 80 means a file is dropped
return
- data = selection.data
+ data = selection.get_data()
path = treeview.get_selection().get_selected_rows()[1][0]
iter_ = model.get_iter(path)
type_ = model[iter_][2]