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': []},
'queries_queue': {'queue': []},
'sluts': {},
'notes': {},
}
BROWSER = AuMBrowser
@ -437,6 +438,21 @@ class AuMBackend(BaseBackend, ICapMessages, ICapMessagesPost, ICapDating, ICapCh
if not self.browser.send_charm(id):
raise QueryError('No enough charms available')
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 ---------------------

View file

@ -129,3 +129,21 @@ class ICapContact(IBaseCap):
@except QueryError
"""
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