Bläddra i källkod

presence_mwi: fixed indentation and trailing whitespaces

Daniel-Constantin Mierla 9 år sedan
förälder
incheckning
288840cb7b

+ 69 - 69
modules/presence_mwi/add_events.c

@@ -15,8 +15,8 @@
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
  *
- * You should have received a copy of the GNU General Public License 
- * along with this program; if not, write to the Free Software 
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
  *
  * History:
@@ -42,97 +42,97 @@
 /*! \brief utility function that skips spaces and tabs */
 static inline char *eat_sp_tab(char *at, char *over)
 {
-    while((at < over) && ((*at == ' ') || (*at == '\t'))) at++;
-    return at;
+	while((at < over) && ((*at == ' ') || (*at == '\t'))) at++;
+	return at;
 }
 
 /*! \brief utility function that skips printable ascii chars */
 static inline char *eat_printable(char *at, char *over)
 {
-    while ((at < over) && ((*at == '\t') || ((*at >= 32) && (*at <= 126))))
-	at++;
-    return at;
+	while ((at < over) && ((*at == '\t') || ((*at >= 32) && (*at <= 126))))
+		at++;
+	return at;
 }
 
 /*! \brief
  * event specific publish handling - check if body format is ok
  */
 int mwi_publ_handl(struct sip_msg* msg)
-{	
-    str body;
-    char *at, *over;
+{
+	str body;
+	char *at, *over;
 
-    if (get_content_length(msg) == 0)
-	return 1;
-	
-    body.s = get_body(msg);
-    if (body.s == NULL) {
-	LM_ERR("cannot extract body from msg\n");
-	return -1;
-    }
-
-    /* content-length (if present) must be already parsed */
-    body.len = get_content_length(msg);
-    at = body.s;
-    over = body.s + body.len;
-
-    /* check msg-status-line */
-    if (body.len <= 16) goto err;
-    if (strncmp(body.s, "Messages-Waiting", 16) != 0) goto err;
-    at = at + 16;
-    at = eat_sp_tab(at, over);
-    if ((at >= over) || (*at != ':')) goto err;
-    at++;
-    if ((at >= over) || ((*at != ' ') && (*at != '\t'))) goto err;
-    at++;
-    at = eat_sp_tab(at, over);
-    if (at + 3 >= over) goto err;
-    if (strncmp(at, "yes", 3) == 0) at = at + 3;
-    else
-	if (strncmp(at, "no", 2) == 0) at = at + 2;
+	if (get_content_length(msg) == 0)
+		return 1;
+
+	body.s = get_body(msg);
+	if (body.s == NULL) {
+		LM_ERR("cannot extract body from msg\n");
+		return -1;
+	}
+
+	/* content-length (if present) must be already parsed */
+	body.len = get_content_length(msg);
+	at = body.s;
+	over = body.s + body.len;
+
+	/* check msg-status-line */
+	if (body.len <= 16) goto err;
+	if (strncmp(body.s, "Messages-Waiting", 16) != 0) goto err;
+	at = at + 16;
+	at = eat_sp_tab(at, over);
+	if ((at >= over) || (*at != ':')) goto err;
+	at++;
+	if ((at >= over) || ((*at != ' ') && (*at != '\t'))) goto err;
+	at++;
+	at = eat_sp_tab(at, over);
+	if (at + 3 >= over) goto err;
+	if (strncmp(at, "yes", 3) == 0) at = at + 3;
 	else
-	    goto err;
-    if ((at + 1 >= over) || (*at != '\r') || (*(at + 1) != '\n')) goto err;
-    at = at + 2;
-    
-    /* check that remaining body consists of lines that only contain
-       printable ascii chars */
-    while (at < over) {
-	at = eat_printable(at, over);
+		if (strncmp(at, "no", 2) == 0) at = at + 2;
+		else
+			goto err;
 	if ((at + 1 >= over) || (*at != '\r') || (*(at + 1) != '\n')) goto err;
 	at = at + 2;
-    }
-    
-    return 1;
+
+	/* check that remaining body consists of lines that only contain
+	 * printable ascii chars */
+	while (at < over) {
+		at = eat_printable(at, over);
+		if ((at + 1 >= over) || (*at != '\r') || (*(at + 1) != '\n')) goto err;
+		at = at + 2;
+	}
+
+	return 1;
 
 err:
-    LM_ERR("check of body <%.*s> failed at character number %d\n",
-	   body.len, body.s, (int)(at - body.s + 1));
-    return -1;
+	LM_ERR("check of body <%.*s> failed at character number %d\n",
+			body.len, body.s, (int)(at - body.s + 1));
+	return -1;
 
 }
 
 int mwi_add_events(void)
 {
-    pres_ev_t event;
-	
-    /* constructing message-summary event */
-    memset(&event, 0, sizeof(pres_ev_t));
-    event.name.s = "message-summary";
-    event.name.len = 15;
+	pres_ev_t event;
 
-    event.content_type.s = "application/simple-message-summary";
-    event.content_type.len = 34;
+	/* constructing message-summary event */
+	memset(&event, 0, sizeof(pres_ev_t));
+	event.name.s = "message-summary";
+	event.name.len = 15;
+
+	event.content_type.s = "application/simple-message-summary";
+	event.content_type.len = 34;
 
 	event.default_expires= 3600;
-    event.type = PUBL_TYPE;
+	event.type = PUBL_TYPE;
 	event.req_auth = 0;
-    event.evs_publ_handl = mwi_publ_handl;
-	
-    if (pres_add_event(&event) < 0) {
-	LM_ERR("failed to add event \"message-summary\"\n");
-	return -1;
-    }		
-	
-    return 0;
+	event.evs_publ_handl = mwi_publ_handl;
+
+	if (pres_add_event(&event) < 0) {
+		LM_ERR("failed to add event \"message-summary\"\n");
+		return -1;
+	}
+
+	return 0;
 }

+ 2 - 2
modules/presence_mwi/add_events.h

@@ -15,8 +15,8 @@
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
  *
- * You should have received a copy of the GNU General Public License 
- * along with this program; if not, write to the Free Software 
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
  *
  * History:

+ 39 - 39
modules/presence_mwi/presence_mwi.c

@@ -13,8 +13,8 @@
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
  *
- * You should have received a copy of the GNU General Public License 
- * along with this program; if not, write to the Free Software 
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
  *
  * History:
@@ -62,57 +62,57 @@ add_event_t pres_add_event;
 /* module exported commands */
 static cmd_export_t cmds[] =
 {
-    {0,	0, 0, 0, 0, 0}
+	{0,	0, 0, 0, 0, 0}
 };
 
 /* module exported paramaters */
 static param_export_t params[] = {
-    {0, 0, 0}
+	{0, 0, 0}
 };
 
 /* module exports */
 struct module_exports exports= {
-    "presence_mwi",				/* module name */
-    DEFAULT_DLFLAGS,            /* dlopen flags */
-    cmds,						/* exported functions */
-    params,						/* exported parameters */
-    0,							/* exported statistics */
-    0,							/* exported MI functions */
-    0,							/* exported pseudo-variables */
+	"presence_mwi",				/* module name */
+	DEFAULT_DLFLAGS,            /* dlopen flags */
+	cmds,						/* exported functions */
+	params,						/* exported parameters */
+	0,							/* exported statistics */
+	0,							/* exported MI functions */
+	0,							/* exported pseudo-variables */
 	0,							/* extra processes */
-    mod_init,					/* module initialization function */
-    0,							/* response handling function */
-    0,							/* destroy function */
-    0							/* per-child init function */
+	mod_init,					/* module initialization function */
+	0,							/* response handling function */
+	0,							/* destroy function */
+	0							/* per-child init function */
 };
-	
+
 /*
  * init module function
  */
 static int mod_init(void)
 {
 	presence_api_t pres;
-    bind_presence_t bind_presence;
-
-    bind_presence= (bind_presence_t)find_export("bind_presence", 1,0);
-    if (!bind_presence) {
-	LM_ERR("can't bind presence\n");
-	return -1;
-    }
-    if (bind_presence(&pres) < 0) {
-	LM_ERR("can't bind pua\n");
-	return -1;
-    }
-
-    pres_add_event = pres.add_event;
-    if (pres_add_event == NULL) {
-	LM_ERR("could not import add_event\n");
-	return -1;
-    }
-    if(mwi_add_events() < 0) {
-	LM_ERR("failed to add mwi events\n");
-	return -1;		
-    }	
-    
-    return 0;
+	bind_presence_t bind_presence;
+
+	bind_presence= (bind_presence_t)find_export("bind_presence", 1,0);
+	if (!bind_presence) {
+		LM_ERR("can't bind presence\n");
+		return -1;
+	}
+	if (bind_presence(&pres) < 0) {
+		LM_ERR("can't bind pua\n");
+		return -1;
+	}
+
+	pres_add_event = pres.add_event;
+	if (pres_add_event == NULL) {
+		LM_ERR("could not import add_event\n");
+		return -1;
+	}
+	if(mwi_add_events() < 0) {
+		LM_ERR("failed to add mwi events\n");
+		return -1;
+	}
+
+	return 0;
 }

+ 2 - 2
modules/presence_mwi/presence_mwi.h

@@ -13,8 +13,8 @@
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
  *
- * You should have received a copy of the GNU General Public License 
- * along with this program; if not, write to the Free Software 
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
  *
  * History: