look if we have unread / recent messages AFTER we get the status message (we can also do it before AND after ... comments ?)

This commit is contained in:
Yann Leboulanger 2005-05-13 20:50:49 +00:00
parent e2012ca370
commit 156c81846b
1 changed files with 30 additions and 29 deletions

View File

@ -1032,6 +1032,15 @@ class Roster_window:
def on_quit_menuitem_activate(self, widget): def on_quit_menuitem_activate(self, widget):
accounts = gajim.connections.keys() accounts = gajim.connections.keys()
get_msg = False
for acct in accounts:
if gajim.connections[acct].connected:
get_msg = True
break
if get_msg:
message = self.get_status_message('offline')
if message == -1:
return
# check if we have unread or recent mesages # check if we have unread or recent mesages
unread = False unread = False
recent = False recent = False
@ -1057,19 +1066,11 @@ class Roster_window:
dialog = dialogs.Confirmation_dialog(_('You have unread messages.\nAre you sure you want to quit Gajim?')) dialog = dialogs.Confirmation_dialog(_('You have unread messages.\nAre you sure you want to quit Gajim?'))
if dialog.get_response() != gtk.RESPONSE_YES: if dialog.get_response() != gtk.RESPONSE_YES:
return return
#FIXME: do we keep that ?
if recent: if recent:
dialog = dialogs.Confirmation_dialog(_('You received a message in the last two seconds.\nAre you sure you want to quit Gajim?')) dialog = dialogs.Confirmation_dialog(_('You received a message in the last two seconds.\nAre you sure you want to quit Gajim?'))
if dialog.get_response() != gtk.RESPONSE_YES: if dialog.get_response() != gtk.RESPONSE_YES:
return return
get_msg = False
for acct in accounts:
if gajim.connections[acct].connected:
get_msg = True
break
if get_msg:
message = self.get_status_message('offline')
if message == -1:
return
for acct in accounts: for acct in accounts:
if gajim.connections[acct].connected: if gajim.connections[acct].connected:
self.send_status(acct, 'offline', message) self.send_status(acct, 'offline', message)