summaryrefslogtreecommitdiff
path: root/src/users.cpp
diff options
context:
space:
mode:
authorPeter Powell <petpow@saberuk.com>2014-02-05 13:49:16 +0000
committerAttila Molnar <attilamolnar@hush.com>2014-02-06 23:10:01 +0100
commitdb0e78c5d2e0998591b274c027fef26e1ac6ce6a (patch)
treef87b58008e0b3ccb44c4c4088e913de95cf1dcb3 /src/users.cpp
parent13edc2e8eb1404e51131468451ed64ef4d25cdaf (diff)
Fix various cases of UUID exposure.
- Introduce WriteCommand which sends * when the user has not registered. - Switch a ton of code to use WriteCommand instead of WriteServ. - Convert WriteNotice to be a wrapper around WriteCommand. - Only send * when NICK has not been sent instead of before registration.
Diffstat (limited to 'src/users.cpp')
-rw-r--r--src/users.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/users.cpp b/src/users.cpp
index 4968c7a37..04d2114dc 100644
--- a/src/users.cpp
+++ b/src/users.cpp
@@ -357,7 +357,7 @@ void User::Oper(OperInfo* info)
this->SetMode(opermh, true);
this->oper = info;
- this->WriteServ("MODE %s :+o", this->nick.c_str());
+ this->WriteCommand("MODE", "+o");
FOREACH_MOD(OnOper, (this, info->name));
std::string opername;
@@ -863,9 +863,9 @@ void User::WriteServ(const char* text, ...)
this->WriteServ(textbuffer);
}
-void User::WriteNotice(const std::string& text)
+void User::WriteCommand(const char* command, const std::string& text)
{
- this->WriteServ("NOTICE " + (this->registered == REG_ALL ? this->nick : "*") + " :" + text);
+ this->WriteServ(command + (this->registered & REG_NICK ? " " + this->nick : " *") + " " + text);
}
void User::WriteNumeric(unsigned int numeric, const char* text, ...)
@@ -885,7 +885,7 @@ void User::WriteNumeric(unsigned int numeric, const std::string &text)
return;
const std::string message = InspIRCd::Format(":%s %03u %s %s", ServerInstance->Config->ServerName.c_str(),
- numeric, !this->nick.empty() ? this->nick.c_str() : "*", text.c_str());
+ numeric, this->registered & REG_NICK ? this->nick.c_str() : "*", text.c_str());
this->Write(message);
}