Changeset 278 in code for trunk/upstream.go


Ignore:
Timestamp:
Apr 29, 2020, 5:45:37 PM (5 years ago)
Author:
contact
Message:

Add upstreamConn.caps

Instead of adding one field per capability, let's just have a map, just
like downstreamConn.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/upstream.go

    r277 r278  
    4848        channels      map[string]*upstreamChannel
    4949        supportedCaps map[string]string
     50        caps          map[string]bool
    5051        batches       map[string]batch
    5152        away          bool
    52 
    53         tagsSupported       bool
    54         awayNotifySupported bool
    55         labelsSupported     bool
    56         nextLabelID         uint64
     53        nextLabelID   uint64
    5754
    5855        saslClient  sasl.Client
     
    112109                channels:                 make(map[string]*upstreamChannel),
    113110                supportedCaps:            make(map[string]string),
     111                caps:                     make(map[string]bool),
    114112                batches:                  make(map[string]batch),
    115113                availableChannelTypes:    stdChannelTypes,
     
    12831281
    12841282func (uc *upstreamConn) handleCapAck(name string, ok bool) error {
     1283        uc.caps[name] = ok
     1284
    12851285        switch name {
    12861286        case "sasl":
     
    13031303                        Params:  []string{auth.Mechanism},
    13041304                })
    1305         case "message-tags":
    1306                 uc.tagsSupported = ok
    1307         case "labeled-response":
    1308                 uc.labelsSupported = ok
    1309         case "away-notify":
    1310                 uc.awayNotifySupported = ok
    1311         case "batch", "server-time":
     1305        case "message-tags", "labeled-response", "away-notify", "batch", "server-time":
    13121306                // Nothing to do
    13131307        default:
     
    13331327
    13341328func (uc *upstreamConn) SendMessageLabeled(downstreamID uint64, msg *irc.Message) {
    1335         if uc.labelsSupported {
     1329        if uc.caps["labeled-response"] {
    13361330                if msg.Tags == nil {
    13371331                        msg.Tags = make(map[string]irc.TagValue)
Note: See TracChangeset for help on using the changeset viewer.