[PATCH] xodtemplate: Don't use space as a delimiter in escalations

Robin Sonefors robin.sonefors at op5.com
Wed May 8 18:38:11 CEST 2013


contact_names are allowed to have spaces in them, so using space as a
delimiter doesn't really work. Space is thus not a valid delimiter for
contacts anywhere, except in escalations, where it is only valid after
the first comma. So you could have one contact with a space in its name,
as long as you put it first - and no more than that!

This patch allows you to have as many contacts with as many spaces as
you want in your escalations.

Signed-off-by: Robin Sonefors <robin.sonefors at op5.com>
---
 xdata/xodtemplate.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/xdata/xodtemplate.c b/xdata/xodtemplate.c
index bb1e14d..f1fe86e 100644
--- a/xdata/xodtemplate.c
+++ b/xdata/xodtemplate.c
@@ -7358,7 +7358,7 @@ int xodtemplate_register_serviceescalation(xodtemplate_serviceescalation *this_s
 	/* add the contact groups */
 	if(this_serviceescalation->contact_groups != NULL) {
 
-		for(contact_group = strtok(this_serviceescalation->contact_groups, ","); contact_group != NULL; contact_group = strtok(NULL, ", ")) {
+		for(contact_group = strtok(this_serviceescalation->contact_groups, ","); contact_group != NULL; contact_group = strtok(NULL, ",")) {
 
 			strip(contact_group);
 			new_contactgroupsmember = add_contactgroup_to_serviceescalation(new_serviceescalation, contact_group);
@@ -7372,7 +7372,7 @@ int xodtemplate_register_serviceescalation(xodtemplate_serviceescalation *this_s
 	/* add the contacts */
 	if(this_serviceescalation->contacts != NULL) {
 
-		for(contact_name = strtok(this_serviceescalation->contacts, ","); contact_name != NULL; contact_name = strtok(NULL, ", ")) {
+		for(contact_name = strtok(this_serviceescalation->contacts, ","); contact_name != NULL; contact_name = strtok(NULL, ",")) {
 
 			strip(contact_name);
 			new_contactsmember = add_contact_to_serviceescalation(new_serviceescalation, contact_name);
@@ -7715,7 +7715,7 @@ int xodtemplate_register_hostescalation(xodtemplate_hostescalation *this_hostesc
 	/* add the contacts */
 	if(this_hostescalation->contacts != NULL) {
 
-		for(contact_name = strtok(this_hostescalation->contacts, ","); contact_name != NULL; contact_name = strtok(NULL, ", ")) {
+		for(contact_name = strtok(this_hostescalation->contacts, ","); contact_name != NULL; contact_name = strtok(NULL, ",")) {
 
 			strip(contact_name);
 			new_contactsmember = add_contact_to_hostescalation(new_hostescalation, contact_name);
-- 
1.7.11.7


------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and 
their applications. This 200-page book is written by three acclaimed 
leaders in the field. The early access version is available now. 
Download your free book today! http://p.sf.net/sfu/neotech_d2d_may




More information about the Developers mailing list