ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/socket/lowlevel.C
(Generate patch)

Comparing deliantra/server/socket/lowlevel.C (file contents):
Revision 1.91 by root, Thu Nov 8 02:50:14 2012 UTC vs.
Revision 1.94 by root, Sun Nov 18 09:29:25 2012 UTC

132 if (inbuf_len >= 2 + pkt_len) 132 if (inbuf_len >= 2 + pkt_len)
133 return 2 + pkt_len; 133 return 2 + pkt_len;
134 134
135 if (inbuf_len == sizeof (inbuf)) 135 if (inbuf_len == sizeof (inbuf))
136 { 136 {
137 send_packet_printf ("drawinfo %d input buffer overflow - closing connection.", NDI_RED | NDI_REPLY); 137 send_packet_printf ("msg %d log input buffer overflow - closing connection.", NDI_RED | NDI_REPLY);
138 destroy (); 138 destroy ();
139 return -1; 139 return -1;
140 } 140 }
141 } 141 }
142 142
167 167
168/** 168/**
169 * Dispatch table for the server. 169 * Dispatch table for the server.
170 */ 170 */
171static struct packet_type packets[] = { 171static struct packet_type packets[] = {
172 {"ncom", PC(NewPlayerCmd) PF_PLAYING | PF_COMMAND6 },
173 {"command", PC(PlayerCmd) PF_PLAYING | PF_COMMAND0 }, 172 {"command", PC(PlayerCmd) PF_PLAYING | PF_COMMAND },
174 173
175 {"examine", PC(ExamineCmd) PF_PLAYING }, 174 {"examine", PC(ExamineCmd) PF_PLAYING },
176 {"ex", PC(ExCmd) PF_PLAYING }, 175 {"ex", PC(ExCmd) PF_PLAYING },
177 {"apply", PC(ApplyCmd) PF_PLAYING }, 176 {"apply", PC(ApplyCmd) PF_PLAYING },
178 {"lookat", PC(LookAt) PF_PLAYING }, 177 {"lookat", PC(LookAt) PF_PLAYING },
208// but kept seperate to emphasise the hack aspect, i.e. 207// but kept seperate to emphasise the hack aspect, i.e.
209// do it better, then remove. 208// do it better, then remove.
210static bool 209static bool
211always_immediate (const client *ns, const packet_type *pkt, const char *data, int len) 210always_immediate (const client *ns, const packet_type *pkt, const char *data, int len)
212{ 211{
213 if (!(pkt->flags & (PF_COMMAND0 | PF_COMMAND6))) 212 if (!(pkt->flags & PF_COMMAND))
214 return false; 213 return false;
215 214
216 if (!ns->pl || !ns->pl->ob || !ns->pl->ob->map) 215 if (!ns->pl || !ns->pl->ob || !ns->pl->ob->map)
217 return false; 216 return false;
218
219 if (pkt->flags & PF_COMMAND6)
220 {
221 data += 6;
222 len -= 6;
223 }
224 217
225 if (len > 4 && data [ 3] == ' ' && !strncmp (data, "say " , 4)) return true; 218 if (len > 4 && data [ 3] == ' ' && !strncmp (data, "say " , 4)) return true;
226 if (len > 5 && data [ 4] == ' ' && !strncmp (data, "chat " , 5)) return true; 219 if (len > 5 && data [ 4] == ' ' && !strncmp (data, "chat " , 5)) return true;
227 if (len > 6 && data [ 5] == ' ' && !strncmp (data, "shout " , 6)) return true; 220 if (len > 6 && data [ 5] == ' ' && !strncmp (data, "shout " , 6)) return true;
228 if (len > 8 && data [ 7] == ' ' && !strncmp (data, "suicide " , 8)) return true; 221 if (len > 8 && data [ 7] == ' ' && !strncmp (data, "suicide " , 8)) return true;
298 291
299 goto next_packet; 292 goto next_packet;
300 } 293 }
301 294
302 // If we get here, we didn't find a valid command. 295 // If we get here, we didn't find a valid command.
303 send_packet_printf ("drawinfo %d ERROR: command '%s' not supported.", NDI_RED | NDI_REPLY, (char *)inbuf + 2); 296 send_packet_printf ("msg %d log ERROR: command '%s' not supported.", NDI_RED | NDI_REPLY, (char *)inbuf + 2);
304 297
305next_packet: 298next_packet:
306 inbuf [pkt_len] = save_byte; // rather ugly 299 inbuf [pkt_len] = save_byte; // rather ugly
307 skip_packet (pkt_len); 300 skip_packet (pkt_len);
308 301

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines