mirror of
https://github.com/fluffle/goirc
synced 2025-05-12 18:44:50 +00:00
Refactor to remove line.Text and use line.Args[-1] instead.
This commit is contained in:
parent
8ad6e67467
commit
08b7d63c27
2 changed files with 41 additions and 60 deletions
|
@ -54,7 +54,7 @@ type Conn struct {
|
|||
// Cmd == e.g. PRIVMSG, 332
|
||||
type Line struct {
|
||||
Nick, Ident, Host, Src string
|
||||
Cmd, Text, Raw string
|
||||
Cmd, Raw string
|
||||
Args []string
|
||||
Time *time.Time
|
||||
}
|
||||
|
@ -234,9 +234,10 @@ func (conn *Conn) recv() {
|
|||
// s should contain "cmd args[] :text"
|
||||
args := strings.Split(s, " :", 2)
|
||||
if len(args) > 1 {
|
||||
line.Text = args[1]
|
||||
args = append(strings.Fields(args[0]), args[1])
|
||||
} else {
|
||||
args = strings.Fields(args[0])
|
||||
}
|
||||
args = strings.Fields(args[0])
|
||||
line.Cmd = strings.ToUpper(args[0])
|
||||
if len(args) > 1 {
|
||||
line.Args = args[1:len(args)]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue