Skip to content

Commit

Permalink
Merge pull request telegramdesktop#1152 from eduardosm/disable-regist…
Browse files Browse the repository at this point in the history
…er-custom-scheme2

Allow to disable 'register custom scheme' functions using a macro
  • Loading branch information
john-preston committed Oct 3, 2015
2 parents cb7b736 + d955b29 commit dbc9806
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 0 deletions.
2 changes: 2 additions & 0 deletions Telegram/SourceFiles/pspecific_linux.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1165,6 +1165,7 @@ namespace {
}

void psRegisterCustomScheme() {
#ifndef TDESKTOP_DISABLE_REGISTER_CUSTOM_SCHEME
QString home(_psHomeDir());
if (home.isEmpty()) return;

Expand Down Expand Up @@ -1249,6 +1250,7 @@ void psRegisterCustomScheme() {
LOG(("App Error: Could not open '%1' for write").arg(file));
}
}
#endif
}

void psNewVersion() {
Expand Down
2 changes: 2 additions & 0 deletions Telegram/SourceFiles/pspecific_mac_p.mm
Original file line number Diff line number Diff line change
Expand Up @@ -936,8 +936,10 @@ void objc_finish() {
}

void objc_registerCustomScheme() {
#ifndef TDESKTOP_DISABLE_REGISTER_CUSTOM_SCHEME
OSStatus result = LSSetDefaultHandlerForURLScheme(CFSTR("tg"), (CFStringRef)[[NSBundle mainBundle] bundleIdentifier]);
DEBUG_LOG(("App Info: set default handler for 'tg' scheme result: %1").arg(result));
#endif
}

BOOL _execUpdater(BOOL update = YES) {
Expand Down
2 changes: 2 additions & 0 deletions Telegram/SourceFiles/pspecific_wnd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2216,6 +2216,7 @@ namespace {
}

void RegisterCustomScheme() {
#ifndef TDESKTOP_DISABLE_REGISTER_CUSTOM_SCHEME
DEBUG_LOG(("App Info: Checking custom scheme 'tg'.."));

HKEY rkey;
Expand All @@ -2232,6 +2233,7 @@ void RegisterCustomScheme() {
if (!_psOpenRegKey(L"Software\\Classes\\tg\\shell\\open", &rkey)) return;
if (!_psOpenRegKey(L"Software\\Classes\\tg\\shell\\open\\command", &rkey)) return;
if (!_psSetKeyValue(rkey, 0, '"' + exe + qsl("\" -workdir \"") + cWorkingDir() + qsl("\" -- \"%1\""))) return;
#endif
}

void psNewVersion() {
Expand Down

0 comments on commit dbc9806

Please sign in to comment.