[gdr_gdr] Add a file transfer completed event. Fixes # 8266

This commit is contained in:
Yann Leboulanger 2016-02-20 21:36:24 +01:00
parent 7740f8ccf4
commit 766bb508e3
2 changed files with 12 additions and 1 deletions

View File

@ -2310,6 +2310,15 @@ class FileRequestErrorEvent(nec.NetworkIncomingEvent):
self.jid = gajim.get_jid_without_resource(self.jid) self.jid = gajim.get_jid_without_resource(self.jid)
return True return True
class FileTransferCompletedEvent(nec.NetworkIncomingEvent):
name = 'file-transfer-completed'
base_network_events = []
def generate(self):
jid = unicode(self.file_props.receiver)
self.jid = gajim.get_jid_without_resource(jid)
return True
class GatewayPromptReceivedEvent(nec.NetworkIncomingEvent, HelperEvent): class GatewayPromptReceivedEvent(nec.NetworkIncomingEvent, HelperEvent):
name = 'gateway-prompt-received' name = 'gateway-prompt-received'
base_network_events = [] base_network_events = []

View File

@ -82,7 +82,7 @@ from common import dataforms
from common import passwords from common import passwords
from common import logging_helpers from common import logging_helpers
from common.connection_handlers_events import OurShowEvent, \ from common.connection_handlers_events import OurShowEvent, \
FileRequestErrorEvent, InformationEvent FileRequestErrorEvent, FileTransferCompletedEvent, InformationEvent
from common.connection import Connection from common.connection import Connection
from common import jingle from common import jingle
from common.file_props import FilesProp from common.file_props import FilesProp
@ -996,6 +996,8 @@ class Interface:
if file_props.error == 0: if file_props.error == 0:
ft.set_progress(file_props.type_, file_props.sid, ft.set_progress(file_props.type_, file_props.sid,
file_props.received_len) file_props.received_len)
gajim.nec.push_incoming_event(FileTransferCompletedEvent(None,
file_props=file_props))
else: else:
ft.set_status(file_props, 'stop') ft.set_status(file_props, 'stop')
if file_props.stalled or file_props.paused: if file_props.stalled or file_props.paused: