/// <summary> /// Event arguments for presence events. /// </summary> /// <param name="e">Copies attributes from this event arguments class.</param> protected PresenceEventArgs(PresenceEventArgs e) { this.statuses = e.statuses; this.presence = e.presence; this.content = e.content; this.errorElement = e.errorElement; this.errorType = e.errorType; this.stanzaError = e.stanzaError; this.errorText = e.errorText; this.client = e.client; this.component = e.component; this.type = e.type; this.availability = e.availability; this.from = e.from; this.fromBareJid = e.fromBareJid; this.to = e.to; this.id = e.id; this.status = e.status; this.errorCode = e.errorCode; this.priority = e.priority; this.ok = e.ok; this.received = e.received; this.state = e.state; }
internal RosterItem(XmlElement Item, Dictionary <string, RosterItem> Roster) { this.bareJid = XML.Attribute(Item, "jid"); this.name = XML.Attribute(Item, "name"); switch (XML.Attribute(Item, "subscription")) { case "both": this.state = SubscriptionState.Both; break; case "to": this.state = SubscriptionState.To; break; case "from": this.state = SubscriptionState.From; break; case "none": case "": this.state = SubscriptionState.None; break; case "remove": this.state = SubscriptionState.Remove; break; default: this.state = SubscriptionState.Unknown; break; } switch (XML.Attribute(Item, "ask").ToLower()) { case "subscribe": this.pendingSubscription = PendingSubscription.Subscribe; break; case "unsubscribe": this.pendingSubscription = PendingSubscription.Unsubscribe; break; default: this.pendingSubscription = PendingSubscription.None; break; } List <string> Groups = new List <string>(); foreach (XmlNode N in Item.ChildNodes) { if (N.LocalName == "group") { Groups.Add(N.InnerText); } } this.groups = Groups.ToArray(); if (this.state == SubscriptionState.Both || this.state == SubscriptionState.To) { if (Roster.TryGetValue(this.bareJid, out RosterItem Prev)) { this.resources = Prev.resources; } this.lastPresence = Prev?.lastPresence; } if (this.resources is null) { this.resources = new Dictionary <string, PresenceEventArgs>(); } }