15 [ArchivingTime(nameof(ArchiveDays))]
16 [CollectionName(
"MucRooms")]
17 [Index(
"Domain",
"Room")]
20 private readonly Dictionary<CaseInsensitiveString, MucOccupant> occupantsByNick =
new Dictionary<CaseInsensitiveString, MucOccupant>();
21 private readonly Dictionary<CaseInsensitiveString, MucOccupant> occupantsByFullJid =
new Dictionary<CaseInsensitiveString, MucOccupant>();
22 private readonly Dictionary<CaseInsensitiveString, MucOccupant> occupantsByBareJid =
new Dictionary<CaseInsensitiveString, MucOccupant>();
23 private readonly
object synchObj =
new object();
24 private string objectId =
null;
28 private string name =
string.
Empty;
29 private string description =
string.
Empty;
30 private string language =
string.
Empty;
31 private string subject =
string.
Empty;
32 private string subjectJid =
string.
Empty;
33 private DateTime subjectTimestamp = DateTime.MinValue;
34 private bool logging =
false;
35 private bool allowChangeSubject =
false;
36 private bool allowInvites =
false;
37 private CanSendPrivateMessages allowPrivateMessages = CanSendPrivateMessages.Anyone;
38 private int maxOccupants = 20;
39 private BroadcastPresence presenceBroadcast = BroadcastPresence.All;
40 private RetrieveMembershipList getMemberList = RetrieveMembershipList.All;
41 private bool persistent =
false;
42 private bool archive =
false;
43 private bool moderated =
false;
44 private bool membersOnly =
false;
45 private bool passwordProtected =
false;
46 private bool _public =
false;
47 private bool locked =
false;
48 private string password =
string.
Empty;
49 private DiscoverReadJids discoverRealJids = DiscoverReadJids.Moderators;
50 private int maxHistoryFetch = 50;
51 private int archiveMessagesDays = 0;
64 public string ObjectID
67 set => this.objectId = value;
73 set => this.room = value;
79 set => this.domain = value;
85 set => this.creator = value;
88 [DefaultValueStringEmpty]
92 set => this.name = value;
95 [DefaultValueStringEmpty]
96 public string Description
98 get => this.description;
99 set => this.description = value;
102 [DefaultValueStringEmpty]
103 public string Language
105 get => this.language;
106 set => this.language = value;
109 [DefaultValue(
false)]
113 set => this.logging = value;
116 [DefaultValue(
false)]
117 public bool AllowChangeSubject
119 get => this.allowChangeSubject;
120 set => this.allowChangeSubject = value;
123 [DefaultValue(
false)]
124 public bool AllowInvites
126 get => this.allowInvites;
127 set => this.allowInvites = value;
130 [DefaultValue(CanSendPrivateMessages.Anyone)]
131 public CanSendPrivateMessages AllowPrivateMessages
133 get => this.allowPrivateMessages;
134 set => this.allowPrivateMessages = value;
138 public int MaxOccupants
140 get => this.maxOccupants;
141 set => this.maxOccupants = value;
144 [DefaultValue(BroadcastPresence.All)]
145 public BroadcastPresence PresenceBroadcast
147 get => this.presenceBroadcast;
148 set => this.presenceBroadcast = value;
151 [DefaultValue(RetrieveMembershipList.All)]
152 public RetrieveMembershipList GetMemberList
154 get => this.getMemberList;
155 set => this.getMemberList = value;
158 [DefaultValue(
false)]
159 public bool Persistent
161 get => this.persistent;
164 this.persistent = value;
165 this.archive |= value;
169 [DefaultValue(
false)]
173 set => this.archive = value;
176 [DefaultValue(
false)]
177 public bool Moderated
179 get => this.moderated;
180 set => this.moderated = value;
183 [DefaultValue(
false)]
184 public bool MembersOnly
186 get => this.membersOnly;
187 set => this.membersOnly = value;
190 [DefaultValue(
false)]
194 set => this._public = value;
197 [DefaultValue(
false)]
198 public bool PasswordProtected
200 get => this.passwordProtected;
201 set => this.passwordProtected = value;
205 public string Password
207 get => this.password;
208 set => this.password = value;
216 [DefaultValue(DiscoverReadJids.Moderators)]
217 public DiscoverReadJids DiscoverRealJids
219 get => this.discoverRealJids;
220 set => this.discoverRealJids = value;
224 public int MaxHistoryFetch
226 get => this.maxHistoryFetch;
227 set => this.maxHistoryFetch = value;
231 public int ArchiveMessagesDays
233 get => this.archiveMessagesDays;
234 set => this.archiveMessagesDays = value;
241 set => this.admins = value;
248 set => this.owners = value;
255 set => this.locked = value;
258 [DefaultValueStringEmpty]
259 public string Subject
262 set => this.subject = value;
265 [DefaultValueStringEmpty]
268 get => this.subjectJid;
269 set => this.subjectJid = value;
272 [DefaultValueDateTimeMinValue]
273 public DateTime SubjectTimestamp
275 get => this.subjectTimestamp;
276 set => this.subjectTimestamp = value;
288 return this.occupantsByNick.TryGetValue(NickName, out Occupant);
296 return this.occupantsByFullJid.TryGetValue(FullJid, out Occupant);
304 return this.occupantsByBareJid.TryGetValue(BareJid, out Occupant);
312 if (this.occupantsByNick.Count >=
this.maxOccupants && !(Occupant.Affiliation is Affiliations.Admin) && !(Occupant.Affiliation is
Member))
315 this.occupantsByNick[Occupant.NickName] = Occupant;
316 this.occupantsByBareJid[Occupant.BareJid] = Occupant;
318 if (!(Occupant.FullJids is
null))
321 this.occupantsByFullJid[FullJid.
Address] = Occupant;
334 Result = this.occupantsByNick.Remove(Occupant.NickName);
335 this.occupantsByBareJid.Remove(Occupant.BareJid);
337 if (!(Occupant.FullJids is
null))
340 this.occupantsByFullJid.Remove(FullJid.
Address);
352 this.occupantsByNick.Values.CopyTo(Result, 0);
361 this.occupantsByFullJid[FullJid.
Address] = Occupant;
362 this.occupantsByBareJid[FullJid.
BareJid] = Occupant;
365 Occupant.AddFullJid(FullJid);
370 int c = Occupant.RemoveFullJid(FullJid);
374 this.occupantsByFullJid.Remove(FullJid.
Address);
378 this.occupantsByBareJid.Remove(FullJid.
BareJid);
388 if (!(this.owners is
null) && Array.IndexOf(
this.owners, BareJid) >= 0)
391 if (!(this.admins is
null) && Array.IndexOf(
this.admins, BareJid) >= 0)
392 return new Affiliations.Admin();
394 if (!(this.members is
null) && Array.IndexOf(
this.members, BareJid) >= 0)
397 return new Affiliations.None();
400 internal bool CanBroadcastPresence(
MucOccupant Occupant)
405 internal bool CanGetMembership(
MucOccupant Occupant)
410 internal bool CanDiscoverRealJids(
MucOccupant Occupant)
415 internal bool CanSendPrivateMessage(
MucOccupant Occupant)
430 if (!(this.admins is
null) && Array.IndexOf(
this.admins, Occupant.BareJid) >= 0)
433 return IsOwner(Occupant);
438 return this.IsOwner(Occupant.BareJid);
443 if (!(this.owners is
null) && Array.IndexOf(
this.owners, BareJid) >= 0)
451 return Add(ref this.members, BareJid);
456 return !(this.members is
null) && Array.IndexOf(
this.members, BareJid) >= 0;
461 return Add(ref this.admins, BareJid);
466 return Add(ref this.owners, BareJid);
471 return Remove(ref this.members, BareJid);
476 return Remove(ref this.admins, BareJid);
481 return Remove(ref this.owners, BareJid);
488 else if (Array.IndexOf(List, BareJid) >= 0)
494 Array.Resize(ref New, c + 1);
508 int i = Array.
IndexOf(New, BareJid);
515 Array.Copy(New, i + 1, New, i, c - 1 - i);
517 Array.Resize(ref New, c - 1);
Contains information about one XMPP address.
CaseInsensitiveString Address
XMPP Address
CaseInsensitiveString BareJid
Bare JID
Represents a case-insensitive string.
static readonly CaseInsensitiveString Empty
Empty case-insensitive string
int Length
Gets the number of characters in the current CaseInsensitiveString object.
int IndexOf(CaseInsensitiveString value, StringComparison comparisonType)
Reports the zero-based index of the first occurrence of the specified string in the current System....
Abstract base class for MUC affiliations.
Represents a member of a room
Represents the owner of a room
Multi-user Chat Room Occupant
MucRoom()
Multi-user Chat Room
int ArchiveDays
Number of days to archive field.
string[] EncryptedProperties
Array of properties that are encrypted.
abstract bool SendPrivateMessages
If user can send private messages
abstract bool CanSendPrivateMessage(CanSendPrivateMessages Level)
If occupants of this role can send private messages.
abstract bool CanBroadcastPresence(BroadcastPresence Level)
If occupants of this role should be broadcast.
abstract bool CanDiscoverRealJids(DiscoverReadJids Level)
If occupants of this role can discover occupant's real JIDs.
abstract bool CanGetMembership(RetrieveMembershipList Level)
If occupants of this role can get membership list.
Interface for objects containing encrypted properties. Mark the properties that are encrypted with th...
TypeNameSerialization
How the type name should be serialized.