--- deliantra/server/socket/request.C 2007/07/01 04:08:14 1.111
+++ deliantra/server/socket/request.C 2007/07/10 06:05:55 1.114
@@ -1,23 +1,22 @@
/*
- * This file is part of Crossfire TRT, the Multiplayer Online Role Playing Game.
+ * This file is part of Crossfire TRT, the Roguelike Realtime MORPG.
*
* Copyright (©) 2005,2006,2007 Marc Alexander Lehmann / Robin Redeker / the Crossfire TRT team
* Copyright (©) 2001,2007 Mark Wedel
* Copyright (©) 1992,2007 Frank Tore Johansen
*
- * Crossfire TRT is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License as published by the Free
- * Software Foundation; either version 2 of the License, or (at your option)
- * any later version.
+ * Crossfire TRT is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
*
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * for more details.
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along
- * with Crossfire TRT; if not, write to the Free Software Foundation, Inc. 51
- * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
*
* The authors can be reached via e-mail to
*/
@@ -204,29 +203,17 @@
* that information.
*/
void
-RequestInfo (char *buf, int len, client * ns)
+RequestInfo (char *buf, int len, client *ns)
{
- char *params = NULL, *cp;
-
- /* No match */
- char bigbuf[MAX_BUF];
- int slen;
-
- /* Set up replyinfo before we modify any of the buffers - this is used
- * if we don't find a match.
- */
- strcpy (bigbuf, "replyinfo ");
- slen = strlen (bigbuf);
- safe_strcat (bigbuf, buf, &slen, MAX_BUF);
+ char *params;
/* find the first space, make it null, and update the
* params pointer.
*/
- for (cp = buf; *cp != '\0'; cp++)
- if (*cp == ' ')
+ for (params = buf; *params; params++)
+ if (*params == ' ')
{
- *cp = '\0';
- params = cp + 1;
+ *params++ = 0;
break;
}
@@ -239,7 +226,13 @@
else if (!strcmp (buf, "spell_paths"))
send_spell_paths (ns, params);
else
- ns->send_packet (bigbuf, len);
+ {
+ // undo tokenisation above and send replyinfo with the request unchanged
+ if (*params)
+ *--params = ' ';
+
+ ns->send_packet_printf ("replyinfo %s", buf);
+ }
}
void
@@ -514,7 +507,7 @@
{
if (len <= 6)
{
- LOG (llevDebug, "Corrupt ncom command <%s> not long enough - discarding\n", buf);
+ LOG (llevDebug, "%s: corrupt ncom command <%s>: not long enough (%d) - discarding\n", pl->ns->host, buf, len);
return;
}