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