public static string GetAFError(ToxErrorFriendAdd error) { switch (error) { case ToxErrorFriendAdd.AlreadySent: return("This person is already in your friend list."); case ToxErrorFriendAdd.SetNewNospam: return("This person is already in your friend list but the nospam value of this id is different. (The nospam value for that friend was set to this new one)"); case ToxErrorFriendAdd.NoMessage: return("You can't send a friend request with an empty message."); case ToxErrorFriendAdd.OwnKey: return("You can't add yourself to your friend list."); case ToxErrorFriendAdd.Malloc: return("Something went wrong while increasing the size of your friend list."); case ToxErrorFriendAdd.BadChecksum: return("The checksum in this address is bad."); default: return("An unknown error occurred"); } }
public new int AddFriendNoRequest(ToxKey publicKey, out ToxErrorFriendAdd error) { var friendNumber = base.AddFriendNoRequest(publicKey, out error); if (error == ToxErrorFriendAdd.Ok) FriendListChanged(friendNumber, FriendListChangedAction.Add); return friendNumber; }
public void RelayError(ToxErrorFriendAdd error) { switch (error) { case ToxErrorFriendAdd.AlreadySent: RaiseToxErrorOccured( "Friend request is already sent or you already have this user on your friend list."); return; case ToxErrorFriendAdd.OwnKey: RaiseToxErrorOccured("This ID is yours. You can't add yourself to your friend list."); return; case ToxErrorFriendAdd.SetNewNospam: RaiseToxErrorOccured( "You already have this user on your friend list, but with a different no spam value."); return; case ToxErrorFriendAdd.TooLong: RaiseToxErrorOccured("The friend request message is too long."); return; default: if (error != ToxErrorFriendAdd.Ok) { RaiseToxErrorOccured("An unexpected error occurred when handling a friend request: " + error); } return; } }
public new int AddFriend(ToxId id, string message, out ToxErrorFriendAdd error) { var friendNumber = base.AddFriend(id, message, out error); if (error == ToxErrorFriendAdd.Ok) FriendListChanged(friendNumber, FriendListChangedAction.Add); return friendNumber; }
public new int AddFriendNoRequest(ToxKey publicKey, out ToxErrorFriendAdd error) { var friendNumber = base.AddFriendNoRequest(publicKey, out error); if (error == ToxErrorFriendAdd.Ok) { FriendListChanged(friendNumber, FriendListChangedAction.Add); } return(friendNumber); }
public new int AddFriend(ToxId id, string message, out ToxErrorFriendAdd error) { var friendNumber = base.AddFriend(id, message, out error); if (error == ToxErrorFriendAdd.Ok) { FriendListChanged(friendNumber, FriendListChangedAction.Add); } return(friendNumber); }
public static string GetAFError(ToxErrorFriendAdd error) { switch(error) { case ToxErrorFriendAdd.AlreadySent: return "This person is already in your friend list."; case ToxErrorFriendAdd.SetNewNospam: return "This person is already in your friend list but the nospam value of this id is different. (The nospam value for that friend was set to this new one)"; case ToxErrorFriendAdd.NoMessage: return "You can't send a friend request with an empty message."; case ToxErrorFriendAdd.OwnKey: return "You can't add yourself to your friend list."; case ToxErrorFriendAdd.Malloc: return "Something went wrong while increasing the size of your friend list."; case ToxErrorFriendAdd.BadChecksum: return "The checksum in this address is bad."; default: return "An unknown error occurred"; } }
public void RelayError(ToxErrorFriendAdd error) { switch (error) { case ToxErrorFriendAdd.AlreadySent: RaiseToxErrorOccured( "Friend request is already sent or you already have this user on your friend list."); return; case ToxErrorFriendAdd.OwnKey: RaiseToxErrorOccured("This ID is yours. You can't add yourself to your friend list."); return; case ToxErrorFriendAdd.SetNewNospam: RaiseToxErrorOccured( "You already have this user on your friend list, but with a different no spam value."); return; case ToxErrorFriendAdd.TooLong: RaiseToxErrorOccured("The friend request message is too long."); return; default: if (error != ToxErrorFriendAdd.Ok) RaiseToxErrorOccured("An unexpected error occurred when handling a friend request: " + error); return; } }
internal static extern uint FriendAddNoRequest(ToxHandle tox, byte[] publicKey, ref ToxErrorFriendAdd error);
internal static extern uint FriendAdd(ToxHandle tox, byte[] address, byte[] message, uint length, ref ToxErrorFriendAdd error);
/// <summary> /// Adds a friend to the friend list without sending a friend request. /// This method should be used to accept friend requests. /// </summary> /// <param name="publicKey">The public key of the friend to add.</param> /// <param name="error"></param> /// <returns>The friend number.</returns> public int AddFriendNoRequest(ToxKey publicKey, out ToxErrorFriendAdd error) { ThrowIfDisposed(); if (publicKey == null) throw new ArgumentNullException("publicKey"); error = ToxErrorFriendAdd.Ok; return (int)ToxFunctions.FriendAddNoRequest(_tox, publicKey.GetBytes(), ref error); }
/// <summary> /// Adds a friend to the friend list and sends a friend request. /// </summary> /// <param name="id">The Tox id of the friend to add.</param> /// <param name="message">The message that will be sent along with the friend request.</param> /// <param name="error"></param> /// <returns>The friend number.</returns> public int AddFriend(ToxId id, string message, out ToxErrorFriendAdd error) { ThrowIfDisposed(); if (id == null) throw new ArgumentNullException("id"); byte[] msg = Encoding.UTF8.GetBytes(message); error = ToxErrorFriendAdd.Ok; return (int)ToxFunctions.FriendAdd(_tox, id.Bytes, msg, (uint)msg.Length, ref error); }
public static extern UInt32 AddNoRequest(ToxHandle tox, Byte[] publicKey, ref ToxErrorFriendAdd error);
public static extern UInt32 Add(ToxHandle tox, Byte[] address, Byte[] message, SizeT length, ref ToxErrorFriendAdd error);