|
|
@ -1552,19 +1552,16 @@ static int action_agent_logoff(struct mansession *s, 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)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
if (pos == 2) {
|
|
|
|
struct agent_pvt *p;
|
|
|
|
struct agent_pvt *p;
|
|
|
|
char name[AST_MAX_AGENT];
|
|
|
|
char name[AST_MAX_AGENT];
|
|
|
|
int which = 0;
|
|
|
|
int which = 0, len = strlen(word);
|
|
|
|
|
|
|
|
|
|
|
|
if (pos == 2) {
|
|
|
|
|
|
|
|
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, strlen(word))) {
|
|
|
|
if (!strncasecmp(word, name, len) && ++which > state)
|
|
|
|
if (++which > state) {
|
|
|
|
|
|
|
|
return ast_strdup(name);
|
|
|
|
return ast_strdup(name);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
} else if (pos == 3 && state == 0) {
|
|
|
|
} else if (pos == 3 && state == 0) {
|
|
|
|
return ast_strdup("soft");
|
|
|
|
return ast_strdup("soft");
|
|
|
|
}
|
|
|
|
}
|
|
|
|