コード例 #1
0
        public void MucRoomSettingsTest()
        {
            var room1 = new Jid("a.conf@s/R");
            store.RemoveMuc(room1);
            var s = store.GetMucRoomSettings(room1);
            Assert.IsNull(s);

            s = new MucRoomSettings();
            store.SetMucRoomSettings(room1, s);

            s = store.GetMucRoomSettings(room1);
            Assert.IsNotNull(s);

            s.Members = new List<MucRoomMemberInfo>();
            var m1 = new MucRoomMemberInfo("1:1:1");
            var m2 = new MucRoomMemberInfo("2:1:1");
            s.Members.Add(m1);
            s.Members.Add(m2);
            store.SetMucRoomSettings(room1, s);

            s = store.GetMucRoomSettings(room1);
            Assert.AreEqual(2, s.Members.Count);

            store.RemoveMuc(room1);
            s = store.GetMucRoomSettings(room1);
            Assert.IsNull(s);
        }
コード例 #2
0
ファイル: DbMucStore.cs プロジェクト: vipwan/CommunityServer
        public void SetMucRoomSettings(Jid roomName, MucRoomSettings settings)
        {
            if (Jid.IsNullOrEmpty(roomName)) throw new ArgumentNullException("roomName");
            if (settings == null) throw new ArgumentNullException("settings");

            ExecuteNonQuery(
                new SqlInsert("jabber_room", true)
                .InColumnValue("jid", roomName.Bare)
                .InColumnValue("title", settings.Title ?? roomName.User)
                .InColumnValue("subject", settings.Subject)
                .InColumnValue("instructions", settings.Instructions)
                .InColumnValue("pwd", settings.Password)
                .InColumnValue("pwdprotect", settings.PasswordProtected)
                .InColumnValue("visible", settings.Visible)
                .InColumnValue("members", settings.GetMemberList())
                .InColumnValue("maxoccupant", settings.MaxOccupant)
                .InColumnValue("historycountonenter", settings.HistoryCountOnEnter)
                .InColumnValue("anonymous", settings.Anonymous)
                .InColumnValue("logging", settings.Logging)
                .InColumnValue("membersonly", settings.MembersOnly)
                .InColumnValue("usernamesonly", settings.UserNamesOnly)
                .InColumnValue("moderated", settings.Moderated)
                .InColumnValue("persistent", settings.Persistent)
                .InColumnValue("presencebroadcastedfrom", settings.PresenceBroadcastedFrom)
                .InColumnValue("canchangesubject", settings.CanChangeSubject)
                .InColumnValue("caninvite", settings.CanInvite)
                .InColumnValue("canseememberlist", settings.CanSeeMemberList));
        }