From 6cafd14883b5611c2ee49b63aea80142f1a63d4a Mon Sep 17 00:00:00 2001 From: ingvar1995 Date: Sat, 24 Dec 2016 22:05:29 +0300 Subject: [PATCH] qtox screenshots support --- toxygen/file_transfers.py | 4 ++++ toxygen/profile.py | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/toxygen/file_transfers.py b/toxygen/file_transfers.py index 5684450..4a9723a 100644 --- a/toxygen/file_transfers.py +++ b/toxygen/file_transfers.py @@ -32,6 +32,10 @@ SHOW_PROGRESS_BAR = (0, 1, 4) ALLOWED_FILES = ('toxygen_inline.png', 'utox-inline.png', 'sticker.png') +def is_inline(file_name): + return file_name in ALLOWED_FILES or file_name.startswith('qTox_Screenshot_') + + class StateSignal(QtCore.QObject): signal = QtCore.Signal(int, float, int) # state, progress, time in sec diff --git a/toxygen/profile.py b/toxygen/profile.py index f534c4b..1bc3507 100644 --- a/toxygen/profile.py +++ b/toxygen/profile.py @@ -883,7 +883,7 @@ class Profile(basecontact.BaseContact, Singleton): settings = Settings.get_instance() friend = self.get_friend_by_number(friend_number) auto = settings['allow_auto_accept'] and friend.tox_id in settings['auto_accept_from_friends'] - inline = (file_name in ALLOWED_FILES) and settings['allow_inline'] + inline = is_inline(file_name) and settings['allow_inline'] file_id = self._tox.file_get_file_id(friend_number, file_number) accepted = True if file_id in self._paused_file_transfers: