예제 #1
0
        //public const string DeleteRosterQuery = @"<query xmlns=""jabber:iq:roster""><item jid=""##JID##"" subscription=""remove"" /></query>";

        public void DeleteFromRoster(JID jid)
        {
            //<iq from='[email protected]/balcony'
            //      id='hm4hs97y'
            //      type='set'>
            //    <query xmlns='jabber:iq:roster'>
            //      <item jid='*****@*****.**'
            //            subscription='remove'/>
            //    </query>
            //  </iq>

            //string strDeleteQuery = DeleteRosterQuery.Replace("##JID##", jid.BareJID);

            RosterIQ DeleteRosterIQ = new RosterIQ();

            //DeleteRosterIQ.InnerXML = strDeleteQuery;
            DeleteRosterIQ.Type = IQType.set.ToString();
            DeleteRosterIQ.To   = null;
            DeleteRosterIQ.From = XMPPClient.JID;
            //DeleteRosterIQ.xmlns = "jabber:client";

            rosteritem deleteitem = new rosteritem();

            deleteitem.JID          = jid;
            deleteitem.Subscription = subscription.remove.ToString();

            DeleteRosterIQ.Query.RosterItems = new rosteritem[] { deleteitem };


            IQ IQResponse = XMPPClient.SendRecieveIQ(DeleteRosterIQ, 10000);

            if (IQResponse != null)
            {
            }
        }
예제 #2
0
        //public const string AddRosterQuery = @"<query xmlns=""jabber:iq:roster""><item jid=""##JID##"" name=""##NAME##""><group>##GROUP##</group></item></query>";

        public void AddToRoster(JID jid, string strName, string strGroup)
        {
            //<iq from='[email protected]/balcony'
            //      id='ph1xaz53'
            //      type='set'>
            //    <query xmlns='jabber:iq:roster'>
            //      <item jid='*****@*****.**'
            //            name='Nurse'>
            //        <group>Servants</group>
            //      </item>
            //    </query>
            //  </iq>

            //string strAddQuery = AddRosterQuery.Replace("##JID##", jid.BareJID);
            //strAddQuery = strAddQuery.Replace("##NAME##", strName);
            //strAddQuery = strAddQuery.Replace("##GROUP##", strGroup);

            RosterIQ AddRosterIQ = new RosterIQ();

            AddRosterIQ.Type = IQType.set.ToString();
            AddRosterIQ.To   = null;
            AddRosterIQ.From = XMPPClient.JID;
            rosteritem newitem = new rosteritem();

            newitem.Name = strName;

            JID newjid = jid;

            if (newjid.User.Length <= 0)
            {
                newjid.User   = newjid.Domain;
                newjid.Domain = XMPPClient.JID.Domain;
            }

            newitem.JID          = newjid;
            newitem.Subscription = subscription.none.ToString();
            newitem.Groups       = new string[] { strGroup };

            AddRosterIQ.Query.RosterItems = new rosteritem[] { newitem };



            IQ IQResponse = XMPPClient.SendRecieveIQ(AddRosterIQ, 10000);

            if (IQResponse != null)
            {
            }
        }
예제 #3
0
        //public const string DeleteRosterQuery = @"<query xmlns=""jabber:iq:roster""><item jid=""##JID##"" subscription=""remove"" /></query>";
        public void DeleteFromRoster(JID jid)
        {
            //<iq from='[email protected]/balcony'
             //      id='hm4hs97y'
             //      type='set'>
             //    <query xmlns='jabber:iq:roster'>
             //      <item jid='*****@*****.**'
             //            subscription='remove'/>
             //    </query>
             //  </iq>

            //string strDeleteQuery = DeleteRosterQuery.Replace("##JID##", jid.BareJID);

            RosterIQ DeleteRosterIQ = new RosterIQ();
            //DeleteRosterIQ.InnerXML = strDeleteQuery;
            DeleteRosterIQ.Type = IQType.set.ToString();
            DeleteRosterIQ.To = null;
            DeleteRosterIQ.From = XMPPClient.JID;
            //DeleteRosterIQ.xmlns = "jabber:client";

            rosteritem deleteitem = new rosteritem();
            deleteitem.JID = jid;
            deleteitem.Subscription = subscription.remove.ToString();

            DeleteRosterIQ.Query.RosterItems = new rosteritem[] { deleteitem };

            IQ IQResponse = XMPPClient.SendRecieveIQ(DeleteRosterIQ, 10000);
            if (IQResponse != null)
            {
            }
        }
예제 #4
0
        //public const string AddRosterQuery = @"<query xmlns=""jabber:iq:roster""><item jid=""##JID##"" name=""##NAME##""><group>##GROUP##</group></item></query>";
        public void AddToRoster(JID jid, string strName, string strGroup)
        {
            //<iq from='[email protected]/balcony'
             //      id='ph1xaz53'
             //      type='set'>
             //    <query xmlns='jabber:iq:roster'>
             //      <item jid='*****@*****.**'
             //            name='Nurse'>
             //        <group>Servants</group>
             //      </item>
             //    </query>
             //  </iq>

            //string strAddQuery = AddRosterQuery.Replace("##JID##", jid.BareJID);
            //strAddQuery = strAddQuery.Replace("##NAME##", strName);
            //strAddQuery = strAddQuery.Replace("##GROUP##", strGroup);

            RosterIQ AddRosterIQ = new RosterIQ();
            AddRosterIQ.Type = IQType.set.ToString();
            AddRosterIQ.To = null;
            AddRosterIQ.From = XMPPClient.JID;
            rosteritem newitem = new rosteritem();
            newitem.Name = strName;

            JID newjid = jid;
            if (newjid.User.Length <= 0)
            {
                newjid.User = newjid.Domain;
                newjid.Domain = XMPPClient.JID.Domain;
            }

            newitem.JID = newjid;
            newitem.Subscription = subscription.none.ToString();
            newitem.Groups = new string[] { strGroup };

            AddRosterIQ.Query.RosterItems = new rosteritem[] { newitem };

            IQ IQResponse = XMPPClient.SendRecieveIQ(AddRosterIQ, 10000);
            if (IQResponse != null)
            {
            }
        }