return fmt.Sprintf("%s: %s", t.ColorName(m.from), m.body)
}
+// RenderFor renders the message for other users to see.
func (m PublicMsg) RenderFor(cfg UserConfig) string {
if cfg.Highlight == nil || cfg.Theme == nil {
return m.Render(cfg.Theme)
return fmt.Sprintf("%s: %s", cfg.Theme.ColorName(m.from), body)
}
+// RenderSelf renders the message for when it's echoing your own message.
+func (m PublicMsg) RenderSelf(cfg UserConfig) string {
+ return fmt.Sprintf("[%s] %s", cfg.Theme.ColorName(m.from), m.body)
+}
+
func (m PublicMsg) String() string {
return fmt.Sprintf("%s: %s", m.from.Name(), m.body)
}
var out string
switch m := m.(type) {
case PublicMsg:
- out += m.RenderFor(cfg)
+ if u == m.From() {
+ out += m.RenderSelf(cfg)
+ } else {
+ out += m.RenderFor(cfg)
+ }
case *PrivateMsg:
out += m.Render(cfg.Theme)
if cfg.Bell {