From b2efc9685bfa0c497538241a9e453cce55e1179c Mon Sep 17 00:00:00 2001 From: Stephan Erb Date: Sun, 29 Nov 2009 21:06:26 +0100 Subject: [PATCH] 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) --- src/common/contacts.py | 19 ++++++------------- src/conversation_textview.py | 9 --------- 2 files changed, 6 insertions(+), 22 deletions(-) diff --git a/src/common/contacts.py b/src/common/contacts.py index fbc49b229..748d0f3ff 100644 --- a/src/common/contacts.py +++ b/src/common/contacts.py @@ -28,9 +28,10 @@ ## along with Gajim. If not, see . ## -import common.gajim -import caps -from account import Account + +from common import caps +from common.account import Account +import common.gajim class XMPPEntity(object): """ @@ -98,7 +99,7 @@ class Contact(CommonContact): def __init__(self, jid, account, name='', groups=[], show='', status='', sub='', ask='', resource='', priority=0, keyID='', client_caps=None, - our_chatstate=None, chatstate=None, last_status_time=None, msg_id = + our_chatstate=None, chatstate=None, last_status_time=None, msg_id= None, composing_xep=None): CommonContact.__init__(self, jid, account, resource, show, status, name, @@ -256,7 +257,7 @@ class Contacts: account = self._accounts.get(account, account) # Use Account object if available self_contact = self.create_contact(jid=jid, account=account, name=nick, groups=['self_contact'], show=show, status=status, - sub='both', ask='none', priority=priority, keyID=keyID, + sub='both', ask='none', priority=priority, keyID=keyID, resource=resource) self_contact.pep = conn.pep return self_contact @@ -380,14 +381,6 @@ class Contacts: return False 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): # Only called if self has no attr_name if hasattr(self._metacontact_manager, attr_name): diff --git a/src/conversation_textview.py b/src/conversation_textview.py index 7744ef685..292d524c2 100644 --- a/src/conversation_textview.py +++ b/src/conversation_textview.py @@ -909,16 +909,7 @@ class ConversationTextview(gobject.GObject): self.on_join_group_chat_menuitem_activate, text) self.handlers[id_] = childs[6] - allow_add = False 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, text) self.handlers[id_] = childs[7]