Interface IChatService


  • public interface IChatService
    Global chat service. Called to send messages, send files and user status.
    • Field Detail

      • STATE_IDLE

        static final java.lang.String STATE_IDLE
        The default user state.
        See Also:
        Constant Field Values
      • STATE_TYPING

        static final java.lang.String STATE_TYPING
        The user typing a message.
        See Also:
        Constant Field Values
      • STATE_AWAY

        static final java.lang.String STATE_AWAY
        The user is currently away from the chat.
        See Also:
        Constant Field Values
      • STATE_DEAD

        static final java.lang.String STATE_DEAD
        The state for a disconnected user.
        See Also:
        Constant Field Values
    • Method Detail

      • getNickName

        IFuture<java.lang.String> getNickName()
        Get the user name.
      • getImage

        IFuture<byte[]> getImage()
        Get the user image.
      • getStatus

        IFuture<java.lang.String> getStatus()
        Get the current status.
      • message

        IFuture<java.lang.Void> message​(java.lang.String nick,
                                        java.lang.String text,
                                        boolean privatemessage)
        Post a message
        Parameters:
        nick - The sender's nick name.
        text - The text message.
      • status

        IFuture<java.lang.Void> status​(java.lang.String nick,
                                       java.lang.String status,
                                       byte[] image)
        Post a status or nick name, or image change.
        Parameters:
        nick - The (possibly changed) nick name.
        status - The new status or null for no change.
        image - The new image or null for no change.
      • sendFile

        ITerminableIntermediateFuture<java.lang.Long> sendFile​(java.lang.String nick,
                                                               java.lang.String filename,
                                                               long size,
                                                               java.lang.String id,
                                                               IInputConnection con)
        Send a file.
        Parameters:
        nick - The sender's nick name.
        filename - The filename.
        size - The size of the file.
        id - An optional id to identify the transfer (e.g. for resume after error).
        con - The connection.
        Returns:
        The returned future publishes updates about the total number of bytes received. Exception messages of the returned future correspond to file transfer states (aborted vs. error vs. rejected).
      • startUpload

        ITerminableFuture<IOutputConnection> startUpload​(java.lang.String nick,
                                                         java.lang.String filename,
                                                         long size,
                                                         java.lang.String id)
        Send a file. Alternative method signature.
        Parameters:
        nick - The sender's nick name.
        filename - The filename.
        size - The size of the file.
        id - An optional id to identify the transfer (e.g. for resume after error).
        Returns:
        When the upload is accepted, the output connection for sending the file is returned.