[asterisk-commits] mmichelson: branch 1.4 r82865 - /branches/1.4/apps/app_queue.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Tue Sep 18 15:09:03 CDT 2007


Author: mmichelson
Date: Tue Sep 18 15:09:02 2007
New Revision: 82865

URL: http://svn.digium.com/view/asterisk?view=rev&rev=82865
Log:
Moving the logic for handling an empty membername to the create_member function so that there is a common place
where this occurs instead of being spread out to several different places.


Modified:
    branches/1.4/apps/app_queue.c

Modified: branches/1.4/apps/app_queue.c
URL: http://svn.digium.com/view/asterisk/branches/1.4/apps/app_queue.c?view=diff&rev=82865&r1=82864&r2=82865
==============================================================================
--- branches/1.4/apps/app_queue.c (original)
+++ branches/1.4/apps/app_queue.c Tue Sep 18 15:09:02 2007
@@ -650,7 +650,10 @@
 		cur->penalty = penalty;
 		cur->paused = paused;
 		ast_copy_string(cur->interface, interface, sizeof(cur->interface));
-		ast_copy_string(cur->membername, membername, sizeof(cur->membername));
+		if(!ast_strlen_zero(membername))
+			ast_copy_string(cur->membername, membername, sizeof(cur->membername));
+		else
+			ast_copy_string(cur->membername, interface, sizeof(cur->membername));
 		if (!strchr(cur->interface, '/'))
 			ast_log(LOG_WARNING, "No location at interface '%s'\n", interface);
 		cur->status = ast_device_state(interface);
@@ -1145,7 +1148,7 @@
 
 	while ((interface = ast_category_browse(member_config, interface))) {
 		rt_handle_member_record(q, interface,
-			S_OR(ast_variable_retrieve(member_config, interface, "membername"), interface),
+			ast_variable_retrieve(member_config, interface, "membername"),
 			ast_variable_retrieve(member_config, interface, "penalty"),
 			ast_variable_retrieve(member_config, interface, "paused"));
 	}
@@ -3045,7 +3048,7 @@
 	char *queue_name;
 	char *member;
 	char *interface;
-	char *membername;
+	char *membername = NULL;
 	char *penalty_tok;
 	int penalty = 0;
 	char *paused_tok;
@@ -3346,10 +3349,6 @@
 		if (strchr(args.options, 'j'))
 			priority_jump = 1;
 	}
-
-	if (ast_strlen_zero(args.membername))
-		args.membername = args.interface;
-
 
 	switch (add_to_queue(args.queuename, args.interface, args.membername, penalty, 0, queue_persistent_members)) {
 	case RES_OKAY:
@@ -3944,8 +3943,7 @@
 						if (!ast_strlen_zero(args.membername)) {
 							membername = args.membername;
 							while (*membername && *membername < 33) membername++;
-						} else
-							membername = interface;
+						}
 
 						/* Find the old position in the list */
 						ast_copy_string(tmpmem.interface, interface, sizeof(tmpmem.interface));
@@ -4321,9 +4319,6 @@
 	else
 		paused = abs(ast_true(paused_s));
 
-	if (ast_strlen_zero(membername))
-		membername = interface;
-
 	switch (add_to_queue(queuename, interface, membername, penalty, paused, queue_persistent_members)) {
 	case RES_OKAY:
 		ast_queue_log(queuename, "MANAGER", interface, "ADDMEMBER", "%s", "");
@@ -4399,7 +4394,7 @@
 
 static int handle_queue_add_member(int fd, int argc, char *argv[])
 {
-	char *queuename, *interface, *membername;
+	char *queuename, *interface, *membername = NULL;
 	int penalty;
 
 	if ((argc != 6) && (argc != 8) && (argc != 10)) {
@@ -4430,8 +4425,6 @@
 
 	if (argc >= 10) {
 		membername = argv[9];
-	} else {
-		membername = interface;
 	}
 
 	switch (add_to_queue(queuename, interface, membername, penalty, 0, queue_persistent_members)) {




More information about the asterisk-commits mailing list