Author Topic: Filtered channels?  (Read 4249 times)

Offline quixadhal

  • BFF
  • ***
  • Posts: 642
    • View Profile
    • WileyMUD
Filtered channels?
« on: June 09, 2010, 05:11:11 am »
Ok, so since certain folks decided to abuse my nice url expander, because they are childish little minions who'd rather tear down than build up, I figured I'd take Crat's advice and try to set up a filtered channel of my own. :)

This is the mythical "mode 2" channel.  From reading the docs, it looks like you simply create an I3 channel of this mode and it becomes a public channel, but with a catch.  Anything sent to that channel is first forwarded to the mud that owns it (seperate message type), and that mud then has to send it back to the router as approved for it to go out.

Essentially, this allows you to make a channel anyone can watch, but only certain users/muds/etc can write to it.  Problem solved?

Almost.  I implemented what appears (to me) a handler to deal with these auth request packets (chan-filter-req), but it never gets triggered.  I went down to the network room in ds to watch the packets go out, and it LOOKED ok, so I reloaded intermud.c to see if I could spot the channel list.  I forgot I was on *wpr because of *i4's downtime the other day, and IT seemed to show my channel as mode 1!

I redid the chancreate on *i4, and it shows up as mode 2, but still no filter requests come back.

Sooooo, time for me to get some sleep, but if Crat or someone else with I3 router knowhow could help me figure out what's going on, I'd appreciate it.  No hurry. :)

Here's /daemon/services/filter.c
Code: [Select]
#include <daemons.h>
#include <message_class.h>

void eventReceiveFilterRequest(mixed *packet) {
    // The actual payload to be filtered is in packet[7]
    // ({
    //     (string)   "chan-filter-req",
    //     (int)      5,
    //     (string)   originator_mudname,     // the router
    //     (string)   0,
    //     (string)   target_mudname,         // the owner/host mud
    //     (string)   0,
    //     (string)   channel_name,
    //     (mixed *)  packet_to_filter,
    // })
    // Where packet_to_filter is a channel-m, channel-e or channel-t packet.

    tn("eventReceiveFilterRequest: "+identify(packet),"green");
    if( file_name(previous_object()) != INTERMUD_D ) return;

    if( packet[4] != mud_name() ) return;
    // We only want to respond to packets that were sent to us for filtering.

    if( packet[7][0] != "channel-m" ) return;
    // Further, we only want regular messages, no emotes!

    if( packet[7][2] != mud_name() ) return;
    // And we only want to deal with packets which came from someone here!

    // ({
    //     (string)   "chan-filter-reply",
    //     (int)      5,
    //     (string)   originator_mudname,    // The channel host/owner mudname
    //     (string)   0,
    //     (string)   target_mudname,        // the router
    //     (string)   0,
    //     (string)   channel_name,
    //     (mixed *)  filtered_packet,
    // })

    INTERMUD_D->eventWrite(({ "chan-filter-reply", 5, mud_name(), 0, packet[2],
                    0, packet[6], packet[7] }));

and the change to intermud.c, in eventRead():
Code: [Select]
        case "chan-filter-req":
            tn("chan-filter-req: "+identify(packet),"green");
        case "chan-filter-reply":
            tn("chan-filter-reply: "+identify(packet), "red");

Offline cratylus

  • Your favorite and best
  • Administrator
  • ***
  • Posts: 1024
  • Cratylus@Dead Souls <ds> np
    • View Profile
    • About Cratylus
Re: Filtered channels?
« Reply #1 on: June 09, 2010, 07:57:08 am »
Your fastest, best bets are Tricky and Aidil. Tricky actually had it working. Aidil is a superintelligent shade of the color blue.

I can promise to look at it then next time I have my brain turned on...but you know how rare those moments are :(


PS It might even be worth posting on Aidil's new forum!
« Last Edit: June 09, 2010, 07:59:20 am by cratylus »