Example #1
0
        public static void OnKickUser(dynamic message, SyncService s, SyncRoom room)
        {
            if (s.Permissions == UserPermissionLevel.OWNER)
            {
                SyncService target = room.GetServiceByNickname((string)message.TargetNickname);

                var res = new
                {
                    CommandType = CommandType.KICKUSER.Value
                };

                target.SendMessage(JsonConvert.SerializeObject(res));

                target.Disconnect();
            }
        }
Example #2
0
        public static void OnUpgradeUserPermissions(dynamic message, SyncService s, SyncRoom room)
        {
            if (s.Permissions == UserPermissionLevel.OWNER)
            {
                SyncService target = room.GetServiceByNickname((string)message.TargetNickname);

                if ((bool)message.Upgrade)
                {
                    target.Permissions = UserPermissionLevel.TRUSTED;
                }
                else
                {
                    target.Permissions = UserPermissionLevel.VIEWER;
                }
            }
        }