Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
gajim
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Sophie Herold
gajim
Commits
cdf4d0ee
Commit
cdf4d0ee
authored
7 years ago
by
Emmanuel Gil Peyrot
Browse files
Options
Downloads
Patches
Plain Diff
Also log the offending JID on avatar decoding issue
parent
fc627fc1
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
gajim/common/connection_handlers.py
+4
-4
4 additions, 4 deletions
gajim/common/connection_handlers.py
gajim/vcard.py
+3
-3
3 additions, 3 deletions
gajim/vcard.py
with
7 additions
and
7 deletions
gajim/common/connection_handlers.py
+
4
−
4
View file @
cdf4d0ee
...
...
@@ -474,7 +474,7 @@ class ConnectionVcard:
app
.
nec
.
push_incoming_event
(
VcardNotPublishedEvent
(
None
,
conn
=
self
))
def
get_vcard_photo
(
self
,
vcard
):
def
_
get_vcard_photo
(
self
,
vcard
,
jid
):
try
:
photo
=
vcard
[
'
PHOTO
'
][
'
BINVAL
'
]
except
(
KeyError
,
AttributeError
):
...
...
@@ -488,7 +488,7 @@ class ConnectionVcard:
try
:
photo_decoded
=
base64
.
b64decode
(
photo
.
encode
(
'
utf-8
'
))
except
binascii
.
Error
as
error
:
app
.
log
(
'
avatar
'
).
warning
(
'
Invalid
A
vatar
: %s
'
,
error
)
app
.
log
(
'
avatar
'
).
warning
(
'
Invalid
a
vatar
for %s: %s
'
,
jid
,
error
)
return
None
,
None
avatar_sha
=
hashlib
.
sha1
(
photo_decoded
).
hexdigest
()
...
...
@@ -532,7 +532,7 @@ class ConnectionVcard:
def
_on_own_avatar_received
(
self
,
jid
,
resource
,
room
,
vcard
):
avatar_sha
,
photo_decoded
=
self
.
get_vcard_photo
(
vcard
)
avatar_sha
,
photo_decoded
=
self
.
_
get_vcard_photo
(
vcard
,
jid
)
app
.
log
(
'
avatar
'
).
info
(
'
Received own (vCard): %s
'
,
avatar_sha
)
...
...
@@ -570,7 +570,7 @@ class ConnectionVcard:
"""
Called when we receive a vCard Parse the vCard and trigger Events
"""
avatar_sha
,
photo_decoded
=
self
.
get_vcard_photo
(
vcard
)
avatar_sha
,
photo_decoded
=
self
.
_
get_vcard_photo
(
vcard
,
jid
)
app
.
interface
.
save_avatar
(
photo_decoded
)
# Received vCard from a contact
...
...
This diff is collapsed.
Click to expand it.
gajim/vcard.py
+
3
−
3
View file @
cdf4d0ee
...
...
@@ -202,7 +202,7 @@ class VcardWindow:
except
AttributeError
:
pass
def
set_values
(
self
,
vcard
):
def
_
set_values
(
self
,
vcard
,
jid
):
for
i
in
vcard
.
keys
():
if
i
==
'
PHOTO
'
and
self
.
xml
.
get_object
(
'
information_notebook
'
).
\
get_n_pages
()
>
4
:
...
...
@@ -215,7 +215,7 @@ class VcardWindow:
photo_decoded
=
base64
.
b64decode
(
photo_encoded
.
encode
(
'
utf-8
'
))
except
binascii
.
Error
as
error
:
app
.
log
(
'
avatar
'
).
warning
(
'
Invalid
A
vatar
: %s
'
,
error
)
app
.
log
(
'
avatar
'
).
warning
(
'
Invalid
a
vatar
for %s: %s
'
,
jid
,
error
)
continue
pixbuf
=
gtkgui_helpers
.
get_pixbuf_from_data
(
photo_decoded
)
if
pixbuf
is
None
:
...
...
@@ -266,7 +266,7 @@ class VcardWindow:
def
_nec_vcard_received
(
self
,
jid
,
resource
,
room
,
vcard
):
self
.
clear_values
()
self
.
set_values
(
vcard
)
self
.
_
set_values
(
vcard
,
jid
)
def
set_os_info
(
self
,
obj
):
if
obj
.
conn
.
name
!=
self
.
account
:
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment