frontends: incoming files transfer management:

- quick app: getWaitingConf is used on profile connexion
    - primitivus: askConfirmation is now managed, use new 'dir' style of FileDialog
This commit is contained in:
Goffi 2012-11-14 20:37:15 +01:00
commit 297b439369

View file

@ -20,6 +20,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
"""
from sat.tools.jid import JID
from os.path import exists, splitext
def escapePrivate(ori_jid):
"""Escape a private jid"""
@ -31,3 +32,16 @@ def unescapePrivate(escaped_jid):
escaped_split = tuple(escaped_jid[len(const_PRIVATE_PREFIX):].split('@'))
assert(len(escaped_split) == 3)
return JID("%s@%s/%s" % escaped_split)
def getNewPath(path):
""" Check if path exists, and find a non existant path if needed """
idx = 2
if not exists(path):
return path
root, ext = splitext(path)
while True:
new_path = "%s_%d%s" % (root, idx, ext)
if not exists(new_path):
return new_path
idx+=1