Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
norstbox
gajim
Commits
f9d0421d
Commit
f9d0421d
authored
Mar 10, 2006
by
Yann Leboulanger
Browse files
jids and nicks are now punycoded before we store on HD. See #1030
parent
b1ebd06f
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/common/connection.py
View file @
f9d0421d
...
...
@@ -45,6 +45,7 @@ if os.name != 'nt':
signal
.
signal
(
signal
.
SIGPIPE
,
signal
.
SIG_DFL
)
from
calendar
import
timegm
from
encodings.punycode
import
punycode_encode
import
common.xmpp
...
...
@@ -272,7 +273,8 @@ class Connection:
def
save_vcard_to_hd
(
self
,
full_jid
,
card
):
jid
,
nick
=
gajim
.
get_room_and_nick_from_fjid
(
full_jid
)
path
=
os
.
path
.
join
(
gajim
.
VCARD_PATH
,
jid
)
puny_jid
=
punycode_encode
(
jid
)
path
=
os
.
path
.
join
(
gajim
.
VCARD_PATH
,
puny_jid
)
if
jid
in
self
.
room_jids
:
# remove room_jid file if needed
if
os
.
path
.
isfile
(
path
):
...
...
@@ -280,7 +282,8 @@ class Connection:
# create folder if needed
if
not
os
.
path
.
isdir
(
path
):
os
.
mkdir
(
path
,
0700
)
path_to_file
=
os
.
path
.
join
(
gajim
.
VCARD_PATH
,
jid
,
nick
)
puny_nick
=
punycode_encode
(
nick
)
path_to_file
=
os
.
path
.
join
(
gajim
.
VCARD_PATH
,
puny_jid
,
puny_nick
)
else
:
path_to_file
=
path
fil
=
open
(
path_to_file
,
'w'
)
...
...
@@ -2356,10 +2359,12 @@ class Connection:
return {} if vcard was too old
return None if we don't have cached vcard'''
jid
,
nick
=
gajim
.
get_room_and_nick_from_fjid
(
fjid
)
puny_jid
=
punycode_encode
(
jid
)
if
is_fake_jid
:
path_to_file
=
os
.
path
.
join
(
gajim
.
VCARD_PATH
,
jid
,
nick
)
puny_nick
=
punycode_encode
(
nick
)
path_to_file
=
os
.
path
.
join
(
gajim
.
VCARD_PATH
,
puny_jid
,
puny_nick
)
else
:
path_to_file
=
os
.
path
.
join
(
gajim
.
VCARD_PATH
,
jid
)
path_to_file
=
os
.
path
.
join
(
gajim
.
VCARD_PATH
,
puny_
jid
)
if
not
os
.
path
.
isfile
(
path_to_file
):
return
None
# We have the vcard cached
...
...
src/gtkgui_helpers.py
View file @
f9d0421d
...
...
@@ -23,6 +23,7 @@ import gobject
import
pango
import
os
import
sys
from
encodings.punycode
import
punycode_encode
import
vcard
...
...
@@ -443,10 +444,12 @@ def get_avatar_pixbuf_from_cache(fjid, is_fake_jid = False):
# don't show avatar for the transport itself
return
None
puny_jid
=
punycode_encode
(
jid
)
if
is_fake_jid
:
path
=
os
.
path
.
join
(
gajim
.
VCARD_PATH
,
jid
,
nick
)
puny_nick
=
punycode_encode
(
nick
)
path
=
os
.
path
.
join
(
gajim
.
VCARD_PATH
,
puny_jid
,
puny_nick
)
else
:
path
=
os
.
path
.
join
(
gajim
.
VCARD_PATH
,
jid
)
path
=
os
.
path
.
join
(
gajim
.
VCARD_PATH
,
puny_
jid
)
if
not
os
.
path
.
isfile
(
path
):
return
'ask'
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment