Beispiel #1
0
        public void UdpateVCARD(vcard vcard)
        {
            IQ iq = new IQ();

            iq.From     = XMPPClient.JID;
            iq.To       = null;
            iq.Type     = IQType.set.ToString();
            iq.InnerXML = Utility.GetXMLStringFromObject(vcard);

            XMPPClient.SendXMPP(iq);
        }
        public void UdpateVCARD(vcard vcard)
        {
            IQ iq = new IQ();
            iq.From = XMPPClient.JID;
            iq.To = null;
            iq.Type = IQType.set.ToString();
            iq.InnerXML = Utility.GetXMLStringFromObject(vcard);

            XMPPClient.SendXMPP(iq);
        }
Beispiel #3
0
        // Look for subscribe message to subscribe to presence
        public override bool NewIQ(IQ iq)
        {
            if ((iqGetOurVCARD != null) && (iq.ID == iqGetOurVCARD.ID))
            {
                foreach (XElement vcard in iq.InitalXMLElement.Descendants("{vcard-temp}vCard"))
                {
                    vcard card = Utility.ParseObjectFromXMLString(vcard.ToString(), typeof(vcard)) as vcard;
                    if (card != null)
                    {
                        XMPPClient.vCard = card;
                    }
                }
                return(true);
            }

            if (iq.InitalXMLElement != null)
            {
                foreach (XElement vcard in iq.InitalXMLElement.Descendants("{vcard-temp}vCard"))
                {
                    vcard card = Utility.ParseObjectFromXMLString(vcard.ToString(), typeof(vcard)) as vcard;
                    if (card != null)
                    {
                        RosterItem item = XMPPClient.FindRosterItem(iq.From);
                        if (item != null)
                        {
                            item.vCard = card;
                        }
                        else if (iq.From.BareJID == XMPPClient.JID.BareJID)
                        {
                            XMPPClient.vCard = card;
                        }
                    }

                    return(true);
                }

                foreach (XElement avaelem in iq.InitalXMLElement.Descendants("{jabber:iq:avatar}query"))
                {
                    IQAvatarQuery ava = Utility.ParseObjectFromXMLString(avaelem.ToString(), typeof(IQAvatarQuery)) as IQAvatarQuery;
                    if (ava != null)
                    {
                        /// Found a new avatar using this 3rd method, tell the client
                    }

                    return(true);
                }
            }

            /// We'll handle vcards here
            ///


            //US: <iq id='b89c5r7ib574'
            //        to='[email protected]/foo'
            //        type='set'>
            //      <query xmlns='jabber:iq:roster'>
            //        <item ask='subscribe'
            //              jid='*****@*****.**'
            //              subscription='none'/>
            //      </query>
            //    </iq>

            //US: <iq id='b89c5r7ib575'
            //        to='[email protected]/bar'
            //        type='set'>
            //      <query xmlns='jabber:iq:roster'>
            //        <item ask='subscribe'
            //              jid='*****@*****.**'
            //              subscription='none'/>
            //      </query>
            //    </iq>


            return(base.NewIQ(iq));
        }