Commit 22ac4090 authored by Ghislain MARY's avatar Ghislain MARY

Generic sorting of commands in linphone-daemon (so that commands dump function are also sorted).

parent dc597140
......@@ -25,10 +25,6 @@ HelpCommand::HelpCommand() :
DaemonCommand("help", "help <command>", "Show <command> help notice, if command is unspecified or inexistent show all commands.") {
}
static bool compareCommand(const DaemonCommand *command1, const DaemonCommand *command2) {
return (command1->getProto() < command2->getProto());
}
void HelpCommand::exec(Daemon *app, const char *args) {
ostringstream ost;
list<DaemonCommand*>::const_iterator it;
......@@ -44,9 +40,7 @@ void HelpCommand::exec(Daemon *app, const char *args) {
}
if (args==NULL){
list<DaemonCommand*> lcopy = l;
lcopy.sort(compareCommand);
for (it = lcopy.begin(); it != lcopy.end(); ++it) {
for (it = l.begin(); it != l.end(); ++it) {
ost << (*it)->getProto() << endl;
}
}
......
......@@ -457,6 +457,10 @@ void Daemon::removeAudioStream(int id) {
}
}
static bool compareCommands(const DaemonCommand *command1, const DaemonCommand *command2) {
return (command1->getProto() < command2->getProto());
}
void Daemon::initCommands() {
mCommands.push_back(new RegisterCommand());
mCommands.push_back(new ContactCommand());
......@@ -503,6 +507,7 @@ void Daemon::initCommands() {
mCommands.push_back(new ConfigSetCommand());
mCommands.push_back(new NetsimCommand());
mCommands.push_back(new CNCommand());
mCommands.sort(compareCommands);
}
void Daemon::uninitCommands() {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment