per-profile srs storage
This commit is contained in:
parent
9d04cd0a82
commit
0ae43eab4e
|
@ -20,8 +20,6 @@ import stat
|
||||||
from common import gajim
|
from common import gajim
|
||||||
import logger
|
import logger
|
||||||
|
|
||||||
import pickle
|
|
||||||
|
|
||||||
# DO NOT MOVE ABOVE OF import gajim
|
# DO NOT MOVE ABOVE OF import gajim
|
||||||
try:
|
try:
|
||||||
import sqlite3 as sqlite # python 2.5
|
import sqlite3 as sqlite # python 2.5
|
||||||
|
@ -86,7 +84,6 @@ def check_and_possibly_create_paths():
|
||||||
LOG_DB_PATH = logger.LOG_DB_PATH
|
LOG_DB_PATH = logger.LOG_DB_PATH
|
||||||
VCARD_PATH = gajim.VCARD_PATH
|
VCARD_PATH = gajim.VCARD_PATH
|
||||||
AVATAR_PATH = gajim.AVATAR_PATH
|
AVATAR_PATH = gajim.AVATAR_PATH
|
||||||
SECRETS_PATH = gajim.SECRETS_PATH
|
|
||||||
dot_gajim = os.path.dirname(VCARD_PATH)
|
dot_gajim = os.path.dirname(VCARD_PATH)
|
||||||
if os.path.isfile(dot_gajim):
|
if os.path.isfile(dot_gajim):
|
||||||
print _('%s is a file but it should be a directory') % dot_gajim
|
print _('%s is a file but it should be a directory') % dot_gajim
|
||||||
|
@ -119,13 +116,6 @@ def check_and_possibly_create_paths():
|
||||||
print _('Gajim will now exit')
|
print _('Gajim will now exit')
|
||||||
sys.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
|
else: # dot_gajim doesn't exist
|
||||||
if dot_gajim: # is '' on win9x so avoid that
|
if dot_gajim: # is '' on win9x so avoid that
|
||||||
create_path(dot_gajim)
|
create_path(dot_gajim)
|
||||||
|
@ -136,8 +126,6 @@ def check_and_possibly_create_paths():
|
||||||
if not os.path.isfile(LOG_DB_PATH):
|
if not os.path.isfile(LOG_DB_PATH):
|
||||||
create_log_db()
|
create_log_db()
|
||||||
gajim.logger.init_vars()
|
gajim.logger.init_vars()
|
||||||
if not os.path.isfile(SECRETS_PATH):
|
|
||||||
pickle.dump({}, SECRETS_PATH)
|
|
||||||
|
|
||||||
def create_path(directory):
|
def create_path(directory):
|
||||||
print _('creating %s directory') % directory
|
print _('creating %s directory') % directory
|
||||||
|
|
|
@ -77,8 +77,8 @@ def init():
|
||||||
paths = ConfigPaths()
|
paths = ConfigPaths()
|
||||||
|
|
||||||
# LOG is deprecated
|
# LOG is deprecated
|
||||||
k = ( 'LOG', 'LOG_DB', 'VCARD', 'AVATAR', 'MY_EMOTS', 'SECRETS' )
|
k = ( 'LOG', 'LOG_DB', 'VCARD', 'AVATAR', 'MY_EMOTS' )
|
||||||
v = (u'logs', u'logs.db', u'vcards', u'avatars', u'emoticons', u'secrets')
|
v = (u'logs', u'logs.db', u'vcards', u'avatars', u'emoticons')
|
||||||
|
|
||||||
if os.name == 'nt':
|
if os.name == 'nt':
|
||||||
v = map(lambda x: x.capitalize(), v)
|
v = map(lambda x: x.capitalize(), v)
|
||||||
|
@ -106,13 +106,17 @@ gajimpaths = init()
|
||||||
def init_profile(profile, paths=gajimpaths):
|
def init_profile(profile, paths=gajimpaths):
|
||||||
conffile = windowsify(u'config')
|
conffile = windowsify(u'config')
|
||||||
pidfile = windowsify(u'gajim')
|
pidfile = windowsify(u'gajim')
|
||||||
|
secretsfile = windowsify(u'secrets')
|
||||||
|
|
||||||
if len(profile) > 0:
|
if len(profile) > 0:
|
||||||
conffile += u'.' + profile
|
conffile += u'.' + profile
|
||||||
pidfile += u'.' + profile
|
pidfile += u'.' + profile
|
||||||
|
secretsfile += u'.' + profile
|
||||||
|
|
||||||
pidfile += u'.pid'
|
pidfile += u'.pid'
|
||||||
paths.add_from_root('CONFIG_FILE', conffile)
|
paths.add_from_root('CONFIG_FILE', conffile)
|
||||||
paths.add_from_root('PID_FILE', pidfile)
|
paths.add_from_root('PID_FILE', pidfile)
|
||||||
|
paths.add_from_root('SECRETS_FILE', secretsfile)
|
||||||
|
|
||||||
# for k, v in paths.iteritems():
|
# for k, v in paths.iteritems():
|
||||||
# print "%s: %s" % (repr(k), repr(v))
|
# print "%s: %s" % (repr(k), repr(v))
|
||||||
|
|
|
@ -71,7 +71,6 @@ LOGPATH = gajimpaths['LOG'] # deprecated
|
||||||
VCARD_PATH = gajimpaths['VCARD']
|
VCARD_PATH = gajimpaths['VCARD']
|
||||||
AVATAR_PATH = gajimpaths['AVATAR']
|
AVATAR_PATH = gajimpaths['AVATAR']
|
||||||
MY_EMOTS_PATH = gajimpaths['MY_EMOTS']
|
MY_EMOTS_PATH = gajimpaths['MY_EMOTS']
|
||||||
SECRETS_PATH = gajimpaths['SECRETS']
|
|
||||||
TMP = gajimpaths['TMP']
|
TMP = gajimpaths['TMP']
|
||||||
DATA_DIR = gajimpaths['DATA']
|
DATA_DIR = gajimpaths['DATA']
|
||||||
HOME_DIR = gajimpaths['HOME']
|
HOME_DIR = gajimpaths['HOME']
|
||||||
|
|
Loading…
Reference in New Issue