Changeset 162 in code for trunk/upstream.go


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

Add upstream RPL_CREATIONTIME support

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/upstream.go

    r161 r162  
    1717
    1818type upstreamChannel struct {
    19         Name      string
    20         conn      *upstreamConn
    21         Topic     string
    22         TopicWho  string
    23         TopicTime time.Time
    24         Status    channelStatus
    25         modes     channelModes
    26         Members   map[string]*membership
    27         complete  bool
     19        Name         string
     20        conn         *upstreamConn
     21        Topic        string
     22        TopicWho     string
     23        TopicTime    time.Time
     24        Status       channelStatus
     25        modes        channelModes
     26        creationTime string
     27        Members      map[string]*membership
     28        complete     bool
    2829}
    2930
     
    764765                        })
    765766                }
     767        case rpl_creationtime:
     768                var channel, creationTime string
     769                if err := parseMessageParams(msg, nil, &channel, &creationTime); err != nil {
     770                        return err
     771                }
     772
     773                ch, err := uc.getChannel(channel)
     774                if err != nil {
     775                        return err
     776                }
     777
     778                firstCreationTime := ch.creationTime == ""
     779                ch.creationTime = creationTime
     780                if firstCreationTime {
     781                        uc.forEachDownstream(func(dc *downstreamConn) {
     782                                dc.SendMessage(&irc.Message{
     783                                        Prefix:  dc.srv.prefix(),
     784                                        Command: rpl_creationtime,
     785                                        Params:  []string{dc.nick, channel, creationTime},
     786                                })
     787                        })
     788                }
    766789        case rpl_topicwhotime:
    767790                var name, who, timeStr string
Note: See TracChangeset for help on using the changeset viewer.