/* doesn't really belong here, but I couldn't figure out where else */ void do_page(dbref player, const char *arg1, const char *arg2) { int ignored; char buf[BUFFER_LEN], buf2[BUFFER_LEN]; dbref target; if (!payfor(player, tp_lookup_cost)) { anotify_fmt(player, CFAIL "You don't have enough %s.", tp_pennies); return; } if ( strcmp(arg1, "me") ) { if ((target = lookup_player(arg1)) == NOTHING) { anotify(player, CINFO WHO_MESG); return; } } else target = player; if(Guest(player)) { if(!Mage(target)) { anotify(player, CINFO "Guests can only page " NAMEWIZ "s, type 'wizzes'."); return; } } if (FLAGS(target) & HAVEN) { anotify(player, CFAIL "That player is haven."); return; } ignored = ignoring(target, player); if(ignored == 1) { anotify(player, CFAIL "That player is ignoring you."); return; } else if(ignored == 2) { anotify(player, CINFO "That player is ignoring you."); } do_parse_mesg(player, player, arg2, "(page)", buf, MPI_ISPRIVATE); tct(buf,buf2); if (!*buf2) { sprintf(buf, CGREEN "You sense that %s is looking for you in %s.", PNAME(player), NAME(DBFETCH(player)->location)); } else { if(buf2[0] == ':' || buf2[0] == ';') { sprintf(buf, CGREEN "%s pages \"" CYELLOW "%s %.3900s" CGREEN "\"", PNAME(player), PNAME(player), buf2); } else { sprintf(buf, CGREEN "%s pages \"" CYELLOW "%.3900s" CGREEN "\"", PNAME(player), buf2); } } if (anotify_from(player, target, buf)) anotify(player, CSUCC "Your message has been sent."); else { sprintf(buf, CINFO "%s is not connected.", PNAME(target)); anotify(player, buf); } }
void prim_ignoringp(PRIM_PROTOTYPE) { CHECKOP(2); oper2 = POP(); oper1 = POP(); if (!valid_object(oper1)) abort_interp("invalid argument (1)"); if (!valid_object(oper2)) abort_interp("invalid argument (2)"); ref = oper1->data.objref; ref = OWNER(ref); if (Typeof(ref) != TYPE_PLAYER) abort_interp("invalid argument (1)"); result = ignoring(ref, OWNER(oper2->data.objref)); PushInt(result); }
/* Update the user's ignore list to include the new user */ void ignore(struct user *user, struct user *user_to_ignore) { int i; //If the user is already ignoring the user, don't let them add the person to the list again if (ignoring(user, user_to_ignore)) return; //Iterate through the user's ignore list for (i = 0; i < MAXIGNORE; i++) //If ignore_list[i] is NULL, the slot is open -- set it to user_to_ignore and return if (user->ignore_list[i] == NULL) { user->ignore_list[i] = user_to_ignore; return; } }
static void rec_chat(unsigned short channel,char *text) { int n; unsigned int bit; if (channel==0) { for (n=1; n<MAXCHARS; n++) { if (!ch[n].flags) continue; log_char(n,LOG_SYSTEM,0,"%s",text); } } else if (channel<1024) { int uID,cnr=0,step,anr=0,mnr=0; bit=1<<(channel-1); uID=atoi(text); if (channel==7 || channel==12 || channel==13) { cnr=atoi(text+11); step=14; } else if (channel==8) { anr=atoi(text+11); step=14; } else if (channel==9) { anr=atoi(text+11); mnr=atoi(text+14); step=17; } else step=10; for (n=1; n<MAXCHARS; n++) { if (!ch[n].flags) continue; if (!(ch[n].channel&bit)) continue; if (channel==31 && !(ch[n].flags&(CF_STAFF|CF_GOD))) { ch[n].channel&=~bit; continue; } if (channel==32 && !(ch[n].flags&CF_GOD)) { ch[n].channel&=~bit; continue; } if (ignoring(n,uID)) continue; if (channel==7 && cnr!=get_char_clan(n)) continue; if (channel==12 && cnr!=get_char_clan(n) && !clan_alliance(cnr,get_char_clan(n))) continue; if (anr && anr!=areaID) continue; if (mnr && mnr!=areaM) continue; if (channel==13 && get_char_club(n)!=cnr) continue; log_char(n,LOG_SYSTEM,0,"%s",text+step); } } else if (channel==1024 || channel==1030) { // tell int cnID,coID,ret; char buf[80]; cnID=atoi(text); coID=atoi(text+11); for (n=1; n<MAXCHARS; n++) { if (!ch[n].flags) continue; if (ch[n].ID!=cnID) continue; if (channel!=1030 && (ch[n].flags&CF_NOTELL)) continue; if (channel!=1030 && ignoring(n,coID)) continue; ret=log_char(n,LOG_SYSTEM,0,"°c6%s",text+22); if (ret && coID) { // server sends messages with ID 0 and does not need a received note sprintf(buf,"%010u:%010u",coID,cnID); server_chat(1029,buf); } } } else if (channel==1026) { // allow int cnID,coID; cnID=atoi(text); coID=atoi(text+11); allow_body_db(cnID,coID); } else if (channel==1027) { // look int cnID,coID; cnID=atoi(text); coID=atoi(text+11); look_values_bg(cnID,coID); } else if (channel==1028) { // dungeon-clan clan_dungeon_chat(text); } else if (channel==1029) { // chat receive ack int cnID,coID; cnID=atoi(text); coID=atoi(text+11); for (n=1; n<MAXCHARS; n++) { if (!ch[n].flags) continue; if (ch[n].ID!=cnID) continue; register_rec_tell(n,coID); } } else if (channel==1031) { // whostaff request int cnID; cnID=atoi(text); do_whostaff(cnID); } else if (channel==1032) { // look int cnID,coID; cnID=atoi(text); coID=atoi(text+11); lollipop_bg(cnID,coID); } else if (channel==1033) { // shutdown int t,m; t=atoi(text); m=atoi(text+11); shutdown_bg(t,m); } else if (channel==1034) { // shutup int cnID,coID,minutes; void shutup_bg(int,int,int); cnID=atoi(text); coID=atoi(text+11); minutes=atoi(text+22); shutup_bg(cnID,coID,minutes); } else if (channel==1035) { // setglobal int idx,value; idx=atoi(text); value=atoi(text+11); setglobal(idx,value); } else if (channel==1036) { // destroy items in body int cnID,IID; cnID=atoi(text); IID=atoi(text+11); remove_item_from_body_bg(cnID,IID); } }
void do_whisper(dbref player, const char *arg1, const char *arg2) { int ignored; dbref who; char buf[BUFFER_LEN], buf2[BUFFER_LEN]; struct match_data md; if(Guest(player)) { anotify(player, CFAIL NOGUEST_MESG); return; } init_match(player, arg1, TYPE_PLAYER, &md); match_neighbor(&md); match_me(&md); if (Mage(player) && Typeof(player) == TYPE_PLAYER) { match_absolute(&md); match_player(&md); } switch (who = match_result(&md)) { case NOTHING: case AMBIGUOUS: anotify(player, CINFO WHO_MESG); break; default: ignored = ignoring(who, player); if(ignored == 1) { anotify(player, CFAIL "That player is ignoring you."); return; } else if(ignored == 2) { anotify(player, CINFO "That player is ignoring you."); } do_parse_mesg(player, player, arg2, "(whisper)", buf, MPI_ISPRIVATE); tct(buf,buf2); if (buf2[0] == ':' || buf2[0] == ';') { sprintf(buf, CBLUE "%s whispers, \"" CPURPLE "%s %.3900s" CBLUE "\"", PNAME(player), PNAME(player), buf2+1); if (!anotify_from(player, who, buf)) { sprintf(buf, CBLUE "%s is not connected.", PNAME(who)); anotify(player, buf); break; } sprintf(buf, CBLUE "You whisper, \"" CPURPLE "%s %.3900s" CBLUE "\" to %s.", PNAME(player), buf2+1, PNAME(who)); anotify(player, buf); break; } else { sprintf(buf, CBLUE "%s whispers, \"" CPURPLE "%.3900s" CBLUE "\"", PNAME(player), buf2); if (!anotify_from(player, who, buf)) { sprintf(buf, CBLUE "%s is not connected.", PNAME(who)); anotify(player, buf); break; } sprintf(buf, CBLUE "You whisper, \"" CPURPLE "%.3900s" CBLUE "\" to %s.", buf2, PNAME(who)); anotify(player, buf); break; } } }
int ansi_notify_listeners(dbref who, dbref xprog, dbref obj, dbref room, const char *msg, int isprivate, int parseansi) { const char *lmsg; char buf[BUFFER_LEN]; dbref ref; if (obj == NOTHING) return 0; /* Gag jerks, but not wizards or selves */ if((who != obj) && (ignoring(obj, who) == 1)) return 0; if(parseansi > 0) { buf[0] = '\0'; unparse_ansi(buf, msg, parseansi); lmsg = buf; } else lmsg = msg; if (tp_listeners && (tp_listeners_obj || Typeof(obj) == TYPE_ROOM)) { listenqueue(who,room,obj,obj,xprog,"@listen",lmsg, tp_listen_mlev,1,1); listenqueue(who,room,obj,obj,xprog,"~listen",lmsg, tp_listen_mlev,1,1); listenqueue(who,room,obj,obj,xprog,"~olisten",lmsg,tp_listen_mlev,0,1); listenqueue(who,room,obj,obj,xprog,"_listen",lmsg, tp_listen_mlev,1,tp_mortal_mpi_listen_props); listenqueue(who,room,obj,obj,xprog,"_olisten",lmsg,tp_listen_mlev,0,tp_mortal_mpi_listen_props); } if ((Typeof(obj) == TYPE_THING || Typeof(obj) == TYPE_PLAYER) && !isprivate) { if (!(FLAGS(obj) & QUELL)) { if (getloc(who) == getloc(obj)) { char pbuf[BUFFER_LEN]; const char *prefix; prefix = GETOECHO(obj); if (prefix && *prefix) { prefix = do_parse_mesg(who, obj, prefix, "(@Oecho)", pbuf, MPI_ISPRIVATE ); } if (!prefix || !*prefix) prefix = "Outside>"; sprintf(buf, "%s %.*s", prefix, (int)(BUFFER_LEN - 2 - strlen(prefix)), msg ); ref = DBFETCH(obj)->contents; while(ref != NOTHING) { if(obj != OWNER(ref)) /* Don't tell us what we already know */ ansi_notify_nolisten(ref, buf, isprivate, parseansi); ref = DBFETCH(ref)->next; } } } } if (Typeof(obj) == TYPE_PLAYER || Typeof(obj) == TYPE_THING) { return ansi_notify_nolisten(obj, msg, isprivate, parseansi); } else return 0; }