mirror of
https://github.com/OpenFusionProject/OpenFusion.git
synced 2024-11-04 22:40:05 +00:00
Do not strip newlines from email bodies
This commit is contained in:
parent
1d7f8bd133
commit
858fbf40be
@ -673,7 +673,7 @@ void BuddyManager::emailSend(CNSocket* sock, CNPacketData* data) {
|
||||
U16toU8(plr->PCStyle.szFirstName), // SenderFirstName
|
||||
U16toU8(plr->PCStyle.szLastName), // SenderLastName
|
||||
ChatManager::sanitizeText(U16toU8(pkt->szSubject)), // SubjectLine
|
||||
ChatManager::sanitizeText(U16toU8(pkt->szContent)), // MsgBody
|
||||
ChatManager::sanitizeText(U16toU8(pkt->szContent), true), // MsgBody
|
||||
pkt->iCash, // Taros
|
||||
(uint64_t)getTimestamp(), // SendTime
|
||||
0 // DeleteTime (unimplemented)
|
||||
|
@ -850,7 +850,7 @@ void ChatManager::announcementHandler(CNSocket* sock, CNPacketData* data) {
|
||||
}
|
||||
|
||||
// we only allow plain ascii, at least for now
|
||||
std::string ChatManager::sanitizeText(std::string text) {
|
||||
std::string ChatManager::sanitizeText(std::string text, bool allowNewlines) {
|
||||
int i;
|
||||
char buf[128];
|
||||
|
||||
@ -858,6 +858,10 @@ std::string ChatManager::sanitizeText(std::string text) {
|
||||
for (char c : text) {
|
||||
if (i >= 127)
|
||||
break;
|
||||
|
||||
if (!allowNewlines && c == '\n')
|
||||
continue;
|
||||
|
||||
if (c >= ' ' && c <= '~')
|
||||
buf[i++] = c;
|
||||
}
|
||||
|
@ -29,5 +29,5 @@ namespace ChatManager {
|
||||
void sendServerMessage(CNSocket* sock, std::string msg); // uses MOTD
|
||||
void announcementHandler(CNSocket* sock, CNPacketData* data);
|
||||
|
||||
std::string sanitizeText(std::string text);
|
||||
std::string sanitizeText(std::string text, bool allowNewlines=false);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user