Commit 1b1ca88c authored by Philipp Hörist's avatar Philipp Hörist

Interface: Simplify event code

parent e00dad0b
Pipeline #4757 passed with stages
in 2 minutes and 41 seconds
......@@ -168,14 +168,6 @@ class FileRequestReceivedEvent(nec.NetworkIncomingEvent):
self.file_props.transfered_size = []
return True
class FileTransferCompletedEvent(nec.NetworkIncomingEvent):
name = 'file-transfer-completed'
def generate(self):
jid = str(self.file_props.receiver)
self.jid = app.get_jid_without_resource(jid)
return True
class NotificationEvent(nec.NetworkIncomingEvent):
name = 'notification'
base_network_events = ['decrypted-message-received',
......
......@@ -77,8 +77,7 @@ from gajim.common import logging_helpers
from gajim.common.structs import MUCData
from gajim.common.nec import NetworkEvent
from gajim.common.i18n import _
from gajim.common.connection_handlers_events import (
OurShowEvent, FileTransferCompletedEvent)
from gajim.common.connection_handlers_events import OurShowEvent
from gajim.common.modules.httpupload import HTTPUploadProgressEvent
from gajim.common.connection import Connection
......@@ -637,8 +636,12 @@ class Interface:
if file_props.error == 0:
ft.set_progress(
file_props.type_, file_props.sid, file_props.received_len)
jid = app.get_jid_without_resource(str(file_props.receiver))
app.nec.push_incoming_event(
FileTransferCompletedEvent(None, file_props=file_props))
NetworkEvent('file-transfer-completed',
file_props=file_props,
jid=jid))
else:
ft.set_status(file_props, 'stop')
if not file_props.completed and (file_props.stalled or
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment