]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Merge branch 'master' into Mario/fix_me
authorterencehill <piuntn@gmail.com>
Mon, 14 Jan 2019 08:50:15 +0000 (09:50 +0100)
committerterencehill <piuntn@gmail.com>
Mon, 14 Jan 2019 08:50:15 +0000 (09:50 +0100)
qcsrc/server/client.qc

index 213ad6fb70064e0f4c72e8bd3ddf0495b817a153..ee87e2ea286015561b4ae48d76b26e3f2dee47fd 100644 (file)
@@ -2746,6 +2746,24 @@ 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, ")", colorprefix) : strcat(colorprefix, namestr, colorprefix));
+                       FOREACH_WORD(msgin, true,
+                       {
+                               if(strdecolorize(it) == "/me")
+                               {
+                                       found_me = true;
+                                       newmsgin = cons(newmsgin, newnamestr);
+                               }
+                               else
+                                       newmsgin = cons(newmsgin, it);
+                       });
+                       msgin = newmsgin;
+               }
+
                if(privatesay)
                {
                        msgstr = strcat("\{1}\{13}* ", colorprefix, namestr, "^3 tells you: ^7");
@@ -2756,11 +2774,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
@@ -2769,12 +2787,12 @@ 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);
-                               msgstr = strcat("\{1}^4* ", "^7", msgin);
+                               //msgin = strreplace("/me", strcat(colorprefix, namestr), msgin);
+                               msgstr = strcat("\{1}^4* ^7", msgin);
                        }
                        else {
                                msgstr = "\{1}";