Changeset 152 in code for trunk/upstream.go


Ignore:
Timestamp:
Mar 25, 2020, 10:15:48 PM (5 years ago)
Author:
delthas
Message:

Add upstream message-tags capability support

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/upstream.go

    r146 r152  
    5050        channels   map[string]*upstreamChannel
    5151        caps       map[string]string
     52
     53        tagsSupported bool
    5254
    5355        saslClient  sasl.Client
     
    191193                        }
    192194
     195                        requestCaps := make([]string, 0, 16)
     196                        for _, c := range []string{"message-tags"} {
     197                                if _, ok := uc.caps[c]; ok {
     198                                        requestCaps = append(requestCaps, c)
     199                                }
     200                        }
     201
    193202                        if uc.requestSASL() {
     203                                requestCaps = append(requestCaps, "sasl")
     204                        }
     205
     206                        if len(requestCaps) > 0 {
    194207                                uc.SendMessage(&irc.Message{
    195208                                        Command: "CAP",
    196                                         Params:  []string{"REQ", "sasl"},
    197                                 })
     209                                        Params:  []string{"REQ", strings.Join(requestCaps, " ")},
     210                                })
     211                        }
     212
     213                        if uc.requestSASL() {
    198214                                break // we'll send CAP END after authentication is completed
    199215                        }
     
    892908                        })
    893909                })
     910        case "TAGMSG":
     911                // TODO: relay to downstream connections that accept message-tags
    894912        case irc.RPL_YOURHOST, irc.RPL_CREATED:
    895913                // Ignore
     
    9881006                        Params:  []string{auth.Mechanism},
    9891007                })
     1008        case "message-tags":
     1009                uc.tagsSupported = ok
    9901010        }
    9911011        return nil
Note: See TracChangeset for help on using the changeset viewer.