fix some issues with the difference between Contacts and GC_Contacts

This commit is contained in:
Brendan Taylor 2008-07-26 01:16:24 +00:00
parent 67fb7e211c
commit 094052eb7c
2 changed files with 18 additions and 10 deletions

View File

@ -144,7 +144,7 @@ class ChatControlBase(MessageControl):
# This is bad, we need the highest for caps etc.
c = gajim.contacts.get_contact_with_highest_priority(
acct, contact.jid)
if c:
if c and not isinstance(c, GC_Contact):
contact = c
MessageControl.__init__(self, type_id, parent_win, widget_name,
@ -1184,7 +1184,8 @@ class ChatControl(ChatControlBase):
def update_toolbar(self):
# Add to roster
if _('Not in Roster') in self.contact.groups:
if not isinstance(self.contact, GC_Contact) \
and _('Not in Roster') in self.contact.groups:
self._add_to_roster_button.show()
else:
self._add_to_roster_button.hide()
@ -1202,14 +1203,16 @@ class ChatControl(ChatControlBase):
self._convert_to_gc_button.set_sensitive(False)
def update_mood(self):
if self.contact.mood.has_key('mood'):
if not isinstance(self.contact, GC_Contact) \
and self.contact.mood.has_key('mood'):
mood = self.contact.mood['mood']
if HAVE_MARKUP_TOOLTIPS:
mood = gobject.markup_escape_text(mood)
else:
mood = None
if self.contact.mood.has_key('text'):
if not isinstance(self.contact, GC_Contact) \
and self.contact.mood.has_key('text'):
text = self.contact.mood['text']
if HAVE_MARKUP_TOOLTIPS:
text = gobject.markup_escape_text(text)
@ -1245,15 +1248,18 @@ class ChatControl(ChatControlBase):
title = None
source = None
if self.contact.tune.has_key('artist'):
if not isinstance(self.contact, GC_Contact) \
and self.contact.tune.has_key('artist'):
artist = self.contact.tune['artist'].strip()
if HAVE_MARKUP_TOOLTIPS:
artist = gobject.markup_escape_text(artist)
if self.contact.tune.has_key('title'):
if not isinstance(self.contact, GC_Contact) \
and self.contact.tune.has_key('title'):
title = self.contact.tune['title'].strip()
if HAVE_MARKUP_TOOLTIPS:
title = gobject.markup_escape_text(title)
if self.contact.tune.has_key('source'):
if not isinstance(self.contact, GC_Contact) \
and self.contact.tune.has_key('source'):
source = self.contact.tune['source'].strip()
if HAVE_MARKUP_TOOLTIPS:
source = gobject.markup_escape_text(source)

View File

@ -81,8 +81,6 @@ class Contact:
return self.jid.split('@')[0]
def get_shown_groups(self):
'''
'''
if self.is_observer():
return [_('Observers')]
elif self.is_groupchat():
@ -132,7 +130,8 @@ class Contact:
class GC_Contact:
'''Information concerning each groupchat contact'''
def __init__(self, room_jid='', name='', show='', status='', role='',
affiliation='', jid = '', resource = ''):
affiliation='', jid = '', resource = '', our_chatstate = None,
composing_xep = None, chatstate = None):
self.room_jid = room_jid
self.name = name
self.show = show
@ -144,6 +143,9 @@ class GC_Contact:
self.caps_node = None
self.caps_hash_method = None
self.caps_hash = None
self.our_chatstate = our_chatstate
self.composing_xep = composing_xep
self.chatstate = chatstate
def get_full_jid(self):
return self.room_jid + '/' + self.name