コード例 #1
0
            public LoginData()
            {
                username = "******" + DateTime.Now.Minute;
                password = "******" + DateTime.Now.Minute;

                optionalAttrs = new List <OptionalAttr>();
                OptionalAttr _OptionalAttr = new OptionalAttr();

                _OptionalAttr.attrName  = "string";
                _OptionalAttr.attrValue = "string";
                optionalAttrs.Add(_OptionalAttr);

                privacySettings = new List <PrivacySetting>();
                PrivacySetting _PrivacySetting = new PrivacySetting();

                _PrivacySetting.settingName  = "string";
                _PrivacySetting.settingValue = "string";
                privacySettings.Add(_PrivacySetting);

                requiredAttrs = new List <RequiredAttr>();
                RequiredAttr _RequiredAttr = new RequiredAttr();

                _RequiredAttr.attrName  = "role";
                _RequiredAttr.attrValue = "Gaslini -  Tutor";
                requiredAttrs.Add(_RequiredAttr);
            }
コード例 #2
0
        public void ChangePrivacySetting(PrivacySetting setting, Perm value)
        {
            List <byte> bts = new List <byte>();

            bts.AddRange(BitConverter.GetBytes((int)setting));
            bts.AddRange(BitConverter.GetBytes((int)value));
            SendCommand(new Command(Command.CommandType.ChangeUserPrivacy, bts.ToArray()));
        }
コード例 #3
0
        protected override void ProcessHTML()
        {
            if (HtmlDoc != null && HtmlDoc.HasData)
            {
                string firstItem = string.Empty;
                List <PrivacySetting>       items      = new List <PrivacySetting>();
                List <ParseDataItem>        components = null;
                IEnumerable <ParseDataItem> htmlItems  = HtmlDoc.Items.Where(x => !x.Header.ToUpper().Contains("DEFINITION"));
                IEnumerable <ParseDataItem> toSearch   = htmlItems.Count() > 1 ? htmlItems : htmlItems.ElementAt(0).Children;
                if (toSearch != null && toSearch.Any())
                {
                    foreach (ParseDataItem item in toSearch)
                    {
                        if (string.IsNullOrEmpty(firstItem))
                        {
                            firstItem = item.Header;
                        }

                        if (item.Header.Equals(firstItem) && components != null && components.Any())
                        {
                            PrivacySetting newItem = new PrivacySetting(Logger, DisplaySectionName, components);
                            if (newItem.HasData)
                            {
                                items.Add(newItem);
                            }
                            components = null;
                        }
                        if (components == null)
                        {
                            components = new List <ParseDataItem>();
                        }
                        components.Add(item);
                    }

                    if (components != null && components.Any())
                    {
                        PrivacySetting newItem = new PrivacySetting(Logger, DisplaySectionName, components);
                        if (newItem.HasData)
                        {
                            items.Add(newItem);
                        }
                    }

                    if (items.Count == 0)
                    {
                        throw new SectionEmptyException(DisplaySectionName);
                    }

                    Items = items;
                }
            }

            if (!HasData)
            {
                throw new SectionEmptyException(DisplaySectionName);
            }
        }
コード例 #4
0
        public async Task <IActionResult> EditPrivacy(EditPrivacyViewModel viewModel)
        {
            User currentUser = await userManager.GetUserAsync(HttpContext.User);

            PrivacySetting privacySettings = context.PrivacySettings.Where(s => s.User == currentUser).Single();

            privacySettings.ShowProfileToFriends = viewModel.ShowProfileToFriends;
            privacySettings.ShowProfileToWorld   = viewModel.ShowProfileToWorld;
            await context.SaveChangesAsync();

            return(RedirectToAction("Edit", new { option = "Privacy" }));
        }
コード例 #5
0
ファイル: AccountService.cs プロジェクト: HaiNNT/CP-MathHub
        public void CreatePrivacy(int userId)
        {
            PrivacySetting privacy = new PrivacySetting();

            privacy.User         = GetUser(userId);
            privacy.Notification = 0;
            privacy.ReceiveEmail = true;
            privacy.ChatPrivacy  = ChatPrivacyEnum.Friend;
            privacy.SendRequest  = FriendRequestEnum.Everyone;
            _dal.Repository <PrivacySetting>().Insert(privacy);
            _dal.Save();
        }
コード例 #6
0
        public bool Equals(DestinyProfileTransitoryJoinability input)
        {
            if (input == null)
            {
                return(false);
            }

            return
                ((
                     OpenSlots == input.OpenSlots ||
                     (OpenSlots.Equals(input.OpenSlots))
                     ) &&
                 (
                     PrivacySetting == input.PrivacySetting ||
                     (PrivacySetting != null && PrivacySetting.Equals(input.PrivacySetting))
                 ) &&
                 (
                     ClosedReasons == input.ClosedReasons ||
                     (ClosedReasons != null && ClosedReasons.Equals(input.ClosedReasons))
                 ));
        }
コード例 #7
0
        public async Task <IActionResult> Edit(string option)
        {
            ViewData["option"] = option;

            // Work with database only if necessary.
            if (option == "Notifications" || option == null)
            {
                User currentUser = await userManager.GetUserAsync(HttpContext.User);

                NotificationsSetting notificationsSettings = context.NotificationSettings.Where(s => s.User == currentUser).Single();
                ViewData["notificationSettings"] = notificationsSettings;
            }
            else if (option == "Privacy")
            {
                User currentUser = await userManager.GetUserAsync(HttpContext.User);

                PrivacySetting privacySettings = context.PrivacySettings.Where(s => s.User == currentUser).Single();
                ViewData["privacySettings"] = privacySettings;
            }
            ViewBag.Message = TempData["message"];
            return(View());
        }
コード例 #8
0
        void SetPrivacySettingInner(PrivacySetting setting, string value)
        {

            if (value == String.Empty)
                privacySettings.Remove(setting);

            else if (!privacySettings.ContainsKey(setting))
                privacySettings.Add(setting, value);

            else
                privacySettings[setting] = value;
        }
コード例 #9
0
        string GetPrivacySettingInner(PrivacySetting setting)
        {
            if (privacySettings.ContainsKey(setting))
                return privacySettings[setting];

            return string.Empty;
        }
コード例 #10
0
 public string GetPrivacySetting(PrivacySetting setting)
 {
     return GetPrivacySettingInner(setting);
 }
コード例 #11
0
        public async Task SetPrivacySettingAsync(PrivacySetting setting, string value)
        {

            if (setting == PrivacySetting.AcceptInvitations &&
                value != AcceptInvitationsFromAllUsers &&
                value != AcceptInvitationsFromAllowedUsersOnly)
                throw new ArgumentException("Invalid value for property");

            if (setting == PrivacySetting.AddUsers &&
                value != AddUsersAutomatically &&
                value != AddUsersWithPrompt)
                throw new ArgumentException("Invalid value for property");

            await @lock.ReaderLockAsync();

            try
            {

                if (closed)
                    throw new ObjectDisposedException(GetType().Name);

                if (!IsLoggedIn)
                    throw new NotLoggedInException();

                if (privacySettings[setting] == value)
                    throw new ArgumentException("This value is already set.");

                var cmd = new PrivacySettingCommand(PrivacySettingToString(setting), value);
                await responseTracker.GetResponseAsync<PrivacySettingCommand>(cmd, defaultTimeout);

                privacySettings[setting] = value;

                OnPrivacySettingChanged(new PrivacySettingEventArgs(setting, value, false));

            }
            finally
            {
                @lock.ReaderRelease();
            }


        }
コード例 #12
0
        static string PrivacySettingToString(PrivacySetting setting)
        {

            switch (setting)
            {
                case PrivacySetting.AddUsers:
                    return "GTC";
                case PrivacySetting.AcceptInvitations:
                    return "BLP";
                default:
                    throw new NotSupportedException();
            }
        }
コード例 #13
0
ファイル: Session.cs プロジェクト: pkt30/OscarLib
 /// <summary>
 /// Sets the session's privacy setting sent by the server in SNAC(13,06)
 /// </summary>
 /// <param name="ps">One of the <see cref="PrivacySetting"/> enumeration members</param>
 protected internal void SetPrivacyFromServer(PrivacySetting ps)
 {
     _privacy = ps;
 }
コード例 #14
0
ファイル: Session.cs プロジェクト: pkt30/OscarLib
        /// <summary>
        /// Create a new OSCAR session
        /// </summary>
        /// <param name="screenname">The screenname to log in</param>
        /// <param name="password">The password associated with the screenname</param>
        /// <exception cref="ArgumentException">Thrown when <paramref name="screenname"/> is not
        /// a valid AIM or ICQ screenname.</exception>
        public Session(string screenname, string password)
        {
            // Check to make sure the screenname is something valid
            if (!ScreennameVerifier.IsValidAIM(screenname) &&
                !ScreennameVerifier.IsValidICQ(screenname))
            {
                throw new ArgumentException(screenname + " is not a valid AIM or ICQ screenname", "screenname");
            }

            // Save parameter values
            _screenname = screenname;
            _password = password;

            connectionManager = new ConnectionManager(this);
            serviceManager = new ServiceManager(this);
            ssiManager = new SSIManager(this);
            icqManager = new IcqManager(this);
            messageManager = new MessageManager(this);
            statusManager = new StatusManager(this);
            chatRoomManager = new ChatRoomManager(this);
            graphicsManager = new GraphicsManager(this);
            authManager = new AuthorizationManager(this);
            searchManager = new SearchManager(this);
            rateManager = new RateClassManager(this);
            statsManager = new UsageStatsManager(this);

            connectionManager.CreateNewConnection(0x0017);

            // Create a default set of capabilities for this session
            SetDefaultIdentification();

            // Set up some default values for public properties
            _publicidletime = true;

            // Set initial values for internal properties
            _loggedin = false;
            _privacy = PrivacySetting.AllowAllUsers;
            _parametercount = 0;
        }
コード例 #15
0
ファイル: EventArgs.cs プロジェクト: kwerty/Messenger-Library
 internal PrivacySettingEventArgs(PrivacySetting privacySetting, string value, bool loginEvent)
 {
     PrivacySetting = privacySetting;
     Value = value;
     LoginEvent = LoginEvent;
 }