def login(self):
   self.loggedin=False
   try:
     self.prowl_listener = ProwlListener()
     self.print_listener = PrintListener()
   except:
     print 'Could not load Listeners...not logged in.'
     self.loggedin=False
     return self.loggedin
   try:
     self.sleep_time, name, passwd = readparams(self.cfile)
   except:
     print 'Could not load Google Voice info...not logged in.'
     self.loggedin=False
     return self.loggedin
   self.gv = GoogleVoiceNotify(name, passwd,\
      listeners=(self.prowl_listener, self.print_listener),\
      picklefile=self.pfile)
   try:
     self.gv = GoogleVoiceNotify(name, passwd,\
      listeners=(self.prowl_listener, self.print_listener),\
      picklefile=self.pfile)
   except:
     print 'Cannot connect to Google Voice.'
     self.loggedin=False
     return self.loggedin
   del passwd
   try:
     self.gv.check()
     self.loggedin=True
   except:
     self.loggedin=False
     return self.loggedin
   print 'Connected will check every %i s'%self.sleep_time
   return self.loggedin
 def login(self):
     self.loggedin = False
     try:
         self.prowl_listener = ProwlListener()
         self.print_listener = PrintListener()
     except:
         print 'Could not load Listeners...not logged in.'
         self.loggedin = False
         return self.loggedin
     try:
         self.sleep_time, name, passwd = readparams(self.cfile)
     except:
         print 'Could not load Google Voice info...not logged in.'
         self.loggedin = False
         return self.loggedin
     self.gv = GoogleVoiceNotify(name, passwd,\
        listeners=(self.prowl_listener, self.print_listener),\
        picklefile=self.pfile)
     try:
         self.gv = GoogleVoiceNotify(name, passwd,\
          listeners=(self.prowl_listener, self.print_listener),\
          picklefile=self.pfile)
     except:
         print 'Cannot connect to Google Voice.'
         self.loggedin = False
         return self.loggedin
     del passwd
     try:
         self.gv.check()
         self.loggedin = True
     except:
         self.loggedin = False
         return self.loggedin
     print 'Connected will check every %i s' % self.sleep_time
     return self.loggedin
class gv2prowl(Daemon):
    def setpickle(self, pfile=environ['HOME'] + '/logs/pickle.dump'):
        self.pfile = pfile

    def setcfile(self, cfile=environ['HOME'] + '/.gvnotify'):
        self.cfile = cfile

    def reset(self):
        self.loggedin = False

    def login(self):
        self.loggedin = False
        try:
            self.prowl_listener = ProwlListener()
            self.print_listener = PrintListener()
        except:
            print 'Could not load Listeners...not logged in.'
            self.loggedin = False
            return self.loggedin
        try:
            self.sleep_time, name, passwd = readparams(self.cfile)
        except:
            print 'Could not load Google Voice info...not logged in.'
            self.loggedin = False
            return self.loggedin
        self.gv = GoogleVoiceNotify(name, passwd,\
           listeners=(self.prowl_listener, self.print_listener),\
           picklefile=self.pfile)
        try:
            self.gv = GoogleVoiceNotify(name, passwd,\
             listeners=(self.prowl_listener, self.print_listener),\
             picklefile=self.pfile)
        except:
            print 'Cannot connect to Google Voice.'
            self.loggedin = False
            return self.loggedin
        del passwd
        try:
            self.gv.check()
            self.loggedin = True
        except:
            self.loggedin = False
            return self.loggedin
        print 'Connected will check every %i s' % self.sleep_time
        return self.loggedin

    def run(self):
        if self.loggedin:
            while True:
                self.gv.check()
                sleep(self.sleep_time)
        else:
            print 'Not logged into GV!'
class gv2prowl(Daemon):
  def setpickle(self,pfile=environ['HOME']+'/logs/pickle.dump'):
    self.pfile=pfile
  def setcfile(self,cfile=environ['HOME']+'/.gvnotify'):
    self.cfile=cfile
  def reset(self):
    self.loggedin=False
  def login(self):
    self.loggedin=False
    try:
      self.prowl_listener = ProwlListener()
      self.print_listener = PrintListener()
    except:
      print 'Could not load Listeners...not logged in.'
      self.loggedin=False
      return self.loggedin
    try:
      self.sleep_time, name, passwd = readparams(self.cfile)
    except:
      print 'Could not load Google Voice info...not logged in.'
      self.loggedin=False
      return self.loggedin
    self.gv = GoogleVoiceNotify(name, passwd,\
       listeners=(self.prowl_listener, self.print_listener),\
       picklefile=self.pfile)
    try:
      self.gv = GoogleVoiceNotify(name, passwd,\
       listeners=(self.prowl_listener, self.print_listener),\
       picklefile=self.pfile)
    except:
      print 'Cannot connect to Google Voice.'
      self.loggedin=False
      return self.loggedin
    del passwd
    try:
      self.gv.check()
      self.loggedin=True
    except:
      self.loggedin=False
      return self.loggedin
    print 'Connected will check every %i s'%self.sleep_time
    return self.loggedin
  def run(self):
    if self.loggedin:
      while True:
        self.gv.check()
        sleep(self.sleep_time)
    else:
      print 'Not logged into GV!'
	try:
		params['sleep']
	except:
		params['sleep'] = 60
	return params['sleep'], params['gvid'], params['password']

if __name__ == '__main__':
	try:
		prowl_listener = ProwlListener()
		print_listener = PrintListener()
	except Exception, e:
		print e
		print 'Could not load ProwlListener...exiting.'
		sys.exit()
	cfile = environ['HOME']+'/.gvnotify'
	try:
		sleep_time, name, passwd = readparams(cfile)
	except:
		print 'Could not load Google Voice info...exiting.'
		sys.exit()
	gv = GoogleVoiceNotify(name, passwd,
		listeners=(prowl_listener, print_listener),
		picklefile = environ['HOME']+'/.gvcache')
	del passwd
	while True:
		# uncomment below for debugging
		# print 'sleeping...'
		gv.check()
		sleep(sleep_time)

        params['sleep']
    except:
        params['sleep'] = 60
    return params['sleep'], params['gvid'], params['password']


if __name__ == '__main__':
    try:
        prowl_listener = ProwlListener()
        print_listener = PrintListener()
    except Exception, e:
        print e
        print 'Could not load ProwlListener...exiting.'
        sys.exit()
    cfile = environ['HOME'] + '/.gvnotify'
    try:
        sleep_time, name, passwd = readparams(cfile)
    except:
        print 'Could not load Google Voice info...exiting.'
        sys.exit()
    gv = GoogleVoiceNotify(name,
                           passwd,
                           listeners=(prowl_listener, print_listener),
                           picklefile=environ['HOME'] + '/.gvcache')
    del passwd
    while True:
        # uncomment below for debugging
        # print 'sleeping...'
        gv.check()
        sleep(sleep_time)