Exemple #1
0
int
notify_html_listeners(int descr, dbref who, dbref xprog, dbref obj,
                      dbref room, const char *msg, int isprivate)
{
    char buf[BUFFER_LEN], *nohbuf, *noabuf, buf2[BUFFER_LEN];
    dbref ref;

    if (obj == NOTHING)
        return 0;

    nohbuf = html_escape(msg);
    noabuf = tct(buf2, nohbuf);

    if (tp_listeners && (tp_listeners_obj || Typeof(obj) == TYPE_ROOM)) {
        listenqueue(descr, who, room, obj, obj, xprog, "_listen", nohbuf,
                    tp_listen_mlev, 1, 0);
        listenqueue(descr, who, room, obj, obj, xprog, "_olisten", nohbuf,
                    tp_listen_mlev, 0, 0);
        listenqueue(descr, who, room, obj, obj, xprog, "~listen", nohbuf,
                    tp_listen_mlev, 1, 1);
        listenqueue(descr, who, room, obj, obj, xprog, "~olisten", nohbuf,
                    tp_listen_mlev, 0, 1);
        listenqueue(descr, who, room, obj, obj, xprog, "@listen", nohbuf,
                    tp_listen_mlev, 1, 1);
        listenqueue(descr, who, room, obj, obj, xprog, "@olisten", nohbuf,
                    tp_listen_mlev, 0, 1);
        listenqueue(descr, who, room, obj, obj, xprog, "_alisten", noabuf,
                    tp_listen_mlev, 1, 0);
        listenqueue(descr, who, room, obj, obj, xprog, "_aolisten", noabuf,
                    tp_listen_mlev, 0, 0);
        listenqueue(descr, who, room, obj, obj, xprog, "~alisten", noabuf,
                    tp_listen_mlev, 1, 1);
        listenqueue(descr, who, room, obj, obj, xprog, "~aolisten", noabuf,
                    tp_listen_mlev, 0, 1);
        listenqueue(descr, who, room, obj, obj, xprog, "@alisten", noabuf,
                    tp_listen_mlev, 1, 1);
        listenqueue(descr, who, room, obj, obj, xprog, "@aolisten", noabuf,
                    tp_listen_mlev, 0, 1);
        /* Loop up the environment only if tp_listeners_env is set and obj
         * is a room. Runs once otherwise. -brevantes */
        if (tp_listeners_env && (Typeof(obj) == TYPE_ROOM) ) {
            obj = DBFETCH(obj)->location;
            for (;obj != NOTHING;obj = DBFETCH(obj)->location) {
                listenqueue(descr, who, room, obj, obj, xprog, "_listen", nohbuf,
                            tp_listen_mlev, 1, 0);
                listenqueue(descr, who, room, obj, obj, xprog, "_olisten", nohbuf,
                            tp_listen_mlev, 0, 0);
                listenqueue(descr, who, room, obj, obj, xprog, "~listen", nohbuf,
                            tp_listen_mlev, 1, 1);
                listenqueue(descr, who, room, obj, obj, xprog, "~olisten", nohbuf,
                            tp_listen_mlev, 0, 1);
                listenqueue(descr, who, room, obj, obj, xprog, "@listen", nohbuf,
                            tp_listen_mlev, 1, 1);
                listenqueue(descr, who, room, obj, obj, xprog, "@olisten", nohbuf,
                            tp_listen_mlev, 0, 1);
                listenqueue(descr, who, room, obj, obj, xprog, "_alisten", noabuf,
                            tp_listen_mlev, 1, 0);
                listenqueue(descr, who, room, obj, obj, xprog, "_aolisten", noabuf,
                            tp_listen_mlev, 0, 0);
                listenqueue(descr, who, room, obj, obj, xprog, "~alisten", noabuf,
                            tp_listen_mlev, 1, 1);
                listenqueue(descr, who, room, obj, obj, xprog, "~aolisten", noabuf,
                            tp_listen_mlev, 0, 1);
                listenqueue(descr, who, room, obj, obj, xprog, "@alisten", noabuf,
                            tp_listen_mlev, 1, 1);
                listenqueue(descr, who, room, obj, obj, xprog, "@aolisten", noabuf,
                            tp_listen_mlev, 0, 1);
            }
            return 0;
        }
    }

    if (tp_zombies && (Typeof(obj) == TYPE_THING) && !isprivate
        && !(FLAGS(obj) & QUELL)) {
        if (FLAGS(obj) & VEHICLE) {
            if (getloc(who) == getloc(obj)) {
                char pbuf[BUFFER_LEN];
                const char *prefix;

                prefix = GETOECHO(obj);
                if (prefix && *prefix) {
                    prefix = do_parse_mesg(-1, 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) {
#ifdef IGNORE_SUPPORT
                    if (!ignorance(who, ref))
#endif /* IGNORE_SUPPORT */
                        notify_html_nolisten(ref, buf, isprivate);
                    ref = DBFETCH(ref)->next;
                }
            }
        }
    }

    if (Typeof(obj) == TYPE_PLAYER || Typeof(obj) == TYPE_THING) {
#ifdef IGNORE_SUPPORT
        if (ignorance(who, obj))
            return 0;
#endif
	if ( !isprivate && 
	     Typeof(obj) == TYPE_THING &&
	     FLAGS(obj) & ZOMBIE && 
	     LOCATION(obj) == LOCATION(OWNER(obj))
	   ) return 0;

        return notify_html_nolisten(obj, msg, isprivate);
    } else {
        return 0;
    }
}
Exemple #2
0
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;
}