Changeset 276 in code for trunk/upstream.go
- Timestamp:
- Apr 29, 2020, 5:34:44 PM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/upstream.go
r274 r276 47 47 modes userModes 48 48 channels map[string]*upstreamChannel 49 caps map[string]string 49 caps map[string]string // available capabilities 50 50 batches map[string]batch 51 51 away bool 52 52 53 tagsSupported bool 54 labelsSupported bool 55 nextLabelID uint64 53 tagsSupported bool 54 awayNotifySupported bool 55 labelsSupported bool 56 nextLabelID uint64 56 57 57 58 saslClient sasl.Client … … 318 319 319 320 requestCaps := make([]string, 0, 16) 320 for _, c := range []string{"message-tags", "batch", "labeled-response", "server-time" } {321 for _, c := range []string{"message-tags", "batch", "labeled-response", "server-time", "away-notify"} { 321 322 if _, ok := uc.caps[c]; ok { 322 323 requestCaps = append(requestCaps, c) … … 450 451 uc.registered = true 451 452 uc.logger.Printf("connection registered") 453 454 uc.forEachDownstream(func(dc *downstreamConn) { 455 dc.updateSupportedCaps() 456 }) 452 457 453 458 for _, ch := range uc.network.channels { … … 1149 1154 }) 1150 1155 }) 1156 case "AWAY": 1157 if msg.Prefix == nil { 1158 return fmt.Errorf("expected a prefix") 1159 } 1160 1161 uc.forEachDownstream(func(dc *downstreamConn) { 1162 if !dc.caps["away-notify"] { 1163 return 1164 } 1165 dc.SendMessage(&irc.Message{ 1166 Prefix: dc.marshalUserPrefix(uc.network, msg.Prefix), 1167 Command: "AWAY", 1168 Params: msg.Params, 1169 }) 1170 }) 1151 1171 case "TAGMSG": 1152 1172 // TODO: relay to downstream connections that accept message-tags … … 1263 1283 1264 1284 func (uc *upstreamConn) handleCapAck(name string, ok bool) error { 1265 auth := &uc.network.SASL1266 1285 switch name { 1267 1286 case "sasl": … … 1271 1290 } 1272 1291 1292 auth := &uc.network.SASL 1273 1293 switch auth.Mechanism { 1274 1294 case "PLAIN": … … 1287 1307 case "labeled-response": 1288 1308 uc.labelsSupported = ok 1309 case "away-notify": 1310 uc.awayNotifySupported = ok 1289 1311 case "batch", "server-time": 1290 1312 // Nothing to do
Note:
See TracChangeset
for help on using the changeset viewer.