- pass utc time and timezone offset when sending chat message so we can display the send time by converting to local time
This commit is contained in:
parent
0cfc9fabec
commit
9aa4f274c3
@ -11,7 +11,13 @@ public class ChatMessageVO {
|
||||
public String fromUserID;
|
||||
public String fromUsername;
|
||||
public String fromColor;
|
||||
public String fromTime;
|
||||
|
||||
// Stores the UTC time (milliseconds) when the message was sent.
|
||||
public Double fromTime;
|
||||
// Stores the timezone offset (minutes) when the message was sent.
|
||||
// This will be used by receiver to convert to locale time.
|
||||
public Long fromTimezoneOffset;
|
||||
|
||||
public String fromLang;
|
||||
|
||||
// The receiver. For PUBLIC chat this is empty
|
||||
@ -29,6 +35,7 @@ public class ChatMessageVO {
|
||||
msg.put("fromTime", fromTime);
|
||||
msg.put("fromLang", fromLang);
|
||||
msg.put("fromTime", fromTime);
|
||||
msg.put("fromTimezoneOffset", fromTimezoneOffset);
|
||||
msg.put("chatType", chatType);
|
||||
msg.put("message", message);
|
||||
msg.put("toUserID", toUserID);
|
||||
|
@ -40,7 +40,8 @@ public class ChatService {
|
||||
chatObj.chatType = msg.get("chatType").toString();
|
||||
chatObj.fromUsername = msg.get("fromUsername").toString();
|
||||
chatObj.fromColor = msg.get("fromColor").toString();
|
||||
chatObj.fromTime = msg.get("fromTime").toString();
|
||||
chatObj.fromTime = Double.valueOf(msg.get("fromTime").toString());
|
||||
chatObj.fromTimezoneOffset = Long.valueOf(msg.get("fromTimezoneOffset").toString());
|
||||
chatObj.fromLang = msg.get("fromLang").toString();
|
||||
chatObj.toUserID = msg.get("toUserID").toString();
|
||||
chatObj.toUsername = msg.get("toUsername").toString();
|
||||
@ -60,7 +61,8 @@ public class ChatService {
|
||||
chatObj.fromUserID = msg.get("fromUserID").toString();
|
||||
chatObj.fromUsername = msg.get("fromUsername").toString();
|
||||
chatObj.fromColor = msg.get("fromColor").toString();
|
||||
chatObj.fromTime = msg.get("fromTime").toString();
|
||||
chatObj.fromTime = Double.valueOf(msg.get("fromTime").toString());
|
||||
chatObj.fromTimezoneOffset = Long.valueOf(msg.get("fromTimezoneOffset").toString());
|
||||
chatObj.fromLang = msg.get("fromLang").toString();
|
||||
chatObj.toUserID = msg.get("toUserID").toString();
|
||||
chatObj.toUsername = msg.get("toUsername").toString();
|
||||
|
@ -34,14 +34,22 @@ package org.bigbluebutton.modules.chat.model {
|
||||
[Bindable] public var translatedLocaleTooltip:String = "";
|
||||
|
||||
[Bindable] public var name:String;
|
||||
[Bindable] public var senderTime:String;
|
||||
|
||||
[Bindable] public var time:String;
|
||||
[Bindable] public var lastTime:String;
|
||||
[Bindable] public var senderText:String;
|
||||
[Bindable] public var translatedText:String;
|
||||
[Bindable] public var translated:Boolean = false;
|
||||
[Bindable] public var translatedColor:uint;
|
||||
|
||||
|
||||
// Stores the time (millis) when the sender sent the message.
|
||||
public var fromTime:Number;
|
||||
// Stores the timezone offset (minutes) of the sender.
|
||||
public var fromTimezoneOffset:Number;
|
||||
|
||||
// Stores what we display to the user. The converted fromTime and fromTimezoneOffset to local time.
|
||||
[Bindable] public var senderTime:String;
|
||||
|
||||
private var g:GoogleTranslation;
|
||||
|
||||
public function ChatMessage() {
|
||||
|
@ -43,7 +43,13 @@ package org.bigbluebutton.modules.chat.model
|
||||
cm.name = msg.fromUsername;
|
||||
cm.senderColor = uint(msg.fromColor);
|
||||
cm.translatedColor = uint(msg.fromColor);
|
||||
cm.senderTime = msg.fromTime;
|
||||
|
||||
cm.fromTime = msg.fromTime;
|
||||
cm.fromTimezoneOffset = msg.fromTimezoneOffset;
|
||||
|
||||
var sentTime:Date = new Date();
|
||||
sentTime.setTime(cm.fromTime);
|
||||
cm.senderTime = ChatUtil.getHours(sentTime) + ":" + ChatUtil.getMinutes(sentTime);
|
||||
|
||||
messages.addItem(cm);
|
||||
}
|
||||
|
@ -53,6 +53,7 @@ package org.bigbluebutton.modules.chat.services
|
||||
msg.fromColor = message.fromColor;
|
||||
msg.fromLang = message.fromLang;
|
||||
msg.fromTime = message.fromTime;
|
||||
msg.fromTimezoneOffset = message.fromTimezoneOffset;
|
||||
msg.toUserID = message.toUserID;
|
||||
msg.toUsername = message.toUsername;
|
||||
msg.message = message.message;
|
||||
@ -75,6 +76,7 @@ package org.bigbluebutton.modules.chat.services
|
||||
msg.fromColor = message.fromColor;
|
||||
msg.fromLang = message.fromLang;
|
||||
msg.fromTime = message.fromTime;
|
||||
msg.fromTimezoneOffset = message.fromTimezoneOffset;
|
||||
msg.toUserID = message.toUserID;
|
||||
msg.toUsername = message.toUsername;
|
||||
msg.message = message.message;
|
||||
|
@ -443,7 +443,13 @@
|
||||
cm.fromUsername = UsersUtil.getMyUsername();
|
||||
cm.fromColor = cmpColorPicker.selectedColor.toString();
|
||||
cm.fromLang = ChatUtil.getUserLang();
|
||||
cm.fromTime = ChatUtil.getCurrentTime();
|
||||
|
||||
// Get the current UTC time and the timezone for this sender.
|
||||
// The receiver will have to convert this to local time.
|
||||
var now:Date = new Date();
|
||||
cm.fromTime = now.valueOf();
|
||||
cm.fromTimezoneOffset = now.getTimezoneOffset();
|
||||
|
||||
cm.message = ChatUtil.cleanup(message);
|
||||
|
||||
publicEvent.chatMessage = cm;
|
||||
@ -458,7 +464,13 @@
|
||||
cm.fromUsername = UsersUtil.getMyUsername();
|
||||
cm.fromColor = cmpColorPicker.selectedColor.toString();
|
||||
cm.fromLang = ChatUtil.getUserLang();
|
||||
cm.fromTime = ChatUtil.getCurrentTime();
|
||||
|
||||
// Get the current UTC time and the timezone for this sender.
|
||||
// The receiver will have to convert this to local time.
|
||||
var now:Date = new Date();
|
||||
cm.fromTime = now.valueOf();
|
||||
cm.fromTimezoneOffset = now.getTimezoneOffset();
|
||||
|
||||
cm.message = ChatUtil.cleanup(message);
|
||||
cm.toUserID = chatWithUserID;
|
||||
cm.toUsername = chatWithUsername;
|
||||
|
@ -40,7 +40,6 @@
|
||||
}
|
||||
|
||||
private function onCreationComplete():void{
|
||||
LogUtil.debug("Displaying hat message.");
|
||||
/** Register a change handler as the renderer get recycled. If we don't
|
||||
* do this, we'll get a stale data which will display the chat
|
||||
* message repeatedly. (ralam Nov 1, 2010)
|
||||
|
@ -8,7 +8,13 @@ package org.bigbluebutton.modules.chat.vo
|
||||
public var fromUserID:String;
|
||||
public var fromUsername:String;
|
||||
public var fromColor:String;
|
||||
public var fromTime:String;
|
||||
|
||||
// Store the UTC time when the message was sent.
|
||||
public var fromTime:Number;
|
||||
// Stores the timezone offset (in minutes) when the message was
|
||||
// sent. This is used by the receiver to convert to locale time.
|
||||
public var fromTimezoneOffset:Number;
|
||||
|
||||
public var fromLang:String;
|
||||
|
||||
// The receiver.
|
||||
@ -24,6 +30,7 @@ package org.bigbluebutton.modules.chat.vo
|
||||
m.fromUsername = fromUsername;
|
||||
m.fromColor = fromColor;
|
||||
m.fromTime = fromTime;
|
||||
m.fromTimezoneOffset = fromTimezoneOffset;
|
||||
m.fromLang = fromLang;
|
||||
m.message = message;
|
||||
m.toUserID = toUserID;
|
||||
|
Loading…
Reference in New Issue
Block a user