changeset bbd9bfbbbaa2 in /home/hg/repos/gajim

details:http://hg.gajim.org/gajim?cmd=changeset;node=bbd9bfbbbaa2
description: Inject account object instead of account string into contact 
instances.

        Each contact has now access to the account object instead of the 
account string.

diffstat:

 src/common/account.py  |  6 +++++-
 src/common/contacts.py |  5 ++++-
 2 files changed, 9 insertions(+), 2 deletions(-)

diffs (51 lines):

diff -r f4eb12df7ae5 -r bbd9bfbbbaa2 src/common/account.py
--- a/src/common/account.py     Tue Nov 10 22:56:10 2009 +0100
+++ b/src/common/account.py     Wed Nov 11 21:38:39 2009 +0100
@@ -25,4 +25,8 @@
                self.contacts = contacts
                self.gc_contacts = gc_contacts
                
-               
\ No newline at end of file
+       def __repr__(self):
+               return self.name
+       
+       def __hash__(self):
+               return self.name.__hash__()
\ No newline at end of file
diff -r f4eb12df7ae5 -r bbd9bfbbbaa2 src/common/contacts.py
--- a/src/common/contacts.py    Tue Nov 10 22:56:10 2009 +0100
+++ b/src/common/contacts.py    Wed Nov 11 21:38:39 2009 +0100
@@ -229,7 +229,7 @@
                sub='', ask='', resource='', priority=0, keyID='', 
client_caps=None,
                our_chatstate=None, chatstate=None, last_status_time=None,
                composing_xep=None, mood={}, tune={}, activity={}):
-
+               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,
@@ -239,6 +239,7 @@
        def create_self_contact(self, jid, account, resource, show, status, 
priority, keyID=''):
                conn = common.gajim.connections[account]
                nick = common.gajim.nicks[account]
+               account = self._accounts.get(account, account) # Use Account 
object if available
                return self.create_contact(jid=jid, account=account,
                        name=nick, groups=['self_contact'], show=show, 
status=status,
                        sub='both', ask='none', priority=priority, keyID=keyID,
@@ -246,6 +247,7 @@
                        activity=conn.activity)
                
        def create_not_in_roster_contact(self, jid, account, resource='', 
name='', keyID=''):
+               account = self._accounts.get(account, account) # Use Account 
object if available
                return self.create_contact(jid=jid, account=account, 
resource=resource,
                                name=name, groups=[_('Not in Roster')], 
show='not in roster',
                                status='', sub='none', keyID=keyID)
@@ -372,6 +374,7 @@
        
        def create_gc_contact(self, room_jid, account, name='', show='', 
status='',
                role='', affiliation='', jid='', resource=''):
+               account = self._accounts.get(account, account) # Use Account 
object if available
                return GC_Contact(room_jid, account, name, show, status, role, 
affiliation, jid,
                        resource)
 
_______________________________________________
Commits mailing list
[email protected]
http://lists.gajim.org/cgi-bin/listinfo/commits

Reply via email to