Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

presence : add default_expires and use in the presence* modules #3003

Merged
merged 6 commits into from Jan 18, 2022

Conversation

adita76
Copy link

@adita76 adita76 commented Jan 14, 2022

Pre-Submission Checklist

  • Commit message has the format required by CONTRIBUTING guide
  • Commits are split per component (core, individual modules, libs, utils, ...)
  • Each component has a single commit (if not, squash them into one commit)
  • No commits to README files for modules (changes must be done to docbook files
    in doc/ subfolder, the README file is autogenerated)

Type Of Change

  • Small bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds new functionality)
  • Breaking change (fix or feature that would change existing functionality)

Checklist:

Description

closes #2996

#include "../presence/event_list.h"
#include "presence_conference.h"
#include "notify_body.h"

int conference_add_events(void)
{
{
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
{
{

@@ -43,7 +53,7 @@ int conference_add_events(void)
event.content_type.s = "application/conference-info+xml";
event.content_type.len = 31;

event.default_expires= 3600;
event.default_expires= pres_default_expires;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
event.default_expires= pres_default_expires;
event.default_expires = pres_default_expires;

@@ -43,7 +53,7 @@ int dlginfo_add_events(void)
event.content_type.s = "application/dialog-info+xml";
event.content_type.len = 27;

event.default_expires= 3600;
event.default_expires= pres_default_expires;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
event.default_expires= pres_default_expires;
event.default_expires = pres_default_expires;

@@ -124,7 +134,7 @@ int mwi_add_events(void)
event.content_type.s = "application/simple-message-summary";
event.content_type.len = 34;

event.default_expires= 3600;
event.default_expires= pres_default_expires;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
event.default_expires= pres_default_expires;
event.default_expires = pres_default_expires;

event.content_type.s = "text/xml";
event.content_type.len = 8;

event.default_expires= 3600;
event.default_expires= pres_default_expires;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
event.default_expires= pres_default_expires;
event.default_expires = pres_default_expires;

/* 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;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
event.default_expires= pres_default_expires;
event.default_expires = pres_default_expires;

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) )
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if ( param && (type == INT_PARAM) )
if(param && type == INT_PARAM)

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) )
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if ( param && (type == INT_PARAM) )
if(param && type == INT_PARAM)

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) )
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if ( param && (type == INT_PARAM) )
if(param && type == INT_PARAM)

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) )
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if ( param && (type == INT_PARAM) )
if(param && type == INT_PARAM)

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) )
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if ( param && (type == INT_PARAM) )
if(param && type == INT_PARAM)

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) )
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if ( param && (type == INT_PARAM) )
if(param && type == INT_PARAM)

@miconda
Copy link
Member

miconda commented Jan 14, 2022

@adita76: every module (that needs it) has to get its own parameter, not to lookup the parameter from another module. That's not how usual is done and each module can do some internal optimization to its parameters, so in long term might create hidden issues.

@lnicola: probably the modules' code just need to be run through clang-format.

@adita76
Copy link
Author

adita76 commented Jan 14, 2022

Being a parameter with very simple functionality, I thought it would be easier to use it once than having to configure one for each module.
I'll create one per module, if that's the usual way.

@miconda
Copy link
Member

miconda commented Jan 18, 2022

Thanks! Modules are for different purposes and each event can be with its own expire settings.

@miconda miconda merged commit ad8e1c4 into kamailio:master Jan 18, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

add parameter presence : default_expires
3 participants