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/>.
##
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):

View File

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