server.DeleteMessage catches channel or client==nil#2024
Open
FiskFan1999 wants to merge 1 commit intoergochat:masterfrom
Open
server.DeleteMessage catches channel or client==nil#2024FiskFan1999 wants to merge 1 commit intoergochat:masterfrom
FiskFan1999 wants to merge 1 commit intoergochat:masterfrom
Conversation
FiskFan1999
commented
Dec 25, 2022
irc/server.go
Outdated
| hist = &channel.history | ||
| } | ||
| } else { | ||
| return errNoSuchChannel |
Contributor
Author
There was a problem hiding this comment.
I'm interested in your feedback on what errors should be thrown here. and below.
Member
|
Thanks, these error values seem fine. What is the error message that ultimately gets sent to the operator? |
Contributor
Author
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)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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