VCARDPATH --> VCARD_PATH

This commit is contained in:
Nikos Kouremenos 2006-02-15 10:44:41 +00:00
parent 036de12230
commit cb6f163f02
4 changed files with 17 additions and 17 deletions

View file

@ -73,9 +73,9 @@ def create_log_db():
def check_and_possibly_create_paths(): def check_and_possibly_create_paths():
LOG_DB_PATH = logger.LOG_DB_PATH LOG_DB_PATH = logger.LOG_DB_PATH
VCARDPATH = gajim.VCARDPATH VCARD_PATH = gajim.VCARD_PATH
AVATAR_PATH = gajim.AVATAR_PATH AVATAR_PATH = gajim.AVATAR_PATH
dot_gajim = os.path.dirname(VCARDPATH) dot_gajim = os.path.dirname(VCARD_PATH)
if os.path.isfile(dot_gajim): if os.path.isfile(dot_gajim):
print _('%s is file but it should be a directory') % dot_gajim print _('%s is file but it should be a directory') % dot_gajim
print _('Gajim will now exit') print _('Gajim will now exit')
@ -85,10 +85,10 @@ def check_and_possibly_create_paths():
if s.st_mode & stat.S_IROTH: # others have read permission! if s.st_mode & stat.S_IROTH: # others have read permission!
os.chmod(dot_gajim, 0700) # rwx------ os.chmod(dot_gajim, 0700) # rwx------
if not os.path.exists(VCARDPATH): if not os.path.exists(VCARD_PATH):
self.create_path(VCARDPATH) self.create_path(VCARD_PATH)
elif os.path.isfile(VCARDPATH): elif os.path.isfile(VCARD_PATH):
print _('%s is file but it should be a directory') % VCARDPATH print _('%s is file but it should be a directory') % VCARD_PATH
print _('Gajim will now exit') print _('Gajim will now exit')
sys.exit() sys.exit()
@ -109,8 +109,8 @@ def check_and_possibly_create_paths():
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
self.create_path(dot_gajim) self.create_path(dot_gajim)
if not os.path.isdir(VCARDPATH): if not os.path.isdir(VCARD_PATH):
self.create_path(VCARDPATH) self.create_path(VCARD_PATH)
if not os.path.exists(AVATAR_PATH): if not os.path.exists(AVATAR_PATH):
self.create_path(AVATAR_PATH) self.create_path(AVATAR_PATH)
if not os.path.isfile(LOG_DB_PATH): if not os.path.isfile(LOG_DB_PATH):

View file

@ -294,7 +294,7 @@ class Connection:
card.getTag('PHOTO').setTagData('SHA', avatar_sha) card.getTag('PHOTO').setTagData('SHA', avatar_sha)
# Save it to file # Save it to file
path_to_file = os.path.join(gajim.VCARDPATH, frm) path_to_file = os.path.join(gajim.VCARD_PATH, frm)
fil = open(path_to_file, 'w') fil = open(path_to_file, 'w')
fil.write(str(card)) fil.write(str(card))
fil.close() fil.close()
@ -1581,7 +1581,7 @@ class Connection:
# Save it to file # Save it to file
our_jid = gajim.get_jid_from_account(self.name) our_jid = gajim.get_jid_from_account(self.name)
path_to_file = os.path.join(gajim.VCARDPATH, our_jid) path_to_file = os.path.join(gajim.VCARD_PATH, our_jid)
fil = open(path_to_file, 'w') fil = open(path_to_file, 'w')
fil.write(str(vcard_iq)) fil.write(str(vcard_iq))
fil.close() fil.close()
@ -1609,7 +1609,7 @@ class Connection:
self.dispatch('VCARD', {'jid': jid}) self.dispatch('VCARD', {'jid': jid})
jid = gajim.get_jid_without_resource(jid) jid = gajim.get_jid_without_resource(jid)
# Write an empty file # Write an empty file
path_to_file = os.path.join(gajim.VCARDPATH, jid) path_to_file = os.path.join(gajim.VCARD_PATH, jid)
fil = open(path_to_file, 'w') fil = open(path_to_file, 'w')
fil.close() fil.close()
del self.awaiting_answers[id] del self.awaiting_answers[id]
@ -2283,7 +2283,7 @@ class Connection:
return {} if vcard was too old return {} if vcard was too old
return None if we don't have cached vcard''' return None if we don't have cached vcard'''
jid = gajim.get_jid_without_resource(fjid) jid = gajim.get_jid_without_resource(fjid)
path_to_file = os.path.join(gajim.VCARDPATH, jid) path_to_file = os.path.join(gajim.VCARD_PATH, jid)
if os.path.isfile(path_to_file): if os.path.isfile(path_to_file):
# We have the vcard cached # We have the vcard cached
f = open(path_to_file) f = open(path_to_file)

View file

@ -52,17 +52,17 @@ if os.name == 'nt':
try: try:
# Documents and Settings\[User Name]\Application Data\Gajim # Documents and Settings\[User Name]\Application Data\Gajim
LOGPATH = os.path.join(os.environ['appdata'], 'Gajim', 'Logs') # deprecated LOGPATH = os.path.join(os.environ['appdata'], 'Gajim', 'Logs') # deprecated
VCARDPATH = os.path.join(os.environ['appdata'], 'Gajim', 'Vcards') VCARD_PATH = os.path.join(os.environ['appdata'], 'Gajim', 'Vcards')
AVATAR_PATH = os.path.join(os.environ['appdata'], 'Gajim', 'Avatars') AVATAR_PATH = os.path.join(os.environ['appdata'], 'Gajim', 'Avatars')
except KeyError: except KeyError:
# win9x, in cwd # win9x, in cwd
LOGPATH = 'Logs' # deprecated LOGPATH = 'Logs' # deprecated
VCARDPATH = 'Vcards' VCARD_PATH = 'Vcards'
AVATAR_PATH = 'Avatars' AVATAR_PATH = 'Avatars'
else: # Unices else: # Unices
DATA_DIR = '../data' DATA_DIR = '../data'
LOGPATH = os.path.expanduser('~/.gajim/logs') # deprecated LOGPATH = os.path.expanduser('~/.gajim/logs') # deprecated
VCARDPATH = os.path.expanduser('~/.gajim/vcards') VCARD_PATH = os.path.expanduser('~/.gajim/vcards')
AVATAR_PATH = os.path.expanduser('~/.gajim/avatars') AVATAR_PATH = os.path.expanduser('~/.gajim/avatars')
HOME_DIR = os.path.expanduser('~') HOME_DIR = os.path.expanduser('~')
@ -70,7 +70,7 @@ TMP = tempfile.gettempdir()
try: try:
LOGPATH = LOGPATH.decode(sys.getfilesystemencoding()) LOGPATH = LOGPATH.decode(sys.getfilesystemencoding())
VCARDPATH = VCARDPATH.decode(sys.getfilesystemencoding()) VCARD_PATH = VCARD_PATH.decode(sys.getfilesystemencoding())
TMP = TMP.decode(sys.getfilesystemencoding()) TMP = TMP.decode(sys.getfilesystemencoding())
AVATAR_PATH = AVATAR_PATH.decode(sys.getfilesystemencoding()) AVATAR_PATH = AVATAR_PATH.decode(sys.getfilesystemencoding())
except: except:

View file

@ -445,7 +445,7 @@ def get_avatar_pixbuf_from_cache(jid):
# don't show avatar for the transport itself # don't show avatar for the transport itself
return None return None
if jid not in os.listdir(gajim.VCARDPATH): if jid not in os.listdir(gajim.VCARD_PATH):
return 'ask' return 'ask'
vcard_dict = gajim.connections.values()[0].get_cached_vcard(jid) vcard_dict = gajim.connections.values()[0].get_cached_vcard(jid)