- strcpy(text, host_client->name);
- strcat(text, ": ");
-
- p = Cmd_Args();
-
-// remove quotes if present
- if (*p == '"')
- {
- p++;
- p[strlen(p)-1] = 0;
+ if (!fromServer)
+ sprintf (text, "%s: ", host_client->name);
+ else
+ sprintf (text, "<%s> ", hostname.string);
+
+ p1 = Cmd_Args();
+ p2 = p1 + strlen(p1);
+ // remove the target name
+ while (p1 < p2 && *p1 != ' ')
+ p1++;
+ while (p1 < p2 && *p1 == ' ')
+ p1++;
+ // remove trailing newlines
+ while (p2 > p1 && (p2[-1] == '\n' || p2[-1] == '\r'))
+ p2--;
+ // remove quotes if present
+ if (*p1 == '"')
+ {
+ p1++;
+ if (p2[-1] == '"')
+ p2--;
+ else
+ Con_Printf("Host_Say: missing end quote\n");