aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/Chat.js34
1 files changed, 32 insertions, 2 deletions
diff --git a/src/Chat.js b/src/Chat.js
index 4117183..701d0a2 100644
--- a/src/Chat.js
+++ b/src/Chat.js
@@ -39,8 +39,21 @@ class Chat extends Component {
return msg ? msg.replace(/%3A/g, ":") : "";
}
- addMessage(message, stream, own = false, sender = "", color = "grey") {
- var ts = new Date();
+ addMessage(
+ message,
+ stream,
+ own = false,
+ sender = "",
+ color = "grey",
+ timestamp = ""
+ ) {
+ let ts;
+ if (timestamp) {
+ ts = new Date(parseInt(timestamp));
+ console.log(ts);
+ } else {
+ ts = new Date();
+ }
this.setState(
prevState => ({
chat: [
@@ -98,6 +111,17 @@ class Chat extends Component {
case "MSG":
this.addMessage(this.translateColon(args[2]), args[1]);
break;
+ case "HMSG":
+ console.log(line);
+ this.addMessage(
+ this.translateColon(args[3]),
+ args[2],
+ false,
+ "",
+ "grey",
+ args[1]
+ );
+ break;
case "FMSG":
this.addMessage(
this.translateColon(args[3]),
@@ -108,6 +132,7 @@ class Chat extends Component {
break;
case "WELCOME":
this.addMessage("Conectado al chat, " + args[1], "", false, "green");
+ this.client.send("HISTORY:10");
break;
case "COUNT":
this.setState({ chatUserCount: args[1] });
@@ -118,6 +143,11 @@ class Chat extends Component {
"red"
);
break;
+ case "HISTORY_OK":
+ /* Renard: z411: que hago con el HISTORY_OK?
+ Renard: me lo meto en la raja?
+ z411: bien adentro */
+ break;
default:
console.error("[Chat] Unsupported command " + args[0]);
break;