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
b5c0d80f
Commit
b5c0d80f
authored
Jun 24, 2013
by
Dan Pascu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed some of the presence logic
parent
10f43be7
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
18 deletions
+10
-18
presence.py
blink/presence.py
+10
-18
No files found.
blink/presence.py
View file @
b5c0d80f
...
...
@@ -49,8 +49,8 @@ class PresencePublicationHandler(object):
notification_center
=
NotificationCenter
()
notification_center
.
add_observer
(
self
,
name
=
'SIPAccountWillActivate'
)
notification_center
.
add_observer
(
self
,
name
=
'SIPAccountWillDeactivate'
)
notification_center
.
add_observer
(
self
,
name
=
'SIPAccountDidDiscoverXCAPSupport'
)
notification_center
.
add_observer
(
self
,
name
=
'SystemDidWakeUpFromSleep'
)
notification_center
.
add_observer
(
self
,
name
=
'XCAPManagerDidDiscoverServerCapabilities'
)
notification_center
.
add_observer
(
self
,
name
=
'XCAPManagerDidReloadData'
)
notification_center
.
add_observer
(
self
,
sender
=
BlinkSettings
(),
name
=
'CFGSettingsObjectDidChange'
)
try
:
...
...
@@ -62,8 +62,8 @@ class PresencePublicationHandler(object):
notification_center
=
NotificationCenter
()
notification_center
.
remove_observer
(
self
,
name
=
'SIPAccountWillActivate'
)
notification_center
.
remove_observer
(
self
,
name
=
'SIPAccountWillDeactivate'
)
notification_center
.
remove_observer
(
self
,
name
=
'SIPAccountDidDiscoverXCAPSupport'
)
notification_center
.
remove_observer
(
self
,
name
=
'SystemDidWakeUpFromSleep'
)
notification_center
.
remove_observer
(
self
,
name
=
'XCAPManagerDidDiscoverServerCapabilities'
)
notification_center
.
remove_observer
(
self
,
name
=
'XCAPManagerDidReloadData'
)
notification_center
.
remove_observer
(
self
,
sender
=
BlinkSettings
(),
name
=
'CFGSettingsObjectDidChange'
)
...
...
@@ -161,7 +161,7 @@ class PresencePublicationHandler(object):
blink_settings
=
BlinkSettings
()
if
not
account
:
account_manager
=
AccountManager
()
accounts
=
[
account
for
account
in
account_manager
.
get_accounts
()
if
hasattr
(
account
,
'xcap'
)
and
account
.
xcap
.
discovered
]
accounts
=
[
account
for
account
in
account_manager
.
get_accounts
()
if
hasattr
(
account
,
'xcap'
)
and
account
.
xcap
.
enabled
and
account
.
xcap
.
discovered
]
else
:
accounts
=
[
account
]
for
account
in
accounts
:
...
...
@@ -172,7 +172,7 @@ class PresencePublicationHandler(object):
blink_settings
=
BlinkSettings
()
if
not
account
:
account_manager
=
AccountManager
()
accounts
=
[
account
for
account
in
account_manager
.
get_accounts
()
if
hasattr
(
account
,
'xcap'
)
and
account
.
xcap
.
discovered
]
accounts
=
[
account
for
account
in
account_manager
.
get_accounts
()
if
hasattr
(
account
,
'xcap'
)
and
account
.
xcap
.
enabled
and
account
.
xcap
.
discovered
]
else
:
accounts
=
[
account
]
try
:
...
...
@@ -209,18 +209,9 @@ class PresencePublicationHandler(object):
self
.
publish
()
else
:
account
=
notification
.
sender
if
'presence.enabled'
in
notification
.
data
.
modified
:
if
account
.
presence
.
enabled
:
self
.
publish
(
account
)
# The account itself will unpublish when presence is disabled
return
if
set
([
'xcap.enabled'
,
'xcap.xcap_root'
])
.
intersection
(
notification
.
data
.
modified
):
account
.
icon
=
None
if
set
([
'display_name'
,
'xcap.enabled'
,
'xcap.discovered'
])
.
intersection
(
notification
.
data
.
modified
):
if
'xcap.discovered'
in
notification
.
data
.
modified
and
account
.
xcap
.
enabled
and
account
.
xcap
.
discovered
:
with
account
.
xcap_manager
.
transaction
():
self
.
set_xcap_offline_note
(
account
)
self
.
set_xcap_icon
(
account
)
if
set
([
'presence.enabled'
,
'display_name'
,
'xcap.enabled'
,
'xcap.xcap_root'
])
.
intersection
(
notification
.
data
.
modified
)
and
account
.
presence
.
enabled
:
self
.
publish
(
account
)
def
_NH_SIPAccountWillActivate
(
self
,
notification
):
...
...
@@ -264,10 +255,11 @@ class PresencePublicationHandler(object):
blink_settings
.
presence
.
state_history
=
[
new_state
]
+
[
state
for
state
in
blink_settings
.
presence
.
state_history
if
state
!=
new_state
]
blink_settings
.
save
()
def
_NH_XCAPManagerDidDiscoverServerCapabilities
(
self
,
notification
):
account
=
notification
.
sender
.
account
if
account
.
enabled
and
account
.
presence
.
enabled
:
self
.
publish
(
account
)
def
_NH_SIPAccountDidDiscoverXCAPSupport
(
self
,
notification
):
account
=
notification
.
sender
with
account
.
xcap_manager
.
transaction
():
self
.
set_xcap_offline_note
(
account
)
self
.
set_xcap_icon
(
account
)
def
_NH_XCAPManagerDidReloadData
(
self
,
notification
):
account
=
notification
.
sender
.
account
...
...
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