mirror of
https://gitlab.linphone.org/BC/public/linphone-desktop.git
synced 2026-01-29 09:49:20 +00:00
fix(Cli): better code to convert from base 64 (uri command)
This commit is contained in:
parent
833be4c60e
commit
306c187774
2 changed files with 5 additions and 16 deletions
|
|
@ -149,24 +149,14 @@ void Cli::Command::execute (QHash<QString, QString> &args) const {
|
|||
}
|
||||
}
|
||||
|
||||
void Cli::Command::decode (QHash <QString,QString> &args) const{
|
||||
QByteArray qa;
|
||||
for (const auto &argName : args.keys()) {
|
||||
if (argName != QString("sip-address")) {
|
||||
qa.append(args[argName]);
|
||||
args[argName] = QByteArray::fromBase64(qa);
|
||||
qa.clear();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Cli::Command::executeUri (const shared_ptr<linphone::Address> &address) const {
|
||||
QHash<QString, QString> args;
|
||||
for (const auto &argName : mArgsScheme.keys())
|
||||
args[argName] = ::Utils::coreStringToAppString(address->getHeader(::Utils::appStringToCoreString(argName)));
|
||||
for (const auto &argName : mArgsScheme.keys()) {
|
||||
const string header = address->getHeader(::Utils::appStringToCoreString(argName));
|
||||
args[argName] = QByteArray::fromBase64(QByteArray(header.c_str(), header.length()));
|
||||
}
|
||||
address->clean();
|
||||
args["sip-address"] = ::Utils::coreStringToAppString(address->asStringUriOnly());
|
||||
decode(args);
|
||||
execute(args);
|
||||
}
|
||||
|
||||
|
|
@ -237,7 +227,7 @@ void Cli::executeCommand (const QString &command, CommandFormat *format) const {
|
|||
return;
|
||||
}
|
||||
|
||||
//TODO: check if there is any header when the `method` header is missing.
|
||||
// TODO: Check if there is any header when the `method` header is missing.
|
||||
const QString functionName = ::Utils::coreStringToAppString(address->getHeader("method")).isEmpty()
|
||||
? QStringLiteral("call")
|
||||
: ::Utils::coreStringToAppString(address->getHeader("method"));
|
||||
|
|
|
|||
|
|
@ -63,7 +63,6 @@ class Cli : public QObject {
|
|||
const QHash<QString, Argument> &argsScheme
|
||||
);
|
||||
|
||||
void decode (QHash<QString, QString> &args) const;
|
||||
void execute (QHash<QString, QString> &args) const;
|
||||
void executeUri (const std::shared_ptr<linphone::Address> &address) const;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue