2 Copyright (c) 1993 Richard V. Nash.
3 Copyright (c) 2000 Dan Papasian
4 Copyright (C) Andrew Tridgell 2002
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
23 static int on_channel(int ch, int p);
25 static int CheckShoutQuota(int p)
27 struct player *pp = &player_globals.parray[p];
28 int timeleft = time(0) - pp->lastshout_a;
30 if ((timeleft < seek_globals.quota_time) && (pp->adminLevel == 0))
31 return (seek_globals.quota_time - timeleft);
36 int com_shout(int p, param_list param)
38 int p1, count = 0, timeleft = CheckShoutQuota(p);
39 struct player *pp = &player_globals.parray[p];
41 if (!CheckPFlag(p, PFLAG_REG)) {
42 pprintf(p, "Only registered players can use the shout command.\n");
45 if (in_list(p, L_MUZZLE, pp->login)) {
46 pprintf(p, "You are muzzled.\n");
49 if (param[0].type == TYPE_NULL) {
51 pprintf(p, "Next shout available in %d seconds.\n", timeleft);
53 pprintf(p, "Your next shout is ready for use.\n");
57 pprintf(p, "Shout not sent. Next shout in %d seconds.\n", timeleft);
61 pp->lastshout_a = pp->lastshout_b;
62 pp->lastshout_b = time(0);
63 if (!printablestring(param[0].val.string)) {
64 pprintf(p, "Your message contains some unprintable character(s).\n");
68 for (p1 = 0; p1 < player_globals.p_num; p1++) {
69 if ((p1 == p) || (player_globals.parray[p1].status != PLAYER_PROMPT) ||
70 (!CheckPFlag(p1, PFLAG_SHOUT)) || (player_censored(p1, p)))
73 pprintf_prompt(p1, "\n%s shouts: %s\n",pp->name,param[0].val.string);
76 pprintf(p, "(%d) %s shouts: %s\n", count, pp->name,
79 if (!CheckPFlag(p, PFLAG_SHOUT))
80 pprintf (p, "You are not listening to shouts.\n");
81 if ((timeleft = CheckShoutQuota(p)))
82 pprintf(p, "Next shout in %d second(s).\n", timeleft);
87 int com_cshout(int p, param_list param)
89 struct player *pp = &player_globals.parray[p];
92 if (!CheckPFlag(p, PFLAG_REG)) {
93 pprintf(p, "Only registered players can use the cshout command.\n");
96 if (in_list(p, L_CMUZZLE, pp->login)) {
97 pprintf(p, "You are c-muzzled.\n");
100 if (!printablestring(param[0].val.string)) {
101 pprintf(p, "Your message contains some unprintable character(s).\n");
105 for (p1 = 0; p1 < player_globals.p_num; p1++) {
106 if ((p1 == p) || (player_globals.parray[p1].status != PLAYER_PROMPT) ||
107 (!CheckPFlag(p1, PFLAG_CSHOUT)) || (player_censored(p1, p)))
110 pprintf_prompt(p1, "\n%s c-shouts: %s\n", pp->name,
111 param[0].val.string);
113 pprintf(p, "(%d) %s c-shouts: %s\n", count, pp->name,
114 param[0].val.string);
115 if (!CheckPFlag(p, PFLAG_CSHOUT))
116 pprintf (p, "You are not listening to c-shouts.\n");
121 int com_it(int p, param_list param)
123 struct player *pp = &player_globals.parray[p];
124 int p1, count = 0, timeleft = CheckShoutQuota(p);
126 if (!CheckPFlag(p, PFLAG_REG)) {
127 pprintf(p, "Only registered players can use the it command.\n");
130 if (in_list(p, L_MUZZLE, pp->login)) {
131 pprintf(p, "You are muzzled.\n");
134 if (param[0].type == TYPE_NULL) {
136 pprintf(p, "Next shout available in %d seconds.\n", timeleft);
138 pprintf(p, "Your next shout is ready for use.\n");
143 pprintf(p, "Shout not sent. Next shout in %d seconds.\n", timeleft);
146 pp->lastshout_a = pp->lastshout_b;
147 pp->lastshout_b = time(0);
149 if (!printablestring(param[0].val.string)) {
150 pprintf(p, "Your message contains some unprintable character(s).\n");
154 for (p1 = 0; p1 < player_globals.p_num; p1++) {
155 if ((p1 == p) || (player_globals.parray[p1].status != PLAYER_PROMPT) ||
156 (!CheckPFlag(p1, PFLAG_SHOUT)) || (player_censored(p1, p)))
159 if ((!strncmp(param[0].val.string, "\'", 1)) ||
160 (!strncmp(param[0].val.string, ",", 1)) ||
161 (!strncmp(param[0].val.string, ".", 1)))
162 pprintf_prompt(p1, "\n--> %s%s\n", pp->name,
163 param[0].val.string);
165 pprintf_prompt(p1, "\n--> %s %s\n", pp->name,
166 param[0].val.string);
168 if ((!strncmp(param[0].val.string, "\'", 1)) ||
169 (!strncmp(param[0].val.string, ",", 1)) ||
170 (!strncmp(param[0].val.string, ".", 1)))
171 pprintf(p, "--> %s%s\n", pp->name, param[0].val.string);
173 pprintf(p, "--> %s %s\n", pp->name, param[0].val.string);
175 if ((timeleft = CheckShoutQuota(p)))
176 pprintf(p, "Next shout in %d second(s).\n", timeleft);
181 static int tell(int p, int p1, const char *msg, int why, int ch)
183 struct player *pp = &player_globals.parray[p];
184 char tmp[MAX_LINE_SIZE];
185 int rating, rating1, p2;
187 if (!printablestring(msg)) {
188 pprintf(p, "Your message contains some unprintable character(s).\n");
192 if (!CheckPFlag(p1, PFLAG_TELL) && !CheckPFlag(p, PFLAG_REG)) {
193 pprintf(p, "Player \"%s\" isn't listening to unregistered tells.\n",
194 player_globals.parray[p1].name);
197 if (player_censored(p1, p)) {
198 if (pp->adminLevel == 0) {
199 if (why != TELL_KIBITZ && why != TELL_WHISPER && why != TELL_CHANNEL)
200 pprintf(p, "Player \"%s\" is censoring you.\n", player_globals.parray[p1].name);
203 pprintf(p, "Told \"%s\", who is censoring you.\n", player_globals.parray[p1].name);
208 pprintf_highlight(p1, "\n%s", pp->name);
209 pprintf_prompt(p1, " says: %s\n", msg);
213 rating = GetRating(&player_globals.parray[p], TYPE_BLITZ);
214 if (rating < (rating1 = (GetRating(&player_globals.parray[p], TYPE_STAND))))
216 if (in_list(p, L_FM, pp->name))
217 pprintf(p1, "\n%s(FM)", pp->name);
218 else if (in_list(p, L_IM, pp->name))
219 pprintf(p1, "\n%s(IM)", pp->name);
220 else if (in_list(p, L_GM, pp->name))
221 pprintf(p1, "\n%s(GM)", pp->name);
222 else if (in_list(p, L_WGM, pp->name))
223 pprintf(p1, "\n%s(WGM)", pp->name);
224 else if ((pp->adminLevel >= 10)
225 && CheckPFlag(p, PFLAG_ADMINLIGHT))
226 pprintf(p1, "\n%s(*)", pp->name);
227 else if ((rating >= player_globals.parray[p1].kiblevel) ||
228 ((pp->adminLevel >= 10)
229 && CheckPFlag(p, PFLAG_ADMINLIGHT)))
230 if (!CheckPFlag(p, PFLAG_REG))
231 pprintf(p1, "\n%s(++++)", pp->name);
232 else if (rating != 0)
233 if (in_list(p, L_COMPUTER, pp->name))
234 pprintf(p1, "\n%s(%d)(C)", pp->name, rating);
236 pprintf(p1, "\n%s(%d)", pp->name, rating);
238 pprintf(p1, "\n%s(----)", pp->name);
241 if (why == TELL_WHISPER)
242 pprintf_prompt(p1, " whispers: %s\n", msg);
244 pprintf_prompt(p1, " kibitzes: %s\n", msg);
248 pprintf(p1, "\n%s", pp->name);
249 if ((pp->adminLevel >= 10)
250 && CheckPFlag(p, PFLAG_ADMINLIGHT) && (ch == 1))
252 pprintf_prompt(p1, "(%d): %s\n", ch, msg);
255 pprintf_prompt(p1, "\n%s tells you: %s\n", pp->name, msg);
260 if (player_globals.parray[p1].highlight)
261 pprintf_highlight(p1, "\n%s", pp->name);
263 pprintf(p1, "\n%s", pp->name);
265 if ((pp->adminLevel >= 10) && CheckPFlag(p, PFLAG_ADMINLIGHT))
268 pprintf_prompt(p1, " tells you: %s\n", msg);
270 /* let's test for forwarding of tells */
272 if ((pp->ftell == p1) || (player_globals.parray[p1].ftell == p)) {
273 for (p2 = 0; p2 < player_globals.p_num; p2++) {
274 if ((p2 == p) || (p2 == p1) || (player_globals.parray[p2].status != PLAYER_PROMPT))
276 if (on_channel(0, p2))
277 pprintf (p2,"\nFwd tell: %s told %s: %s\n", pp->name,
278 player_globals.parray[p1].name, msg);
287 if (!(player_globals.parray[p1].busy == NULL))
288 sprintf(tmp, ", who %s (idle: %s)", player_globals.parray[p1].busy,
289 hms_desc(player_idle(p1)));
291 if (((player_idle(p1) % 3600) / 60) > 2)
292 sprintf(tmp, ", who has been idle %s", hms_desc(player_idle(p1)));
294 if ((why == TELL_SAY) || (why == TELL_TELL) || (why == TELL_LTELL)) {
295 pprintf(p, "(told %s%s)\n", player_globals.parray[p1].name,
296 (((player_globals.parray[p1].game>=0) && (game_globals.garray[player_globals.parray[p1].game].status == GAME_EXAMINE))
297 ? ", who is examining a game" :
298 ((player_globals.parray[p1].game>=0) && (game_globals.garray[player_globals.parray[p1].game].status == GAME_SETUP))
299 ? ", who is setting up a position" :
300 (player_globals.parray[p1].game >= 0 && (player_globals.parray[p1].game != pp->game))
301 ? ", who is playing" : tmp));
304 if (why == TELL_TELL || why == TELL_SAY) {
306 pp->last_tell = strdup(player_globals.parray[p1].login);
312 int com_ptell(int p, param_list param)
314 struct player *pp = &player_globals.parray[p];
315 char tmp[MAX_LINE_SIZE];
318 if (pp->partner < 0) {
319 pprintf (p, "You do not have a partner at present.\n");
324 if ((p1 < 0) || (player_globals.parray[p1].status == PLAYER_PASSWORD)
325 || (player_globals.parray[p1].status == PLAYER_LOGIN)) {
326 pprintf(p, "Your partner is not logged in.\n");
330 if (player_globals.parray[p1].highlight)
331 pprintf_highlight(p1, "\n%s", pp->name);
333 pprintf(p1, "\n%s", pp->name);
335 pprintf_prompt(p1, " (your partner) tells you: %s\n", param[0].val.string);
337 if (!(player_globals.parray[p1].busy == NULL))
338 sprintf(tmp, ", who %s (idle: %s)", player_globals.parray[p1].busy,
339 hms_desc(player_idle(p1)));
341 if (((player_idle(p1) % 3600) / 60) > 2)
342 sprintf(tmp, ", who has been idle %s", hms_desc(player_idle(p1)));
344 pprintf(p, "(told %s%s)\n", player_globals.parray[p1].name,
345 (((player_globals.parray[p1].game>=0) && (game_globals.garray[player_globals.parray[p1].game].status == GAME_EXAMINE))
346 ? ", who is examining a game" :
347 ((player_globals.parray[p1].game>=0) && (game_globals.garray[player_globals.parray[p1].game].status == GAME_SETUP))
348 ? ", who is setting up a position" :
349 (player_globals.parray[p1].game >= 0 && (player_globals.parray[p1].game != pp->game))
350 ? ", who is playing" : tmp));
355 static int chtell(int p, int ch, char *msg)
357 struct player *pp = &player_globals.parray[p];
360 if ((ch == 0) && (pp->adminLevel < ADMIN_ADMIN)) {
361 pprintf(p, "Only admins may send tells to channel 0.\n");
366 pprintf(p, "The lowest channel number is 0.\n");
370 if (ch >= MAX_CHANNELS) {
371 pprintf(p, "The maximum channel number is %d.\n", MAX_CHANNELS - 1);
375 if ((ch == 1) && (in_list(p, L_C1MUZZLE, pp->login))) {
376 pprintf (p, "You have been prevented from sending tells to channel 1.\n");
380 if ((ch == 24) && (in_list(p, L_C24MUZZLE, pp->login))) {
381 pprintf (p, "You have been prevented from sending tells to channel 24.\n");
385 if ((ch == 46) && (in_list(p, L_C46MUZZLE, pp->login))) {
386 pprintf (p, "You have been prevented from sending tells to channel 46.\n");
390 if ((ch == 49) && (in_list(p, L_C49MUZZLE, pp->login))) {
391 pprintf (p, "You have been prevented from sending tells to channel 49.\n");
395 if ((ch == 50) && (in_list(p, L_C50MUZZLE, pp->login))) {
396 pprintf (p, "You have been prevented from sending tells to channel 50.\n");
400 if ((ch == 51) && (in_list(p, L_C51MUZZLE, pp->login))) {
401 pprintf (p, "You have been prevented from sending tells to channel 51.\n");
405 for (p1 = 0; p1 < player_globals.p_num; p1++) {
406 if ((p1 == p) || (player_globals.parray[p1].status != PLAYER_PROMPT))
408 if ((on_channel(ch, p1)) && (!player_censored(p1, p))
409 && (CheckPFlag(p, PFLAG_REG) || CheckPFlag(p1, PFLAG_TELL))) {
410 tell(p, p1, msg, TELL_CHANNEL, ch);
411 if (!player_censored(p1, p))
417 pp->last_channel = ch;
419 pprintf(p, "%s(%d): %s\n", pp->name, ch, msg);
420 if (!on_channel(ch, p))
421 pprintf(p, " (You're not listening to channel %d.)\n", ch);
426 int com_whisper(int p, param_list param)
428 struct player *pp = &player_globals.parray[p];
429 int g, p1, count = 0;
431 if (!pp->num_observe && pp->game < 0) {
432 pprintf(p, "You are not playing or observing a game.\n");
435 if (!CheckPFlag(p, PFLAG_REG) && (pp->game == -1)) {
436 pprintf(p, "You must be registered to whisper other people's games.\n");
442 g = pp->observe_list[0];
443 for (p1 = 0; p1 < player_globals.p_num; p1++) {
444 if ((p1 == p) || (player_globals.parray[p1].status != PLAYER_PROMPT))
446 if (player_is_observe(p1, g) ||
447 (game_globals.garray[g].link >= 0 && player_is_observe(p1, game_globals.garray[g].link)
448 && player_globals.parray[p1].game != game_globals.garray[g].link)) {
449 tell(p, p1, param[0].val.string, TELL_WHISPER, 0);
450 if ((pp->adminLevel >= ADMIN_ADMIN) || !game_globals.garray[g].private || !player_censored(p1, p))
454 pprintf(p, "whispered to %d.\n", count);
458 int com_kibitz(int p, param_list param)
460 struct player *pp = &player_globals.parray[p];
461 int g, p1, count = 0;
463 if (!pp->num_observe && pp->game < 0) {
464 pprintf(p, "You are not playing or observing a game.\n");
467 if (!CheckPFlag(p, PFLAG_REG) && (pp->game == -1)) {
468 pprintf(p, "You must be registered to kibitz other people's games.\n");
474 g = pp->observe_list[0];
475 for (p1 = 0; p1 < player_globals.p_num; p1++) {
476 if ((p1 == p) || (player_globals.parray[p1].status != PLAYER_PROMPT))
478 if ((player_is_observe(p1, g) || player_globals.parray[p1].game == g
479 || (game_globals.garray[g].link >= 0
480 && (player_is_observe(p1, game_globals.garray[g].link)
481 || player_globals.parray[p1].game == game_globals.garray[g].link)))
482 && CheckPFlag(p1, PFLAG_KIBITZ)) {
483 tell(p, p1, param[0].val.string, TELL_KIBITZ, 0);
484 if ((pp->adminLevel >= ADMIN_ADMIN) ||
485 !game_globals.garray[g].private || (player_globals.parray[p1].game == g) || !player_censored(p1, p))
489 pprintf(p, "kibitzed to %d.\n", count);
494 like tell() but takes a player name
496 static int tell_s(int p, const char *who, const char *msg, int why, int ch)
500 p1 = player_find_part_login(who);
501 if ((p1 < 0) || (player_globals.parray[p1].status == PLAYER_PASSWORD)
502 || (player_globals.parray[p1].status == PLAYER_LOGIN)) {
503 if (why != TELL_LTELL) {
504 pprintf(p, "No user named '%s' is logged in.\n", who);
509 return tell(p, p1, msg, why, ch);
512 int com_tell(int p, param_list param)
514 struct player *pp = &player_globals.parray[p];
517 if (param[0].type == TYPE_NULL)
518 return COM_BADPARAMETERS;
519 if (param[0].type != TYPE_WORD) {
520 return chtell(p, param[0].val.integer, param[1].val.string);
523 who = param[0].val.word;
526 if (strcmp(who, ".") == 0) {
527 if (!pp->last_tell) {
528 pprintf(p, "No previous tell.\n");
534 if (strcmp(who, ",") == 0) {
535 if (pp->last_channel == -1) {
536 pprintf(p, "No previous channel.\n");
539 return chtell(p, pp->last_channel, param[1].val.string);
542 return tell_s(p, who, param[1].val.string, TELL_TELL, 0);
546 /* tell all players in a named list */
547 int com_ltell(int p, param_list param)
552 gl = list_findpartial(p, param[0].val.word, 0);
554 pprintf(p,"Can't find that list\n");
558 for (i=0;i<gl->numMembers;i++) {
559 tell_s(p, gl->m_member[i], param[1].val.string, TELL_LTELL, 0);
566 int com_xtell(int p, param_list param)
568 struct player *pp = &player_globals.parray[p];
570 char *msg, tmp[2048];
572 msg = param[1].val.string;
573 p1 = player_find_part_login(param[0].val.word);
574 if ((p1 < 0) || (player_globals.parray[p1].status == PLAYER_PASSWORD)
575 || (player_globals.parray[p1].status == PLAYER_LOGIN)) {
576 pprintf(p, "No user named \"%s\" is logged in.\n", param[0].val.word);
579 if (!printablestring(msg)) {
580 pprintf(p, "Your message contains some unprintable character(s).\n");
583 if (!CheckPFlag(p1, PFLAG_TELL) && !CheckPFlag(p, PFLAG_REG)) {
584 pprintf(p, "Player \"%s\" isn't listening to unregistered tells.\n",
585 player_globals.parray[p1].name);
588 if ((player_censored(p1, p)) && (pp->adminLevel == 0)) {
589 pprintf(p, "Player \"%s\" is censoring you.\n", player_globals.parray[p1].name);
592 if (player_globals.parray[p1].highlight)
593 pprintf_highlight(p1, "\n%s", pp->name);
595 pprintf(p1, "\n%s", pp->name);
597 pprintf_prompt(p1, " tells you: %s\n", msg);
600 if (!(player_globals.parray[p1].busy == NULL))
601 sprintf(tmp, ", who %s (idle: %s)", player_globals.parray[p1].busy,
602 hms_desc(player_idle(p1)));
604 if (((player_idle(p1) % 3600) / 60) > 2)
605 sprintf(tmp, ", who has been idle %s", hms_desc(player_idle(p1)));
607 pprintf(p, "(told %s%s)\n", player_globals.parray[p1].name,
608 (((player_globals.parray[p1].game>=0) && (game_globals.garray[player_globals.parray[p1].game].status == GAME_EXAMINE))
609 ? ", who is examining a game" :
610 ((player_globals.parray[p1].game>=0) && (game_globals.garray[player_globals.parray[p1].game].status == GAME_SETUP))
611 ? ", who is setting up a position" :
612 (player_globals.parray[p1].game >= 0 && (player_globals.parray[p1].game != pp->game))
613 ? ", who is playing" : tmp));
617 int com_say(int p, param_list param)
619 struct player *pp = &player_globals.parray[p];
620 if (pp->opponent < 0) {
621 if (!pp->last_opponent) {
622 pprintf(p, "No one to say anything to, try tell.\n");
625 return tell_s(p, pp->last_opponent, param[0].val.string, TELL_SAY, 0);
627 return tell(p, pp->opponent, param[0].val.string, TELL_SAY, 0);
630 int com_inchannel(int p, param_list param)
635 if (param[0].type == TYPE_NULL) {
636 pprintf (p,"inchannel [no params] has been removed\n");
637 pprintf (p,"Please use inchannel [name] or inchannel [number]\n");
641 if (param[0].type == TYPE_WORD) {
642 p1 = player_find_part_login(param[0].val.word);
643 if ((p1 < 0) || (player_globals.parray[p1].status != PLAYER_PROMPT)) {
644 pprintf(p, "No user named \"%s\" is logged in.\n", param[0].val.word);
647 pprintf (p,"%s is in the following channels:",player_globals.parray[p1].name);
648 if (list_channels (p,p1))
649 pprintf (p," No channels found for %s.\n",player_globals.parray[p1].name);
651 } else if (param[0].val.integer >= MAX_CHANNELS) {
652 pprintf (p, "No such channel; the largest channel number is %d.\n",
656 sprintf (tmp,"%d",param[0].val.integer);
657 for (p1 = 0; p1 < player_globals.p_num; p1++) {
658 if (player_globals.parray[p1].status != PLAYER_PROMPT)
660 if (in_list(p1,L_CHANNEL,tmp)) {
662 pprintf(p,"Channel %d:",param[0].val.integer);
663 pprintf (p," %s", player_globals.parray[p1].name);
664 if ((player_globals.parray[p1].adminLevel >= 10)
665 && CheckPFlag(p1, PFLAG_ADMINLIGHT)
666 && (param[0].val.integer < 2))
672 pprintf(p,"Channel %d is empty.\n",param[0].val.integer);
674 pprintf (p,"\n%d %s in channel %d.\n",count,(count == 1 ? "person is" : "people are"),param[0].val.integer);
679 static int com_sendmessage(int p, param_list param)
681 struct player *pp = &player_globals.parray[p];
682 int p1, connected = 1;
684 if (!CheckPFlag(p, PFLAG_REG)) {
685 pprintf(p, "You are not registered and cannot send messages.\n");
689 if (!FindPlayer(p, param[0].val.word, &p1, &connected))
692 if (!CheckPFlag(p1, PFLAG_REG)) {
693 pprintf(p, "Player \"%s\" is unregistered and cannot receive messages.\n",
694 player_globals.parray[p1].name);
698 if ((player_censored(p1, p)) && (pp->adminLevel == 0)) {
699 pprintf(p, "Player \"%s\" is censoring you.\n", player_globals.parray[p1].name);
704 if (player_add_message(p1, p, param[1].val.string)) {
705 pprintf(p, "Couldn't send message to %s. Message buffer full.\n",
706 player_globals.parray[p1].name);
709 pprintf(p1, "\n%s just sent you a message:\n", pp->name);
710 pprintf_prompt(p1, " %s\n", param[1].val.string);
718 int com_messages(int p, param_list param)
722 if (!CheckPFlag(p, PFLAG_REG)) {
723 pprintf (p, "Unregistered players may not send or receive messages.\n");
726 if (param[0].type == TYPE_NULL) {
727 player_show_messages (p);
728 } else if (param[0].type == TYPE_WORD) {
729 if (param[1].type != TYPE_NULL)
730 return com_sendmessage(p, param);
731 else ShowMsgsBySender(p, param);
733 start = param[0].val.integer;
734 ShowMsgRange (p, start, start);
739 int com_forwardmess(int p, param_list param)
741 if (!CheckPFlag(p, PFLAG_REG)) {
742 pprintf (p, "Unregistered players may not send or receive messages.\n");
746 ForwardMsgRange(param[0].val.word, p, param[1].val.integer, param[1].val.integer);
751 int com_clearmessages(int p, param_list param)
753 if (player_num_messages(p) <= 0) {
754 pprintf(p, "You have no messages.\n");
757 if (param[0].type == TYPE_NULL) {
758 pprintf(p, "Messages cleared.\n");
759 player_clear_messages(p);
760 } else if (param[0].type == TYPE_WORD)
761 ClearMsgsBySender(p, param);
762 else if (param[0].type == TYPE_INT)
763 ClrMsgRange (p, param[0].val.integer, param[0].val.integer);
768 int com_znotify(int p, param_list param)
772 for (p1 = 0; p1 < player_globals.p_num; p1++) {
773 if (player_notified(p, p1) && player_globals.parray[p1].status == PLAYER_PROMPT) {
775 pprintf(p, "Present company on your notify list:\n ");
776 pprintf(p, " %s", player_globals.parray[p1].name);
781 pprintf(p, "No one from your notify list is logged on.");
785 for (p1 = 0; p1 < player_globals.p_num; p1++) {
786 if (player_notified(p1, p) && player_globals.parray[p1].status == PLAYER_PROMPT) {
789 "The following players have you on their notify list:\n ");
790 pprintf(p, " %s", player_globals.parray[p1].name);
795 pprintf(p, "No one logged in has you on their notify list.");
801 int com_qtell(int p, param_list param)
803 struct player *pp = &player_globals.parray[p];
805 char tmp[MAX_STRING_LENGTH];
807 char buffer1[MAX_STRING_LENGTH]; /* no highlight and no bell */
808 char buffer2[MAX_STRING_LENGTH]; /* no highlight and bell */
809 char buffer3[MAX_STRING_LENGTH]; /* highlight and no bell */
810 char buffer4[MAX_STRING_LENGTH]; /* highlight and and bell */
813 if (!in_list(p, L_TD, pp->name)) {
814 pprintf(p, "Only TD programs are allowed to use this command.\n");
817 strcpy(buffer1, ":\0");
818 strcpy(buffer2, ":\0");
819 strcpy(buffer3, ":\0");
820 strcpy(buffer4, ":\0");
822 sprintf(tmp, "%s", param[1].val.string);
823 for (i = 0, count = 0; ((tmp[i] != '\0') && (count < 1029));) {
824 if ((tmp[i] == '\\') && (tmp[i + 1] == 'n')) {
825 strcat(buffer1, "\n:");
826 strcat(buffer2, "\n:");
827 strcat(buffer3, "\n:");
828 strcat(buffer4, "\n:");
831 } else if ((tmp[i] == '\\') && (tmp[i + 1] == 'b')) {
832 strcat(buffer2, "\007");
833 strcat(buffer4, "\007");
836 } else if ((tmp[i] == '\\') && (tmp[i + 1] == 'H')) {
837 strcat(buffer3, "\033[7m");
838 strcat(buffer4, "\033[7m");
841 } else if ((tmp[i] == '\\') && (tmp[i + 1] == 'h')) {
842 strcat(buffer3, "\033[0m");
843 strcat(buffer4, "\033[0m");
849 strcat(buffer1, dummy);
850 strcat(buffer2, dummy);
851 strcat(buffer3, dummy);
852 strcat(buffer4, dummy);
858 if (param[0].type == TYPE_WORD) {
859 if ((p1 = player_find_bylogin(param[0].val.word)) < 0) {
860 pprintf(p, "*qtell %s 1*\n", param[0].val.word);
863 pprintf_prompt(p1, "\n%s\n", (player_globals.parray[p1].highlight && CheckPFlag(p1, PFLAG_BELL)) ? buffer4 :
864 (player_globals.parray[p1].highlight && !CheckPFlag(p1, PFLAG_BELL)) ? buffer3 :
865 (!player_globals.parray[p1].highlight && CheckPFlag(p1, PFLAG_BELL)) ? buffer2 :
867 pprintf(p, "*qtell %s 0*\n", player_globals.parray[p1].name);
871 int ch = param[0].val.integer;
874 pprintf(p, "*qtell %d 1*\n", param[0].val.integer);
878 pprintf(p, "*qtell %d 1*\n", param[0].val.integer);
881 if (ch >= MAX_CHANNELS) {
882 pprintf(p, "*qtell %d 1*\n", param[0].val.integer);
885 sprintf (tmp,"%d",param[0].val.integer);
886 for (p1 = 0; p1 < player_globals.p_num ; p1++) {
887 if ((p1 == p) || (player_censored(p1, p)) || (player_globals.parray[p1].status != PLAYER_PROMPT))
889 if (in_list(p1,L_CHANNEL,tmp))
890 pprintf_prompt(p1, "\n%s\n", (player_globals.parray[p1].highlight && CheckPFlag(p1, PFLAG_BELL)) ? buffer4 :
891 (player_globals.parray[p1].highlight && !CheckPFlag(p1, PFLAG_BELL)) ? buffer3 :
892 (!player_globals.parray[p1].highlight && CheckPFlag(p1, PFLAG_BELL)) ? buffer2 :
895 pprintf(p, "*qtell %d 0*\n", param[0].val.integer);
900 static int on_channel(int ch, int p)
902 char tmp[10]; /* 9 digits ought to be enough :) */
904 sprintf (tmp,"%d",ch);
905 return in_list(p, L_CHANNEL,tmp); /* since needs ch converted to a string
906 kept hidden from view */