Search in sources :

Example 31 with Buddy

use of org.olat.instantMessaging.model.Buddy in project openolat by klemens.

the class GroupController method doIm.

private void doIm(UserRequest ureq, Identity identity) {
    Buddy buddy = imService.getBuddyById(identity.getKey());
    OpenInstantMessageEvent e = new OpenInstantMessageEvent(ureq, buddy);
    ureq.getUserSession().getSingleUserEventCenter().fireEventToListenersOf(e, InstantMessagingService.TOWER_EVENT_ORES);
}
Also used : OpenInstantMessageEvent(org.olat.instantMessaging.OpenInstantMessageEvent) Buddy(org.olat.instantMessaging.model.Buddy)

Example 32 with Buddy

use of org.olat.instantMessaging.model.Buddy in project openolat by klemens.

the class AbstractMemberListController method doIm.

/**
 * Open private chat
 * @param ureq
 * @param member
 */
protected void doIm(UserRequest ureq, MemberView member) {
    Buddy buddy = imService.getBuddyById(member.getIdentityKey());
    OpenInstantMessageEvent e = new OpenInstantMessageEvent(ureq, buddy);
    ureq.getUserSession().getSingleUserEventCenter().fireEventToListenersOf(e, InstantMessagingService.TOWER_EVENT_ORES);
}
Also used : OpenInstantMessageEvent(org.olat.instantMessaging.OpenInstantMessageEvent) Buddy(org.olat.instantMessaging.model.Buddy)

Example 33 with Buddy

use of org.olat.instantMessaging.model.Buddy in project openolat by klemens.

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();
    }
}
Also used : Buddy(org.olat.instantMessaging.model.Buddy)

Example 34 with Buddy

use of org.olat.instantMessaging.model.Buddy in project openolat by klemens.

the class IMBuddyListController method event.

@Override
protected void event(UserRequest ureq, Component source, Event event) {
    // buddies list
    if (source == toggleOffline) {
        if (viewMode == ViewMode.onlineUsers) {
            toggleOffline.setCustomDisplayText(translate("im.hide.offline.buddies"));
            toggleOffline.setIconLeftCSS("o_icon o_icon-fw o_icon_status_available");
            toggleOffline.setElementCssClass("o_im_hideofflineswitch");
            loadRoster(ViewMode.offlineUsers);
        } else {
            toggleOffline.setCustomDisplayText(translate("im.show.offline.buddies"));
            toggleOffline.setIconLeftCSS("o_icon o_icon-fw o_icon_status_unavailable");
            toggleOffline.setElementCssClass("o_im_showofflineswitch");
            loadRoster(ViewMode.onlineUsers);
        }
    } else if (source == toggleGroup) {
        if (viewGroups) {
            toggleGroup.setCustomDisplayText(translate("im.show.groups"));
            toggleGroup.setElementCssClass("o_im_hidegroupswitch");
            buddiesListContent.contextPut("viewGroups", Boolean.FALSE);
            viewGroups = false;
        } else {
            toggleGroup.setCustomDisplayText(translate("im.hide.groups"));
            toggleGroup.setElementCssClass("o_im_showgroupswitch");
            buddiesListContent.contextPut("viewGroups", Boolean.TRUE);
            viewGroups = true;
        }
    } else if (source instanceof Link) {
        Link link = (Link) source;
        if ("cmd.buddy".equals(link.getCommand())) {
            Buddy buddy = (Buddy) link.getUserObject();
            fireEvent(ureq, new OpenInstantMessageEvent(ureq, buddy));
        }
    }
}
Also used : OpenInstantMessageEvent(org.olat.instantMessaging.OpenInstantMessageEvent) Link(org.olat.core.gui.components.link.Link) Buddy(org.olat.instantMessaging.model.Buddy)

Example 35 with Buddy

use of org.olat.instantMessaging.model.Buddy in project openolat by klemens.

the class InstantMessagingMainController method processInstantMessageEvent.

private void processInstantMessageEvent(InstantMessagingEvent imEvent) {
    if (imEvent.getCommand().equals("message")) {
        // user receives messages from an other user
        Long fromId = imEvent.getFromId();
        if (!chatMgrCtrl.hasRunningChat(imEvent.getChatResource())) {
            // add follow up message to info holder
            if (!showNewMessageHolder.contains(fromId)) {
                Buddy buddy = imService.getBuddyById(fromId);
                if (Presence.available.name().equals(imStatus) && !inAssessment) {
                    doOpenPrivateChat(new SyntheticUserRequest(getIdentity(), getLocale()), buddy);
                } else {
                    showNewMessageHolder.add(fromId);
                    createShowNewMessageLink(buddy);
                }
            }
        }
    }
}
Also used : SyntheticUserRequest(org.olat.core.gui.util.SyntheticUserRequest) Buddy(org.olat.instantMessaging.model.Buddy)

Aggregations

Buddy (org.olat.instantMessaging.model.Buddy)36 OpenInstantMessageEvent (org.olat.instantMessaging.OpenInstantMessageEvent)16 BuddyGroup (org.olat.instantMessaging.model.BuddyGroup)6 ArrayList (java.util.ArrayList)4 Link (org.olat.core.gui.components.link.Link)4 HashSet (java.util.HashSet)2 CopyOnWriteArrayList (java.util.concurrent.CopyOnWriteArrayList)2 Test (org.junit.Test)2 UserSessionView (org.olat.admin.sysinfo.model.UserSessionView)2 IdentityShort (org.olat.basesecurity.IdentityShort)2 TableEvent (org.olat.core.gui.components.table.TableEvent)2 SyntheticUserRequest (org.olat.core.gui.util.SyntheticUserRequest)2 Identity (org.olat.core.id.Identity)2 OLATResourceable (org.olat.core.id.OLATResourceable)2 UserSession (org.olat.core.util.UserSession)2 InstantMessageNotification (org.olat.instantMessaging.InstantMessageNotification)2 RosterEntryView (org.olat.instantMessaging.model.RosterEntryView)2