@@ -31,7 +31,7 @@ interface ToxCore : Closeable {
3131 *
3232 * @return a byte array containing the serialised tox instance.
3333 */
34- val getSavedata : ByteArray
34+ val savedata : ByteArray
3535
3636 /* *
3737 * Create a new [[ToxCore]] instance with different options. The implementation may choose to
@@ -43,7 +43,7 @@ interface ToxCore : Closeable {
4343 * instance will operate correctly.
4444 *
4545 * If the [[ToxOptions.saveData]] field is not empty, this function will load the Tox instance
46- * from a byte array previously filled by [[getSavedata ]].
46+ * from a byte array previously filled by [[savedata ]].
4747 *
4848 * If loading failed or succeeded only partially, an exception will be thrown.
4949 *
@@ -78,6 +78,8 @@ interface ToxCore : Closeable {
7878 */
7979 // @Throws(ToxBootstrapException::class)
8080 fun bootstrap (address : String , port : Port , publicKey : ToxPublicKey ): Unit
81+ fun bootstrap (address : String , port : Int , publicKey : ByteArray ): Unit =
82+ bootstrap(address, Port (port.toUShort()), ToxPublicKey (publicKey))
8183
8284 /* *
8385 * Connect to a TCP relay to forward traffic.
@@ -91,14 +93,17 @@ interface ToxCore : Closeable {
9193 */
9294 // @Throws(ToxBootstrapException::class)
9395 fun addTcpRelay (address : String , port : Port , publicKey : ToxPublicKey ): Unit
96+ fun addTcpRelay (address : String , port : Int , publicKey : ByteArray ): Unit =
97+ addTcpRelay(address, Port (port.toUShort()), ToxPublicKey (publicKey))
9498
9599 /* *
96100 * Get the UDP port this instance is bound to.
97101 *
98102 * @return a port number between 1 and 65535.
99103 */
100104 // @Throws(ToxGetPortException::class)
101- val getUdpPort: Port
105+ val udpPort: Port
106+ fun getUdpPort (): Int = udpPort.value.toInt()
102107
103108 /* *
104109 * Return the TCP port this Tox instance is bound to. This is only relevant if the instance is
@@ -107,20 +112,22 @@ interface ToxCore : Closeable {
107112 * @return a port number between 1 and 65535.
108113 */
109114 // @Throws(ToxGetPortException::class)
110- val getTcpPort: Port
115+ val tcpPort: Port
116+ fun getTcpPort (): Int = tcpPort.value.toInt()
111117
112118 /* *
113119 * Writes the temporary DHT public key of this instance to a byte array.
114120 *
115121 * This can be used in combination with an externally accessible IP address and the bound port
116- * (from [[getUdpPort ]]}) to run a temporary bootstrap node.
122+ * (from [[udpPort ]]}) to run a temporary bootstrap node.
117123 *
118124 * Be aware that every time a new instance is created, the DHT public key changes, meaning this
119125 * cannot be used to run a permanent bootstrap node.
120126 *
121127 * @return a byte array of size [[ToxCoreConstants.PublicKeySize]]
122128 */
123- val getDhtId: ToxPublicKey
129+ val dhtId: ToxPublicKey
130+ fun getDhtId (): ByteArray = dhtId.value
124131
125132 /* *
126133 * Get the time in milliseconds until [[iterate]] should be called again for optimal performance.
@@ -141,27 +148,24 @@ interface ToxCore : Closeable {
141148 *
142149 * @return a byte array of size [[ToxCoreConstants.PublicKeySize]]
143150 */
144- val getPublicKey: ToxPublicKey
151+ val publicKey: ToxPublicKey
152+ fun getPublicKey (): ByteArray = publicKey.value
145153
146154 /* *
147155 * Copy the Tox Secret Key from the Tox object.
148156 *
149157 * @return a byte array of size [[ToxCoreConstants.SecretKeySize]]
150158 */
151- val getSecretKey: ToxSecretKey
159+ val secretKey: ToxSecretKey
160+ fun getSecretKey (): ByteArray = secretKey.value
152161
153162 /* *
154- * Set the 4-byte nospam part of the address.
163+ * The 4-byte nospam part of the address.
155164 *
156165 * Setting the nospam makes it impossible for others to send us friend requests that contained the
157166 * old nospam number.
158- *
159- * @param nospam the new nospam number.
160167 */
161- fun setNospam (nospam : Int ): Unit
162-
163- /* * Get our current nospam number. */
164- val getNospam: Int
168+ var nospam: Int
165169
166170 /* *
167171 * Get our current tox address to give to friends.
@@ -175,43 +179,28 @@ interface ToxCore : Closeable {
175179 *
176180 * @return a byte array of size [[ToxCoreConstants.AddressSize]]
177181 */
178- val getAddress : ToxFriendAddress
182+ val address : ToxFriendAddress
179183
180184 /* *
181- * Set the nickname for the Tox client.
185+ * The nickname for the Tox client.
182186 *
183187 * Cannot be longer than [[ToxCoreConstants.MaxNameLength]] bytes. Can be empty (zero-length).
184- *
185- * @param name A byte array containing the new nickname..
186188 */
187189 // @Throws(ToxSetInfoException::class)
188- fun setName (name : ToxNickname ): Unit
189-
190- /* * Get our own nickname. */
191- val getName: ToxNickname
190+ var name: ToxNickname
192191
193192 /* *
194- * Set our status message.
193+ * Our status message.
195194 *
196195 * Cannot be longer than [[ToxCoreConstants.MaxStatusMessageLength]] bytes.
197- *
198- * @param message the status message to set.
199196 */
200197 // @Throws(ToxSetInfoException::class)
201- fun setStatusMessage (message : ToxStatusMessage ): Unit
202-
203- /* * Gets our own status message. May be null if the status message was empty. */
204- val getStatusMessage: ToxStatusMessage
198+ var statusMessage: ToxStatusMessage
205199
206200 /* *
207- * Set our status.
208- *
209- * @param status status to set.
201+ * Our status.
210202 */
211- fun setStatus (status : ToxUserStatus ): Unit
212-
213- /* * Get our status. */
214- val getStatus: ToxUserStatus
203+ var status: ToxUserStatus
215204
216205 /* *
217206 * Add a friend to the friend list and send a friend request.
@@ -240,6 +229,8 @@ interface ToxCore : Closeable {
240229 */
241230 // @Throws(ToxFriendAddException::class, IllegalArgumentException::class)
242231 fun addFriend (address : ToxFriendAddress , message : ToxFriendRequestMessage ): ToxFriendNumber
232+ fun addFriend (address : ByteArray , message : ByteArray ): Int =
233+ addFriend(ToxFriendAddress (address), ToxFriendRequestMessage (message)).value
243234
244235 /* *
245236 * Add a friend without sending a friend request.
@@ -257,6 +248,8 @@ interface ToxCore : Closeable {
257248 */
258249 // @Throws(ToxFriendAddException::class, IllegalArgumentException::class)
259250 fun addFriendNorequest (publicKey : ToxPublicKey ): ToxFriendNumber
251+ fun addFriendNorequest (publicKey : ByteArray ): Int =
252+ addFriendNorequest(ToxPublicKey (publicKey)).value
260253
261254 /* *
262255 * Remove a friend from the friend list.
@@ -308,7 +301,7 @@ interface ToxCore : Closeable {
308301 * @return an array containing the currently valid friend numbers, the empty int array if there
309302 * are no friends.
310303 */
311- val getFriendList : IntArray
304+ val friendList : IntArray
312305
313306 /* *
314307 * Get an array of [[ToxFriendNumber]] objects with the same values as [[getFriendList]].
@@ -317,8 +310,8 @@ interface ToxCore : Closeable {
317310 *
318311 * @return [[getFriendList]] mapped to [[ToxFriendNumber]].
319312 */
320- val getFriendNumbers : List <ToxFriendNumber >
321- get() = getFriendList .map { ToxFriendNumber (it) }
313+ val friendNumbers : List <ToxFriendNumber >
314+ get() = friendList .map { ToxFriendNumber (it) }
322315
323316 /* *
324317 * Tell friend number whether or not we are currently typing.
@@ -347,7 +340,7 @@ interface ToxCore : Closeable {
347340 * incremented by 1 each time a message is sent. If [[Int.MaxValue]] messages were sent, the next
348341 * message ID is [[Int.MinValue]].
349342 *
350- * Message IDs are not stored in the array returned by [[getSavedata ]].
343+ * Message IDs are not stored in the array returned by [[savedata ]].
351344 *
352345 * @param friendNumber The friend number of the friend to send the message to.
353346 * @param messageType Message type (normal, action, ...).
0 commit comments