import pprint
import constants
-import gv_backend
+from backends import gv_backend
def get_missed(backend):
return not seemEqual
-def is_changed():
+def create_backend(config):
gvCookiePath = os.path.join(constants._data_path_, "gv_cookies.txt")
backend = gv_backend.GVDialer(gvCookiePath)
if not loggedIn:
loggedIn = backend.is_authed()
- config = ConfigParser.SafeConfigParser()
- config.read(constants._user_settings_)
if not loggedIn:
import base64
try:
except ConfigParser.NoSectionError, e:
pass
+ assert loggedIn
+ return backend
+
+
+def is_changed(config, backend):
try:
notifyOnMissed = config.getboolean("2 - Account Info", "notifyOnMissed")
notifyOnVoicemail = config.getboolean("2 - Account Info", "notifyOnVoicemail")
notifyOnVoicemail = False
notifyOnSms = False
- assert loggedIn
notifySources = []
if notifyOnMissed:
notifySources.append(("missed", get_missed))
def notify_on_change():
- notifyUser = is_changed()
+ config = ConfigParser.SafeConfigParser()
+ config.read(constants._user_settings_)
+ backend = create_backend(config)
+ notifyUser = is_changed(config, backend)
if notifyUser:
import led_handler