From 8afe645b0bdae9360fb4e79d8a53f7bcc8db8f95 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Schreiner?= Date: Sun, 4 Dec 2011 00:21:07 +0100 Subject: [PATCH] ICapContact: manage personal notes about a contact --- weboob/backends/aum/backend.py | 16 ++++++++++++++++ weboob/capabilities/contact.py | 18 ++++++++++++++++++ 2 files changed, 34 insertions(+) diff --git a/weboob/backends/aum/backend.py b/weboob/backends/aum/backend.py index d3ae6e4f..a19a9330 100644 --- a/weboob/backends/aum/backend.py +++ b/weboob/backends/aum/backend.py @@ -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 --------------------- diff --git a/weboob/capabilities/contact.py b/weboob/capabilities/contact.py index a392cbdd..d15baae24 100644 --- a/weboob/capabilities/contact.py +++ b/weboob/capabilities/contact.py @@ -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