… | |
… | |
193 | } |
193 | } |
194 | |
194 | |
195 | return 1; |
195 | return 1; |
196 | } |
196 | } |
197 | |
197 | |
198 | /** |
|
|
199 | * Add player's IP to ban_file and kick them off the server |
|
|
200 | * I know most people have dynamic IPs but this is more of a short term |
|
|
201 | * solution if they have to get a new IP to play maybe they'll calm down. |
|
|
202 | * This uses the banish_file in the local directory *not* the ban_file |
|
|
203 | * The action is logged with a ! for easy searching. -tm |
|
|
204 | */ |
|
|
205 | int |
|
|
206 | command_banish (object *op, char *params) |
|
|
207 | { |
|
|
208 | player *pl; |
|
|
209 | FILE *banishfile; |
|
|
210 | char buf[MAX_BUF]; |
|
|
211 | time_t now; |
|
|
212 | |
|
|
213 | if (!params) |
|
|
214 | { |
|
|
215 | new_draw_info (NDI_UNIQUE, 0, op, "Usage: banish <player>."); |
|
|
216 | return 1; |
|
|
217 | } |
|
|
218 | |
|
|
219 | pl = get_other_player_from_name (op, params); |
|
|
220 | if (!pl) |
|
|
221 | return 1; |
|
|
222 | |
|
|
223 | sprintf (buf, "%s/%s", settings.localdir, BANISHFILE); |
|
|
224 | |
|
|
225 | if ((banishfile = fopen (buf, "a")) == NULL) |
|
|
226 | { |
|
|
227 | LOG (llevDebug, "Could not find file banish_file.\n"); |
|
|
228 | new_draw_info (NDI_UNIQUE, 0, op, "Could not find banish_file."); |
|
|
229 | return 0; |
|
|
230 | } |
|
|
231 | |
|
|
232 | now = time (NULL); |
|
|
233 | /* |
|
|
234 | * Record this as a comment - then we don't have to worry about changing |
|
|
235 | * the parsing code. |
|
|
236 | */ |
|
|
237 | fprintf (banishfile, "# %s (%s) banned by %s at %s\n", &pl->ob->name, pl->ns->host, &op->name, ctime (&now)); |
|
|
238 | fprintf (banishfile, "*@%s\n", pl->ns->host); |
|
|
239 | fclose (banishfile); |
|
|
240 | |
|
|
241 | LOG (llevDebug, "! %s banned %s from IP: %s.\n", &op->name, &pl->ob->name, pl->ns->host); |
|
|
242 | new_draw_info_format (NDI_UNIQUE | NDI_RED, 0, op, "You banish %s", &pl->ob->name); |
|
|
243 | new_draw_info_format (NDI_UNIQUE | NDI_ALL | NDI_RED, 5, op, "%s banishes %s from the land!", &op->name, &pl->ob->name); |
|
|
244 | command_kick (op, (char *) &pl->ob->name); |
|
|
245 | return 1; |
|
|
246 | } |
|
|
247 | |
|
|
248 | //TODO |
198 | //TODO |
249 | #if 0 |
199 | #if 0 |
250 | int |
200 | int |
251 | command_save_overlay (object *op, char *params) |
201 | command_save_overlay (object *op, char *params) |
252 | { |
202 | { |