diff --git a/gemp-lotr/gemp-lotr-logic/src/main/java/com/gempukku/lotro/game/state/EventSerializer.java b/gemp-lotr/gemp-lotr-logic/src/main/java/com/gempukku/lotro/game/state/EventSerializer.java index 18ff03e97..b0b9d11c3 100644 --- a/gemp-lotr/gemp-lotr-logic/src/main/java/com/gempukku/lotro/game/state/EventSerializer.java +++ b/gemp-lotr/gemp-lotr-logic/src/main/java/com/gempukku/lotro/game/state/EventSerializer.java @@ -19,8 +19,6 @@ public class EventSerializer { eventElem.setAttribute("cardId", gameEvent.getCardId().toString()); if (gameEvent.getIndex() != null) eventElem.setAttribute("index", gameEvent.getIndex().toString()); - if (gameEvent.getDate() != null) - eventElem.setAttribute("date", String.valueOf(gameEvent.getDate().getTime())); if (gameEvent.getControllerId() != null) eventElem.setAttribute("controllerId", gameEvent.getControllerId()); if (gameEvent.getParticipantId() != null) diff --git a/gemp-lotr/gemp-lotr-logic/src/main/java/com/gempukku/lotro/game/state/GameEvent.java b/gemp-lotr/gemp-lotr-logic/src/main/java/com/gempukku/lotro/game/state/GameEvent.java index bcb7094bd..870dc3883 100644 --- a/gemp-lotr/gemp-lotr-logic/src/main/java/com/gempukku/lotro/game/state/GameEvent.java +++ b/gemp-lotr/gemp-lotr-logic/src/main/java/com/gempukku/lotro/game/state/GameEvent.java @@ -7,7 +7,6 @@ import com.gempukku.lotro.game.PhysicalCard; import com.gempukku.lotro.logic.decisions.AwaitingDecision; import com.gempukku.lotro.logic.timing.GameStats; -import java.util.Date; import java.util.List; public class GameEvent { @@ -19,11 +18,10 @@ public class GameEvent { AT, RT, M, W, GS, - CAC, EP, CA, D, CH + CAC, EP, CA, D } private String _message; - private Date _date; private String _side; private Type _type; private Zone _zone; @@ -54,15 +52,6 @@ public class GameEvent { return this; } - public Date getDate() { - return _date; - } - - public GameEvent date(Date date) { - _date = date; - return this; - } - public Type getType() { return _type; } diff --git a/gemp-lotr/gemp-lotr-server/src/main/java/com/gempukku/lotro/game/LotroGameMediator.java b/gemp-lotr/gemp-lotr-server/src/main/java/com/gempukku/lotro/game/LotroGameMediator.java index afacbfdea..a38761c40 100644 --- a/gemp-lotr/gemp-lotr-server/src/main/java/com/gempukku/lotro/game/LotroGameMediator.java +++ b/gemp-lotr/gemp-lotr-server/src/main/java/com/gempukku/lotro/game/LotroGameMediator.java @@ -3,7 +3,6 @@ package com.gempukku.lotro.game; import com.gempukku.lotro.PrivateInformationException; import com.gempukku.lotro.SubscriptionConflictException; import com.gempukku.lotro.SubscriptionExpiredException; -import com.gempukku.lotro.chat.ChatRoom; import com.gempukku.lotro.common.*; import com.gempukku.lotro.communication.GameStateListener; import com.gempukku.lotro.filters.Filters; @@ -40,7 +39,6 @@ public class LotroGameMediator { private ReentrantReadWriteLock.ReadLock _readLock = _lock.readLock(); private ReentrantReadWriteLock.WriteLock _writeLock = _lock.writeLock(); private int _channelNextIndex = 0; - private ChatRoom _chatRoom; public LotroGameMediator(LotroFormat lotroFormat, LotroGameParticipant[] participants, LotroCardBlueprintLibrary library, int maxSecondsForGamePerPlayer, boolean allowSpectators, boolean cancellable) { @@ -62,7 +60,6 @@ public class LotroGameMediator { _userFeedback = new DefaultUserFeedback(); _lotroGame = new DefaultLotroGame(lotroFormat, decks, _userFeedback, library); _userFeedback.setGame(_lotroGame); - _chatRoom = new ChatRoom(false); } public boolean isAllowSpectators() { @@ -79,14 +76,6 @@ public class LotroGameMediator { _lotroGame.getGameState().sendMessage(message); } - public void sendMessage(Player player, String message) throws PrivateInformationException { - String playerName = player.getName(); - if (!player.getType().contains("a") && !_allowSpectators && !_playersPlaying.contains(playerName)) - throw new PrivateInformationException(); - - _chatRoom.postMessage(playerName, message); - } - public void addGameStateListener(String playerId, GameStateListener listener) { _lotroGame.addGameStateListener(playerId, listener); } @@ -249,7 +238,6 @@ public class LotroGameMediator { if (currentTime > channel.getLastConsumed().getTime() + _playerDecisionTimeoutPeriod) { _lotroGame.removeGameStateListener(channel); _communicationChannels.remove(playerId); - _chatRoom.partChatRoom(playerId); } } @@ -415,7 +403,6 @@ public class LotroGameMediator { _communicationChannels.put(playerName, participantCommunicationChannel); _lotroGame.addGameStateListener(playerName, participantCommunicationChannel); - _chatRoom.joinChatRoom(playerName, participantCommunicationChannel); visitor.visitChannelNumber(number); diff --git a/gemp-lotr/gemp-lotr-web-server/src/main/java/com/gempukku/lotro/server/GameResource.java b/gemp-lotr/gemp-lotr-web-server/src/main/java/com/gempukku/lotro/server/GameResource.java index 2db72b542..cbabe231f 100644 --- a/gemp-lotr/gemp-lotr-web-server/src/main/java/com/gempukku/lotro/server/GameResource.java +++ b/gemp-lotr/gemp-lotr-web-server/src/main/java/com/gempukku/lotro/server/GameResource.java @@ -142,26 +142,6 @@ public class GameResource extends AbstractResource { gameMediator.cancel(resourceOwner); } - @Path("/{gameId}/chat") - @POST - public void sendMessage( - @PathParam("gameId") String gameId, - @FormParam("message") String message, - @FormParam("participantId") String participantId, - @Context HttpServletRequest request) throws ParserConfigurationException { - Player resourceOwner = getResourceOwnerSafely(request, participantId); - - LotroGameMediator gameMediator = _lotroServer.getGameById(gameId); - if (gameMediator == null) - throw new WebApplicationException(Response.Status.NOT_FOUND); - - try { - gameMediator.sendMessage(resourceOwner, message); - } catch (PrivateInformationException e) { - throw new WebApplicationException(Response.Status.FORBIDDEN); - } - } - @Path("/{gameId}") @POST @Produces(MediaType.APPLICATION_XML) @@ -194,7 +174,7 @@ public class GameResource extends AbstractResource { // Use long polling long start = System.currentTimeMillis(); - while (System.currentTimeMillis() < start + _longPollingLength && !gameMediator.hasAnyNewMessages(resourceOwner, channelNumber)) { + while (System.currentTimeMillis()< start+_longPollingLength && !gameMediator.hasAnyNewMessages(resourceOwner, channelNumber)) { try { Thread.sleep(_longPollingInterval); } catch (InterruptedException exp) { diff --git a/gemp-lotr/gemp-lotr-web/src/main/webapp/js/gemp-015/chat.js b/gemp-lotr/gemp-lotr-web/src/main/webapp/js/gemp-015/chat.js index 2c69bfa9f..7854e82fc 100644 --- a/gemp-lotr/gemp-lotr-web/src/main/webapp/js/gemp-015/chat.js +++ b/gemp-lotr/gemp-lotr-web/src/main/webapp/js/gemp-015/chat.js @@ -21,9 +21,8 @@ var ChatBoxUI = Class.extend({ lockChat:false, stopUpdates: false, - sendMessageFunc: null, - init:function (name, div, url, showList, playerListener, showHideSystemButton, showLockButton, startChat) { + init:function (name, div, url, showList, playerListener, showHideSystemButton, showLockButton) { var that = this; this.hiddenClasses = new Array(); this.playerListener = playerListener; @@ -41,37 +40,37 @@ var ChatBoxUI = Class.extend({ if (showHideSystemButton) { this.hideSystemButton = $("").button( - {icons:{ - primary:"ui-icon-zoomin" - }, text:false}); + {icons:{ + primary:"ui-icon-zoomin" + }, text:false}); this.hideSystemButton.click( - function () { - if (that.isShowingMessageClass("systemMessage")) { - $('#showSystemMessages').button("option", "icons", {primary:'ui-icon-zoomin'}); - that.hideMessageClass("systemMessage"); - } else { - $('#showSystemMessages').button("option", "icons", {primary:'ui-icon-zoomout'}); - that.showMessageClass("systemMessage"); - } - }); + function () { + if (that.isShowingMessageClass("systemMessage")) { + $('#showSystemMessages').button("option", "icons", {primary:'ui-icon-zoomin'}); + that.hideMessageClass("systemMessage"); + } else { + $('#showSystemMessages').button("option", "icons", {primary:'ui-icon-zoomout'}); + that.showMessageClass("systemMessage"); + } + }); this.hideMessageClass("systemMessage"); } if (showLockButton) { this.lockButton = $("").button( - {icons:{ - primary:"ui-icon-locked" - }, text:false}); + {icons:{ + primary:"ui-icon-locked" + }, text:false}); this.lockButton.click( - function () { - if (that.lockChat) { - $('#lockChatButton').button("option", "icons", {primary:'ui-icon-locked'}); - that.lockChat = false; - } else { - $('#lockChatButton').button("option", "icons", {primary:'ui-icon-unlocked'}); - that.lockChat = true; - } - }); + function () { + if (that.lockChat) { + $('#lockChatButton').button("option", "icons", {primary:'ui-icon-locked'}); + that.lockChat = false; + } else { + $('#lockChatButton').button("option", "icons", {primary:'ui-icon-unlocked'}); + that.lockChat = true; + } + }); } if (showList) { @@ -84,12 +83,10 @@ var ChatBoxUI = Class.extend({ this.div.append(this.lockButton); this.div.append(this.chatTalkDiv); - if (startChat) { - this.communication.startChat(this.name, + this.communication.startChat(this.name, function (xml) { that.processMessages(xml, true); }, this.chatErrorMap()); - } this.chatTalkDiv.bind("keypress", function (e) { var code = (e.keyCode ? e.keyCode : e.which); @@ -153,19 +150,6 @@ var ChatBoxUI = Class.extend({ } }, - appendChatMessage: function(from, dateObj, text) { - var msgClass = "chatMessage"; - if (from == "System") - msgClass = "systemMessage"; - if (this.showTimestamps) { - var date = new Date(parseInt(dateObj)); - var dateStr = this.monthNames[date.getMonth()] + " " + date.getDate() + " " + this.formatToTwoDigits(date.getHours()) + ":" + this.formatToTwoDigits(date.getMinutes()) + ":" + this.formatToTwoDigits(date.getSeconds()); - this.appendMessage("
" + from + ": " + text, msgClass); - } else { - this.appendMessage("" + from + ": " + text, msgClass); - } - }, - appendMessage:function (message, msgClass) { if (msgClass == undefined) msgClass = "chatMessage"; @@ -203,7 +187,16 @@ var ChatBoxUI = Class.extend({ var from = message.getAttribute("from"); var text = message.childNodes[0].nodeValue; - this.appendChatMessage(from, message.getAttribute("date"), text); + var msgClass = "chatMessage"; + if (from == "System") + msgClass = "systemMessage"; + if (this.showTimestamps) { + var date = new Date(parseInt(message.getAttribute("date"))); + var dateStr = this.monthNames[date.getMonth()] + " " + date.getDate() + " " + this.formatToTwoDigits(date.getHours()) + ":" + this.formatToTwoDigits(date.getMinutes()) + ":" + this.formatToTwoDigits(date.getSeconds()); + this.appendMessage(" " + from + ": " + text, msgClass); + } else { + this.appendMessage("" + from + ": " + text, msgClass); + } } var users = root.getElementsByTagName("user"); @@ -246,14 +239,10 @@ var ChatBoxUI = Class.extend({ }, sendMessage:function (message) { - if (this.sendMessageFunc != null) { - this.sendMessageFunc(message); - } else { - var that = this; - this.communication.sendChatMessage(this.name, message, function(xml) { - that.processMessages(xml, false); - }, this.chatErrorMap()); - } + var that = this; + this.communication.sendChatMessage(this.name, message, function(xml) { + that.processMessages(xml, false); + }, this.chatErrorMap()); }, chatMalfunction: function() { @@ -287,4 +276,4 @@ var ChatBoxUI = Class.extend({ } }; } -}); \ No newline at end of file +}); diff --git a/gemp-lotr/gemp-lotr-web/src/main/webapp/js/gemp-015/communication.js b/gemp-lotr/gemp-lotr-web/src/main/webapp/js/gemp-015/communication.js index 1bba6611b..df87b45ed 100644 --- a/gemp-lotr/gemp-lotr-web/src/main/webapp/js/gemp-015/communication.js +++ b/gemp-lotr/gemp-lotr-web/src/main/webapp/js/gemp-015/communication.js @@ -208,20 +208,6 @@ var GempLotrCommunication = Class.extend({ dataType:"xml" }); }, - sendGameMessage: function(message, callback, errorMap) { - $.ajax({ - type:"POST", - url:this.url + "/game/" + getUrlParam("gameId")+"/chat", - cache:false, - async: false, - data:{ - message: message, - participantId:getUrlParam("participantId") }, - success:this.deliveryCheck(callback), - error:this.errorCheck(errorMap), - dataType:"xml" - }); - }, getGameCardModifiers:function (cardId, callback, errorMap) { $.ajax({ type:"GET", diff --git a/gemp-lotr/gemp-lotr-web/src/main/webapp/js/gemp-015/gameAnimations.js b/gemp-lotr/gemp-lotr-web/src/main/webapp/js/gemp-015/gameAnimations.js index 9cd272baa..dc2ad0ea3 100644 --- a/gemp-lotr/gemp-lotr-web/src/main/webapp/js/gemp-015/gameAnimations.js +++ b/gemp-lotr/gemp-lotr-web/src/main/webapp/js/gemp-015/gameAnimations.js @@ -863,21 +863,6 @@ var GameAnimations = Class.extend({ }); }, - chatMessage:function (element, animate) { - var that = this; - $("#main").queue( - function (next) { - var from = element.getAttribute("participantId"); - var date = element.getAttribute("date"); - var message = element.getAttribute("message"); - - if (that.game.chatBox != null) - that.game.chatBox.appendChatMessage(form, date, message); - - next(); - }); - }, - warning:function (element, animate) { var that = this; $("#main").queue( @@ -948,4 +933,4 @@ var GameAnimations = Class.extend({ next(); }); } -}); \ No newline at end of file +}); diff --git a/gemp-lotr/gemp-lotr-web/src/main/webapp/js/gemp-015/gameUi.js b/gemp-lotr/gemp-lotr-web/src/main/webapp/js/gemp-015/gameUi.js index dcc496566..693aa567a 100644 --- a/gemp-lotr/gemp-lotr-web/src/main/webapp/js/gemp-015/gameUi.js +++ b/gemp-lotr/gemp-lotr-web/src/main/webapp/js/gemp-015/gameUi.js @@ -474,11 +474,7 @@ var GempLotrGameUI = Class.extend({ }; var chatRoomName = (this.replayMode ? null : ("Game" + getUrlParam("gameId"))); - this.chatBox = new ChatBoxUI(chatRoomName, $("#chatBox"), this.communication.url, false, playerListener, false, true, false); - this.chatBox.sendMessageFunc = - function(message) { - this.comm.sendGameMessage(message, function() {}, this.gameErrorMap()); - }; + this.chatBox = new ChatBoxUI(chatRoomName, $("#chatBox"), this.communication.url, false, playerListener, false, true); this.chatBox.chatUpdateInterval = 3000; if (!this.spectatorMode && !this.replayMode) { @@ -1057,8 +1053,6 @@ var GempLotrGameUI = Class.extend({ this.animations.cardActivated(gameEvent, animate); } else if (eventType == "D") { this.animations.processDecision(gameEvent, animate); - } else if (eventType == "CH") { - this.animations.chatMessage(gameEvent, animate); } }, @@ -2052,4 +2046,4 @@ var GempLotrGameUI = Class.extend({ } else this.dialogResize(this.cardActionDialog, this.specialGroup); } -}); \ No newline at end of file +});