Beispiel #1
0
        /// <summary>
        /// Invoked when a presence stanza is being received.
        /// </summary>
        /// <param name="stanza">The stanza which is being received.</param>
        /// <returns>true to intercept the stanza or false to pass the stanza
        /// on to the next handler.</returns>
        public bool Input(Im.Presence stanza)
        {
            var vcard = stanza.Data["x"];

            if (vcard == null || vcard.NamespaceURI != "vcard-temp:x:update")
            {
                return(false);
            }

            VCardInfoChanged type = (stanza.Data.GetElementsByTagName("avatar").Count > 0) ? VCardInfoChanged.Avatar : VCardInfoChanged.Data;

            // Raise 'VCardChanged' event.
            VCardChanged.Raise(this, new VCardChangedEventArgs(stanza.From, type));

            //Even if we raised the 'VCardChanged' event we need to deal with presence message too
            return(false);
        }
 /// <summary>
 /// Initializes a new instance of the VCardChangedEventArgs class.
 /// </summary>
 /// <exception cref="ArgumentNullException">The jid parameter is null.</exception>
 public VCardChangedEventArgs(Jid jid, VCardInfoChanged type)
 {
     jid.ThrowIfNull("jid");
     Jid  = jid;
     Type = type;
 }