Always show the 'add contact to roster' menu entry in textviews.

Showing it is more consistent than hiding it from the user. (We do the same in the Groupchat roster)
This commit is contained in:
Stephan Erb 2009-11-29 21:06:26 +01:00
parent 132d71b08b
commit b2efc9685b
2 changed files with 6 additions and 22 deletions

View file

@ -28,9 +28,10 @@
## along with Gajim. If not, see <http://www.gnu.org/licenses/>. ## along with Gajim. If not, see <http://www.gnu.org/licenses/>.
## ##
from common import caps
from common.account import Account
import common.gajim import common.gajim
import caps
from account import Account
class XMPPEntity(object): class XMPPEntity(object):
""" """
@ -380,14 +381,6 @@ class Contacts:
return False return False
return True return True
def is_pm_from_contact(self, account, contact):
"""
Return True if the given contact is a private message contact
"""
if isinstance(contact, Contact):
return False
return True
def __getattr__(self, attr_name): def __getattr__(self, attr_name):
# Only called if self has no attr_name # Only called if self has no attr_name
if hasattr(self._metacontact_manager, attr_name): if hasattr(self._metacontact_manager, attr_name):

View file

@ -909,16 +909,7 @@ class ConversationTextview(gobject.GObject):
self.on_join_group_chat_menuitem_activate, text) self.on_join_group_chat_menuitem_activate, text)
self.handlers[id_] = childs[6] self.handlers[id_] = childs[6]
allow_add = False
if self.account: if self.account:
c = gajim.contacts.get_first_contact_from_jid(self.account, text)
if c and not gajim.contacts.is_pm_from_contact(self.account, c):
if _('Not in Roster') in c.groups:
allow_add = True
else: # he or she's not at all in the account contacts
allow_add = True
if allow_add:
id_ = childs[7].connect('activate', self.on_add_to_roster_activate, id_ = childs[7].connect('activate', self.on_add_to_roster_activate,
text) text)
self.handlers[id_] = childs[7] self.handlers[id_] = childs[7]