X-Git-Url: http://git.maemo.org/git/?p=theonering;a=blobdiff_plain;f=src%2Fgvoice%2Fsession.py;h=d024ea9b1a63eebcfcc37a77515819c87515da29;hp=5a825f0d1337aeb486fa25af7eef4eadeb86ac4a;hb=HEAD;hpb=82d3b4a7ae787eaaf1ac5ff07bc60aa25c84d50a diff --git a/src/gvoice/session.py b/src/gvoice/session.py index 5a825f0..d024ea9 100644 --- a/src/gvoice/session.py +++ b/src/gvoice/session.py @@ -4,7 +4,6 @@ import os import time import logging -import backend import addressbook import conversations import state_machine @@ -37,9 +36,14 @@ class Session(object): defaults[key] = (state_machine.UpdateStateMachine.INFINITE_PERIOD, unit) self._username = None self._password = None + self._cookiePath = cookiePath + + self._lastDndCheck = 0 + self._cachedIsDnd = False self._asyncPool = gobject_utils.AsyncPool() - self._backend = backend.GVoiceBackend(cookiePath) + import backend + self._backend = backend.GVoiceBackend(self._cookiePath) if defaults["contacts"][0] == state_machine.UpdateStateMachine.INFINITE_PERIOD: contactsPeriodInSeconds = state_machine.UpdateStateMachine.INFINITE_PERIOD @@ -129,9 +133,6 @@ class Session(object): self._masterStateMachine.append_machine(self._voicemailsStateMachine) self._masterStateMachine.append_machine(self._textsStateMachine) - self._lastDndCheck = 0 - self._cachedIsDnd = False - def load(self, path): self._texts.load(os.sep.join((path, "texts.cache"))) self._voicemails.load(os.sep.join((path, "voicemails.cache"))) @@ -218,8 +219,9 @@ class Session(object): return isLoggedIn def set_dnd(self, doNotDisturb): - self._backend.set_dnd(doNotDisturb) - self._cachedIsDnd = doNotDisturb + if self._cachedIsDnd != doNotDisturb: + self._backend.set_dnd(doNotDisturb) + self._cachedIsDnd = doNotDisturb def is_dnd(self): # To throttle checking with the server, use a 30s cache