Changeset 163 in code for trunk/downstream.go


Ignore:
Timestamp:
Mar 26, 2020, 9:43:48 PM (5 years ago)
Author:
delthas
Message:

Add downstream INVITE support

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/downstream.go

    r162 r163  
    12371237                        uc.network.ring.Produce(echoMsg)
    12381238                }
     1239        case "INVITE":
     1240                var user, channel string
     1241                if err := parseMessageParams(msg, &user, &channel); err != nil {
     1242                        return err
     1243                }
     1244
     1245                ucChannel, upstreamChannel, err := dc.unmarshalEntity(channel)
     1246                if err != nil {
     1247                        return err
     1248                }
     1249
     1250                ucUser, upstreamUser, err := dc.unmarshalEntity(user)
     1251                if err != nil {
     1252                        return err
     1253                }
     1254
     1255                if ucChannel != ucUser {
     1256                        return ircError{&irc.Message{
     1257                                Command: irc.ERR_USERNOTINCHANNEL,
     1258                                Params:  []string{dc.nick, user, channel, "They aren't on that channel"},
     1259                        }}
     1260                }
     1261                uc := ucChannel
     1262
     1263                uc.SendMessageLabeled(dc, &irc.Message{
     1264                        Command: "INVITE",
     1265                        Params:  []string{upstreamUser, upstreamChannel},
     1266                })
    12391267        default:
    12401268                dc.logger.Printf("unhandled message: %v", msg)
Note: See TracChangeset for help on using the changeset viewer.