Welcome to mirror list, hosted at ThFree Co, Russian Federation.

dev.gajim.org/gajim/gajim.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrendan Taylor <bct@diffeq.com>2007-07-14 02:52:23 +0400
committerBrendan Taylor <bct@diffeq.com>2007-07-14 02:52:23 +0400
commit9d04cd0a82a89452ab4e00579429ef81ce2dcc55 (patch)
tree83ff6feab0e670950a0356f6c41cd50436ee388b
parent8af883e8521892e2e8e9e1dcb590b7a69a527b98 (diff)
a file for pickling retained secrets
-rw-r--r--src/common/check_paths.py12
-rw-r--r--src/common/configpaths.py4
-rw-r--r--src/common/gajim.py1
3 files changed, 15 insertions, 2 deletions
diff --git a/src/common/check_paths.py b/src/common/check_paths.py
index 600855aab..3dfefe501 100644
--- a/src/common/check_paths.py
+++ b/src/common/check_paths.py
@@ -20,6 +20,8 @@ import stat
from common import gajim
import logger
+import pickle
+
# DO NOT MOVE ABOVE OF import gajim
try:
import sqlite3 as sqlite # python 2.5
@@ -84,6 +86,7 @@ def check_and_possibly_create_paths():
LOG_DB_PATH = logger.LOG_DB_PATH
VCARD_PATH = gajim.VCARD_PATH
AVATAR_PATH = gajim.AVATAR_PATH
+ SECRETS_PATH = gajim.SECRETS_PATH
dot_gajim = os.path.dirname(VCARD_PATH)
if os.path.isfile(dot_gajim):
print _('%s is a file but it should be a directory') % dot_gajim
@@ -115,6 +118,13 @@ def check_and_possibly_create_paths():
print _('%s is a directory but should be a file') % LOG_DB_PATH
print _('Gajim will now exit')
sys.exit()
+
+ if not os.path.exists(SECRETS_PATH):
+ pickle.dump({}, SECRETS_PATH)
+ elif os.path.isdir(SECRETS_PATH):
+ print _('%s is a directory but should be a file') % SECRETS_PATH
+ print _('Gajim will now exit')
+ sys.exit()
else: # dot_gajim doesn't exist
if dot_gajim: # is '' on win9x so avoid that
@@ -126,6 +136,8 @@ def check_and_possibly_create_paths():
if not os.path.isfile(LOG_DB_PATH):
create_log_db()
gajim.logger.init_vars()
+ if not os.path.isfile(SECRETS_PATH):
+ pickle.dump({}, SECRETS_PATH)
def create_path(directory):
print _('creating %s directory') % directory
diff --git a/src/common/configpaths.py b/src/common/configpaths.py
index f7e09a686..9350903c3 100644
--- a/src/common/configpaths.py
+++ b/src/common/configpaths.py
@@ -77,8 +77,8 @@ def init():
paths = ConfigPaths()
# LOG is deprecated
- k = ( 'LOG', 'LOG_DB', 'VCARD', 'AVATAR', 'MY_EMOTS' )
- v = (u'logs', u'logs.db', u'vcards', u'avatars', u'emoticons')
+ k = ( 'LOG', 'LOG_DB', 'VCARD', 'AVATAR', 'MY_EMOTS', 'SECRETS' )
+ v = (u'logs', u'logs.db', u'vcards', u'avatars', u'emoticons', u'secrets')
if os.name == 'nt':
v = map(lambda x: x.capitalize(), v)
diff --git a/src/common/gajim.py b/src/common/gajim.py
index fc109e8d0..cd7715592 100644
--- a/src/common/gajim.py
+++ b/src/common/gajim.py
@@ -71,6 +71,7 @@ LOGPATH = gajimpaths['LOG'] # deprecated
VCARD_PATH = gajimpaths['VCARD']
AVATAR_PATH = gajimpaths['AVATAR']
MY_EMOTS_PATH = gajimpaths['MY_EMOTS']
+SECRETS_PATH = gajimpaths['SECRETS']
TMP = gajimpaths['TMP']
DATA_DIR = gajimpaths['DATA']
HOME_DIR = gajimpaths['HOME']