[tuxdroid-svn] r6047 - software_suite_v3/software/plugin/plugin-hotmail/trunk/executables
Status: Beta
Brought to you by:
ks156
From: jerome <c2m...@c2...> - 2010-02-03 10:25:43
|
Author: jerome Date: 2010-02-03 11:25:26 +0100 (Wed, 03 Feb 2010) New Revision: 6047 Modified: software_suite_v3/software/plugin/plugin-hotmail/trunk/executables/plugin-hotmail.py Log: * Implemented 'first cycle' silent mode. Modified: software_suite_v3/software/plugin/plugin-hotmail/trunk/executables/plugin-hotmail.py =================================================================== --- software_suite_v3/software/plugin/plugin-hotmail/trunk/executables/plugin-hotmail.py 2010-02-03 10:24:15 UTC (rev 6046) +++ software_suite_v3/software/plugin/plugin-hotmail/trunk/executables/plugin-hotmail.py 2010-02-03 10:25:26 UTC (rev 6047) @@ -185,7 +185,7 @@ self.login = True #Private list. self.__history = [] - self.__firstCycle = False + self.__firstCycle = True self.__fcMutex = threading.Lock() # -------------------------------------------------------------------------- @@ -195,7 +195,7 @@ '''Plugin entry point. ''' #Checking first if internet connection is available. - if self.isInternetAvailable(): + if self.isInternetAvailable(): #Checking username is 'Hotmail friendly'. if ( self.configuration().getUser() == "" ) or ( self.configuration().getPassword() == "" ): if self.getCommand() == "run": @@ -206,9 +206,14 @@ #Getting Xml emails file. self.getXmlEmailFile() self.toXmlDict() - + + #Getting first cycle state. + mPath, mFile = os.path.split(__file__) + file = os.path.join(mPath, 'data.pkl') + self.__firstCycle = not os.path.exists(file) + #Loading history. - self.__firstCycle = self.loadHistory() + self.loadHistory() #Getting right action. if self.getCommand() == "run": @@ -262,7 +267,9 @@ '''Plugin entry point for the "check" command. ''' if not self.isWindows(): + self.throwResult('false') self.stop() + if not ( len(self.mails) == 0 ): count = 0 #Checking how many email were already said. @@ -271,15 +278,21 @@ count += 1 #Registering as readed into history. self.registerMail(mail) - #and throwing the result. + + if self.__firstCycle: + self.stop() + + #Throwing the result. if count > 1: - self.throwNotification("start") + self.throwNotification('start') self.throwMessage(self.pickSentence(self.MULTIPLE_MAIL), count) - self.throwNotification("stop") + self.throwNotification('stop') elif count == 1: self.throwNotification("start") self.throwMessage(self.pickSentence(self.SINGLE_MAIL)) - self.throwNotification("stop") + self.throwNotification('stop') + + self.stop() # -------------------------------------------------------------------------- # Ping for internet connection. @@ -362,16 +375,16 @@ ''' self.__fcMutex.acquire() try: - pkl_file = open('data.pkl', 'rb') + mPath, mFile = os.path.split(__file__) + f = os.path.join(mPath, 'data.pkl') + pkl_file = open(f, 'rb') self.__history = pickle.load(pkl_file) pkl_file.close() self.__fcMutex.release() - return True except IOError: self.__fcMutex.release() #Pickle file does not exists. self.__history = [] - return True # -------------------------------------------------------------------------- # Register pickle struct history file. @@ -380,7 +393,9 @@ '''Register pickle struct history file. ''' try: - output = open('data.pkl', 'wb') + mPath, mFile = os.path.split(__file__) + f = os.path.join(mPath, 'data.pkl') + output = open(f, 'wb') pickle.dump(self.__history, output) output.close() except: |