コード例 #1
0
        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);
                        }
                    }
                }
            }
        }
コード例 #2
0
 internal UserMoodEventArguments(UserMood Mood, PersonalEventNotificationEventArgs e) :
     base(e)
 {
     this.mood = Mood;
 }
コード例 #3
0
 /// <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;
 }
コード例 #4
0
 internal UserLocationEventArguments(UserLocation Location, PersonalEventNotificationEventArgs e) :
     base(e)
 {
     this.location = Location;
 }
コード例 #5
0
 internal UserAvatarMetaDataEventArguments(UserAvatarMetaData AvatarMetaData, PersonalEventNotificationEventArgs e) :
     base(e)
 {
     this.avatarMetaData = AvatarMetaData;
 }
コード例 #6
0
 internal UserActivityEventArguments(UserActivity Activity, PersonalEventNotificationEventArgs e) :
     base(e)
 {
     this.activity = Activity;
 }
コード例 #7
0
 internal UserTuneEventArguments(UserTune Tune, PersonalEventNotificationEventArgs e) :
     base(e)
 {
     this.tune = Tune;
 }