Selaa lähdekoodia

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
Daniel-Constantin Mierla 14 vuotta sitten
vanhempi
commit
73ec9511e3
1 muutettua tiedostoa jossa 8 lisäystä ja 0 poistoa
  1. 8 0
      modules_k/presence/presence.c

+ 8 - 0
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;