aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorGravatar Attila Molnar2015-01-11 14:35:21 +0100
committerGravatar Attila Molnar2015-01-11 14:35:21 +0100
commit1f186bd6505e263ccc7ce1ec38cf6a5d5a8a85c5 (patch)
tree7024cc70c6f006cc91123be82455ad04456ca777 /src
parentStore iovec array on the stack instead of heap allocating it for the lifetime... (diff)
Fix issues with some numerics introduced in the WriteNumeric() conversion and elsewhere
Diffstat (limited to 'src')
-rw-r--r--src/coremods/core_stub.cpp2
-rw-r--r--src/coremods/core_user/cmd_mode.cpp9
2 files changed, 8 insertions, 3 deletions
diff --git a/src/coremods/core_stub.cpp b/src/coremods/core_stub.cpp
index bb6590261..28adb9e6a 100644
--- a/src/coremods/core_stub.cpp
+++ b/src/coremods/core_stub.cpp
@@ -102,7 +102,7 @@ class CommandServer : public Command
}
else
{
- user->WriteNumeric(ERR_NOTREGISTERED, ":You may not register as a server (servers have separate ports from clients, change your config)");
+ user->WriteNumeric(ERR_NOTREGISTERED, "SERVER :You may not register as a server (servers have separate ports from clients, change your config)");
}
return CMD_FAILURE;
}
diff --git a/src/coremods/core_user/cmd_mode.cpp b/src/coremods/core_user/cmd_mode.cpp
index f1e857fc1..190983d13 100644
--- a/src/coremods/core_user/cmd_mode.cpp
+++ b/src/coremods/core_user/cmd_mode.cpp
@@ -143,11 +143,16 @@ void CommandMode::DisplayCurrentModes(User* user, User* targetuser, Channel* tar
if (targetuser == user || user->HasPrivPermission("users/auspex"))
{
// Display user's current mode string
- user->WriteNumeric(RPL_UMODEIS, ":+%s", targetuser->FormatModes());
+ // XXX: Use WriteServ() because WriteNumeric() assumes the target (i.e. next word after the number)
+ // is 'user' and puts his nick there which is not what we want
+ user->WriteServ("%03d %s :+%s", RPL_UMODEIS, targetuser->nick.c_str(), targetuser->FormatModes());
if (targetuser->IsOper())
{
ModeHandler* snomask = ServerInstance->Modes->FindMode('s', MODETYPE_USER);
- user->WriteNumeric(RPL_SNOMASKIS, "%s :Server notice mask", snomask->GetUserParameter(user).c_str());
+ std::string snomaskstr = snomask->GetUserParameter(user);
+ // snomaskstr is empty if the snomask mode isn't set, otherwise it begins with a '+'.
+ // In the former case output a "+", not an empty string.
+ user->WriteServ("%03d %s %s%s :Server notice mask", RPL_SNOMASKIS, targetuser->nick.c_str(), (snomaskstr.empty() ? "+" : ""), snomaskstr.c_str());
}
}
else