From b2871e034614f964cb5cbd296412587a087b1fc4 Mon Sep 17 00:00:00 2001 From: Mario Date: Tue, 23 Oct 2018 02:56:28 +1000 Subject: [PATCH] Process the message so /me can be handled properly --- qcsrc/server/client.qc | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/qcsrc/server/client.qc b/qcsrc/server/client.qc index 01c8222e6..6051e3405 100644 --- a/qcsrc/server/client.qc +++ b/qcsrc/server/client.qc @@ -2741,6 +2741,22 @@ int Say(entity source, int teamsay, entity privatesay, string msgin, bool floodc int privatemsgprefixlen = 0; if (msgin != "") { + bool found_me = false; + if(strstrofs(msgin, "/me", 0) >= 0) + { + string newmsgin = ""; + string newnamestr = ((teamsay) ? strcat(colorstr, "(", colorprefix, namestr, colorstr, ")^7") : strcat(colorprefix, namestr)); + found_me = true; + FOREACH_WORD(msgin, true, + { + if(strdecolorize(it) == "/me") + newmsgin = cons(newmsgin, newnamestr); + else + newmsgin = cons(newmsgin, it); + }); + msgin = newmsgin; + } + if(privatesay) { msgstr = strcat("\{1}\{13}* ", colorprefix, namestr, "^3 tells you: ^7"); @@ -2751,11 +2767,11 @@ int Say(entity source, int teamsay, entity privatesay, string msgin, bool floodc } else if(teamsay) { - if(strstrofs(msgin, "/me", 0) >= 0) + if(found_me) { //msgin = strreplace("/me", "", msgin); //msgin = substring(msgin, 3, strlen(msgin)); - msgin = strreplace("/me", strcat(colorstr, "(", colorprefix, namestr, colorstr, ")^7"), msgin); + //msgin = strreplace("/me", strcat(colorstr, "(", colorprefix, namestr, colorstr, ")^7"), msgin); msgstr = strcat("\{1}\{13}^4* ", "^7", msgin); } else @@ -2764,11 +2780,11 @@ int Say(entity source, int teamsay, entity privatesay, string msgin, bool floodc } else { - if(strstrofs(msgin, "/me", 0) >= 0) + if(found_me) { //msgin = strreplace("/me", "", msgin); //msgin = substring(msgin, 3, strlen(msgin)); - msgin = strreplace("/me", strcat(colorprefix, namestr), msgin); + //msgin = strreplace("/me", strcat(colorprefix, namestr), msgin); msgstr = strcat("\{1}^4* ", "^7", msgin); } else { -- 2.39.2