PrivateMessageRequest Class |
Namespace: Sfs2X.Requests
public class PrivateMessageRequest : GenericMessageRequest
Name | Description | |
---|---|---|
PrivateMessageRequest(String, Int32) |
See PrivateMessageRequest(string, int, ISFSObject) constructor.
| |
PrivateMessageRequest(String, Int32, ISFSObject) |
Creates a new PrivateMessageRequest instance.
|
void SomeMethod() { sfs.AddEventListener(SFSEvent.PRIVATE_MESSAGE, OnPrivateMessage); // Send a private message to Jack User messageRecipient = sfs.UserManager.GetUserByName("Jack"); sfs.Send( new PrivateMessageRequest("Hello Jack!", messageRecipient.Id) ); } void OnPrivateMessage(BaseEvent evt) { // As messages are forwarded to the sender too, I have to check if I am the sender User sender = (User)evt.Params["sender"]; if (sender != sfs.MySelf) { Console.WriteLine("User " + sender.Name + " sent me this PM: " + (string)evt.Params["message"]); // .Net / Unity System.Diagnostics.Debug.WriteLine("User " + sender.Name + " sent me this PM: " + (string)evt.Params["message"]); // UWP } }