const char * mfn_delay(MFUNARGS) { char *argchr, *cmdchr; int i = atoi(argv[0]); if (i < 1) i = 1; #ifdef WIZZED_DELAY if (!Mageperms(perms)) ABORT_MPI("delay",NOPERM_MESG); #endif cmdchr = get_mvar("cmd"); argchr = get_mvar("arg"); i = add_mpi_event(i, player, getloc(player), perms, argv[1], cmdchr, argchr, (mesgtyp & MPI_ISLISTENER), (!(mesgtyp & MPI_ISPRIVATE))); sprintf(buf, "%d", i); return buf; }
void listenqueue(int descr, dbref player, dbref where, dbref trigger, dbref what, dbref xclude, const char *propname, const char *toparg, int mlev, int mt, int mpi_p) { const char *tmpchar; const char *pname, *sep, *ptr; dbref the_prog = NOTHING; char buf[BUFFER_LEN]; char exbuf[BUFFER_LEN]; char *ptr2; if (!(FLAGS(what) & LISTENER) && !(FLAGS(OWNER(what)) & ZOMBIE)) return; the_prog = NOTHING; tmpchar = NULL; /* queue up program referred to by the given property */ if (((the_prog = get_property_dbref(what, propname)) != NOTHING) || (tmpchar = get_property_class(what, propname))) { if (tmpchar) { sep = tmpchar; while (*sep) { if (*sep == '\\') { sep++; } else if (*sep == '=') { break; } if (*sep) sep++; } if (*sep == '=') { for (ptr = tmpchar, ptr2 = buf; ptr < sep; *ptr2++ = *ptr++) ; *ptr2 = '\0'; strcpyn(exbuf, sizeof(exbuf), toparg); if (!equalstr(buf, exbuf)) { tmpchar = NULL; } else { tmpchar = ++sep; } } } if ((tmpchar && *tmpchar) || the_prog != NOTHING) { if (tmpchar) { if (*tmpchar == '&') { the_prog = AMBIGUOUS; } else if (*tmpchar == NUMBER_TOKEN && number(tmpchar + 1)) { the_prog = (dbref) atoi(++tmpchar); } else if (*tmpchar == REGISTERED_TOKEN) { the_prog = find_registered_obj(what, tmpchar); } else if (number(tmpchar)) { the_prog = (dbref) atoi(tmpchar); } else { the_prog = NOTHING; } } else { if (the_prog == AMBIGUOUS) the_prog = NOTHING; } if (the_prog != AMBIGUOUS) { if (the_prog < 0 || the_prog >= db_top) { the_prog = NOTHING; } else if (Typeof(the_prog) != TYPE_PROGRAM) { the_prog = NOTHING; } else if (OWNER(the_prog) != OWNER(player) && !(FLAGS(the_prog) & LINK_OK)) { the_prog = NOTHING; } else if (MLevel(the_prog) < mlev) { the_prog = NOTHING; } else if (MLevel(OWNER(the_prog)) < mlev) { the_prog = NOTHING; } else if (the_prog == xclude) { the_prog = NOTHING; } } if (the_prog == AMBIGUOUS) { if (mpi_p) { add_mpi_event(1, descr, player, where, trigger, tmpchar + 1, (mt ? "Listen" : "Olisten"), toparg, 1, (mt == 0), Prop_Blessed(what, propname)); } } else if (the_prog != NOTHING) { add_muf_queue_event(descr, player, where, trigger, the_prog, toparg, "(_Listen)", 1); } } } strcpyn(buf, sizeof(buf), propname); if (is_propdir(what, buf)) { strcatn(buf, sizeof(buf), "/"); while ((pname = next_prop_name(what, exbuf, sizeof(exbuf), buf))) { *buf = '\0'; strcatn(buf, sizeof(buf), pname); listenqueue(descr, player, where, trigger, what, xclude, buf, toparg, mlev, mt, mpi_p); } } }