[asterisk-commits] irroot: branch irroot/app_queue_skill r322176 - /team/irroot/app_queue_skill/...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Tue Jun 7 02:29:11 CDT 2011


Author: irroot
Date: Tue Jun  7 02:29:07 2011
New Revision: 322176

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=322176
Log:
Changes For Review

Modified:
    team/irroot/app_queue_skill/apps/app_queue.c

Modified: team/irroot/app_queue_skill/apps/app_queue.c
URL: http://svnview.digium.com/svn/asterisk/team/irroot/app_queue_skill/apps/app_queue.c?view=diff&rev=322176&r1=322175&r2=322176
==============================================================================
--- team/irroot/app_queue_skill/apps/app_queue.c (original)
+++ team/irroot/app_queue_skill/apps/app_queue.c Tue Jun  7 02:29:07 2011
@@ -1260,13 +1260,13 @@
 	int rrpos;                          /*!< Round Robin - position */
 	int memberdelay;                    /*!< Seconds to delay connecting member to caller */
 	int autofill;                       /*!< Ignore the head call status and ring an available agent */
-	
+
 	struct ao2_container *vqueues;      /*!< Virtual queues */
 	struct ao2_container *members;             /*!< Head of the list of members */
-	/*! 
+	/*!
 	 * \brief Number of members _logged in_
 	 * \note There will be members in the members container that are not logged
-	 *       in, so this can not simply be replaced with ao2_container_count(). 
+	 *       in, so this can not simply be replaced with ao2_container_count().
 	 */
 	int membercount;
 	struct queue_ent *head;             /*!< Head of the list of callers */
@@ -1287,7 +1287,7 @@
 static void update_realtime_members(struct call_queue *q);
 static int set_member_paused(const char *queuename, const char *interface, const char *reason, int paused);
 
-static void queue_transfer_fixup(void *data, struct ast_channel *old_chan, struct ast_channel *new_chan); 
+static void queue_transfer_fixup(void *data, struct ast_channel *old_chan, struct ast_channel *new_chan);
 static int update_queue_ent_skills_next_check(struct call_queue *q);
 static int member_is_selected(struct queue_ent *qe, struct member *mem);
 
@@ -1457,7 +1457,7 @@
 			}
 		}
 
-		if (qe && !member_is_selected(qe, member)) {
+		if (!member_is_selected(qe, member)) {
 			ast_debug(4, "%s is unavailable because it is not selected by rule '%s'\n", member->membername, qe->skill_ruleset);
 			continue;
 		}
@@ -1704,7 +1704,7 @@
 static struct member *create_queue_member(const char *interface, const char *membername, int penalty, int paused, const char *state_interface, const char *skills)
 {
 	struct member *cur;
-	
+
 	if ((cur = ao2_alloc(sizeof(*cur), NULL))) {
 		cur->penalty = penalty;
 		cur->paused = paused;
@@ -1727,10 +1727,11 @@
 			ast_copy_string(cur->state_context, S_OR(context, "default"), sizeof(cur->state_context));
 		}
 		cur->status = get_queue_member_status(cur);
-		if (!ast_strlen_zero(skills))
+		if (!ast_strlen_zero(skills)) {
 			ast_copy_string(cur->skills, skills, sizeof(cur->skills));
-		else
+		} else {
 			cur->skills[0] = '\0';
+		}
 	}
 
 	return cur;
@@ -2196,7 +2197,7 @@
 	const char *state_interface = S_OR(ast_variable_retrieve(member_config, interface, "state_interface"), interface);
 	const char *penalty_str = ast_variable_retrieve(member_config, interface, "penalty");
 	const char *paused_str = ast_variable_retrieve(member_config, interface, "paused");
-	const char *skills = ast_variable_retrieve(member_config, interface, "skills"));
+	const char *skills = ast_variable_retrieve(member_config, interface, "skills");
 
 	if (ast_strlen_zero(rt_uniqueid)) {
 		ast_log(LOG_WARNING, "Realtime field uniqueid is empty for member %s\n", S_OR(membername, "NULL"));
@@ -2215,33 +2216,34 @@
 			paused = 0;
 	}
 
- 	/* Find member by realtime uniqueid and update */
- 	mem_iter = ao2_iterator_init(q->members, 0);
- 	while ((m = ao2_iterator_next(&mem_iter))) {
- 		if (!strcasecmp(m->rt_uniqueid, rt_uniqueid)) {
- 			m->dead = 0;	/* Do not delete this one. */
- 			ast_copy_string(m->rt_uniqueid, rt_uniqueid, sizeof(m->rt_uniqueid));
- 			if (paused_str)
- 				m->paused = paused;
- 			if (strcasecmp(state_interface, m->state_interface)) {
- 				ast_copy_string(m->state_interface, state_interface, sizeof(m->state_interface));
- 			}	   
- 			m->penalty = penalty;
- 			if (!ast_strlen_zero(skills))
- 				ast_copy_string(m->skills, skills, sizeof(m->skills));
- 			else
- 				m->skills[0] = '\0';
- 			found = 1;
- 			ao2_ref(m, -1);
- 			update_queue_ent_skills_next_check(q);
- 			break;
- 		}
- 		ao2_ref(m, -1);
- 	}
+	/* Find member by realtime uniqueid and update */
+	mem_iter = ao2_iterator_init(q->members, 0);
+	while ((m = ao2_iterator_next(&mem_iter))) {
+		if (!strcasecmp(m->rt_uniqueid, rt_uniqueid)) {
+			m->dead = 0;	/* Do not delete this one. */
+			ast_copy_string(m->rt_uniqueid, rt_uniqueid, sizeof(m->rt_uniqueid));
+			if (paused_str)
+				m->paused = paused;
+			if (strcasecmp(state_interface, m->state_interface)) {
+				ast_copy_string(m->state_interface, state_interface, sizeof(m->state_interface));
+			}	   
+			m->penalty = penalty;
+			if (!ast_strlen_zero(skills)) {
+				ast_copy_string(m->skills, skills, sizeof(m->skills));
+			} else {
+				m->skills[0] = '\0';
+			}
+			found = 1;
+			ao2_ref(m, -1);
+			update_queue_ent_skills_next_check(q);
+			break;
+		}
+		ao2_ref(m, -1);
+	}
 	ao2_iterator_destroy(&mem_iter);
 
- 	/* Create a new member */
- 	if (!found) {
+	/* Create a new member */
+	if (!found) {
 		if ((m = create_queue_member(interface, membername, penalty, paused, state_interface, skills))) {
 			m->dead = 0;
 			m->realtime = 1;
@@ -2584,8 +2586,9 @@
 {
 	struct skill_rule_operand *operand;
 
-	if (!op)
+	if (!op) {
 		return;
+	}
 
 	AST_LIST_TRAVERSE_SAFE_BEGIN(&op->operands, operand, entry) {
 		AST_LIST_REMOVE_CURRENT(entry);
@@ -2601,10 +2604,12 @@
 static void destroy_skill_rule(void* obj)
 {
 	struct skill_rule* r = obj;
-	if (r->dcond)
+	if (r->dcond) {
 		destroy_operator(r->dcond);
-	if (r->cond)
+	}
+	if (r->cond) {
 		destroy_operator(r->cond);
+	}
 }
 
 static void destroy_skill_ruleset(void *obj)
@@ -2625,8 +2630,9 @@
 {
 	struct skill_rule_operator *op;
 	op = ast_calloc(1, sizeof(*op));
-	if (!op)
+	if (!op) {
 		return NULL;
+	}
 
 	op->type = t;
 	AST_LIST_HEAD_INIT_NOLOCK(&op->operands);
@@ -2639,8 +2645,9 @@
 {
 	struct skill_rule_operand *operand;
 	operand = ast_calloc(1, sizeof(*operand));
-	if (!operand)
+	if (!operand) {
 		return NULL;
+	}
 
 	operand->type = t;
 	return operand;
@@ -2666,8 +2673,9 @@
 		default:                           t = '?'; break;
 		}
 
-		if (*str != '\0')
+		if (*str != '\0') {
 			ast_build_string(&s, &len, "%c", t);
+		}
 
 		switch(operand->type) {
 		case SKILL_RULE_OPERAND_VARIABLE:
@@ -2697,8 +2705,9 @@
 	const char *ptr, *start = NULL;
 
 	op = create_skill_rule_operator(SKILL_RULE_OPERATOR_UNKNOWN, NULL);
-	if (!op)
+	if (!op) {
 		return NULL;
+	}
 
 	head = op;
 	ptr = expr;
@@ -2832,10 +2841,11 @@
 				goto error;
 			}
 
-			if (*ptr != '\0')
+			if (*ptr != '\0') {
 				flag = skill_rule_operator_type_str[(size_t)*ptr];
-			else
+			} else {
 				flag = op->type;
+			}
 
 			if (op->type == SKILL_RULE_OPERATOR_UNKNOWN) {
 				if (flag == SKILL_RULE_OPERATOR_UNKNOWN) {
@@ -2857,8 +2867,9 @@
 				/* Then we try to jump to an upper operator, or to create one. */
 
 				/* look for a parent operator with a lower or equal priority. */
-				for(parent = op->parent; parent && parent->type < flag; parent = parent->parent)
+				for (parent = op->parent; parent && parent->type < flag; parent = parent->parent) {
 					op = parent;
+				}
 
 				if (!parent) {
 					/* There isn't any other operator with a lower or equal priority */
@@ -2966,8 +2977,9 @@
 
 error:
 	destroy_operator(head);
-	if(operand)
+	if (operand) {
 		ast_free(operand);
+	}
 	return NULL;
 }
 
@@ -2980,9 +2992,9 @@
 	if (cond) {
 		*cond++ = '\0';
 		r->dcond = parse_expr(dcond);
-	}
-	else
+	} else {
 		cond = dcond;
+	}
 
 	r->cond = parse_expr(cond);
 	return 0;
@@ -3046,8 +3058,9 @@
 					}
 				}
 
-				if (var)
+				if (var) {
 					ao2_ref(var, -1);
+				}
 				break;
 			}
 			case SKILL_RULE_OPERAND_VALUE:
@@ -3061,17 +3074,18 @@
 				return 0;
 		}
 
-		if (first)
+		if (first) {
 			ret = value;
-		else {
-			if (operator_proceeded_cb)
+		} else {
+			if (operator_proceeded_cb) {
 				operator_proceeded_cb(last_name, ret, op->type, name, value, data);
+			}
 
 			switch(op->type) {
 				case SKILL_RULE_OPERATOR_DIVISION:
-					if (value != 0)
+					if (value != 0) {
 						ret /= value;
-					else {
+					} else {
 						ast_log(LOG_WARNING, "Rule error: division by zero.\n");
 						return 0;
 					}
@@ -3122,12 +3136,13 @@
 	int value = 0;
 	struct skill* skill;
 	struct ao2_iterator iter = ao2_iterator_init(skills->skills, 0);
-	while ((skill = ao2_iterator_next(&iter)) && strcasecmp(skill->name, key))
+	while ((skill = ao2_iterator_next(&iter)) && strcasecmp(skill->name, key)) {
 		ao2_ref(skill, -1);
-
-	if (!skill)
+	}
+
+	if (!skill) {
 		value = 0;
-	else {
+	} else {
 		value = skill->weight;
 		ao2_ref(skill, -1);
 	}
@@ -3149,8 +3164,9 @@
 	float aht, ciqu = 0;
 	float ali;
 
-	if (!qe->mem_selection || ao2_container_count(qe->mem_selection) == 0)
+	if (!qe->mem_selection || ao2_container_count(qe->mem_selection) == 0) {
 		return qe->vqueue->holdtime;
+	}
 
 	iter = ao2_iterator_init(qe->mem_selection, 0);
 	while ((mem = ao2_iterator_next(&iter))) {
@@ -3164,8 +3180,9 @@
 	aht = sum / ali;
 
 	for (ch = qe->parent->head; ch; ch = ch->next) {
-		if (!ch->pending && ch->vqueue == qe->vqueue)
+		if (!ch->pending && ch->vqueue == qe->vqueue) {
 			ciqu++;
+		}
 	}
 
 	return (qe->vqueue->holdtime = aht * ciqu / ali);
@@ -3173,10 +3190,11 @@
 
 static int get_estimated_waiting_time(struct queue_ent *qe)
 {
-	if (qe->vqueue)
+	if (qe->vqueue) {
 		return calculate_estimated_waiting_time(qe);
-	else
+	} else {
 		return qe->parent->holdtime;
+	}
 }
 
 static int get_waiting_time(struct queue_ent *qe)
@@ -3197,11 +3215,11 @@
 	size_t i;
 	int value = 0;
 
-	for (i = 0; i < sizeof(static_vars) / sizeof(*static_vars) && strcasecmp(static_vars[i].name, key); ++i)
-		;
-
-	if (i < (sizeof(static_vars) / sizeof(*static_vars)))
-		value = static_vars[i].func(qe);
+	for (i = 0; i < sizeof(static_vars) / sizeof(*static_vars) && strcasecmp(static_vars[i].name, key); ++i) {
+		if (i < (sizeof(static_vars) / sizeof(*static_vars))) {
+			value = static_vars[i].func(qe);
+		}
+	}
 
 	return value;
 }
@@ -3219,22 +3237,25 @@
 		return;
 	}
 
-	switch(op)
-	{
+	switch (op) {
 	case SKILL_RULE_OPERATOR_EQUAL:
-		if (left_wt)
+		if (left_wt) {
 			new_check = time(NULL) + right_value - get_waiting_time(qe);
-		if (right_wt)
+		}
+		if (right_wt) {
 			new_check = time(NULL) + left_value - get_waiting_time(qe);
+		}
 
 		break;
 	case SKILL_RULE_OPERATOR_GREATER:
-		if (right_wt)
+		if (right_wt) {
 			new_check = time(NULL) + left_value - get_waiting_time(qe);
+		}
 		break;
 	case SKILL_RULE_OPERATOR_LESSER:
-		if (left_wt)
+		if (left_wt) {
 			new_check = time(NULL) + right_value - get_waiting_time(qe);
+		}
 		break;
 	case SKILL_RULE_OPERATOR_DIVISION:
 	case SKILL_RULE_OPERATOR_MULTIPLICATION:
@@ -3271,20 +3292,23 @@
 		return NULL;
 	}
 
-	if (!(ptr = strchr(*rulename, '(')))
+	if (!(ptr = strchr(*rulename, '('))) {
 		return variables;
+	}
 
 	*ptr++ = '\0';
 	while ((var = strsep(&ptr, ",|^)"))) {
 		char *value = strchr(var, '=');
 
-		if (!value)
+		if (!value) {
 			continue;
+		}
 
 		*value++ = '\0';
 		v = ao2_alloc(sizeof(*v), NULL);
-		if (!v)
+		if (!v) {
 			break;
+		}
 		ast_copy_string(v->name, var, sizeof(v->name));
 		ast_copy_string(v->value, value, sizeof(v->value));
 		ao2_link(variables, v);
@@ -3301,17 +3325,18 @@
 	/* If there isn't any queue entry or if there isn't any ruleset on the
 	 * queue, it's because he doesn't use the skills routing.
 	 */
-	if (!qe || ast_strlen_zero(qe->skill_ruleset))
+	if (!qe || ast_strlen_zero(qe->skill_ruleset)) {
 		return 1;
+	}
 
 	/* No member is selected. */
-	if (!qe->mem_selection)
+	if (!qe->mem_selection) {
 		return 0;
-
-	m = ao2_find(qe->mem_selection, mem, OBJ_POINTER);
-
-	if (m)
+	}
+
+	if ((m = ao2_find(qe->mem_selection, mem, OBJ_POINTER))) {
 		ao2_ref(m, -1);
+	}
 
 	return m != NULL;
 }
@@ -3335,8 +3360,9 @@
 
 	if (!vq) {
 		vq = ao2_alloc(sizeof(*vq), NULL);
-		if (!vq)
+		if (!vq) {
 			return -1;
+		}
 		ast_copy_string(vq->id, qe->skill_ruleset, sizeof(vq->id));
 		ao2_link(q->vqueues, vq);
 	}
@@ -3363,22 +3389,25 @@
 	struct ao2_iterator rule_iter, mem_iter;
 	char* ruleset_name;
 
-	if (ast_strlen_zero(qe->skill_ruleset))
+	if (ast_strlen_zero(qe->skill_ruleset)) {
 		return 0;
+	}
 
 	ruleset_name = ast_strdupa(qe->skill_ruleset);
 	qe->skills_next_check = 0;
 	variables = get_rule_variables(qe, &ruleset_name);
 
-	if (!variables)
+	if (!variables) {
 		return -1;
+	}
 
 	AST_LIST_LOCK(&skill_rulesets);
 	AST_LIST_LOCK(&skills_groups);
 
 	AST_LIST_TRAVERSE(&skill_rulesets, rs, entry) {
-		if (!strcmp(rs->name, ruleset_name))
+		if (!strcmp(rs->name, ruleset_name)) {
 			break;
+		}
 	}
 
 	if (!rs) {
@@ -3411,8 +3440,9 @@
 				    operator_eval_skills(rule->cond, skills, variables, qe)) {
 					ao2_link(qe->mem_selection, member);
 					ast_log(LOG_DEBUG, "Member %s is associated.\n", member->interface);
-				} else
+				} else {
 					ast_log(LOG_DEBUG, "Member %s is NOT associated.\n", member->interface);
+				}
 				ao2_ref(member, -1);
 			}
 			ao2_iterator_destroy(&mem_iter);
@@ -3441,8 +3471,9 @@
 {
 	struct queue_ent* ch = q->head;
 	time_t now = time(NULL);
-	for (; ch; ch = ch->next)
+	for (; ch; ch = ch->next) {
 		ch->skills_next_check = now;
+	}
 	return 0;
 }
 
@@ -3481,8 +3512,9 @@
 		inserted = 0;
 		prev = NULL;
 
-		if (!ast_strlen_zero(qe->skill_ruleset))
+		if (!ast_strlen_zero(qe->skill_ruleset)) {
 			join_virtual_queue(q, qe);
+		}
 
 		cur = q->head;
 		while (cur) {
@@ -3605,7 +3637,11 @@
 
 static int say_position(struct queue_ent *qe, int ringing)
 {
-	int res = 0, avgholdmins, avgholdsecs, holdtime, announceposition = 0;
+	int res = 0;
+	int avgholdmins;
+	int avgholdsecs;
+	int holdtime;
+	int announceposition = 0;
 	int say_thanks = 1;
 	time_t now;
 
@@ -4893,9 +4929,10 @@
 	ast_debug(1, "There %s %d available %s.\n", avl != 1 ? "are" : "is", avl, avl != 1 ? "members" : "member");
 
 	while ((idx < avl) && (ch) && (ch != qe)) {
-		if (!ch->pending && ch->vqueue == qe->vqueue)
+		if (!ch->pending && ch->vqueue == qe->vqueue) {
 			idx++;
-		ch = ch->next;			
+		}
+		ch = ch->next;
 	}
 
 	ao2_unlock(qe->parent);
@@ -6172,7 +6209,7 @@
 		}
 
 		res = snprintf(value + value_len, sizeof(value) - value_len, "%s%s;%d;%d;%s;%s;%s",
-			value_len ? "|" : "", cur_member->interface, cur_member->penalty, cur_member->paused, cur_member->membername, 
+			value_len ? "|" : "", cur_member->interface, cur_member->penalty, cur_member->paused, cur_member->membername,
 			cur_member->state_interface, cur_member->skills);
 
 		ao2_ref(cur_member, -1);
@@ -6202,7 +6239,7 @@
 static int remove_from_queue(const char *queuename, const char *interface)
 {
 	struct call_queue *q, tmpq = {
-		.name = queuename,	
+		.name = queuename,
 	};
 	struct member *mem, tmpmem;
 	struct queue_ent* qe;
@@ -6231,15 +6268,18 @@
 			update_queue_ent_skills_next_check(q);
 
 			/* Remove member from selection of each callers. */
-			for(qe = q->head; qe; qe = qe->next)
-				if (qe->mem_selection)
+			for(qe = q->head; qe; qe = qe->next) {
+				if (qe->mem_selection) {
 					ao2_unlink(qe->mem_selection, mem);
+				}
+			}
 
 			ao2_ref(mem, -1);
 
-			if (queue_persistent_members)
+			if (queue_persistent_members) {
 				dump_queue_members(q);
-			
+			}
+
 			res = RES_OKAY;
 		} else {
 			res = RES_EXISTS;
@@ -6357,7 +6397,7 @@
 
 				ast_queue_log(q->name, "NONE", mem->membername, (paused ? "PAUSE" : "UNPAUSE"), "%s", S_OR(reason, ""));
 				update_queue_ent_skills_next_check(q);
-				
+
 				if (!ast_strlen_zero(reason)) {
 					manager_event(EVENT_FLAG_AGENT, "QueueMemberPaused",
 						"Queue: %s\r\n"
@@ -6556,7 +6596,7 @@
 			}
 
 			ast_debug(1, "Reload Members: Queue: %s  Member: %s  Name: %s  Penalty: %d  Paused: %d\n", queue_name, interface, membername, penalty, paused);
-			
+
 			if (add_to_queue(queue_name, interface, membername, penalty, paused, 0, state_interface, skills) == RES_OUTOFMEMORY) {
 				ast_log(LOG_ERROR, "Out of Memory when reloading persistent queue member\n");
 				break;
@@ -6873,12 +6913,12 @@
 	);
 	/* Our queue entry */
 	struct queue_ent qe = { 0 };
-	
+
 	if (ast_strlen_zero(data)) {
 		ast_log(LOG_WARNING, "Queue requires an argument: queuename[,options[,URL[,announceoverride[,timeout[,agi[,macro[,gosub[,rule[,position[,skill_ruleset]]]]]]]]]]\n");
 		return -1;
 	}
-	
+
 	parse = ast_strdupa(data);
 	AST_STANDARD_APP_ARGS(args, parse);
 
@@ -6987,8 +7027,9 @@
 
 	switch (select_members_from_skills(&qe)) {
 	case 1:
-		if (!qe.parent->joinempty || !get_member_status(qe.parent, qe.max_penalty, qe.min_penalty, qe.parent->joinempty, &qe))
+		if (!qe.parent->joinempty || !get_member_status(qe.parent, qe.max_penalty, qe.min_penalty, qe.parent->joinempty, &qe)) {
 			break;
+		}
 		reason = QUEUE_JOINEMPTY;
 	case -1:
 		goto stop;
@@ -7686,8 +7727,9 @@
 			parse_skill_rule(r, var->value);
 
 			/* check if this rule is empty. */
-			if (r->cond)
+			if (r->cond) {
 				ao2_link(ruleset->rules, r);
+			}
 			ao2_ref(r, -1);
 		}
 
@@ -8184,13 +8226,15 @@
 					mem->realtime ? " (realtime)" : "",
 					mem->paused ? " (paused)" : "",
 					ast_devstate2str(mem->status));
-				if (!ast_strlen_zero(mem->skills))
+				if (!ast_strlen_zero(mem->skills)) {
 					ast_str_append(&out, 0, " (skills: %s)", mem->skills);
-				if (mem->calls)
+				}
+				if (mem->calls) {
 					ast_str_append(&out, 0, " has taken %d calls (last was %ld secs ago)",
 						mem->calls, (long) (time(NULL) - mem->lastcall));
-				else
+				} else {
 					ast_str_append(&out, 0, " has taken no calls yet");
+				}
 				do_print(s, fd, ast_str_buffer(out));
 				ao2_ref(mem, -1);
 			}
@@ -8206,8 +8250,7 @@
 				struct virtual_queue *vqueue;
 				struct ao2_iterator iter;
 				iter = ao2_iterator_init(q->vqueues, 0);
-				while ((vqueue = ao2_iterator_next(&iter)))
-				{
+				while ((vqueue = ao2_iterator_next(&iter))) {
 					pos = 1;
 					ast_str_set(&out, 0, "   Virtual queue %s: ", vqueue->id);
 					do_print(s, fd, ast_str_buffer(out));
@@ -9109,10 +9152,10 @@
 		}
 	}
 	AST_LIST_UNLOCK(&rule_lists);
-	return CLI_SUCCESS; 
-}
-
-static char *complete_queue_skills_groups(const char *line, const char *word, int pos, int state) 
+	return CLI_SUCCESS;
+}
+
+static char *complete_queue_skills_groups(const char *line, const char *word, int pos, int state)
 {
 	int which = 0;
 	struct skills_group *skills;
@@ -9152,8 +9195,9 @@
 		return complete_queue_skills_groups(a->line, a->word, a->pos, a->n);
 	}
 
-	if (a->argc != 3 && a->argc != 4 && a->argc != 5)
+	if (a->argc != 3 && a->argc != 4 && a->argc != 5) {
 		return CLI_SHOWUSAGE;
+	}
 
 	name = a->argc == 5 ? a->argv[4] : "";
 
@@ -9180,10 +9224,10 @@
 		}
 	}
 	AST_LIST_UNLOCK(&skills_groups);
-	return CLI_SUCCESS; 
-}
-
-static char *complete_queue_skills_rules(const char *line, const char *word, int pos, int state) 
+	return CLI_SUCCESS;
+}
+
+static char *complete_queue_skills_rules(const char *line, const char *word, int pos, int state)
 {
 	int which = 0;
 	struct skill_ruleset *rs;
@@ -9223,8 +9267,9 @@
 		return complete_queue_skills_rules(a->line, a->word, a->pos, a->n);
 	}
 
-	if (a->argc != 3 && a->argc != 4 && a->argc != 5)
+	if (a->argc != 3 && a->argc != 4 && a->argc != 5) {
 		return CLI_SHOWUSAGE;
+	}
 
 	name = a->argc == 5 ? a->argv[4] : "";
 
@@ -9240,9 +9285,9 @@
 					char *dcond = display_operator(rule->dcond);
 					ast_cli(a->fd, "  => [%s] %s\n", dcond, cond);
 					ast_free(dcond);
+				} else {
+					ast_cli(a->fd, "  => %s\n", cond);
 				}
-				else
-					ast_cli(a->fd, "  => %s\n", cond);
 				ast_free(cond);
 				ao2_ref(rule, -1);
 			}
@@ -9250,7 +9295,7 @@
 		}
 	}
 	AST_LIST_UNLOCK(&skill_rulesets);
-	return CLI_SUCCESS; 
+	return CLI_SUCCESS;
 }
 
 static char *handle_queue_reset(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)




More information about the asterisk-commits mailing list