//public const string DeleteRosterQuery = @"<query xmlns=""jabber:iq:roster""><item jid=""##JID##"" subscription=""remove"" /></query>"; public void DeleteFromRoster(JID jid) { 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) { } }
//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) { 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) { } }