[sr-dev] git:master: presence(k): switch to terminated status if no longer active

Daniel-Constantin Mierla miconda at gmail.com
Wed Jul 6 23:20:34 CEST 2011


Module: sip-router
Branch: master
Commit: 73ec9511e3c740304f6376890f0c0b416d84dd8f
URL:    http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=73ec9511e3c740304f6376890f0c0b416d84dd8f

Author: Daniel-Constantin Mierla <miconda at gmail.com>
Committer: Daniel-Constantin Mierla <miconda at 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

---

 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 df1a4ac..e97df6c 100644
--- a/modules_k/presence/presence.c
+++ b/modules_k/presence/presence.c
@@ -728,6 +728,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;
 		




More information about the sr-dev mailing list