mirror of
https://gitlab.linphone.org/BC/public/linphone-iphone.git
synced 2026-01-31 02:09:22 +00:00
enhance help
This commit is contained in:
parent
16c1352d1c
commit
a5a627dea5
2 changed files with 17 additions and 5 deletions
|
|
@ -6,7 +6,7 @@
|
|||
using namespace std;
|
||||
|
||||
AudioCodecSetCommand::AudioCodecSetCommand() :
|
||||
DaemonCommand("audio-codec-set", "audio-codec-set <payload type number> <param> <value>", "Set a property(number,clock_rate, recv_fmtp, send_fmtp) of a codec") {
|
||||
DaemonCommand("audio-codec-set", "audio-codec-set <payload type number> <property > <value>", "Set a property (number,clock_rate, recv_fmtp, send_fmtp) of a codec. Numbering of payload type is automatically performed at startup, any change will be loosed after restart.") {
|
||||
}
|
||||
|
||||
static PayloadType *findPayload(LinphoneCore *lc, int payload_type, int *index){
|
||||
|
|
|
|||
|
|
@ -3,15 +3,27 @@
|
|||
using namespace std;
|
||||
|
||||
HelpCommand::HelpCommand() :
|
||||
DaemonCommand("help", "help", "Show available commands.") {
|
||||
DaemonCommand("help", "help <command>", "Show <command> help notice, if command is unspecified or inexistent show all commands.") {
|
||||
}
|
||||
void HelpCommand::exec(Daemon *app, const char *args) {
|
||||
char str[4096] = { 0 };
|
||||
char str[16384] = { 0 };
|
||||
int written = 0;
|
||||
list<DaemonCommand*>::const_iterator it;
|
||||
const list<DaemonCommand*> &l = app->getCommandList();
|
||||
for (it = l.begin(); it != l.end(); ++it) {
|
||||
written += snprintf(str + written, sizeof(str) - written, "%s\t%s\n", (*it)->getProto().c_str(), (*it)->getHelp().c_str());
|
||||
if (args){
|
||||
for (it = l.begin(); it != l.end(); ++it) {
|
||||
if ((*it)->matches(args)){
|
||||
written += snprintf(str + written, sizeof(str)-1 - written, "\t%s\n%s\n", (*it)->getProto().c_str(),(*it)->getHelp().c_str());
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (it==l.end()) args=NULL;
|
||||
}
|
||||
|
||||
if (args==NULL){
|
||||
for (it = l.begin(); it != l.end(); ++it) {
|
||||
written += snprintf(str + written, sizeof(str)-1 - written, "\t%s\n", (*it)->getProto().c_str());
|
||||
}
|
||||
}
|
||||
Response resp;
|
||||
resp.setBody(str);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue