Changeset 516 in code for trunk/irc.go


Ignore:
Timestamp:
May 18, 2021, 8:44:10 AM (4 years ago)
Author:
hubert
Message:

Implement CHATHISTORY BETWEEN

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/irc.go

    r498 r516  
    55        "sort"
    66        "strings"
     7        "time"
    78        "unicode"
    89        "unicode/utf8"
     
    638639        }
    639640}
     641
     642// parseChatHistoryBound parses the given CHATHISTORY parameter as a bound.
     643// The zero time is returned on error.
     644func parseChatHistoryBound(param string) time.Time {
     645        parts := strings.SplitN(param, "=", 2)
     646        if len(parts) != 2 {
     647                return time.Time{}
     648        }
     649        switch parts[0] {
     650        case "timestamp":
     651                timestamp, err := time.Parse(serverTimeLayout, parts[1])
     652                if err != nil {
     653                        return time.Time{}
     654                }
     655                return timestamp
     656        default:
     657                return time.Time{}
     658        }
     659}
Note: See TracChangeset for help on using the changeset viewer.