drop from xffm to gajim tab now works
This commit is contained in:
parent
93293dfdc5
commit
56e0c6f3c3
|
@ -19,6 +19,7 @@
|
||||||
|
|
||||||
import sre
|
import sre
|
||||||
import os
|
import os
|
||||||
|
import urllib
|
||||||
|
|
||||||
import gajim
|
import gajim
|
||||||
from common import i18n
|
from common import i18n
|
||||||
|
@ -260,3 +261,13 @@ def play_sound(event):
|
||||||
command = player + ' "' + path_to_soundfile + '" &'
|
command = player + ' "' + path_to_soundfile + '" &'
|
||||||
#FIXME: when we require 2.4+ use subprocess module
|
#FIXME: when we require 2.4+ use subprocess module
|
||||||
os.system(command)
|
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,9 +106,7 @@ class TabbedChatWindow(chat.Chat):
|
||||||
timestamp, contact):
|
timestamp, contact):
|
||||||
if target_type == self.TARGET_TYPE_URI_LIST:
|
if target_type == self.TARGET_TYPE_URI_LIST:
|
||||||
uri = selection.data.strip()
|
uri = selection.data.strip()
|
||||||
path = urllib.url2pathname(uri) # escape special chars
|
path = helpers.get_file_path_from_dnd_dropped_uri(uri)
|
||||||
if path.startswith('file://'): # get the path to file
|
|
||||||
path = path[7:] # 7 is len('file://')
|
|
||||||
if os.path.isfile(path): # is it file?
|
if os.path.isfile(path): # is it file?
|
||||||
self.plugin.windows['file_transfers'].send_file(self.account,
|
self.plugin.windows['file_transfers'].send_file(self.account,
|
||||||
contact, path)
|
contact, path)
|
||||||
|
|
Loading…
Reference in New Issue