- Timestamp:
- Aug 20, 2020, 9:12:54 AM (5 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/bridge.go
r349 r405 2 2 3 3 import ( 4 "strconv" 5 "strings" 6 4 7 "gopkg.in/irc.v3" 5 "strings"6 8 ) 7 9 … … 12 14 13 15 sendTopic(dc, ch) 14 15 // TODO: rpl_topicwhotime16 16 sendNames(dc, ch) 17 17 } … … 26 26 Params: []string{dc.nick, downstreamName, ch.Topic}, 27 27 }) 28 if ch.TopicWho != nil { 29 topicWho := dc.marshalUserPrefix(ch.conn.network, ch.TopicWho) 30 topicTime := strconv.FormatInt(ch.TopicTime.Unix(), 10) 31 dc.SendMessage(&irc.Message{ 32 Prefix: dc.srv.prefix(), 33 Command: rpl_topicwhotime, 34 Params: []string{dc.nick, downstreamName, topicWho.String(), topicTime}, 35 }) 36 } 28 37 } else { 29 38 dc.SendMessage(&irc.Message{ -
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.