Module: sip-router
Branch: 3.1
Commit: acf25edbf8047a7511b304e0941d8c6365980e48
URL:
http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=acf25ed…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: Wed Jul 6 19:39:36 2011 +0200
presence(k): switch to terminated status if no longer active
- if contact is removed via xcap, making the status different than
active, set it to terminated states
- patch by Laura Testi, FS#133
(cherry picked from commit 73ec9511e3c740304f6376890f0c0b416d84dd8f)
---
modules_k/presence/presence.c | 8 ++++++++
1 files changed, 8 insertions(+), 0 deletions(-)
diff --git a/modules_k/presence/presence.c b/modules_k/presence/presence.c
index 5b00ad3..322bc7a 100644
--- a/modules_k/presence/presence.c
+++ b/modules_k/presence/presence.c
@@ -716,6 +716,14 @@ int pres_update_status(subs_t subs, str reason, db_key_t*
query_cols,
query_vals[q_wuser_col].val.str_val= subs.from_user;
query_vals[q_wdomain_col].val.str_val= subs.from_domain;
+ /* if status is no longer ACTIVE, switch to terminated */
+ if(subs.status!=status && status==ACTIVE_STATUS)
+ {
+ subs.status = TERMINATED_STATUS;
+ subs.reason.s = get_status_str(TERMINATED_STATUS);
+ subs.reason.len = strlen(subs.reason.s);
+ }
+
update_vals[u_status_col].val.int_val= subs.status;
update_vals[u_reason_col].val.str_val= subs.reason;