fix some buglets in 'agents' Manager action (issue #5235)
authorKevin P. Fleming <kpfleming@digium.com>
Mon, 26 Sep 2005 02:04:07 +0000 (02:04 +0000)
committerKevin P. Fleming <kpfleming@digium.com>
Mon, 26 Sep 2005 02:04:07 +0000 (02:04 +0000)
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@6657 65c4cc65-6c06-0410-ace0-fbb531ad65f3

channels/chan_agent.c

index ca9299d..bf6de08 100755 (executable)
@@ -1369,6 +1369,7 @@ static int action_agents(struct mansession *s, struct message *m)
 {
        char *id = astman_get_header(m,"ActionID");
        char idText[256] = "";
+       char chanbuf[256];
        struct agent_pvt *p;
        char *username = NULL;
        char *loginChan = NULL;
@@ -1412,8 +1413,9 @@ static int action_agents(struct mansession *s, struct message *m)
                        loginChan = p->loginchan;
                        talkingtoChan = "n/a";
                        status = "AGENT_IDLE";
-                       if(p->acknowledged) {
-                               sprintf(loginChan, " %s (Confirmed)", loginChan);
+                       if (p->acknowledged) {
+                               snprintf(chanbuf, sizeof(chanbuf), " %s (Confirmed)", p->loginchan);
+                               loginChan = chanbuf;
                        }
                } else {
                        loginChan = "n/a";
@@ -1430,7 +1432,7 @@ static int action_agents(struct mansession *s, struct message *m)
                        "TalkingTo: %s\r\n"
                        "%s"
                        "\r\n",
-                       p->agent,p->name,status,loginChan,p->loginstart,talkingtoChan,idText);
+                       p->agent, username, status, loginChan, p->loginstart, talkingtoChan, idText);
                ast_mutex_unlock(&p->lock);
                p = p->next;
        }