Skip to content

Commit

Permalink
presence_xml: clang-format for coherent indentation and coding style
Browse files Browse the repository at this point in the history
  • Loading branch information
linuxmaniac committed May 18, 2023
1 parent bffc6c4 commit 194a8d4
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 13 deletions.
16 changes: 10 additions & 6 deletions src/modules/presence_xml/notify_body.c
Expand Up @@ -45,7 +45,8 @@ extern str pxml_single_body_lookup_element;

str *offline_nbody(str *body);
str *aggregate_xmls(str *pres_user, str *pres_domain, str **body_array, int n);
str *aggregate_xmls_priority(str *pres_user, str *pres_domain, str **body_array, int n);
str *aggregate_xmls_priority(
str *pres_user, str *pres_domain, str **body_array, int n);
str *get_final_notify_body(
subs_t *subs, str *notify_body, xmlNodePtr rule_node);

Expand Down Expand Up @@ -645,7 +646,8 @@ str *aggregate_xmls(str *pres_user, str *pres_domain, str **body_array, int n)
return NULL;
}

str *aggregate_xmls_priority(str *pres_user, str *pres_domain, str **body_array, int n)
str *aggregate_xmls_priority(
str *pres_user, str *pres_domain, str **body_array, int n)
{
int i, j = 0, idx = 0;
xmlNodePtr p_root = NULL, new_p_root = NULL;
Expand Down Expand Up @@ -684,13 +686,14 @@ str *aggregate_xmls_priority(str *pres_user, str *pres_domain, str **body_array,

idx = --j;
if(strlen(pxml_single_body_priorities.s) > 0
&& strlen(pxml_single_body_lookup_element.s) > 0) {
&& strlen(pxml_single_body_lookup_element.s) > 0) {
p_root = xmlDocGetNodeByName(xml_array[j], "presence", NULL);
if(p_root == NULL) {
LM_ERR("while getting the xml_tree root\n");
goto error;
}
cur = xmlNodeGetNodeContentByName(p_root, pxml_single_body_lookup_element.s, NULL);
cur = xmlNodeGetNodeContentByName(
p_root, pxml_single_body_lookup_element.s, NULL);
if(cur) {
priority = strstr(pxml_single_body_priorities.s, cur);
}
Expand All @@ -702,8 +705,9 @@ str *aggregate_xmls_priority(str *pres_user, str *pres_domain, str **body_array,
goto error;
}

cmp = xmlNodeGetNodeContentByName(new_p_root, pxml_single_body_lookup_element.s, NULL);
if(cur != NULL && cmp != NULL && strcasecmp(cur,cmp)) {
cmp = xmlNodeGetNodeContentByName(
new_p_root, pxml_single_body_lookup_element.s, NULL);
if(cur != NULL && cmp != NULL && strcasecmp(cur, cmp)) {
char *x1 = strstr(pxml_single_body_priorities.s, cmp);
if(x1 > priority) {
idx = i;
Expand Down
6 changes: 3 additions & 3 deletions src/modules/presence_xml/pidf.c
Expand Up @@ -95,9 +95,9 @@ xmlNodePtr xmlNodeGetNodeByName(
if(xmlStrcasecmp(cur->name, (unsigned char *)name) == 0) {
if(!ns
|| (cur->ns
&& xmlStrcasecmp(
cur->ns->prefix, (unsigned char *)ns)
== 0))
&& xmlStrcasecmp(
cur->ns->prefix, (unsigned char *)ns)
== 0))
return cur;
}
match = xmlNodeGetNodeByName(cur->children, name, ns);
Expand Down
4 changes: 2 additions & 2 deletions src/modules/presence_xml/presence_xml.c
Expand Up @@ -170,8 +170,8 @@ static int mod_init(void)
return 0;
}

LM_DBG("db_url=%s (len=%d addr=%p)\n", ZSW(pxml_db_url.s),
pxml_db_url.len, pxml_db_url.s);
LM_DBG("db_url=%s (len=%d addr=%p)\n", ZSW(pxml_db_url.s), pxml_db_url.len,
pxml_db_url.s);

/* bind the SL API */
if(sl_load_api(&slb) != 0) {
Expand Down
4 changes: 2 additions & 2 deletions src/modules/presence_xml/xcap_auth.c
Expand Up @@ -300,7 +300,7 @@ xmlNodePtr get_rule_node(subs_t *subs, xmlDocPtr xcap_tree)
LM_DBG("<many domain= %s>\n", domain);
if((strlen(domain) != subs->from_domain.len
&& strncmp(domain, subs->from_domain.s,
subs->from_domain.len))) {
subs->from_domain.len))) {
xmlFree(domain);
continue;
}
Expand Down Expand Up @@ -336,7 +336,7 @@ xmlNodePtr get_rule_node(subs_t *subs, xmlDocPtr xcap_tree)
if(strlen(domain) == subs->from_domain.len
&& (strncmp(domain, subs->from_domain.s,
subs->from_domain.len)
== 0)) {
== 0)) {
LM_DBG("except domain match\n");
xmlFree(domain);
apply_rule = 0;
Expand Down

0 comments on commit 194a8d4

Please sign in to comment.