Module: sip-router
Branch: master
Commit: b39747e213e350609761d14583db3e689ad6fefc
URL:
http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=b39747e…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)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
---
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 e867fc2..d6cbae2 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;