Changeset 160 in code for trunk/downstream.go


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

Add downstream TOPIC support

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/downstream.go

    r159 r160  
    10331033                        })
    10341034                }
     1035        case "TOPIC":
     1036                var channel string
     1037                if err := parseMessageParams(msg, &channel); err != nil {
     1038                        return err
     1039                }
     1040
     1041                uc, upstreamChannel, err := dc.unmarshalEntity(channel)
     1042                if err != nil {
     1043                        return err
     1044                }
     1045
     1046                if len(msg.Params) > 1 { // setting topic
     1047                        topic := msg.Params[1]
     1048                        uc.SendMessage(&irc.Message{
     1049                                Command: "TOPIC",
     1050                                Params:  []string{upstreamChannel, topic},
     1051                        })
     1052                } else { // getting topic
     1053                        ch, ok := uc.channels[upstreamChannel]
     1054                        if !ok {
     1055                                return ircError{&irc.Message{
     1056                                        Command: irc.ERR_NOSUCHCHANNEL,
     1057                                        Params:  []string{dc.nick, upstreamChannel, "No such channel"},
     1058                                }}
     1059                        }
     1060                        sendTopic(dc, ch)
     1061                }
    10351062        case "NAMES":
    10361063                if len(msg.Params) == 0 {
Note: See TracChangeset for help on using the changeset viewer.