From: Mario Date: Mon, 22 Oct 2018 16:56:28 +0000 (+1000) Subject: Process the message so /me can be handled properly X-Git-Tag: xonotic-v0.8.5~1661^2~5 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=b2871e034614f964cb5cbd296412587a087b1fc4;p=xonotic%2Fxonotic-data.pk3dir.git Process the message so /me can be handled properly --- diff --git a/qcsrc/server/client.qc b/qcsrc/server/client.qc index 01c8222e62..6051e34054 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 {