Skip to content
Snippets Groups Projects
Commit 56e0c6f3 authored by nkour's avatar nkour
Browse files

drop from xffm to gajim tab now works

parent 93293dfd
No related branches found
No related tags found
No related merge requests found
......@@ -19,6 +19,7 @@
import sre
import os
import urllib
import gajim
from common import i18n
......@@ -260,3 +261,13 @@ def play_sound(event):
command = player + ' "' + path_to_soundfile + '" &'
#FIXME: when we require 2.4+ use subprocess module
os.system(command)
def get_file_path_from_dnd_dropped_uri(uri):
path = urllib.url2pathname(uri) # escape special chars
path = path.strip('\r\n\x00') # remove \r\n and NULL
# get the path to file
if path.startswith('file://'): # nautilus, rox
path = path[7:] # 7 is len('file://')
elif path.startswith('file:'): # xffm
path = path[5:] # 5 is len('file:')
return path
......@@ -106,12 +106,10 @@ class TabbedChatWindow(chat.Chat):
timestamp, contact):
if target_type == self.TARGET_TYPE_URI_LIST:
uri = selection.data.strip()
path = urllib.url2pathname(uri) # escape special chars
if path.startswith('file://'): # get the path to file
path = path[7:] # 7 is len('file://')
if os.path.isfile(path): # is it file?
self.plugin.windows['file_transfers'].send_file(self.account,
contact, path)
path = helpers.get_file_path_from_dnd_dropped_uri(uri)
if os.path.isfile(path): # is it file?
self.plugin.windows['file_transfers'].send_file(self.account,
contact, path)
def draw_widgets(self, contact):
"""draw the widgets in a tab (status_image, contact_button ...)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment