summaryrefslogtreecommitdiff
path: root/src/map/clif.c
diff options
context:
space:
mode:
authorMadCamel <madcamel@gmail.com>2010-02-05 01:15:27 -0500
committerMadCamel <madcamel@gmail.com>2010-02-05 01:15:27 -0500
commit19cc5798002c7bf7003cab336d1540c1745ec285 (patch)
treeab0ed29325caca1e39f3a6d7e0810bd4cf3b6186 /src/map/clif.c
parentcbf63a3ae9087178ae6b6abd88f14726aeb804f6 (diff)
downloadtmwa-19cc5798002c7bf7003cab336d1540c1745ec285.tar.gz
tmwa-19cc5798002c7bf7003cab336d1540c1745ec285.tar.bz2
tmwa-19cc5798002c7bf7003cab336d1540c1745ec285.tar.xz
tmwa-19cc5798002c7bf7003cab336d1540c1745ec285.zip
Spellcasting will no longer trigger spam bans
I ran this by fate and he had no objections. If there are problems with flooding/resource consumption we can put some rate limits in the packet handlers. (That's on my TODO)
Diffstat (limited to 'src/map/clif.c')
-rw-r--r--src/map/clif.c23
1 files changed, 7 insertions, 16 deletions
diff --git a/src/map/clif.c b/src/map/clif.c
index 86be79c..a09b929 100644
--- a/src/map/clif.c
+++ b/src/map/clif.c
@@ -7145,43 +7145,34 @@ void clif_parse_GetCharNameRequest (int fd, struct map_session_data *sd)
*/
void clif_parse_GlobalMessage (int fd, struct map_session_data *sd)
{ // S 008c <len>.w <str>.?B
- int malformed = 0;
-
nullpo_retv (sd);
- if ((is_atcommand (fd, sd, RFIFOP (fd, 4), 0) != AtCommand_None) || (sd->sc_data && (sd->sc_data[SC_BERSERK].timer != -1 || //�o�[�T�[�N���͉��b���s��
- sd->sc_data[SC_NOCHAT].timer != -1))) //�`���b�g�֎~
- {
+ if ((is_atcommand (fd, sd, RFIFOP (fd, 4), 0) != AtCommand_None) || (sd->sc_data && (sd->sc_data[SC_BERSERK].timer != -1 ||
+ sd->sc_data[SC_NOCHAT].timer != -1)))
return;
- }
if (strlen (RFIFOP (fd, 4)) >= battle_config.chat_maxline)
- malformed = 1;
+ return;
// Simply ignore messages with spoofed/incorrect source names.
if (strncmp (RFIFOP (fd, 4), sd->status.name, strlen (sd->status.name)) !=
0)
- malformed = 1;
+ return;
char *buf = (char *) malloc (RFIFOW (fd, 2) + 4);
int msg_len = RFIFOW (fd, 2) + 4; // len of message - 4 + 8
+
// Prepare to send message to others
WBUFW (buf, 0) = 0x8d;
WBUFW (buf, 2) = msg_len;
WBUFL (buf, 4) = sd->bl.id;
memcpy (WBUFP (buf, 8), RFIFOP (fd, 4), RFIFOW (fd, 2) - 4);
-
- if (malformed || !magic_message (sd, buf, msg_len))
+
+ if (magic_message(sd, buf, msg_len) == 0)
{
if (tmw_CheckChatSpam (sd, RFIFOP (fd, 4)))
return;
- if (malformed)
- {
- free (buf);
- return;
- }
-
clif_send (buf, WBUFW (buf, 2), &sd->bl,
sd->chatID ? CHAT_WOS : AREA_CHAT_WOC);
}