Click or drag to resize

RemoveBuddyRequest Class

Removes a buddy from the current user's buddies list.
Inheritance Hierarchy
SystemObject
  BaseRequest
    Sfs2X.Requests.BuddylistRemoveBuddyRequest

Namespace:  Sfs2X.Requests.Buddylist
Assembly:  SmartFox2X (in SmartFox2X.dll) Version: 1.8.0.0 (1.8.0)
Syntax
C#
public class RemoveBuddyRequest : BaseRequest

The RemoveBuddyRequest type exposes the following members.

Constructors
  NameDescription
Public methodRemoveBuddyRequest
Creates a new RemoveBuddyRequest instance.
Top
Remarks
In order to remove a buddy, the current user must be online in the Buddy List system. If the buddy is removed successfully, the operation is confirmed by a BUDDY_REMOVE event; otherwise the BUDDY_ERROR event is fired.

This request can be sent if the Buddy List system was previously initialized only (see the InitBuddyListRequest request description).

Examples
The following example sends a request to remove a buddy:
void SomeMethod() {
    sfs.AddEventListener(SFSBuddyEvent.BUDDY_REMOVE, OnBuddyRemoved);
    sfs.AddEventListener(SFSBuddyEvent.BUDDY_ERROR, OnBuddyError);

    // Remove Jack from my buddies list
    sfs.Send(new RemoveBuddyRequest("Jack"));
}

void OnBuddyRemoved(BaseEvent evt) {
    Console.WriteLine("This buddy was removed: " + (Buddy)evt.Params["buddy"]);                         // .Net / Unity
    System.Diagnostics.Debug.WriteLine("This buddy was removed: " + (Buddy)evt.Params["buddy"]);        // UWP
}

void OnBuddyError(BaseEvent evt) {
    Console.WriteLine("The following error occurred while executing a buddy-related request: " + (string)evt.Params["errorMessage"]);                           // .Net / Unity
    System.Diagnostics.Debug.WriteLine("The following error occurred while executing a buddy-related request: " + (string)evt.Params["errorMessage"]);          // UWP
}
See Also