def result(self, pyGlooxTag): handler = contact_note.NotesListHandler() notes, (count, _, last) = handler.handleTag(pyGlooxTag) getter = self.usersStorage.getUser setter = self.usersStorage.setUser for dbID, note in notes: contact = getter(dbID) if contact: contact.update(note=note) else: setter(SharedUserEntity(dbID, note=note)) self._offset += len(notes) if self._offset < count: self._iqID = self.client().sendIQ(contact_note.NotesListQuery(CONTACT_LIMIT.NOTES_PER_PAGE, last)) else: g_messengerEvents.users.onNotesListReceived() self._result = TASK_RESULT.REMOVE
def _doRun(self, client): self._iqID = client.sendIQ(contact_note.NotesListQuery(CONTACT_LIMIT.NOTES_PER_PAGE))