file-stopped and file-completed can be saved in awiting_events queue
This commit is contained in:
parent
7d5cba01a7
commit
9d42d10853
|
@ -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, file-send-error, file-error:
|
||||
# if type in file-request, file-request-error, file-send-error, file-error,
|
||||
# file-completed, file-stopped:
|
||||
# data = file_props
|
||||
nicks = {} # list of our nick names in each account
|
||||
allow_notifications = {} # do we allow notifications for each account ?
|
||||
|
|
|
@ -912,18 +912,11 @@ class PopupNotificationWindow:
|
|||
chats_window.set_active_tab(self.jid)
|
||||
chats_window.window.present()
|
||||
elif self.msg_type in ('normal', 'file-request', 'file-request-error',
|
||||
'file-send-error', 'file-error'):
|
||||
'file-send-error', 'file-error', 'file-stopped', 'file-completed'):
|
||||
# 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)
|
||||
|
||||
elif self.msg_type == 'file-completed': # file transfer is complete
|
||||
self.plugin.windows['file_transfers'].show_completed(self.jid,
|
||||
self.file_props)
|
||||
|
||||
elif self.msg_type == 'file-stopped': # file transfer ended unexpectedly
|
||||
self.plugin.windows['file_transfers'].show_stopped(self.jid,
|
||||
self.file_props)
|
||||
else: # 'chat'
|
||||
self.plugin.roster.new_chat(contact, self.account)
|
||||
chats_window = self.plugin.windows[self.account]['chats'][self.jid]
|
||||
|
|
31
src/gajim.py
31
src/gajim.py
|
@ -885,21 +885,26 @@ class Interface:
|
|||
file_props.has_key('paused') and file_props['paused']:
|
||||
return
|
||||
jid = unicode(file_props['sender'])
|
||||
if gajim.config.get('notify_on_file_complete'):
|
||||
if (gajim.connections[account].connected in (2, 3)
|
||||
and gajim.config.get('autopopup')) or \
|
||||
gajim.config.get('autopopupaway'):
|
||||
if file_props['error'] == 0:
|
||||
ft.show_completed(jid, file_props)
|
||||
elif file_props['error'] == -1:
|
||||
ft.show_stopped(jid, file_props)
|
||||
return
|
||||
|
||||
if gajim.popup_window(account):
|
||||
if file_props['error'] == 0:
|
||||
msg_type = 'file-completed'
|
||||
event_type = _('File Transfer Completed')
|
||||
ft.show_completed(jid, file_props)
|
||||
elif file_props['error'] == -1:
|
||||
msg_type = 'file-stopped'
|
||||
event_type = _('File Transfer Stopped')
|
||||
ft.show_stopped(jid, file_props)
|
||||
return
|
||||
|
||||
if file_props['error'] == 0:
|
||||
msg_type = 'file-completed'
|
||||
event_type = _('File Transfer Completed')
|
||||
elif file_props['error'] == -1:
|
||||
msg_type = 'file-stopped'
|
||||
event_type = _('File Transfer Stopped')
|
||||
|
||||
self.add_event(account, jid, msg_typ, file_props)
|
||||
|
||||
if gajim.config.get('notify_on_file_complete') and \
|
||||
gajim.config.get('autopopupaway') or \
|
||||
gajim.connections[account].connected in (2, 3):
|
||||
instance = dialogs.PopupNotificationWindow(self, event_type,
|
||||
jid, account, msg_type, file_props)
|
||||
self.roster.popup_notification_windows.append(instance)
|
||||
|
|
|
@ -1823,9 +1823,12 @@ _('If "%s" accepts this request you will know his status.') %jid)
|
|||
elif typ in ('file-request-error', 'file-send-error'):
|
||||
ft.show_send_error(data)
|
||||
return True
|
||||
elif typ == 'file-error':
|
||||
elif typ in ('file-error', 'file-stopped'):
|
||||
ft.show_stopped(jid, data)
|
||||
return True
|
||||
elif typ == 'file-completed':
|
||||
ft.show_completed(jid, data)
|
||||
return True
|
||||
return False
|
||||
|
||||
def on_roster_treeview_row_activated(self, widget, path, col = 0):
|
||||
|
|
|
@ -285,7 +285,7 @@ class Systray:
|
|||
self.plugin.roster.new_chat(c, account)
|
||||
w = wins['chats'][jid]
|
||||
elif typ in ('normal', 'file-request', 'file-request-error',
|
||||
'file-send-error', 'file-error'):
|
||||
'file-send-error', 'file-error', 'file-stopped', 'file-completed'):
|
||||
# Get the first single message event
|
||||
ev = gajim.get_first_event(account, jid, typ)
|
||||
# Open the window
|
||||
|
|
Loading…
Reference in New Issue