Changeset 405 in code for trunk/upstream.go
- Timestamp:
- Aug 20, 2020, 9:12:54 AM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/upstream.go
r403 r405 43 43 conn *upstreamConn 44 44 Topic string 45 TopicWho string45 TopicWho *irc.Prefix 46 46 TopicTime time.Time 47 47 Status channelStatus … … 843 843 } 844 844 case "TOPIC": 845 if msg.Prefix == nil { 846 return fmt.Errorf("expected a prefix") 847 } 848 845 849 var name string 846 850 if err := parseMessageParams(msg, &name); err != nil { … … 853 857 if len(msg.Params) > 1 { 854 858 ch.Topic = msg.Params[1] 859 ch.TopicWho = msg.Prefix.Copy() 860 ch.TopicTime = time.Now() // TODO use msg.Tags["time"] 855 861 } else { 856 862 ch.Topic = "" … … 984 990 return err 985 991 } 986 ch.TopicWho = who 992 firstTopicWhoTime := ch.TopicWho == nil 993 ch.TopicWho = irc.ParsePrefix(who) 987 994 sec, err := strconv.ParseInt(timeStr, 10, 64) 988 995 if err != nil { … … 990 997 } 991 998 ch.TopicTime = time.Unix(sec, 0) 999 if firstTopicWhoTime { 1000 uc.forEachDownstream(func(dc *downstreamConn) { 1001 topicWho := dc.marshalUserPrefix(uc.network, ch.TopicWho) 1002 dc.SendMessage(&irc.Message{ 1003 Prefix: dc.srv.prefix(), 1004 Command: rpl_topicwhotime, 1005 Params: []string{ 1006 dc.nick, 1007 dc.marshalEntity(uc.network, ch.Name), 1008 topicWho.String(), 1009 timeStr, 1010 }, 1011 }) 1012 }) 1013 } 992 1014 case irc.RPL_LIST: 993 1015 var channel, clients, topic string
Note:
See TracChangeset
for help on using the changeset viewer.