示例#1
0
 public ChatClient(string identifier, Config configManager)
 {
     Prefix = identifier;
     Config = configManager;
     Log = new Logger("Chat Client (" + Prefix + ")");
     Users = new Users.UserManager(Actions);
     Messages = new Messages.MessageManager(Actions);
 }
示例#2
0
 public ChatServerContext(Config configManager)
 {
     Config = configManager;
     Actions = new ChatActionContext();
     Users = new UserManager(Actions);
     Messages = new MessageManager(Actions);
     Channels = new ChannelManager(Actions);
 }
示例#3
0
        private void HandleUserUpdate(UserManager manager, User prev, User user)
        {
            string data = Shared.Pack(
                ServerMethod.User,
                prev.Id,
                user.Username,
                user.Colour,
                Shared.GetPermissions(user)
            );

            foreach (Service session in Sessions) {
                session.Context.WebSocket.Send(data);
            }
        }
示例#4
0
        private void HandleUserRemove(UserManager manager, User user, UserRemove mode)
        {
            string data = Shared.Pack(
                ServerMethod.Leave,
                user.Id,
                user.Username,
                mode == UserRemove.Forced ? "kick" : "leave",
                UnixNow,
                InternalId
            );

            foreach (Service session in Sessions) {
                if (session.User == user) {
                    continue;
                }

                session.Context.WebSocket.Send(data);
            }
        }
示例#5
0
        private void HandleUserClear(UserManager manager)
        {
            string data = Shared.Pack(ServerMethod.Clear, 1);

            foreach (Service session in Sessions) {
                session.Context.WebSocket.Send(data);
            }
        }
示例#6
0
        private void HandleUserAdd(UserManager manager, User user)
        {
            string data = Shared.Pack(
                ServerMethod.Join,
                UnixNow,
                user.Id,
                user.Username,
                user.Colour,
                Shared.GetPermissions(user),
                InternalId
            );

            foreach (Service session in Sessions) {
                if (session.User == user) {
                    continue;
                }

                session.Context.WebSocket.Send(data);
            }
        }
示例#7
0
 private void HandleUserUpdate(UserManager manager, User prev, User user)
 {
 }
示例#8
0
 private void HandleUserRemove(UserManager manager, User user, UserRemove mode)
 {
 }
示例#9
0
 private void HandleUserClear(UserManager manager)
 {
 }
示例#10
0
 private void HandleUserAdd(UserManager manager, User user)
 {
 }