diff options
Diffstat (limited to 'shell_integration/windows/OCContextMenu/OCClientInterface.cpp')
-rw-r--r-- | shell_integration/windows/OCContextMenu/OCClientInterface.cpp | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/shell_integration/windows/OCContextMenu/OCClientInterface.cpp b/shell_integration/windows/OCContextMenu/OCClientInterface.cpp index 8472a7cca..ab6206f92 100644 --- a/shell_integration/windows/OCContextMenu/OCClientInterface.cpp +++ b/shell_integration/windows/OCContextMenu/OCClientInterface.cpp @@ -34,28 +34,33 @@ using namespace std; #define PIPE_TIMEOUT 5*1000 //ms #define SOCK_BUFFER 4096 -std::vector<std::wstring> OCClientInterface::WatchedDirectories() +OCClientInterface::ContextMenuInfo OCClientInterface::FetchInfo() { auto pipename = std::wstring(L"\\\\.\\pipe\\"); pipename += L"ownCloud"; CommunicationSocket socket; if (!WaitNamedPipe(pipename.data(), PIPE_TIMEOUT)) { - return std::vector<std::wstring>(); + return {}; } if (!socket.Connect(pipename)) { - return std::vector<std::wstring>(); + return {}; } - std::vector<std::wstring> watchedDirectories; + socket.SendMsg(L"SHARE_MENU_TITLE\n"); + + ContextMenuInfo info; std::wstring response; Sleep(50); while (socket.ReadLine(&response)) { if (StringUtil::begins_with(response, wstring(L"REGISTER_PATH:"))) { wstring responsePath = response.substr(14); // length of REGISTER_PATH - watchedDirectories.push_back(responsePath); + info.watchedDirectories.push_back(responsePath); + } + else if (StringUtil::begins_with(response, wstring(L"SHARE_MENU_TITLE:"))) { + info.shareMenuTitle = response.substr(17); // length of SHARE_MENU_TITLE: } } - return watchedDirectories; + return info; } void OCClientInterface::ShareObject(const std::wstring &path) |