Пример #1
0
 public SwitchboardInvitation(SwitchboardSession session, User user)
 {
     Session = session;
     Id      = _counter++;
     User    = user;
     Key     = AuthenticationService.CreateChallengeString();
 }
Пример #2
0
        public SwitchboardSession CreateSession(User creator)
        {
            SwitchboardSession session = new SwitchboardSession(this, creator);

            _sessions.Add(session);
            return(session);
        }
Пример #3
0
        public void EndSession(SwitchboardSession session)
        {
            if (session.Connections.Count > 0)
            {
                // TODO: Something?
            }

            _sessions.Remove(session);
        }
Пример #4
0
        public bool BroadcastCommand(SwitchboardSession session, Command cmd, SwitchboardConnection ignore)
        {
            if (cmd.TrId != -1 && cmd.TrId != 0)
            {
                throw new ProtocolException("Only Asynchronous server commands can be sent.");
            }

            foreach (SwitchboardConnection conn in session.Connections)
            {
                if (conn != ignore)
                {
                    Send(conn, cmd);
                }
            }

            return(true);
        }