Update main.go
This commit is contained in:
parent
f9adf66d3b
commit
7c532f9233
18
main.go
18
main.go
@ -485,11 +485,25 @@ func handleConn(conn net.Conn) {
|
|||||||
client.fwrite(":server 303 %s :%s\r\n", client.nick, strings.Join(online, " "))
|
client.fwrite(":server 303 %s :%s\r\n", client.nick, strings.Join(online, " "))
|
||||||
// ircv3 stuff
|
// ircv3 stuff
|
||||||
case "CHATHISTORY":
|
case "CHATHISTORY":
|
||||||
|
subcmd := strings.ToUpper(msg.Params[0])
|
||||||
|
|
||||||
|
if subcmd == "LATEST" {
|
||||||
|
if len(msg.Params) < 3 {
|
||||||
|
client.fwrite(":server 461 %s CHATHISTORY :Not enough parameters\r\n", client.nick)
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
target := historyTargetName(msg.Params[1])
|
||||||
|
count, convErr := strconv.Atoi(msg.Params[2])
|
||||||
|
if convErr != nil || count <= 0 {
|
||||||
|
client.fwrite(":server 461 %s CHATHISTORY :Invalid message count\r\n", client.nick)
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
client.serveHistory(subcmd, target, count, msg.Params)
|
||||||
|
} else {
|
||||||
if len(msg.Params) < 4 {
|
if len(msg.Params) < 4 {
|
||||||
client.fwrite(":server 461 %s CHATHISTORY :Not enough parameters\r\n", client.nick)
|
client.fwrite(":server 461 %s CHATHISTORY :Not enough parameters\r\n", client.nick)
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
subcmd := strings.ToUpper(msg.Params[0])
|
|
||||||
target := historyTargetName(msg.Params[1])
|
target := historyTargetName(msg.Params[1])
|
||||||
count, convErr := strconv.Atoi(msg.Params[3])
|
count, convErr := strconv.Atoi(msg.Params[3])
|
||||||
if convErr != nil || count <= 0 {
|
if convErr != nil || count <= 0 {
|
||||||
@ -497,6 +511,8 @@ func handleConn(conn net.Conn) {
|
|||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
client.serveHistory(subcmd, target, count, msg.Params)
|
client.serveHistory(subcmd, target, count, msg.Params)
|
||||||
|
}
|
||||||
|
|
||||||
case "MONITOR":
|
case "MONITOR":
|
||||||
if len(msg.Params) < 1 {
|
if len(msg.Params) < 1 {
|
||||||
client.fwrite(":server 461 %s MONITOR :Not enough parameters\r\n", client.nick)
|
client.fwrite(":server 461 %s MONITOR :Not enough parameters\r\n", client.nick)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user