mirror of
https://github.com/asterisk/asterisk.git
synced 2025-09-24 06:53:41 +00:00
Merged revisions 101433 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4 ........ r101433 | russell | 2008-01-31 13:17:05 -0600 (Thu, 31 Jan 2008) | 2 lines Add more missing locking of the agents list ... ........ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@101449 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
@@ -1507,6 +1507,7 @@ static int agent_logoff(const char *agent, int soft)
|
|||||||
long logintime;
|
long logintime;
|
||||||
int ret = -1; /* Return -1 if no agent if found */
|
int ret = -1; /* Return -1 if no agent if found */
|
||||||
|
|
||||||
|
AST_LIST_LOCK(&agents);
|
||||||
AST_LIST_TRAVERSE(&agents, p, list) {
|
AST_LIST_TRAVERSE(&agents, p, list) {
|
||||||
if (!strcasecmp(p->agent, agent)) {
|
if (!strcasecmp(p->agent, agent)) {
|
||||||
ret = 0;
|
ret = 0;
|
||||||
@@ -1526,6 +1527,7 @@ static int agent_logoff(const char *agent, int soft)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
AST_LIST_UNLOCK(&agents);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
@@ -1592,20 +1594,26 @@ static int action_agent_logoff(struct mansession *s, const struct message *m)
|
|||||||
|
|
||||||
static char *complete_agent_logoff_cmd(const char *line, const char *word, int pos, int state)
|
static char *complete_agent_logoff_cmd(const char *line, const char *word, int pos, int state)
|
||||||
{
|
{
|
||||||
|
char *ret = NULL;
|
||||||
|
|
||||||
if (pos == 2) {
|
if (pos == 2) {
|
||||||
struct agent_pvt *p;
|
struct agent_pvt *p;
|
||||||
char name[AST_MAX_AGENT];
|
char name[AST_MAX_AGENT];
|
||||||
int which = 0, len = strlen(word);
|
int which = 0, len = strlen(word);
|
||||||
|
|
||||||
|
AST_LIST_LOCK(&agents);
|
||||||
AST_LIST_TRAVERSE(&agents, p, list) {
|
AST_LIST_TRAVERSE(&agents, p, list) {
|
||||||
snprintf(name, sizeof(name), "Agent/%s", p->agent);
|
snprintf(name, sizeof(name), "Agent/%s", p->agent);
|
||||||
if (!strncasecmp(word, name, len) && p->loginstart && ++which > state)
|
if (!strncasecmp(word, name, len) && p->loginstart && ++which > state) {
|
||||||
return ast_strdup(name);
|
ret = ast_strdup(name);
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
AST_LIST_UNLOCK(&agents);
|
||||||
} else if (pos == 3 && state == 0)
|
} else if (pos == 3 && state == 0)
|
||||||
return ast_strdup("soft");
|
return ast_strdup("soft");
|
||||||
|
|
||||||
return NULL;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
|
Reference in New Issue
Block a user