hashtag streaming
This commit is contained in:
parent
77f7cfa3c3
commit
ca34330599
12
main.go
12
main.go
|
@ -170,6 +170,18 @@ func (s *Server) HandleConn(ctx context.Context) {
|
||||||
msg.Host = s.cfg.ServerName
|
msg.Host = s.cfg.ServerName
|
||||||
msg.Command = "PONG"
|
msg.Command = "PONG"
|
||||||
s.iw.WriteMessage(msg)
|
s.iw.WriteMessage(msg)
|
||||||
|
case "JOIN":
|
||||||
|
// hashtag streaming
|
||||||
|
target := msg.Params[0]
|
||||||
|
if target[0] != '#' {
|
||||||
|
s.iw.Writef("%s 404 %s :Unknown hashtag", s.cfg.ServerName, s.nickname)
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
err = s.stream(ctx, target, "hashtag", target)
|
||||||
|
if err != nil {
|
||||||
|
ln.Error(err, s.F(), ln.F{"action": "hashtag_stream", "hashtag": target})
|
||||||
|
}
|
||||||
default:
|
default:
|
||||||
s.iw.Writef(":%s 421 %s :Unknown command %q", s.cfg.ServerName, s.nickname, msg.Command)
|
s.iw.Writef(":%s 421 %s :Unknown command %q", s.cfg.ServerName, s.nickname, msg.Command)
|
||||||
continue
|
continue
|
||||||
|
|
Loading…
Reference in New Issue