From e59058845cca68a39f2aab0deae1fadb0a6b2b01 Mon Sep 17 00:00:00 2001 From: Yann Leboulanger Date: Fri, 25 Nov 2005 21:32:56 +0000 Subject: [PATCH] we can now revoke a contact's authorization --- src/gtkgui.glade | 47 ++++++++++++++++++++++++++++++++------------ src/roster_window.py | 26 +++++++++++++++++++----- 2 files changed, 55 insertions(+), 18 deletions(-) diff --git a/src/gtkgui.glade b/src/gtkgui.glade index bde36d762..a0b2c0fd1 100644 --- a/src/gtkgui.glade +++ b/src/gtkgui.glade @@ -16182,7 +16182,7 @@ Banner True - + True gtk-jump-to 1 @@ -16202,7 +16202,7 @@ Banner True - + True gtk-new 1 @@ -16221,7 +16221,7 @@ Banner True - + True gtk-refresh 1 @@ -16255,7 +16255,7 @@ Banner - + True gtk-file 1 @@ -16275,7 +16275,7 @@ Banner - + True gtk-dialog-authentication 1 @@ -16300,7 +16300,7 @@ Banner True - + True gtk-dialog-question 1 @@ -16317,11 +16317,11 @@ Banner True - Send Authorization to + Allow him/her to see my status True - + True gtk-go-up 1 @@ -16337,11 +16337,11 @@ Banner True - Re_quest Authorization from + Ask to see his/her status True - + True gtk-go-down 1 @@ -16353,6 +16353,27 @@ Banner + + + + True + Forbid him/her to see my status + True + + + + + True + gtk-stop + 1 + 0.5 + 0.5 + 0 + 0 + + + + @@ -16364,7 +16385,7 @@ Banner True - + True gtk-add 1 @@ -16383,7 +16404,7 @@ Banner True - + True gtk-remove 1 @@ -16415,7 +16436,7 @@ Banner True - + True gtk-justify-fill 1 diff --git a/src/roster_window.py b/src/roster_window.py index db4178c19..fd5261bfe 100644 --- a/src/roster_window.py +++ b/src/roster_window.py @@ -939,7 +939,7 @@ class RosterWindow: assign_openpgp_key_menuitem = childs[6] #skip a seperator - subscription_to_menuitem, subscription_from_menuitem =\ + send_auth_menuitem, ask_auth_menuitem, revoke_auth_menuitem =\ childs[8].get_submenu().get_children() add_to_roster_menuitem = childs[9] remove_from_roster_menuitem = childs[10] @@ -980,10 +980,20 @@ class RosterWindow: assign_openpgp_key_menuitem.connect('activate', self.on_assign_pgp_key, contact, account) - subscription_to_menuitem.connect('activate', self.authorize, jid, - account) - subscription_from_menuitem.connect('activate', self.req_sub, - jid, _('I would like to add you to my roster'), account) + if contact.sub in ('from', 'both'): + send_auth_menuitem.set_sensitive(False) + else: + send_auth_menuitem.connect('activate', self.authorize, jid, account) + if contact.sub in ('to', 'both'): + ask_auth_menuitem.set_sensitive(False) + else: + ask_auth_menuitem.connect('activate', self.req_sub, jid, + _('I would like to add you to my roster'), account) + if contact.sub in ('to', 'none'): + revoke_auth_menuitem.set_sensitive(False) + else: + revoke_auth_menuitem.connect('activate', self.revoke_auth, jid, + account) else: # contact is in group 'not in the roster' add_to_roster_menuitem.set_no_show_all(False) @@ -1237,6 +1247,12 @@ _('If "%s" accepts this request you will know his or her status.') %jid) self.remove_contact(user1, account) self.add_contact_to_roster(jid, account) + def revoke_auth(self, widget, jid, account): + '''Revoke a contact's authorization''' + gajim.connections[account].refuse_authorization(jid) + dialogs.InformationDialog(_('Authorization has been removed'), + _('Now "%s" will always see you as offline.') %jid) + def on_roster_treeview_scroll_event(self, widget, event): self.tooltip.hide_tooltip()