[Pkg-owncloud-commits] [owncloud-client] 01/164: shell_integration: Wait longer for the Share menu title

Sandro Knauß hefee-guest at moszumanska.debian.org
Sun Mar 22 11:55:48 UTC 2015


This is an automated email from the git hooks/post-receive script.

hefee-guest pushed a commit to branch master
in repository owncloud-client.

commit 4b674292345802ac28f2d511bba3de5e277f9ea6
Author: Jocelyn Turcotte <jturcotte at woboq.com>
Date:   Fri Feb 13 17:18:39 2015 +0100

    shell_integration: Wait longer for the Share menu title
    
    50ms is sometimes not enough when the client is busy synchronizing.
    Wait up to 500ms for the client to answer before we give up and show an
    empty menu title.
    
    Ideally we should request the title before the watched directory list, but
    the list is currently sent implicitly on connect.
---
 .../windows/OCContextMenu/OCClientInterface.cpp     | 21 ++++++++++++++-------
 1 file changed, 14 insertions(+), 7 deletions(-)

diff --git a/shell_integration/windows/OCContextMenu/OCClientInterface.cpp b/shell_integration/windows/OCContextMenu/OCClientInterface.cpp
index ab6206f..7d9783b 100644
--- a/shell_integration/windows/OCContextMenu/OCClientInterface.cpp
+++ b/shell_integration/windows/OCContextMenu/OCClientInterface.cpp
@@ -50,14 +50,21 @@ OCClientInterface::ContextMenuInfo OCClientInterface::FetchInfo()
 
 	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
-			info.watchedDirectories.push_back(responsePath);
+	int sleptCount = 0;
+	while (sleptCount < 5) {
+		if (socket.ReadLine(&response)) {
+			if (StringUtil::begins_with(response, wstring(L"REGISTER_PATH:"))) {
+				wstring responsePath = response.substr(14); // length of REGISTER_PATH
+				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:
+				break; // Stop once we received the last sent request
+			}
 		}
-		else if (StringUtil::begins_with(response, wstring(L"SHARE_MENU_TITLE:"))) {
-			info.shareMenuTitle = response.substr(17); // length of SHARE_MENU_TITLE:
+		else {
+			Sleep(50);
+			++sleptCount;
 		}
 	}
 	return info;

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-owncloud/owncloud-client.git



More information about the Pkg-owncloud-commits mailing list