]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Process the message so /me can be handled properly
authorMario <mario@smbclan.net>
Mon, 22 Oct 2018 16:56:28 +0000 (02:56 +1000)
committerMario <mario@smbclan.net>
Mon, 22 Oct 2018 16:56:28 +0000 (02:56 +1000)
qcsrc/server/client.qc

index 01c8222e62de1597fb561a31590f8bcb164e9b04..6051e34054ad9bfd69d793c6259eed60bb874221 100644 (file)
@@ -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 {