Skip to content

Commit

Permalink
presence_reginfo: use parameter presence/default_expires instead of 3…
Browse files Browse the repository at this point in the history
…600 constant

- GH #2996
  • Loading branch information
Adrian Tabacioiu committed Jan 14, 2022
1 parent 506483b commit 9a1dfe7
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/modules/presence_reginfo/add_events.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,21 +25,31 @@
#include <stdlib.h>
#include <string.h>
#include "../../core/parser/parse_content.h"
#include "../../core/sr_module.h"
#include "../presence/event_list.h"
#include "presence_reginfo.h"

int reginfo_add_events(void)
{
pres_ev_t event;

/* read default expires from presence, if exists */
int pres_default_expires = 3600;
modparam_t type = 0;
int *param = find_param_export(find_module_by_name("presence"), "default_expires", INT_PARAM, &type);
if ( param && (type == INT_PARAM) )
pres_default_expires = *param;
else
LOG(L_WARN, "cannot find pres_default_expires parameter or type is not correct in the presence module\n");

/* constructing message-summary event */
memset(&event, 0, sizeof(pres_ev_t));
event.name.s = "reg";
event.name.len = 3;

event.content_type.s = "application/reginfo+xml";
event.content_type.len = 23;
event.default_expires= 3600;
event.default_expires= pres_default_expires;
event.type = PUBL_TYPE;
event.req_auth = 0;
event.evs_publ_handl = 0;
Expand Down

0 comments on commit 9a1dfe7

Please sign in to comment.