Changeset 300 in code for trunk


Ignore:
Timestamp:
May 27, 2020, 9:45:13 PM (5 years ago)
Author:
delthas
Message:

Add support for upstream ban, invite, and exception lists

This does not try to marshal nicks in masks, for simplicity and
consistency with the current behaviour of marshaling MODE messages.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/upstream.go

    r296 r300  
    12301230                        })
    12311231                })
     1232        case irc.RPL_BANLIST, irc.RPL_INVITELIST, irc.RPL_EXCEPTLIST:
     1233                var channel, mask string
     1234                if err := parseMessageParams(msg, nil, &channel, &mask); err != nil {
     1235                        return err
     1236                }
     1237                var addNick, addTime string
     1238                if len(msg.Params) >= 5 {
     1239                        addNick = msg.Params[3]
     1240                        addTime = msg.Params[4]
     1241                }
     1242
     1243                uc.forEachDownstreamByID(downstreamID, func(dc *downstreamConn) {
     1244                        channel := dc.marshalEntity(uc.network, channel)
     1245
     1246                        var params []string
     1247                        if addNick != "" && addTime != "" {
     1248                                addNick := dc.marshalEntity(uc.network, addNick)
     1249                                params = []string{dc.nick, channel, mask, addNick, addTime}
     1250                        } else {
     1251                                params = []string{dc.nick, channel, mask}
     1252                        }
     1253
     1254                        dc.SendMessage(&irc.Message{
     1255                                Prefix:  dc.srv.prefix(),
     1256                                Command: msg.Command,
     1257                                Params:  params,
     1258                        })
     1259                })
     1260        case irc.RPL_ENDOFBANLIST, irc.RPL_ENDOFINVITELIST, irc.RPL_ENDOFEXCEPTLIST:
     1261                var channel, trailing string
     1262                if err := parseMessageParams(msg, nil, &channel, &trailing); err != nil {
     1263                        return err
     1264                }
     1265
     1266                uc.forEachDownstreamByID(downstreamID, func(dc *downstreamConn) {
     1267                        upstreamChannel := dc.marshalEntity(uc.network, channel)
     1268                        dc.SendMessage(&irc.Message{
     1269                                Prefix:  dc.srv.prefix(),
     1270                                Command: msg.Command,
     1271                                Params:  []string{dc.nick, upstreamChannel, trailing},
     1272                        })
     1273                })
    12321274        case "TAGMSG":
    12331275                // TODO: relay to downstream connections that accept message-tags
Note: See TracChangeset for help on using the changeset viewer.