From 71aa8be4d570eb71a2f35e7dffdfd8394d5d256a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=A8=E9=B1=BC=28iFish=29?= Date: Wed, 8 Jul 2015 20:49:11 +0800 Subject: [PATCH] daily commit --- ChatRoomServer.Main/ChatRoomServer.Main.csproj | 1 + ChatRoomServer.Main/ChatServer.cs | 1 + ChatRoomServer.Main/ChatSession.cs | 2 ++ Web12306/js/ui/chat/roomsession.js | 9 +++++++-- 4 files changed, 11 insertions(+), 2 deletions(-) diff --git a/ChatRoomServer.Main/ChatRoomServer.Main.csproj b/ChatRoomServer.Main/ChatRoomServer.Main.csproj index ae0dfcd..9c607e5 100644 --- a/ChatRoomServer.Main/ChatRoomServer.Main.csproj +++ b/ChatRoomServer.Main/ChatRoomServer.Main.csproj @@ -60,6 +60,7 @@ + diff --git a/ChatRoomServer.Main/ChatServer.cs b/ChatRoomServer.Main/ChatServer.cs index e88772e..d127656 100644 --- a/ChatRoomServer.Main/ChatServer.cs +++ b/ChatRoomServer.Main/ChatServer.cs @@ -20,6 +20,7 @@ namespace ChatRoomServer.Main { static ILog _log; static readonly object _lockObject = new object(); + internal static HashSet PresetAdministrators = (System.Configuration.ConfigurationManager.AppSettings["chat:admin"] ?? "").Split(new[] {';'}, StringSplitOptions.RemoveEmptyEntries).ToHashSet(StringComparer.OrdinalIgnoreCase); static ChatServer() { diff --git a/ChatRoomServer.Main/ChatSession.cs b/ChatRoomServer.Main/ChatSession.cs index 7356035..e97a2b8 100644 --- a/ChatRoomServer.Main/ChatSession.cs +++ b/ChatRoomServer.Main/ChatSession.cs @@ -19,6 +19,7 @@ namespace ChatRoomServer.Main DateTime _connecTime = DateTime.Now; long _connectId; + bool _isAdmin; /// /// 路径分割 @@ -55,6 +56,7 @@ namespace ChatRoomServer.Main NickName = System.Net.WebUtility.UrlDecode(path[3]); } PathSegements = path; + _isAdmin = ChatServer.PresetAdministrators.Contains(UserName); //更新统计 var db = new ChatDb(); diff --git a/Web12306/js/ui/chat/roomsession.js b/Web12306/js/ui/chat/roomsession.js index 3e4d754..7ca9709 100644 --- a/Web12306/js/ui/chat/roomsession.js +++ b/Web12306/js/ui/chat/roomsession.js @@ -17,8 +17,13 @@ }; sessMgr.on("sessionChanged", function () { - user = sessMgr.current; - checkPrivilege(); + + if (!sessMgr.current) { + session.exitRoom(); + } else { + user = sessMgr.current; + checkPrivilege(); + } }); checkPrivilege();