Contact

class Contact(    session: Session,     id: String,     userData: UserData = UserData(JSONObject())) : Emitter

Creates a new contact

Constructors

Link copied to clipboard
fun Contact(    session: Session,     id: String,     userData: UserData = UserData(JSONObject()))

Types

Link copied to clipboard
object Companion
Link copied to clipboard
data class DataMessage(val content: String)

Data message

Link copied to clipboard
data class Message(    val content: String,     val uuid: Int,     val time: Date = Date())

Instant message

Functions

Link copied to clipboard
open fun emit(event: String, vararg args: Any): Emitter

Executes each of listeners with the given args.

Link copied to clipboard
fun getGroups(): Set<String>

Returns groups

Link copied to clipboard
fun getId(): String

Returns contact's user id

Link copied to clipboard
fun getPhotoUrl(): String?

Returns contact's photo url

Link copied to clipboard
fun getUserData(): UserData

Returns contact's user data

Link copied to clipboard
fun getUsername(): String

Returns contact's username

Link copied to clipboard
open fun hasListeners(event: String): Boolean

Check if this emitter has listeners for the specified event.

Link copied to clipboard
fun inGroup(group: String): Boolean

Checks whether the contact is known to be inside a group

Link copied to clipboard
fun isOnline(): Boolean

Checks whether the contact is online or not NOTE : A contact will be shown online only if it is currently in a group subscribed by the user

Link copied to clipboard
open fun listeners(event: String): MutableList<Emitter.Listener>

Returns a list of listeners for the specified event.

Link copied to clipboard
open fun off(): Emitter

Removes all registered listeners.

open fun off(event: String): Emitter

Removes all listeners of the specified event.

open fun off(event: String, fn: Emitter.Listener): Emitter

Removes the listener.

Link copied to clipboard
open fun on(event: String, fn: Emitter.Listener): Emitter

Listens on the event.

Link copied to clipboard
open fun once(event: String, fn: Emitter.Listener): Emitter

Adds a one time listener for the event.

Link copied to clipboard
fun sendData(data: String): Promise

Sends data message to contact, prefer the use of Contact.sendFile() in case of large data objects

Link copied to clipboard
fun sendFile(fileInfo: Session.FileInfo, data: ByteArray): SentInvitation

Invites the contact to a file transfer and sends the data once the contact accepts

Link copied to clipboard
fun sendMessage(message: String): Promise

Sends string message to contact

Link copied to clipboard
open override fun toString(): String