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;
}
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);
}
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;
}
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);
}
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;
}
Aggregations