Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vmj-qt
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kulya
vmj-qt
Commits
e99740bf
Commit
e99740bf
authored
Jul 04, 2013
by
Saul Ibarra
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed losing contact icons
parent
714c82fb
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
6 deletions
+13
-6
presence.py
blink/presence.py
+13
-6
No files found.
blink/presence.py
View file @
e99740bf
...
@@ -319,8 +319,12 @@ class PresenceSubscriptionHandler(object):
...
@@ -319,8 +319,12 @@ class PresenceSubscriptionHandler(object):
response
=
urllib2
.
urlopen
(
req
)
response
=
urllib2
.
urlopen
(
req
)
content
=
response
.
read
()
content
=
response
.
read
()
info
=
response
.
info
()
info
=
response
.
info
()
except
(
ConnectionLost
,
urllib2
.
HTTPError
,
urllib2
.
URLError
):
except
urllib2
.
HTTPError
,
e
:
return
None
,
None
if
e
.
code
==
404
:
return
NoIcon
,
None
return
SameIcon
,
None
except
(
ConnectionLost
,
urllib2
.
URLError
):
return
SameIcon
,
None
content_type
=
info
.
getheader
(
'content-type'
)
content_type
=
info
.
getheader
(
'content-type'
)
etag
=
info
.
getheader
(
'etag'
)
etag
=
info
.
getheader
(
'etag'
)
if
etag
.
startswith
(
'W/'
):
if
etag
.
startswith
(
'W/'
):
...
@@ -331,7 +335,7 @@ class PresenceSubscriptionHandler(object):
...
@@ -331,7 +335,7 @@ class PresenceSubscriptionHandler(object):
pres_content
=
prescontent
.
PresenceContentDocument
.
parse
(
content
)
pres_content
=
prescontent
.
PresenceContentDocument
.
parse
(
content
)
content
=
base64
.
decodestring
(
pres_content
.
data
.
value
)
content
=
base64
.
decodestring
(
pres_content
.
data
.
value
)
except
Exception
:
except
Exception
:
return
None
,
None
return
SameIcon
,
None
return
content
,
etag
return
content
,
etag
@
run_in_green_thread
@
run_in_green_thread
...
@@ -355,7 +359,10 @@ class PresenceSubscriptionHandler(object):
...
@@ -355,7 +359,10 @@ class PresenceSubscriptionHandler(object):
for
contact
,
pidf_list
in
contact_pidf_map
.
iteritems
():
for
contact
,
pidf_list
in
contact_pidf_map
.
iteritems
():
if
not
pidf_list
:
if
not
pidf_list
:
state
=
note
=
icon_descriptor
=
icon_data
=
None
state
=
None
note
=
None
icon_descriptor
=
None
icon_data
=
UnknownIcon
else
:
else
:
services
=
list
(
chain
(
*
(
list
(
pidf_doc
.
services
)
for
pidf_doc
in
pidf_list
)))
services
=
list
(
chain
(
*
(
list
(
pidf_doc
.
services
)
for
pidf_doc
in
pidf_list
)))
services
.
sort
(
key
=
lambda
obj
:
obj
.
timestamp
.
value
if
obj
.
timestamp
else
epoch
,
reverse
=
True
)
services
.
sort
(
key
=
lambda
obj
:
obj
.
timestamp
.
value
if
obj
.
timestamp
else
epoch
,
reverse
=
True
)
...
@@ -377,10 +384,10 @@ class PresenceSubscriptionHandler(object):
...
@@ -377,10 +384,10 @@ class PresenceSubscriptionHandler(object):
else
:
else
:
# New icon, client uses fast path mechanism
# New icon, client uses fast path mechanism
icon_data
,
etag
=
self
.
_download_icon
(
icon
,
None
)
icon_data
,
etag
=
self
.
_download_icon
(
icon
,
None
)
icon_descriptor
=
IconDescriptor
(
icon
,
icon_hash
)
if
icon_data
else
None
icon_descriptor
=
IconDescriptor
(
icon
,
icon_hash
)
if
icon_data
not
in
(
NoIcon
,
SameIcon
,
UnknownIcon
)
else
None
else
:
else
:
icon_data
,
etag
=
self
.
_download_icon
(
icon
,
contact
.
icon
.
etag
if
contact
.
icon
else
None
)
icon_data
,
etag
=
self
.
_download_icon
(
icon
,
contact
.
icon
.
etag
if
contact
.
icon
else
None
)
icon_descriptor
=
IconDescriptor
(
icon
,
etag
)
if
icon_data
else
None
icon_descriptor
=
IconDescriptor
(
icon
,
etag
)
if
icon_data
not
in
(
NoIcon
,
SameIcon
,
UnknownIcon
)
else
None
elif
icon
==
unknown_icon
:
elif
icon
==
unknown_icon
:
icon_data
=
UnknownIcon
icon_data
=
UnknownIcon
icon_descriptor
=
None
icon_descriptor
=
None
...
...
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