[ioquake3] 06/34: Remove newlines from chat messages in Game VM

Simon McVittie smcv at debian.org
Fri Sep 8 10:33:19 UTC 2017


This is an automated email from the git hooks/post-receive script.

smcv pushed a commit to annotated tag debian/1.36+u20170908+dfsg1-1
in repository ioquake3.

commit 3f267728c396c39bed6ef40de42422485b7b6794
Author: Zack Middleton <zack at cloemail.com>
Date:   Wed Aug 9 18:34:26 2017 -0500

    Remove newlines from chat messages in Game VM
    
    This has no affect due to ioquake3 engine already removing command
    separators (which includes newlines) in Cmd_Args_Sanitize().
---
 code/game/g_cmds.c | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/code/game/g_cmds.c b/code/game/g_cmds.c
index b02a19e..c56a1de 100644
--- a/code/game/g_cmds.c
+++ b/code/game/g_cmds.c
@@ -928,6 +928,16 @@ void G_Say( gentity_t *ent, gentity_t *target, int mode, const char *chatText )
 	}
 }
 
+static void SanitizeChatText( char *text ) {
+	int i;
+
+	for ( i = 0; text[i]; i++ ) {
+		if ( text[i] == '\n' || text[i] == '\r' ) {
+			text[i] = ' ';
+		}
+	}
+}
+
 
 /*
 ==================
@@ -950,6 +960,8 @@ static void Cmd_Say_f( gentity_t *ent, int mode, qboolean arg0 ) {
 		p = ConcatArgs( 1 );
 	}
 
+	SanitizeChatText( p );
+
 	G_Say( ent, NULL, mode, p );
 }
 
@@ -982,6 +994,8 @@ static void Cmd_Tell_f( gentity_t *ent ) {
 
 	p = ConcatArgs( 2 );
 
+	SanitizeChatText( p );
+
 	G_LogPrintf( "tell: %s to %s: %s\n", ent->client->pers.netname, target->client->pers.netname, p );
 	G_Say( ent, target, SAY_TELL, p );
 	// don't tell to the player self if it was already directed to this player
@@ -1076,6 +1090,8 @@ static void Cmd_Voice_f( gentity_t *ent, int mode, qboolean arg0, qboolean voice
 		p = ConcatArgs( 1 );
 	}
 
+	SanitizeChatText( p );
+
 	G_Voice( ent, NULL, mode, p, voiceonly );
 }
 
@@ -1108,6 +1124,8 @@ static void Cmd_VoiceTell_f( gentity_t *ent, qboolean voiceonly ) {
 
 	id = ConcatArgs( 2 );
 
+	SanitizeChatText( id );
+
 	G_LogPrintf( "vtell: %s to %s: %s\n", ent->client->pers.netname, target->client->pers.netname, id );
 	G_Voice( ent, target, SAY_TELL, id, voiceonly );
 	// don't tell to the player self if it was already directed to this player

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-games/ioquake3.git



More information about the Pkg-games-commits mailing list