diff options
author | Juha Heinanen <jh@tutpro.com> | 2014-11-18 12:44:27 +0200 |
---|---|---|
committer | Juha Heinanen <jh@tutpro.com> | 2014-11-18 12:44:27 +0200 |
commit | 6502a597f74c966547ba0af42ad5f7522d78eec2 (patch) | |
tree | 02700090f22d8d0f961275500af789de09db73d5 /modules/presence | |
parent | 16308b599e9dd662b7be0d2da018a9dd063c8d99 (diff) |
presence: added ua param to publisher and notifier update status functions
Diffstat (limited to 'modules/presence')
-rw-r--r-- | modules/presence/notifier.c | 7 | ||||
-rw-r--r-- | modules/presence/presence.c | 4 | ||||
-rw-r--r-- | modules/presence/presence.h | 4 | ||||
-rw-r--r-- | modules/presence/publisher.c | 17 |
4 files changed, 19 insertions, 13 deletions
diff --git a/modules/presence/notifier.c b/modules/presence/notifier.c index f099a11..e158ab6 100644 --- a/modules/presence/notifier.c +++ b/modules/presence/notifier.c @@ -183,15 +183,16 @@ static int notifier_add(struct sipevent_sock *sock, const struct sip_msg *msg, } -void notifier_update_status(void) +void notifier_update_status(struct ua *ua) { struct le *le; for (le = notifierl.head; le; le = le->next) { struct notifier *not = le->data; - - (void)notify(not, ua_presence_status(not->ua)); + + if (not->ua == ua) + (void)notify(not, ua_presence_status(not->ua)); } } diff --git a/modules/presence/presence.c b/modules/presence/presence.c index 8f13bbc..318caa8 100644 --- a/modules/presence/presence.c +++ b/modules/presence/presence.c @@ -21,8 +21,8 @@ static int status_update(struct ua *current_ua, ua_presence_status_set(current_ua, new_status); - publisher_update_status(); - notifier_update_status(); + publisher_update_status(current_ua); + notifier_update_status(current_ua); return 0; } diff --git a/modules/presence/presence.h b/modules/presence/presence.h index 38fa6a2..54fcaac 100644 --- a/modules/presence/presence.h +++ b/modules/presence/presence.h @@ -10,9 +10,9 @@ void subscriber_close(void); int notifier_init(void); void notifier_close(void); -void notifier_update_status(void); +void notifier_update_status(struct ua *ua); int publisher_init(void); void publisher_close(void); -void publisher_update_status(void); +void publisher_update_status(struct ua *ua); diff --git a/modules/presence/publisher.c b/modules/presence/publisher.c index 112d791..79d7605 100644 --- a/modules/presence/publisher.c +++ b/modules/presence/publisher.c @@ -207,7 +207,7 @@ static void destructor(void *arg) } -void publisher_update_status(void) +void publisher_update_status(struct ua *ua) { struct le *le; @@ -215,8 +215,10 @@ void publisher_update_status(void) struct publisher *pub = le->data; - pub->refresh = 0; - publish(pub); + if (pub->ua == ua) { + pub->refresh = 0; + publish(pub); + } } } @@ -251,8 +253,10 @@ int publisher_init(void) struct ua *ua = le->data; struct account *acc = ua_account(ua); - if (account_pubint(acc) > 0) - err |= publisher_alloc(ua); + if (account_pubint(acc) == 0) + continue; + + err |= publisher_alloc(ua); } if (err) @@ -270,9 +274,10 @@ void publisher_close(void) struct publisher *pub = le->data; + ua_presence_status_set(pub->ua, PRESENCE_CLOSED); pub->expires = 0; publish(pub); } - + list_flush(&publ); } |