public void Remove(Session session) { lock (objLock) { if (session.SessionUser != null) onlineUsers.Remove(session.SessionUser.UserId); } }
public bool HandleMessage(Session session, Message message) { string destUser = message.To.User; if (string.IsNullOrEmpty(destUser)) return false; if (!DeliverMessage(destUser, message)) server.OfflineMessageManager.PutChatMessage(session.SessionUser.Username, destUser, new Message[] { message }); //put to offline message return true; }
public Session Add(Session session) { if (session.SessionUser == null) return null; lock (objLock) { onlineUsers.Add(session.SessionUser.UserId, session); return session; } }