コード例 #1
0
        public void AddToRoster(RosterItem item)
        {
            this.AssertValid(true);
            item.ThrowIfNull <RosterItem>("item");
            XmlElement e = Xml.Element("item", null).Attr("jid", item.Jid.ToString());

            if (!string.IsNullOrEmpty(item.Name))
            {
                e.Attr("name", item.Name);
            }
            foreach (string str in item.Groups)
            {
                e.Child(Xml.Element("group", null).Text(str));
            }
            XmlElement data    = Xml.Element("query", "jabber:iq:roster").Child(e);
            Iq         errorIq = this.IqRequest(IqType.Set, null, this.Jid, data, null, -1, "");

            if (errorIq.Type == IqType.Error)
            {
                throw Util.ExceptionFromError(errorIq, "The item could not be added to the roster.");
            }
        }
コード例 #2
0
 public void RemoveFromRoster(RosterItem item)
 {
     this.AssertValid(true);
     item.ThrowIfNull <RosterItem>("item");
     this.RemoveFromRoster(item.Jid);
 }
コード例 #3
0
ファイル: XmppClient.cs プロジェクト: BlueBasher/S22.Xmpp
		/// <summary>
		/// Removes the specified item from the user's roster.
		/// </summary>
		/// <param name="item">The item to remove.</param>
		/// <exception cref="ArgumentNullException">The item parameter is null.</exception>
		/// <exception cref="IOException">There was a failure while writing to or reading
		/// from the network.</exception>
		/// <exception cref="InvalidOperationException">The XmppClient instance is not
		/// connected to a remote host, or the XmppClient instance has not authenticated with
		/// the XMPP server.</exception>
		/// <exception cref="ObjectDisposedException">The XmppClient object has been
		/// disposed.</exception>
		/// <exception cref="XmppErrorException">The server returned an XMPP error code.
		/// Use the Error property of the XmppErrorException to obtain the specific
		/// error condition.</exception>
		/// <exception cref="XmppException">The server returned invalid data or another
		/// unspecified XMPP error occurred.</exception>
		public void RemoveContact(RosterItem item) {
			AssertValid();
			item.ThrowIfNull("item");
			im.RemoveFromRoster(item);
		}
コード例 #4
0
		/// <summary>
		/// Initializes a new instance of the RosterUpdatedEventArgs class.
		/// </summary>
		/// <param name="item">The item the RosterUpdated event is being raised
		/// for.</param>
		/// <param name="removed">Set to true if the item is being removed from
		/// the roster.</param>
		/// <exception cref="ArgumentNullException">The item parameter is null.</exception>
		public RosterUpdatedEventArgs(RosterItem item, bool removed) {
			item.ThrowIfNull("item");
			Item = item;
			Removed = removed;
		}
コード例 #5
0
 /// <summary>
 /// Initializes a new instance of the RosterUpdatedEventArgs class.
 /// </summary>
 /// <param name="item">The item the RosterUpdated event is being raised
 /// for.</param>
 /// <param name="removed">Set to true if the item is being removed from
 /// the roster.</param>
 /// <exception cref="ArgumentNullException">The item parameter is null.</exception>
 public RosterUpdatedEventArgs(RosterItem item, bool removed)
 {
     item.ThrowIfNull("item");
     Item    = item;
     Removed = removed;
 }
コード例 #6
0
 public RosterUpdatedEventArgs(RosterItem item, bool removed)
 {
     item.ThrowIfNull <RosterItem>("item");
     this.Item    = item;
     this.Removed = removed;
 }