Skip to content

Conversation

@FiskFan1999
Copy link
Contributor

Fixes #2020

Calling /msg histserv delete #wrongchan returns spurrious success message. Calling /msg histserv delete returns similar message.

These would lead to the pointer hist == nil, and
server.historyDB.DeleteMsgid() would return nil.

Returns errNoSuchChannel or errInvalidTarget if channel or client == nil

irc/server.go Outdated
hist = &channel.history
}
} else {
return errNoSuchChannel
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm interested in your feedback on what errors should be thrown here. and below.

@slingamn
Copy link
Member

Thanks, these error values seem fine. What is the error message that ultimately gets sent to the operator?

@FiskFan1999
Copy link
Contributor Author

Thanks, these error values seem fine. What is the error message that ultimately gets sent to the operator?

The error that is returned by server.DeleteMessage is sent to the operator (that is, err.Error()).

However, while I was away I realized this PR will need to be refactored, because it breaks a situation in which persistent storage is storing a channel or user which is not currently logged in (which is the intention of the original code). Will get on this.

If hist == nil and mysql database Delete msgid function returns
ErrDBIsNil, we know that the target does not match any channel or user.
Return invalid target error to operator (see ergochat#2020)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

histserv delete returns spurrious success message if incorrect parameters

2 participants