Search in sources :

Example 6 with InstantMessagingEvent

use of org.olat.instantMessaging.InstantMessagingEvent in project openolat by klemens.

the class InstantMessagingServiceImpl method sendMessage.

@Override
public InstantMessage sendMessage(Identity from, String fromNickName, boolean anonym, String body, OLATResourceable chatResource) {
    InstantMessage message = imDao.createMessage(from, fromNickName, anonym, body, chatResource);
    // commit before sending event
    dbInstance.commit();
    InstantMessagingEvent event = new InstantMessagingEvent("message", chatResource);
    event.setFromId(from.getKey());
    event.setName(fromNickName);
    event.setAnonym(anonym);
    event.setMessageId(message.getKey());
    coordinator.getCoordinator().getEventBus().fireEventToListenersOf(event, chatResource);
    return message;
}
Also used : InstantMessage(org.olat.instantMessaging.InstantMessage) InstantMessagingEvent(org.olat.instantMessaging.InstantMessagingEvent)

Aggregations

InstantMessagingEvent (org.olat.instantMessaging.InstantMessagingEvent)6 InstantMessage (org.olat.instantMessaging.InstantMessage)4 OLATResourceable (org.olat.core.id.OLATResourceable)2