diff options
-rw-r--r-- | src/common/connection.py | 3 | ||||
-rw-r--r-- | src/common/contacts.py | 21 | ||||
-rw-r--r-- | src/common/pep.py | 25 | ||||
-rw-r--r-- | src/common/zeroconf/connection_zeroconf.py | 4 | ||||
-rw-r--r-- | src/roster_window.py | 9 | ||||
-rw-r--r-- | test/lib/gajim_mocks.py | 4 |
6 files changed, 22 insertions, 44 deletions
diff --git a/src/common/connection.py b/src/common/connection.py index 90df73d08..e2b6d2166 100644 --- a/src/common/connection.py +++ b/src/common/connection.py @@ -168,9 +168,6 @@ class Connection(ConnectionHandlers): self.pubsub_supported = False self.pubsub_publish_options_supported = False self.pep_supported = False - self.mood = {} - self.tune = {} - self.activity = {} self.pep = {} # Do we continue connection when we get roster (send presence,get vcard..) self.continue_connect_info = None diff --git a/src/common/contacts.py b/src/common/contacts.py index b8b039288..d012558bf 100644 --- a/src/common/contacts.py +++ b/src/common/contacts.py @@ -94,7 +94,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 = None, - composing_xep=None, mood={}, tune={}, activity={}): + composing_xep=None): CommonContact.__init__(self, jid, account, resource, show, status, name, our_chatstate, composing_xep, chatstate, client_caps=client_caps) @@ -111,9 +111,6 @@ class Contact(CommonContact): self.last_status_time = last_status_time self.pep = {} - self.mood = mood.copy() - self.tune = tune.copy() - self.activity = activity.copy() def get_full_jid(self): if self.resource: @@ -229,23 +226,25 @@ class Contacts: def create_contact(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, - composing_xep=None, mood={}, tune={}, activity={}): + composing_xep=None): account = self._accounts.get(account, account) # Use Account object if available return Contact(jid=jid, account=account, name=name, groups=groups, show=show, status=status, sub=sub, ask=ask, resource=resource, priority=priority, keyID=keyID, client_caps=client_caps, our_chatstate=our_chatstate, chatstate=chatstate, last_status_time=last_status_time, - composing_xep=composing_xep, mood=mood, tune=tune, activity=activity) + composing_xep=composing_xep) - def create_self_contact(self, jid, account, resource, show, status, priority, keyID=''): + def create_self_contact(self, jid, account, resource, show, status, priority, + name='', keyID=''): conn = common.gajim.connections[account] - nick = common.gajim.nicks[account] + nick = name or common.gajim.nicks[account] account = self._accounts.get(account, account) # Use Account object if available - return self.create_contact(jid=jid, account=account, + 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, - resource=resource, mood=conn.mood, tune=conn.tune, - activity=conn.activity) + resource=resource) + self_contact.pep = conn.pep + return self_contact def create_not_in_roster_contact(self, jid, account, resource='', name='', keyID=''): account = self._accounts.get(account, account) # Use Account object if available diff --git a/src/common/pep.py b/src/common/pep.py index 85e72d8ea..fa4a31a3a 100644 --- a/src/common/pep.py +++ b/src/common/pep.py @@ -237,24 +237,16 @@ class AbstractPEP(object): '''To be implemented by subclasses''' raise NotImplementedError - def _update_contacts(self, jid, account): - dict = {} if self._retracted else self._pep_specific_data - - for contact in common.gajim.contacts.get_contacts(account, jid): - setattr(contact, self.type, dict) - + def _update_contacts(self, jid, account): + for contact in common.gajim.contacts.get_contacts(account, jid): if self._retracted: if self.type in contact.pep: del contact.pep[self.type] else: contact.pep[self.type] = self - def _update_account(self, account): - dict = {} if self._retracted else self._pep_specific_data - - acc = common.gajim.connections[account] - setattr(acc, self.type, dict) - + def _update_account(self, account): + acc = common.gajim.connections[account] if self._retracted: if self.type in acc.pep: del acc.pep[self.type] @@ -571,15 +563,10 @@ def delete_pep(jid, name): if jid == common.gajim.get_jid_from_account(name): acc = common.gajim.connections[name] - acc.activity = {} - user_send_tune(name) - acc.tune = {} - acc.mood = {} + acc.pep = {} for contact in common.gajim.contacts.get_contacts(name, user): - contact.activity = {} - contact.tune = {} - contact.mood = {} + contact.pep = {} if jid == common.gajim.get_jid_from_account(name): common.gajim.interface.roster.draw_account(name) diff --git a/src/common/zeroconf/connection_zeroconf.py b/src/common/zeroconf/connection_zeroconf.py index c5a93b4b8..26725f5f0 100644 --- a/src/common/zeroconf/connection_zeroconf.py +++ b/src/common/zeroconf/connection_zeroconf.py @@ -88,9 +88,7 @@ class ConnectionZeroconf(ConnectionHandlersZeroconf): self.no_log_for = False self.pep_supported = False - self.mood = {} - self.tune = {} - self.activity = {} + self.pep = {} # Do we continue connection when we get roster (send presence,get vcard...) self.continue_connect_info = None if gajim.HAVE_GPG: diff --git a/src/roster_window.py b/src/roster_window.py index 2745a3365..17697b3dd 100644 --- a/src/roster_window.py +++ b/src/roster_window.py @@ -2432,11 +2432,10 @@ class RosterWindow: account_name = account if gajim.account_is_connected(account): account_name += ' (%s/%s)' % (repr(nbr_on), repr(nbr_total)) - contact = gajim.contacts.create_contact(jid=jid, account=account, name=account_name, - show=connection.get_status(), sub='', status=connection.status, - resource=connection.server_resource, - priority=connection.priority, mood=connection.mood, - tune=connection.tune, activity=connection.activity) + contact = gajim.contacts.create_self_contact(jid=jid, account=account, + name=account_name, show=connection.get_status(), + status=connection.status, resource=connection.server_resource, + priority=connection.priority) if gajim.connections[account].gpg: contact.keyID = gajim.config.get_per('accounts', connection.name, 'keyid') diff --git a/test/lib/gajim_mocks.py b/test/lib/gajim_mocks.py index d45e488e6..9607a77c9 100644 --- a/test/lib/gajim_mocks.py +++ b/test/lib/gajim_mocks.py @@ -14,9 +14,7 @@ class MockConnection(Mock, ConnectionHandlersBase): self.name = account self.connected = 2 - self.mood = {} - self.activity = {} - self.tune = {} + self.pep = {} self.blocked_contacts = {} self.blocked_groups = {} self.sessions = {} |