/// <summary> /// Subscribe to a contact /// </summary> /// <param name="to">Bare Jid of the rosteritem we want to subscribe</param> public void Subscribe(Jid to) { // <presence to='*****@*****.**' type='subscribe'/> Presence pres = new Presence(); pres.Type = PresenceType.subscribe; pres.To = to; m_connection.Send(pres); }
/// <summary> /// Add a contact to the Roster. /// </summary> /// <param name="jid">The BARE jid of the contact that should be added.</param> /// <param name="nickname">Nickname for the contact.</param> /// <param name="group">An Array of groups when you want to add the contact to multiple groups.</param> public void AddRosterItem(Jid jid, string nickname, string[] group) { RosterIq riq = new RosterIq(); riq.Type = IqType.set; RosterItem ri = new RosterItem(); ri.Jid = jid; if (nickname != null) { ri.Name = nickname; } foreach (string g in group) { ri.AddGroup(g); } riq.Query.AddRosterItem(ri); m_connection.Send(riq); }