If you are looking for Jitsi Meet, the WebRTC compatible video conferencing product click here.

previous | TOC | next

UI Service Documentation

Chat dialog management

One of the main goals of the UIService is to provide simple access for other bundles to “chat dialogs” within the UI.

If you want to implement the UIService: 1.Implement the ExportedDialog interface in your ‘chat dialog’ implementation. 2.Implement the getChatDialog(Contact) method in the UI Service to return a chat exported dialog for a given contact.

What is a “chat dialog”?

The “chat dialog” is not necessarily a GUI dialog box - it may also be a window, a panel, etc. We consider here that a “chat dialog” should satisfy two main requirements:

  1. A unique “chat dialog” should correspond to a Contact.
  2. A “chat dialog” should implement the ExportedDialog interface in order to be accessed from other bundles.

How to obtain a “chat dialog”?

Each bundle is able to obtain a “chat dialog” for a certain protocol contact through the method: getChatDialog(Contact). The returned dialog is an ExportedDialog, thus you could call over it: show, hide, isVisible, etc.

Example: When a new message is received for a given protocol provider, obtains the application chat dialog corresponding to the message Contact (the sender of the message) and checks if there is already an opened chat window for this Contact.

//Obtain a certain ProtocolProviderService
...

//Obtains the list of operation sets supported by the ProtocolProviderService
Map osMap = protocolProviderService.getSupportedOperationSets();

Iterator entrySetIter
    = osMap.entrySet().iterator();

OperationSetBasicInstantMessaging im;

for (int i = 0; i < osMap.size(); i++) {
    Map.Entry entry = (Map.Entry) entrySetIter.next();

    Object key = entry.getKey();
    Object value = entry.getValue();

    if (key.equals(OperationSetBasicInstantMessaging.class.getName())
        || key.equals(OperationSetPresence.class.getName())){
        //Obtains the operation set managing the instant messaging       
        im = (OperationSetBasicInstantMessaging) value;
    }
}
//Adds a MessageListener to the instant messaging operation set     
im.addMessageListener(new MessageManager());

...

public class MessageManager
    implements MessageListener {

    public void messageReceived(MessageReceivedEvent evt) {
        //When a message is received gets the chatDialog for
        //this message sender.
        ExportedDialog chatDialog
            = uiService.getChatDialog(evt.getSourceContact());

        if(chatDialog.isDialogVisible()) {
            //do something here
        }
    }

    public void messageDelivered(MessageDeliveredEvent evt) {

    }

    public void messageDeliveryFailed(MessageDeliveryFailedEvent evt) {

    }       
}

previous | TOC | next