chat: Remove injectTimestamp after 30min stuff
authorAndrey Petrov <andrey.petrov@shazow.net>
Fri, 15 Mar 2019 20:30:06 +0000 (16:30 -0400)
committerAndrey Petrov <andrey.petrov@shazow.net>
Sat, 16 Mar 2019 15:52:07 +0000 (11:52 -0400)
chat/command.go
chat/message/user.go

index d459fc5194d68aa923b076789301b0f751866ffd..cba9bbc59712cc917572cb16d40ac0a5c502d453 100644 (file)
@@ -284,7 +284,7 @@ func InitCommands(c *Commands) {
 
        c.Add(Command{
                Prefix: "/timestamp",
-               Help:   "Timestamps after 30min of inactivity.",
+               Help:   "Prefix messages with a timestamp.",
                Handler: func(room *Room, msg message.CommandMsg) error {
                        u := msg.From()
                        cfg := u.Config()
index f8cebf4de7a2c1885f8c6770b846318664c7db13..e825ae194c9ea326f0ea63319f2a5036b67099ce 100644 (file)
@@ -195,20 +195,8 @@ func (u *User) writeMsg(m Message) error {
 // HandleMsg will render the message to the screen, blocking.
 func (u *User) HandleMsg(m Message) error {
        u.mu.Lock()
-       cfg := u.config
-       lastMsg := u.lastMsg
        u.lastMsg = m.Timestamp()
-       injectTimestamp := !lastMsg.IsZero() && cfg.Timestamp && u.lastMsg.Sub(lastMsg) > timestampTimeout
        u.mu.Unlock()
-
-       if injectTimestamp {
-               // Inject a timestamp at most once every timestampTimeout between message intervals
-               ts := NewSystemMsg(fmt.Sprintf("Timestamp: %s", m.Timestamp().UTC().Format(timestampLayout)), u)
-               if err := u.writeMsg(ts); err != nil {
-                       return err
-               }
-       }
-
        return u.writeMsg(m)
 }