fix: better formatting for ERR_NEEDMOREPARAMS; display better information for LOCALUSERS and GLOBALUSERS

This commit is contained in:
2025-08-15 21:18:40 +02:00
parent 41645fb679
commit d5a99ada51
+16 -4
View File
@@ -434,7 +434,13 @@ func handleLUSERME(msg irc.Message, client *irc.Client) {
} }
func handleLOCALUSERS(msg irc.Message, client *irc.Client) { func handleLOCALUSERS(msg irc.Message, client *irc.Client) {
message := msg.Parameters[1] message := ""
if len(msg.Parameters) > 2 {
message = msg.Parameters[3]
} else {
message = msg.Parameters[1]
}
msgOpts := irc.MsgFmtOpts{ msgOpts := irc.MsgFmtOpts{
WithTimestamp: true, WithTimestamp: true,
@@ -445,7 +451,13 @@ func handleLOCALUSERS(msg irc.Message, client *irc.Client) {
} }
func handleGLOBALUSERS(msg irc.Message, client *irc.Client) { func handleGLOBALUSERS(msg irc.Message, client *irc.Client) {
message := msg.Parameters[1] message := ""
if len(msg.Parameters) > 2 {
message = msg.Parameters[3]
} else {
message = msg.Parameters[1]
}
msgOpts := irc.MsgFmtOpts{ msgOpts := irc.MsgFmtOpts{
WithTimestamp: true, WithTimestamp: true,
@@ -683,11 +695,11 @@ func handleNONICKNAMEGIVEN(msg irc.Message, client *irc.Client) {
} }
func handleNEEDMOREPARAMS(msg irc.Message, client *irc.Client) { func handleNEEDMOREPARAMS(msg irc.Message, client *irc.Client) {
message := msg.Parameters[1] + " " + msg.Parameters[2] message := msg.Parameters[1] + ": " + msg.Parameters[2]
msgOpts := irc.MsgFmtOpts{ msgOpts := irc.MsgFmtOpts{
WithTimestamp: true, WithTimestamp: true,
AsServerMsg: true, AsErrorMsg: true,
} }
client.Channels[0].AppendMsg(msg.Timestamp, message, msgOpts) client.Channels[0].AppendMsg(msg.Timestamp, message, msgOpts)