Skip to content

Commit

Permalink
[msilo] Fixed setting proper time in offline message
Browse files Browse the repository at this point in the history
  • Loading branch information
bogdan-iancu committed Oct 21, 2021
1 parent 9bc1179 commit cc20f73
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 5 deletions.
5 changes: 3 additions & 2 deletions modules/msilo/msfuncs.c
Expand Up @@ -238,7 +238,8 @@ int m_build_headers(str *buf, str ctype, str contact, time_t date)
* - body->s MUST be allocated
* return: 0 OK ; -1 error
* */
int m_build_body(str *body, time_t date, str msg, time_t sdate)
int m_build_body(str *body, time_t date, str msg, time_t sdate,
int is_reminder)
{
char *p;

Expand All @@ -250,7 +251,7 @@ int m_build_body(str *body, time_t date, str msg, time_t sdate)

if(ms_add_date!=0)
{
if(sdate!=0)
if(is_reminder)
{
memcpy(p, "[Reminder message - ", 20);
p += 20;
Expand Down
3 changes: 2 additions & 1 deletion modules/msilo/msfuncs.h
Expand Up @@ -50,7 +50,8 @@ int m_extract_content_type(char*, int, content_type_t*, int);
int m_build_headers(str *buf, str ctype, str contact, time_t date);

/** build MESSAGE body */
int m_build_body(str *body, time_t date, str msg, time_t sdate);
int m_build_body(str *body, time_t date, str msg, time_t sdate,
int is_reminder);

int ms_extract_time(str *time_str, int *time_val);

Expand Down
6 changes: 4 additions & 2 deletions modules/msilo/msilo.c
Expand Up @@ -939,7 +939,8 @@ static int m_dump(struct sip_msg* msg, str* owner, int* maxmsg)

/** sending using TM function: t_uac */
body_str.len = 1024;
n = m_build_body(&body_str, rtime, str_vals[2/*body*/], 0);
n = m_build_body(&body_str, rtime, str_vals[2/*body*/],
rtime /*Date*/, 0 /*not a reminder*/);
if(n<0)
LM_DBG("sending simple body\n");
else
Expand Down Expand Up @@ -1206,7 +1207,8 @@ void m_send_ontimer(unsigned int ticks, void *param)
body_str.len = 1024;
stime =
(time_t)RES_ROWS(db_res)[i].values[5/*snd time*/].val.int_val;
n = m_build_body(&body_str, 0, str_vals[2/*body*/], stime);
n = m_build_body(&body_str, 0, str_vals[2/*body*/], stime,
1 /*is a reminder*/);
if(n<0)
LM_DBG("sending simple body\n");
else
Expand Down

0 comments on commit cc20f73

Please sign in to comment.