示例#1
0
        protected override void OnOpen()
        {
            string cookies = Context.Headers.Get("cookie");

            user = cookies.Substring(cookies.IndexOf("user") + 5).Split(';')[0];
            global.WebSocketSessionsMap.Add(user, ID);
            global.updateCoWorkers(user, true);

            foreach (string file in global.files.EditingFiles())
            {
                WatchDogMessage m = new WatchDogMessage(WatchDogMessageType.Lock, global.User, file, global.DropboxBasePath);
                Send(m.ToString());
            }
        }
示例#2
0
        private void sendMessage(WatchDogMessage message)
        {
            string sharedfolder = null;

            foreach (SharedFolderMetadata folder in SharedFolders)
            {
                if (folder.PathLower != null && message.Path.ToLower().StartsWith(folder.PathLower))
                {
                    sharedfolder = folder.SharedFolderId;
                    break;
                }
            }
            if (sharedfolder != null)
            {
                foreach (SharedUser user in global.Folder_coWorkers[sharedfolder])
                {
                    sendMessage(user.Email, message.ToString());
                }
            }
        }