Interface IChatService


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

      Fields 
      Modifier and Type Field Description
      static java.lang.String STATE_AWAY
      The user is currently away from the chat.
      static java.lang.String STATE_DEAD
      The state for a disconnected user.
      static java.lang.String STATE_IDLE
      The default user state.
      static java.lang.String STATE_TYPING
      The user typing a message.
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      jadex.commons.future.IFuture<byte[]> getImage()
      Get the user image.
      jadex.commons.future.IFuture<java.lang.String> getNickName()
      Get the user name.
      jadex.commons.future.IFuture<java.lang.String> getStatus()
      Get the current status.
      jadex.commons.future.IFuture<java.lang.Void> image​(java.lang.String nick, byte[] image, boolean privatemessage)
      Post an image.
      jadex.commons.future.IFuture<java.lang.Void> message​(java.lang.String nick, java.lang.String text, boolean privatemessage)
      Post a message
      jadex.commons.future.ITerminableIntermediateFuture<java.lang.Long> sendFile​(java.lang.String nick, java.lang.String filename, long size, java.lang.String id, IInputConnection con)
      Send a file.
      jadex.commons.future.ITerminableFuture<IOutputConnection> startUpload​(java.lang.String nick, java.lang.String filename, long size, java.lang.String id)
      Send a file.
      jadex.commons.future.IFuture<java.lang.Void> status​(java.lang.String nick, java.lang.String status, byte[] image)
      Post a status or nick name, or image change.
    • 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

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

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

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

        jadex.commons.future.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.
      • image

        jadex.commons.future.IFuture<java.lang.Void> image​(java.lang.String nick,
                                                           byte[] image,
                                                           boolean privatemessage)
        Post an image.
        Parameters:
        nick - The sender's nick name.
        image - The image.
      • status

        jadex.commons.future.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

        jadex.commons.future.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

        jadex.commons.future.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.