/// <summary> /// Updates the contact data. /// </summary> public void Update() { IQ iq = new IQ(); RosterQuery query = new RosterQuery(); RosterItem item = new RosterItem(); iq.Type = IQType.Set; item.Jid = this.ContactId.BareIdentifier; item.Name = this.DisplayName; item.Subscription = (RosterSubscriptionType)this.Subscription; item.Groups.AddRange(this.Groups); query.Items.Add(item); iq.Items.Add(query); this.session.Send(iq); }
/// <summary> /// Adds to group. /// </summary> /// <param name="groupName">Name of the group.</param> public void AddToGroup(string groupName) { IQ iq = new IQ(); RosterQuery query = new RosterQuery(); RosterItem item = new RosterItem(); if (!this.Groups.Contains(groupName)) { this.Groups.Add(groupName); } iq.Type = IQType.Set; item.Jid = this.ContactId.BareIdentifier; item.Name = this.Name; item.Subscription = (RosterSubscriptionType)this.Subscription; item.Groups.Add(groupName); query.Items.Add(item); iq.Items.Add(query); this.session.Send(iq); }