mirror of https://github.com/fluffle/goirc
Add a function to make a copy of a *Line (bar the Time field).
This commit is contained in:
parent
47d4587ca3
commit
364c6da7ae
|
@ -17,6 +17,14 @@ type Line struct {
|
||||||
Time *time.Time
|
Time *time.Time
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// NOTE: this doesn't copy l.Time (this should be read-only anyway)
|
||||||
|
func (l *Line) Copy() *Line {
|
||||||
|
nl := *line
|
||||||
|
nl.Args = make([]string, len(line.Args))
|
||||||
|
copy(nl.Args, line.Args)
|
||||||
|
return &nl
|
||||||
|
}
|
||||||
|
|
||||||
func parseLine(s string) *Line {
|
func parseLine(s string) *Line {
|
||||||
line := &Line{Raw: s}
|
line := &Line{Raw: s}
|
||||||
if s[0] == ':' {
|
if s[0] == ':' {
|
||||||
|
|
Loading…
Reference in New Issue