private void PubSubClient_ItemNotification(object Sender, ItemNotificationEventArgs e) { if (this.hasPubSubComponent && e.From.IndexOf('@') < 0) { try { this.NonPepItemNotification?.Invoke(this, e); } catch (Exception ex) { Log.Critical(ex); } } else { if (string.Compare(e.FromBareJID, this.client.BareJID, true) != 0) { RosterItem Item = this.client[e.FromBareJID]; if (Item is null || (Item.State != SubscriptionState.Both && Item.State != SubscriptionState.To)) { return; } } IPersonalEvent PersonalEvent = null; foreach (XmlNode N in e.Item.ChildNodes) { if (N is XmlElement E && personalEventTypes.TryGetValue(E.LocalName + " " + E.NamespaceURI, out IPersonalEvent PersonalEvent2)) { PersonalEvent = PersonalEvent2.Parse(E); break; } } if (PersonalEvent != null) { PersonalEventNotificationEventHandler[] Handlers; lock (this.handlers) { if (!this.handlers.TryGetValue(PersonalEvent.GetType(), out Handlers)) { return; } } PersonalEventNotificationEventArgs e2 = new PersonalEventNotificationEventArgs(PersonalEvent, this, e); foreach (PersonalEventNotificationEventHandler Handler in Handlers) { try { Handler.Invoke(this, e2); } catch (Exception ex) { Log.Critical(ex); } } } } }
internal UserMoodEventArguments(UserMood Mood, PersonalEventNotificationEventArgs e) : base(e) { this.mood = Mood; }
/// <summary> /// Event argument for personal event notification events. /// </summary> /// <param name="e">Message event arguments</param> public PersonalEventNotificationEventArgs(PersonalEventNotificationEventArgs e) : base(e) { this.personalEvent = e.personalEvent; this.pepClient = e.pepClient; }
internal UserLocationEventArguments(UserLocation Location, PersonalEventNotificationEventArgs e) : base(e) { this.location = Location; }
internal UserAvatarMetaDataEventArguments(UserAvatarMetaData AvatarMetaData, PersonalEventNotificationEventArgs e) : base(e) { this.avatarMetaData = AvatarMetaData; }
internal UserActivityEventArguments(UserActivity Activity, PersonalEventNotificationEventArgs e) : base(e) { this.activity = Activity; }
internal UserTuneEventArguments(UserTune Tune, PersonalEventNotificationEventArgs e) : base(e) { this.tune = Tune; }