diff --git a/src/groupchat_control.py b/src/groupchat_control.py index d347ae8b1..bbd18cb4c 100644 --- a/src/groupchat_control.py +++ b/src/groupchat_control.py @@ -34,6 +34,7 @@ import gtk import pango import gobject import gtkgui_helpers +import gui_menu_builder import message_control import tooltips import dialogs @@ -256,6 +257,20 @@ class PrivateChatControl(ChatControl): self.session.negotiate_e2e(False) + def prepare_context_menu(self, hide_buttonbar_items=False): + """ + Set compact view menuitem active state sets active and sensitivity state + for toggle_gpg_menuitem sets sensitivity for history_menuitem (False for + tranasports) and file_transfer_menuitem and hide()/show() for + add_to_roster_menuitem + """ + menu = gui_menu_builder.get_contact_menu(self.contact, self.account, + use_multiple_contacts=False, show_start_chat=False, + show_encryption=True, control=self, + show_buttonbar_items=not hide_buttonbar_items, + gc_contact=self.gc_contact) + return menu + class GroupchatControl(ChatControlBase): TYPE_ID = message_control.TYPE_GC diff --git a/src/gui_menu_builder.py b/src/gui_menu_builder.py index fbc93d1b1..4645c46b4 100644 --- a/src/gui_menu_builder.py +++ b/src/gui_menu_builder.py @@ -151,7 +151,7 @@ def build_invite_submenu(invite_menuitem, list_): def get_contact_menu(contact, account, use_multiple_contacts=True, show_start_chat=True, show_encryption=False, show_buttonbar_items=True, -control=None): +control=None, gc_contact=None): """ Build contact popup menu for roster and chat window. If control is not set, we hide invite_contacts_menuitem @@ -368,7 +368,14 @@ control=None): if muc_icon: invite_menuitem.set_image(muc_icon) - build_invite_submenu(invite_menuitem, [(contact, account)]) + if gc_contact: + if not gc_contact.jid: + # it's a pm and we don't know real JID + invite_menuitem.set_sensitive(False) + else: + build_invite_submenu(invite_menuitem, [(gc_contact, account)]) + else: + build_invite_submenu(invite_menuitem, [(contact, account)]) # One or several resource, we do the same for send_custom_status status_menuitems = gtk.Menu()