Search in sources :

Example 1 with InstantMessagingEvent

use of org.olat.instantMessaging.InstantMessagingEvent in project OpenOLAT by OpenOLAT.

the class InstantMessagingServiceImpl method sendPrivateMessage.

@Override
public InstantMessage sendPrivateMessage(Identity from, Long toIdentityKey, String body, OLATResourceable chatResource) {
    String name = userManager.getUserDisplayName(from);
    InstantMessage message = imDao.createMessage(from, name, false, body, chatResource);
    imDao.createNotification(from.getKey(), toIdentityKey, chatResource);
    // commit before sending event
    dbInstance.commit();
    InstantMessagingEvent event = new InstantMessagingEvent("message", chatResource);
    event.setFromId(from.getKey());
    event.setName(name);
    event.setAnonym(false);
    event.setMessageId(message.getKey());
    // general event
    coordinator.getCoordinator().getEventBus().fireEventToListenersOf(event, chatResource);
    // buddy event
    OLATResourceable buddy = OresHelper.createOLATResourceableInstance("Buddy", toIdentityKey);
    coordinator.getCoordinator().getEventBus().fireEventToListenersOf(event, buddy);
    return message;
}
Also used : OLATResourceable(org.olat.core.id.OLATResourceable) InstantMessage(org.olat.instantMessaging.InstantMessage) InstantMessagingEvent(org.olat.instantMessaging.InstantMessagingEvent)

Example 2 with InstantMessagingEvent

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

the class InstantMessagingServiceImpl method sendPresence.

@Override
public void sendPresence(Identity me, String nickName, boolean anonym, boolean vip, OLATResourceable chatResource) {
    InstantMessagingEvent event = new InstantMessagingEvent("participant", chatResource);
    event.setAnonym(anonym);
    event.setVip(vip);
    event.setFromId(me.getKey());
    if (StringHelper.containsNonWhitespace(nickName)) {
        event.setName(nickName);
    }
    String fullName = userManager.getUserDisplayName(me);
    rosterDao.updateRosterEntry(chatResource, me, fullName, nickName, anonym, vip);
    coordinator.getCoordinator().getEventBus().fireEventToListenersOf(event, chatResource);
}
Also used : InstantMessagingEvent(org.olat.instantMessaging.InstantMessagingEvent)

Example 3 with InstantMessagingEvent

use of org.olat.instantMessaging.InstantMessagingEvent in project OpenOLAT by OpenOLAT.

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)

Example 4 with InstantMessagingEvent

use of org.olat.instantMessaging.InstantMessagingEvent in project OpenOLAT by OpenOLAT.

the class InstantMessagingServiceImpl method sendPresence.

@Override
public void sendPresence(Identity me, String nickName, boolean anonym, boolean vip, OLATResourceable chatResource) {
    InstantMessagingEvent event = new InstantMessagingEvent("participant", chatResource);
    event.setAnonym(anonym);
    event.setVip(vip);
    event.setFromId(me.getKey());
    if (StringHelper.containsNonWhitespace(nickName)) {
        event.setName(nickName);
    }
    String fullName = userManager.getUserDisplayName(me);
    rosterDao.updateRosterEntry(chatResource, me, fullName, nickName, anonym, vip);
    coordinator.getCoordinator().getEventBus().fireEventToListenersOf(event, chatResource);
}
Also used : InstantMessagingEvent(org.olat.instantMessaging.InstantMessagingEvent)

Example 5 with InstantMessagingEvent

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

the class InstantMessagingServiceImpl method sendPrivateMessage.

@Override
public InstantMessage sendPrivateMessage(Identity from, Long toIdentityKey, String body, OLATResourceable chatResource) {
    String name = userManager.getUserDisplayName(from);
    InstantMessage message = imDao.createMessage(from, name, false, body, chatResource);
    imDao.createNotification(from.getKey(), toIdentityKey, chatResource);
    // commit before sending event
    dbInstance.commit();
    InstantMessagingEvent event = new InstantMessagingEvent("message", chatResource);
    event.setFromId(from.getKey());
    event.setName(name);
    event.setAnonym(false);
    event.setMessageId(message.getKey());
    // general event
    coordinator.getCoordinator().getEventBus().fireEventToListenersOf(event, chatResource);
    // buddy event
    OLATResourceable buddy = OresHelper.createOLATResourceableInstance("Buddy", toIdentityKey);
    coordinator.getCoordinator().getEventBus().fireEventToListenersOf(event, buddy);
    return message;
}
Also used : OLATResourceable(org.olat.core.id.OLATResourceable) 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