def getNewMessages(self, questionAsker, type = 'All', progressBroadcaster = None): """ Downloads the new messages of all the users’s accounts, and stores them in the database. """ db = Sqlite(self.username) if type in ('All', 'iPhone messages'): for getter in self.iPhoneGetters: getter.downloadNewMessages(db, progressBroadcaster) if type in ('All', 'IM logs'): if self.imLogGetter: self.imLogGetter.downloadNewConversations(db, questionAsker, progressBroadcaster) if type in ('All', 'IMAP emails'): for getter in self.imapGetters: getter.downloadNewMessages(db, progressBroadcaster) db.close()
def __init__(self, username, password): """ Takes the user’s owl credentials. Checks them (for the sake of paranoia) and initialises any getters for the users’s accounts. It will raise a NotAuthenticatedException if the authentication failed. """ self.username = username db = Sqlite(self.username) self.accountDecriptionKey = settings.settings['userPasswordEncryptionSalt'] + password self.encryptionKey = settings.settings['userDataEncryptionSalt'] + password if not login.checkLogin(username, password): raise NotAuthenticatedException('The username or password was not valid') self.imapGetters = self.checkForImap(db) self.iPhoneGetters = self.checkForIPhone(db) self.imLogGetter = self.checkForIMLogs(db) db.close()