Search in sources :

Example 16 with OpenInstantMessageEvent

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

the class UserSessionController method event.

/**
 * @see org.olat.core.gui.control.DefaultController#event(org.olat.core.gui.UserRequest,
 *      org.olat.core.gui.control.Controller, org.olat.core.gui.control.Event)
 */
public void event(UserRequest ureq, Controller source, Event event) {
    if (source == tableCtr) {
        if (event.getCommand().equals(Table.COMMANDLINK_ROWACTION_CLICKED)) {
            TableEvent te = (TableEvent) event;
            int selRow = te.getRowId();
            // session info (we only have authenticated sessions here
            UserSessionView usessw = (UserSessionView) tableCtr.getTableDataModel().getObject(selRow);
            if ("sess.chat".equals(te.getActionId())) {
                Buddy buddy = imService.getBuddyById(usessw.getIdentityKey());
                OpenInstantMessageEvent e = new OpenInstantMessageEvent(ureq, buddy);
                ureq.getUserSession().getSingleUserEventCenter().fireEventToListenersOf(e, InstantMessagingService.TOWER_EVENT_ORES);
            } else if ("sess.details".equals(te.getActionId())) {
                UserSession usess = usessw.getUserSession();
                UserSessionDetailsController detailsCtrl = new UserSessionDetailsController(ureq, getWindowControl(), usess);
                listenTo(detailsCtrl);
                String username = usess.getIdentity() == null ? "-" : UserManager.getInstance().getUserDisplayName(usess.getIdentity());
                stackController.pushController(username, detailsCtrl);
            }
        }
    }
}
Also used : TableEvent(org.olat.core.gui.components.table.TableEvent) UserSession(org.olat.core.util.UserSession) OpenInstantMessageEvent(org.olat.instantMessaging.OpenInstantMessageEvent) UserSessionView(org.olat.admin.sysinfo.model.UserSessionView) Buddy(org.olat.instantMessaging.model.Buddy)

Example 17 with OpenInstantMessageEvent

use of org.olat.instantMessaging.OpenInstantMessageEvent 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 18 with OpenInstantMessageEvent

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

the class CourseRuntimeController method launchChat.

private void launchChat(UserRequest ureq) {
    boolean vip = reSecurity.isCourseCoach() || reSecurity.isGroupCoach() || reSecurity.isEntryAdmin();
    ICourse course = CourseFactory.loadCourse(getRepositoryEntry());
    OpenInstantMessageEvent event = new OpenInstantMessageEvent(ureq, course, course.getCourseTitle(), vip);
    ureq.getUserSession().getSingleUserEventCenter().fireEventToListenersOf(event, InstantMessagingService.TOWER_EVENT_ORES);
}
Also used : OpenInstantMessageEvent(org.olat.instantMessaging.OpenInstantMessageEvent) ICourse(org.olat.course.ICourse)

Example 19 with OpenInstantMessageEvent

use of org.olat.instantMessaging.OpenInstantMessageEvent 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 20 with OpenInstantMessageEvent

use of org.olat.instantMessaging.OpenInstantMessageEvent 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)

Aggregations

OpenInstantMessageEvent (org.olat.instantMessaging.OpenInstantMessageEvent)20 Buddy (org.olat.instantMessaging.model.Buddy)16 UserSessionView (org.olat.admin.sysinfo.model.UserSessionView)2 Link (org.olat.core.gui.components.link.Link)2 TableEvent (org.olat.core.gui.components.table.TableEvent)2 UserSession (org.olat.core.util.UserSession)2 ICourse (org.olat.course.ICourse)2