diff --git a/src/common/gajim.py b/src/common/gajim.py index 4db4a9459..19a354309 100644 --- a/src/common/gajim.py +++ b/src/common/gajim.py @@ -59,7 +59,8 @@ awaiting_events = {} # list of messages/FT reveived but not printed # if type in ('chat', 'normal'): data = (message, subject, kind, time, # encrypted) # kind can be (incoming, error) - # if type in file-request, file-request-error: data = file_props + # if type in file-request, file-request-error, file-send-error, file-error: + # data = file_props nicks = {} # list of our nick names in each account allow_notifications = {} # do we allow notifications for each account ? con_types = {} # type of each connection (ssl, tls, tcp, ...) diff --git a/src/dialogs.py b/src/dialogs.py index 482370691..07c45ad84 100644 --- a/src/dialogs.py +++ b/src/dialogs.py @@ -911,7 +911,8 @@ class PopupNotificationWindow: chats_window = self.plugin.windows[self.account]['chats'][self.jid] chats_window.set_active_tab(self.jid) chats_window.window.present() - elif self.msg_type in ('normal', 'file-request', 'file-request-error'): + elif self.msg_type in ('normal', 'file-request', 'file-request-error', + 'file-send-error', 'file-error'): # Get the first single message event ev = gajim.get_first_event(self.account, self.jid, self.msg_type) self.plugin.roster.open_event(self.account, self.jid, ev) @@ -923,11 +924,6 @@ class PopupNotificationWindow: elif self.msg_type == 'file-stopped': # file transfer ended unexpectedly self.plugin.windows['file_transfers'].show_stopped(self.jid, self.file_props) - elif self.msg_type == 'file-error': # file transfer ended unexpectedly - self.plugin.windows['file_transfers'].show_stopped(self.jid, - self.file_props) - elif self.msg_type == 'file-send-error': # file transfer ended unexpectedly - self.plugin.windows['file_transfers'].show_send_error(self.file_props) else: # 'chat' self.plugin.roster.new_chat(contact, self.account) chats_window = self.plugin.windows[self.account]['chats'][self.jid] diff --git a/src/gajim.py b/src/gajim.py index 2b407fb33..d66d57972 100755 --- a/src/gajim.py +++ b/src/gajim.py @@ -781,15 +781,17 @@ class Interface: file_props = array[1] ft = self.windows['file_transfers'] ft.set_status(file_props['type'], file_props['sid'], 'stop') - if gajim.config.get('notify_on_new_message'): - # check if we should be notified + + if gajim.popup_window(account): + ft.show_send_error(file_props) + return + + self.add_event(account, jid, 'file-send-error', file_props) + + if gajim.show_notification(account): instance = dialogs.PopupNotificationWindow(self, - _('File Transfer Error'), jid, account, 'file-send-error', file_props) + _('File Transfer Error'), jid, account, 'file-send-error', file_props) self.roster.popup_notification_windows.append(instance) - elif (gajim.connections[account].connected in (2, 3) - and gajim.config.get('autopopup')) or \ - gajim.config.get('autopopupaway'): - self.windows['file_transfers'].show_send_error(file_props) def add_event(self, account, jid, typ, args): '''add an event to the awaiting_events var''' @@ -827,23 +829,24 @@ class Interface: file_props = array[1] ft = self.windows['file_transfers'] ft.set_status(file_props['type'], file_props['sid'], 'stop') + errno = file_props['error'] if gajim.popup_window(account): - errno = file_props['error'] if errno in (-4, -5): ft.show_stopped(jid, file_props) else: ft.show_request_error(file_props) return - self.add_event(account, jid, 'file-request-error', file_props) + if errno in (-4, -5): + msg_type = 'file-error' + else: + msg_type = 'file-request-error' + + self.add_event(account, jid, msg_typ, file_props) if gajim.show_notification(account): # check if we should be notified - if errno in (-4, -5): - msg_type = 'file-error' - else: - msg_type = 'file-request-error' instance = dialogs.PopupNotificationWindow(self, _('File Transfer Error'), jid, account, msg_type, file_props) self.roster.popup_notification_windows.append(instance) diff --git a/src/roster_window.py b/src/roster_window.py index f8b67b5fc..ddbabad21 100644 --- a/src/roster_window.py +++ b/src/roster_window.py @@ -1820,9 +1820,12 @@ _('If "%s" accepts this request you will know his status.') %jid) contact = gajim.get_contact_instance_with_highest_priority(account, jid) ft.show_file_request(account, contact, data) return True - elif typ == 'file-request-error': + elif typ in ('file-request-error', 'file-send-error'): ft.show_send_error(data) return True + elif typ == 'file-error': + ft.show_stopped(jid, data) + return True return False def on_roster_treeview_row_activated(self, widget, path, col = 0): diff --git a/src/systray.py b/src/systray.py index ebf8bf65f..41a646b02 100644 --- a/src/systray.py +++ b/src/systray.py @@ -284,7 +284,8 @@ class Systray: show = show, ask = 'none') self.plugin.roster.new_chat(c, account) w = wins['chats'][jid] - elif typ in ('normal', 'file-request', 'file-request-error'): + elif typ in ('normal', 'file-request', 'file-request-error', + 'file-send-error', 'file-error'): # Get the first single message event ev = gajim.get_first_event(account, jid, typ) # Open the window