Package org.olat.instantMessaging

Examples of org.olat.instantMessaging.InstantMessagingEvent


    msg.setProperty("receiveTime", new Long(new Date().getTime()));
    return msg;
  }
 
  public void event(Event event) {
    InstantMessagingEvent imEvent = (InstantMessagingEvent)event;
    if (imEvent.getCommand().equals("groupchat")) {
      Message msg = (Message) imEvent.getPacket();
      if (isLogDebugEnabled()) logDebug("incoming msg for groupchat: "+msg.getType(), null);
      msg.setProperty("receiveTime", new Long(new Date().getTime()));
      if ((msg.getType() == Message.Type.groupchat) && msg.getBody() != null) {
        if (!chatWindowOpen && !msg.getBody().startsWith("This room is")) { //get rid of room status msg                   
          indicateNewMessage  = LinkFactory.createCustomLink("indicateNewMsg", "cmd.open.client", " ", Link.NONTRANSLATED, summaryCompactVC, this);
          indicateNewMessage.registerForMousePositionEvent(true);
          indicateNewMessage.setCustomEnabledLinkCSS("b_small_icon o_instantmessaging_new_msg_icon");
          indicateNewMessage.setTooltip(getTranslator().translate("groupchat.new.msg"), true);
        }
          appendToMsgHistory(msg);
      }
    } else if (imEvent.getCommand().equals("participant")) {
      Presence presence = (Presence) imEvent.getPacket();
      if (isLogDebugEnabled()) logDebug("incoming presence change for groupchat: "+presence.getFrom() +" : "+ presence.getType(), null);
     
      if (presence.getFrom() != null) {
        if (presence.getFrom().startsWith("coursemodule-") && presence.getType() == Presence.Type.unavailable && !presence.getFrom().endsWith(NICKNAME_ANONYMOUS)) {
          //workaround for smack bug, that does not instantly update the occupants count when someone leaves the room
View Full Code Here


  /**
   * gets called if either a new message or a presence change from one of the buddies happens
   * @see org.olat.core.util.event.GenericEventListener#event(org.olat.core.gui.control.Event)
   */
  public void event(Event event) {
    InstantMessagingEvent imEvent = (InstantMessagingEvent)event;
    if (imEvent.getCommand().equals("chatmessage")) {
      //chat mode. user started chat himself
      Message msg = (Message)imEvent.getPacket();
      if (isLogDebugEnabled()) logDebug("incoming message for user: "+msg.getTo()+"  - body: "+msg.getBody(), null);
      if ((msg.getType() == Message.Type.chat) && msg.getBody() != null) {
          appendToMessageHistory(msg);
      }
    }
View Full Code Here

      public void processPacket(Packet packet) {
        Message jabbmessage = (Message) packet;
        if (log.isDebug()) log.debug("processPacket Msg: to=" + jabbmessage.getTo() );
        jabbmessage.setProperty("receiveTime", new Long(new Date().getTime()));
        if ((jabbmessage.getType() == Message.Type.groupchat) && jabbmessage.getBody() != null) {
          listeningController.event(new InstantMessagingEvent(jabbmessage, "groupchat"));
        }
      }
    };
    muc.addMessageListener(messageListener);
  }
View Full Code Here

      public void processPacket(Packet packet) {
        Presence presence = (Presence) packet;
        if (log.isDebug()) log.debug("processPacket Presence: to=" + presence.getTo() + " , " );
        if (presence.getFrom() != null) {
          listeningController.event(new InstantMessagingEvent(presence, "participant"));
        }
      }
    };
    muc.addParticipantListener(participationsListener);
View Full Code Here

  /**
   * gets called if either a new message or a presence change from one of the buddies happens
   * @see org.olat.core.util.event.GenericEventListener#event(org.olat.core.gui.control.Event)
   */
  public void event(Event event) {
    InstantMessagingEvent imEvent = (InstantMessagingEvent)event;
    if (imEvent.getCommand().equals("presence")) {
      Presence presence = (Presence) imEvent.getPacket();
      if (isLogDebugEnabled()) logDebug("incoming presence for user: "+presence.getFrom() +" type: "+presence, null);

      getWindowControl().getWindowBackOffice().invokeLater(new Runnable(){
        public void run() {
          //smack does not immediately update it's presence information, so when testing only with one person the OnlineOffline count value can be wrong
          //in a productive environment there are normally lot's of presence packages
          onlineOfflineCount.setCustomDisplayText(clientHelper.buddyCountOnline());
          onlineOfflineCount.setDirty(true);
          //adjust also presence icon in gui it may be auto changed by cronjob
          statusChanger.setCustomEnabledLinkCSS("b_small_icon o_instantmessaging_"+clientHelper.getStatus()+"_icon");
          statusChanger.setDirty(true);         
        }});
    }
    else if (imEvent.getCommand().equals("message")) {
      //user receives messages from an other user
      Message initialMessage = (Message)imEvent.getPacket();
      String jid = extractJid(initialMessage.getFrom());
     
      //recentChatPartners.add(initialMessage.getFrom());
      if (((initialMessage.getType() == Message.Type.chat || initialMessage.getType() == Message.Type.normal)) && initialMessage.getBody() != null) {
        if(!chatMgrCtrl.hasRunningChat(jid)) {//only show icon if no chat running or msg from other user
View Full Code Here

TOP

Related Classes of org.olat.instantMessaging.InstantMessagingEvent

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.