add sips and sips-linphone in uri handler

This commit is contained in:
Danmei Chen 2018-01-31 15:24:59 +01:00
parent 3af9220a04
commit 0e50a6b575
5 changed files with 29 additions and 8 deletions

View file

@ -7,7 +7,7 @@ Exec=linphone %u
Icon=linphone
Terminal=false
Categories=Network;Telephony;
MimeType=x-scheme-handler/sip-linphone;x-scheme-handler/sip;
MimeType=x-scheme-handler/sip-linphone;x-scheme-handler/sip;x-scheme-handler/sips-linphone;x-scheme-handler/sips;
# Translations

View file

@ -41,6 +41,8 @@
<array>
<string>sip</string>
<string>sip-linphone</string>
<string>sips</string>
<string>sips-linphone</string>
</array>
</dict>
</array>

View file

@ -7,3 +7,5 @@ notRunningInUninstall:
DeleteRegKey HKCR "sip"
DeleteRegKey HKCR "sip-linphone"
DeleteRegKey HKCR "sips"
DeleteRegKey HKCR "sips-linphone"

View file

@ -10,4 +10,18 @@ WriteRegStr HKCR "sip-linphone" "URL Protocol" ""
WriteRegExpandStr HKCR "sip-linphone\DefaultIcon" "" "@LINPHONE_DESKTOP_DIR@/assets/linphone.ico,1"
WriteRegStr HKCR "sip-linphone\shell" "" "open"
WriteRegStr HKCR "sip-linphone\shell\open" "" "command"
WriteRegStr HKCR "sip-linphone\shell\open\command" "" "$INSTDIR\bin\linphone.exe $\"%1$\""
WriteRegStr HKCR "sip-linphone\shell\open\command" "" "$INSTDIR\bin\linphone.exe $\"%1$\""
WriteRegStr HKCR "sips" "" "URL:sips Protocol"
WriteRegStr HKCR "sips" "URL Protocol" ""
WriteRegExpandStr HKCR "sips\DefaultIcon" "" "@LINPHONE_DESKTOP_DIR@/assets/linphone.ico,1"
WriteRegStr HKCR "sips\shell" "" "open"
WriteRegStr HKCR "sips\shell\open" "" "command"
WriteRegStr HKCR "sips\shell\open\command" "" "$INSTDIR\bin\linphone.exe $\"%1$\""
WriteRegStr HKCR "sips-linphone" "" "URL:sips-linphone Protocol"
WriteRegStr HKCR "sips-linphone" "URL Protocol" ""
WriteRegExpandStr HKCR "sips-linphone\DefaultIcon" "" "@LINPHONE_DESKTOP_DIR@/assets/linphone.ico,1"
WriteRegStr HKCR "sips-linphone\shell" "" "open"
WriteRegStr HKCR "sips-linphone\shell\open" "" "command"
WriteRegStr HKCR "sips-linphone\shell\open\command" "" "$INSTDIR\bin\linphone.exe $\"%1$\""

View file

@ -334,8 +334,8 @@ QMap<QString, Cli::Command> Cli::mCommands = {
void Cli::executeCommand (const QString &command, CommandFormat *format) {
shared_ptr<linphone::Address> address = linphone::Factory::get()->createAddress(
::Utils::appStringToCoreString(command)
);
::Utils::appStringToCoreString(command)
);
// Execute cli command.
if (!address) {
@ -358,11 +358,14 @@ void Cli::executeCommand (const QString &command, CommandFormat *format) {
qInfo() << QStringLiteral("Execute uri command: `%1`.").arg(command);
string scheme = address->getScheme();
if (scheme != "sip" && scheme != "sip-linphone") {
qWarning() << QStringLiteral("Not a valid uri: `%1`.").arg(command);
return;
}
for (const string &validScheme : { "sip", "sip-linphone", "sips", "sips-linphone" })
if (scheme == validScheme)
goto success;
qWarning() << QStringLiteral("Not a valid uri: `%1` Unsupported scheme: `%2`.")
.arg(command).arg(::Utils::coreStringToAppString(scheme));
return;
success:
const QString functionName = ::Utils::coreStringToAppString(address->getHeader("method")).isEmpty()
? QStringLiteral("call")
: ::Utils::coreStringToAppString(address->getHeader("method"));