Changeset 162 in code


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

Add upstream RPL_CREATIONTIME support

Location:
trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/downstream.go

    r160 r162  
    10321032                                Params:  params,
    10331033                        })
     1034                        if ch.creationTime != "" {
     1035                                dc.SendMessage(&irc.Message{
     1036                                        Prefix:  dc.srv.prefix(),
     1037                                        Command: rpl_creationtime,
     1038                                        Params:  []string{dc.nick, name, ch.creationTime},
     1039                                })
     1040                        }
    10341041                }
    10351042        case "TOPIC":
  • trunk/irc.go

    r155 r162  
    1212        rpl_localusers    = "265"
    1313        rpl_globalusers   = "266"
     14        rpl_creationtime  = "329"
    1415        rpl_topicwhotime  = "333"
    1516        err_invalidcapcmd = "410"
  • 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.