Merged revisions 82590,82592 via svnmerge from
authorKevin P. Fleming <kpfleming@digium.com>
Mon, 17 Sep 2007 16:44:13 +0000 (16:44 +0000)
committerKevin P. Fleming <kpfleming@digium.com>
Mon, 17 Sep 2007 16:44:13 +0000 (16:44 +0000)
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r82590 | kpfleming | 2007-09-17 11:33:30 -0500 (Mon, 17 Sep 2007) | 2 lines

fix a couple of places where a logical member name (if specified) was not used, but instead the direct interface was listed

........
r82592 | kpfleming | 2007-09-17 11:40:12 -0500 (Mon, 17 Sep 2007) | 2 lines

revert a change that wasn't supposed to be committed... doh!

........

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@82593 65c4cc65-6c06-0410-ace0-fbb531ad65f3

apps/app_queue.c

index 3cfc66f..6ec2dd1 100644 (file)
@@ -3976,6 +3976,7 @@ static int queue_function_queuememberlist(struct ast_channel *chan, const char *
        if (q) {
                int buflen = 0, count = 0;
                struct ao2_iterator mem_iter = ao2_iterator_init(q->members, 0);
+               const char *name_to_list;
 
                while ((m = ao2_iterator_next(&mem_iter))) {
                        /* strcat() is always faster than printf() */
@@ -3983,8 +3984,9 @@ static int queue_function_queuememberlist(struct ast_channel *chan, const char *
                                strncat(buf + buflen, ",", len - buflen - 1);
                                buflen++;
                        }
-                       strncat(buf + buflen, m->interface, len - buflen - 1);
-                       buflen += strlen(m->interface);
+                       name_to_list = ast_strlen_zero(m->membername) ? m->interface : m->membername;
+                       strncat(buf + buflen, name_to_list, len - buflen - 1);
+                       buflen += strlen(name_to_list);
                        /* Safeguard against overflow (negative length) */
                        if (buflen >= len - 2) {
                                ao2_ref(m, -1);
@@ -4283,7 +4285,7 @@ static int __queues_show(struct mansession *s, int fd, int argc, char **argv)
                        do_print(s, fd, "   Members: ");
                        mem_iter = ao2_iterator_init(q->members, 0);
                        while ((mem = ao2_iterator_next(&mem_iter))) {
-                               ast_str_set(&out, 0, "      %s", mem->interface);
+                               ast_str_set(&out, 0, "      %s", ast_strlen_zero(mem->membername) ? mem->interface : mem->membername);
                                if (mem->penalty)
                                        ast_str_append(&out, 0, " with penalty %d", mem->penalty);
                                ast_str_append(&out, 0, "%s%s%s (%s)",
@@ -4803,7 +4805,7 @@ static char *complete_queue_remove_member(const char *line, const char *word, in
                                if (++which > state) {
                                        char *tmp;
                                        ast_mutex_unlock(&q->lock);
-                                       tmp = ast_strdup(m->interface);
+                                       tmp = ast_strdup((ast_strlen_zero(m->membername) ? m->interface : m->membername));
                                        ao2_ref(m, -1);
                                        return tmp;
                                }