Changeset 549 in code for trunk/downstream.go
- Timestamp:
- Jun 2, 2021, 6:32:11 PM (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/downstream.go
r547 r549 2031 2031 return err 2032 2032 } 2033 case "TARGETS": 2034 if err := parseMessageParams(msg, nil, &boundsStr[0], &boundsStr[1], &limitStr); err != nil { 2035 return err 2036 } 2033 2037 default: 2034 2038 // TODO: support LATEST, AROUND … … 2093 2097 history, err = store.LoadBeforeTime(uc.network, entity, bounds[0], bounds[1], limit) 2094 2098 } 2099 case "TARGETS": 2100 // TODO: support TARGETS in multi-upstream mode 2101 targets, err := store.ListTargets(uc.network, bounds[0], bounds[1], limit) 2102 if err != nil { 2103 dc.logger.Printf("failed fetching targets for chathistory: %v", target, err) 2104 return ircError{&irc.Message{ 2105 Command: "FAIL", 2106 Params: []string{"CHATHISTORY", "MESSAGE_ERROR", subcommand, "Failed to retrieve targets"}, 2107 }} 2108 } 2109 2110 batchRef := "history-targets" 2111 dc.SendMessage(&irc.Message{ 2112 Prefix: dc.srv.prefix(), 2113 Command: "BATCH", 2114 Params: []string{"+" + batchRef, "draft/chathistory-targets"}, 2115 }) 2116 2117 for _, target := range targets { 2118 dc.SendMessage(&irc.Message{ 2119 Tags: irc.Tags{"batch": irc.TagValue(batchRef)}, 2120 Prefix: dc.srv.prefix(), 2121 Command: "CHATHISTORY", 2122 Params: []string{"TARGETS", target.Name, target.LatestMessage.UTC().Format(serverTimeLayout)}, 2123 }) 2124 } 2125 2126 dc.SendMessage(&irc.Message{ 2127 Prefix: dc.srv.prefix(), 2128 Command: "BATCH", 2129 Params: []string{"-" + batchRef}, 2130 }) 2131 2132 return nil 2095 2133 } 2096 2134 if err != nil {
Note:
See TracChangeset
for help on using the changeset viewer.