ICapContact: manage personal notes about a contact

This commit is contained in:
Clément Schreiner 2011-12-04 00:21:07 +01:00 committed by Romain Bignon
commit 8afe645b0b
2 changed files with 34 additions and 0 deletions

View file

@ -69,6 +69,7 @@ class AuMBackend(BaseBackend, ICapMessages, ICapMessagesPost, ICapDating, ICapCh
STORAGE = {'profiles_walker': {'viewed': []}, STORAGE = {'profiles_walker': {'viewed': []},
'queries_queue': {'queue': []}, 'queries_queue': {'queue': []},
'sluts': {}, 'sluts': {},
'notes': {},
} }
BROWSER = AuMBrowser BROWSER = AuMBrowser
@ -438,6 +439,21 @@ class AuMBackend(BaseBackend, ICapMessages, ICapMessagesPost, ICapDating, ICapCh
raise QueryError('No enough charms available') raise QueryError('No enough charms available')
return Query(id, 'A charm has been sent') return Query(id, 'A charm has been sent')
def get_notes(self, id):
if isinstance(id, Contact):
id = id.id
return self.storage.get('notes', id)
def save_notes(self, id, notes):
if isinstance(id, Contact):
id = id.id
self.storage.set('notes', id, notes)
self.storage.save()
# ---- ICapChat methods --------------------- # ---- ICapChat methods ---------------------
def iter_chat_messages(self, _id=None): def iter_chat_messages(self, _id=None):

View file

@ -129,3 +129,21 @@ class ICapContact(IBaseCap):
@except QueryError @except QueryError
""" """
raise NotImplementedError() raise NotImplementedError()
def get_notes(self, id):
"""
Get personal notes about a contact
@param id the ID of the contact
@return a unicode object
"""
raise NotImplementedError
def save_notes(self, id, notes):
"""
Set personal notes about a contact
@param id the ID of the contact
@param notes the unicode object to save as notes
"""
raise NotImplementedError