don't allow to invite pm contacts to other MUC if we don't know his real JID. see #4443

This commit is contained in:
Yann Leboulanger 2011-03-18 10:09:06 +01:00
parent 29c4f64285
commit 8bae294150
2 changed files with 24 additions and 2 deletions

View File

@ -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

View File

@ -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()