use of org.olat.instantMessaging.model.Buddy in project OpenOLAT by OpenOLAT.
the class IMBuddyListController method loadRoster.
private void loadRoster(ViewMode mode) {
this.viewMode = mode;
buddyList.clear();
buddyList.getGroups().clear();
boolean offlineUsers = (viewMode == ViewMode.offlineUsers);
buddyList.getGroups().addAll(imService.getBuddyGroups(getIdentity(), offlineUsers));
for (BuddyGroup group : buddyList.getGroups()) {
for (Buddy buddy : group.getBuddy()) {
forgeBuddyLink(group, buddy);
}
}
buddiesListContent.setDirty(true);
}
use of org.olat.instantMessaging.model.Buddy in project OpenOLAT by OpenOLAT.
the class InstantMessagingMainController method event.
/**
* @see org.olat.core.gui.control.DefaultController#event(org.olat.core.gui.UserRequest, org.olat.core.gui.components.Component, org.olat.core.gui.control.Event)
*/
@Override
public void event(UserRequest ureq, Component source, Event event) {
if (source == available || source == dnd || source == unavailable) {
Link link = (Link) source;
doChangeStatus((String) link.getUserObject());
} else if (source == onlineOfflineCount) {
doOpenRoster(ureq);
} else if (source instanceof Link) {
Link link = (Link) source;
// chat gets created by click on buddy list
if (link.getCommand().equals(ACTION_MSG)) {
// chats gets created by click on new message icon
Object obj = link.getUserObject();
if (obj instanceof Buddy) {
Buddy buddy = (Buddy) obj;
chatMgrCtrl.createChat(ureq, buddy);
showNewMessageHolder.remove(buddy.getIdentityKey());
}
newMsgIcon.setDirty(true);
}
}
}
use of org.olat.instantMessaging.model.Buddy in project OpenOLAT by OpenOLAT.
the class ChatController method updateRosterList.
private void updateRosterList(Long identityKey, String name, boolean anonym, boolean vip) {
if (buddyList != null && rosterCtrl != null) {
Buddy entry;
if (buddyList.contains(identityKey)) {
entry = buddyList.get(identityKey);
} else {
entry = imService.getBuddyById(identityKey);
buddyList.add(entry);
}
entry.setVip(vip);
entry.setAnonym(anonym);
if (StringHelper.containsNonWhitespace(name)) {
entry.setName(name);
}
rosterCtrl.updateModel();
}
}
use of org.olat.instantMessaging.model.Buddy in project OpenOLAT by OpenOLAT.
the class Roster method getBuddies.
public synchronized List<Buddy> getBuddies() {
Set<Buddy> buddies = new HashSet<Buddy>();
Set<Buddy> vips = new HashSet<Buddy>();
for (Buddy entry : entries) {
if (entry.isVip()) {
vips.add(entry);
}
buddies.add(entry);
}
for (BuddyGroup group : groups) {
for (Buddy entry : group.getBuddy()) {
if (entry.isVip()) {
vips.add(entry);
}
buddies.add(entry);
}
}
// if vip once, vip always
List<Buddy> orderedBuddies = new ArrayList<Buddy>(buddies.size());
for (Buddy buddy : buddies) {
Buddy clone = buddy.clone();
clone.setVip(vips.contains(buddy));
orderedBuddies.add(clone);
}
Collections.sort(orderedBuddies);
return orderedBuddies;
}
use of org.olat.instantMessaging.model.Buddy in project OpenOLAT by OpenOLAT.
the class HomePageDisplayController method event.
/**
* @see org.olat.core.gui.control.DefaultController#event(org.olat.core.gui.UserRequest, org.olat.core.gui.components.Component, org.olat.core.gui.control.Event)
*/
public void event(UserRequest ureq, Component source, Event event) {
if (imLink == source) {
Buddy buddy = (Buddy) imLink.getUserObject();
OpenInstantMessageEvent e = new OpenInstantMessageEvent(ureq, buddy);
ureq.getUserSession().getSingleUserEventCenter().fireEventToListenersOf(e, InstantMessagingService.TOWER_EVENT_ORES);
}
}
Aggregations