diff options
author | Kali Kaneko <kali@leap.se> | 2014-01-11 23:10:09 -0400 |
---|---|---|
committer | Kali Kaneko <kali@leap.se> | 2014-01-11 23:36:29 -0400 |
commit | a1db341a39ec336ab62e89280f9bfb315420bfb5 (patch) | |
tree | fecbf3cb3db336bec67bd86c5235e894b9b9bb68 /src/leap/bitmask/config/leapsettings.py | |
parent | cbdda58f1e5f74f37489f3b4b67616bd19d6715d (diff) |
offline mode
This will skip:
* srp authentication with server
* remote soledad configuration
* keymanager sending key to server
* imap fetches.
Its main goal is to help us while debugging imap accounts, by cutting
almost all communication with server.
It will break havoc if you use it without having local keys configured.
So, basically, use with care.
Diffstat (limited to 'src/leap/bitmask/config/leapsettings.py')
-rw-r--r-- | src/leap/bitmask/config/leapsettings.py | 34 |
1 files changed, 31 insertions, 3 deletions
diff --git a/src/leap/bitmask/config/leapsettings.py b/src/leap/bitmask/config/leapsettings.py index c524425e..91ff83a8 100644 --- a/src/leap/bitmask/config/leapsettings.py +++ b/src/leap/bitmask/config/leapsettings.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- # leapsettings.py -# Copyright (C) 2013 LEAP +# Copyright (C) 2013, 2014 LEAP # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -14,9 +14,8 @@ # # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. - """ -QSettings abstraction +QSettings abstraction. """ import os import logging @@ -70,6 +69,7 @@ class LeapSettings(object): GATEWAY_KEY = "Gateway" PINNED_KEY = "Pinned" SKIPFIRSTRUN_KEY = "SkipFirstRun" + UUIDFORUSER_KEY = "%s/%s_uuid" # values GATEWAY_AUTOMATIC = "Automatic" @@ -353,3 +353,31 @@ class LeapSettings(object): """ leap_assert_type(skip, bool) self._settings.setValue(self.SKIPFIRSTRUN_KEY, skip) + + def get_uuid(self, username): + """ + Gets the uuid for a given username. + + :param username: the full user identifier in the form user@provider + :type username: basestring + """ + leap_assert("@" in username, + "Expected username in the form user@provider") + user, provider = username.split('@') + return self._settings.value( + self.UUIDFORUSER_KEY % (provider, user), "") + + def set_uuid(self, username, value): + """ + Sets the uuid for a given username. + + :param username: the full user identifier in the form user@provider + :type username: basestring + :param value: the uuid to save + :type value: basestring + """ + leap_assert("@" in username, + "Expected username in the form user@provider") + user, provider = username.split('@') + leap_assert(len(value) > 0, "We cannot save an empty uuid") + self._settings.setValue(self.UUIDFORUSER_KEY % (provider, user), value) |