[sr-dev] git:3.1: presence(k): insert empty string as sender in db if missing

Daniel-Constantin Mierla miconda at gmail.com
Wed Jul 27 19:31:04 CEST 2011


Module: sip-router
Branch: 3.1
Commit: 97131c94922d48ed7aed632bb34293af034a5fee
URL:    http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=97131c94922d48ed7aed632bb34293af034a5fee

Author: Daniel-Constantin Mierla <miconda at gmail.com>
Committer: Daniel-Constantin Mierla <miconda at gmail.com>
Date:   Thu Jul 21 00:31:49 2011 +0200

presence(k): insert empty string as sender in db if missing

- if sender_uri parameter is not given to handle_publish(), insert empty
  string for sender column in presentity table
- the field is used for SLA/BLA
- fixes constraint of non-null value in db table, reported by Roberto
  Fichera
(cherry picked from commit b39747e213e350609761d14583db3e689ad6fefc)

---

 modules_k/presence/presentity.c |   14 +++++++++-----
 1 files changed, 9 insertions(+), 5 deletions(-)

diff --git a/modules_k/presence/presentity.c b/modules_k/presence/presentity.c
index 1dd9466..50f7f30 100644
--- a/modules_k/presence/presentity.c
+++ b/modules_k/presence/presentity.c
@@ -354,15 +354,19 @@ int update_presentity(struct sip_msg* msg, presentity_t* presentity, str* body,
 				(int)time(NULL);
 		n_query_cols++;
 	
-		if( presentity->sender)
+		query_cols[n_query_cols] = &str_sender_col;
+		query_vals[n_query_cols].type = DB1_STR;
+		query_vals[n_query_cols].nul = 0;
+		if(presentity->sender)
 		{
-			query_cols[n_query_cols] = &str_sender_col;
-			query_vals[n_query_cols].type = DB1_STR;
-			query_vals[n_query_cols].nul = 0;
 			query_vals[n_query_cols].val.str_val.s = presentity->sender->s;
 			query_vals[n_query_cols].val.str_val.len = presentity->sender->len;
-			n_query_cols++;
+		} else {
+			query_vals[n_query_cols].val.str_val.s = "";
+			query_vals[n_query_cols].val.str_val.len = 0;
+		}
 		}
+		n_query_cols++;
 
 		query_cols[n_query_cols] = &str_body_col;
 		query_vals[n_query_cols].type = DB1_BLOB;




More information about the sr-dev mailing list