mirror of
https://github.com/znc/znc.git
synced 2026-04-30 18:42:25 +02:00
Notes: Add some missing returns
When deleting a note via /#-<key> or listening the available notes via /#?, the code somehow managed to add a note. Also, this fixes checking for empty notes. Found by tomaw, thanks. git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1978 726aef4b-f618-498e-8847-2d620e286838
This commit is contained in:
@@ -45,6 +45,7 @@ public:
|
||||
|
||||
if (sLine == "#?") {
|
||||
ListNotes(true);
|
||||
return HALT;
|
||||
} else if (sLine.Left(2) == "#-") {
|
||||
sKey = sLine.Token(0).LeftChomp_n(2);
|
||||
if (DelNote(sKey)) {
|
||||
@@ -52,6 +53,7 @@ public:
|
||||
} else {
|
||||
PutModNotice("Unable to delete note [" + sKey + "]");
|
||||
}
|
||||
return HALT;
|
||||
} else if (sLine.Left(2) == "#+") {
|
||||
sKey = sLine.Token(0).LeftChomp_n(2);
|
||||
bOverwrite = true;
|
||||
@@ -62,7 +64,7 @@ public:
|
||||
CString sValue(sLine.Token(1, true));
|
||||
|
||||
if (!sKey.empty()) {
|
||||
if (!bOverwrite && !GetNV(sKey).empty()) {
|
||||
if (!bOverwrite && FindNV(sKey) != EndNV()) {
|
||||
PutModNotice("That note already exists. Use /#+<key> <note> to overwrite.");
|
||||
} else if (AddNote(sKey, sValue)) {
|
||||
if (!bOverwrite) {
|
||||
|
||||
Reference in New Issue
Block a user