tmi2_fluffos_v2/
tmi2_fluffos_v2/bin/
tmi2_fluffos_v2/etc/
tmi2_fluffos_v2/fluffos-2.7-ds2.018/
tmi2_fluffos_v2/fluffos-2.7-ds2.018/ChangeLog.old/
tmi2_fluffos_v2/fluffos-2.7-ds2.018/Win32/
tmi2_fluffos_v2/fluffos-2.7-ds2.018/compat/
tmi2_fluffos_v2/fluffos-2.7-ds2.018/compat/simuls/
tmi2_fluffos_v2/fluffos-2.7-ds2.018/include/
tmi2_fluffos_v2/fluffos-2.7-ds2.018/testsuite/
tmi2_fluffos_v2/fluffos-2.7-ds2.018/testsuite/clone/
tmi2_fluffos_v2/fluffos-2.7-ds2.018/testsuite/command/
tmi2_fluffos_v2/fluffos-2.7-ds2.018/testsuite/data/
tmi2_fluffos_v2/fluffos-2.7-ds2.018/testsuite/etc/
tmi2_fluffos_v2/fluffos-2.7-ds2.018/testsuite/include/
tmi2_fluffos_v2/fluffos-2.7-ds2.018/testsuite/inherit/
tmi2_fluffos_v2/fluffos-2.7-ds2.018/testsuite/inherit/master/
tmi2_fluffos_v2/fluffos-2.7-ds2.018/testsuite/log/
tmi2_fluffos_v2/fluffos-2.7-ds2.018/testsuite/single/
tmi2_fluffos_v2/fluffos-2.7-ds2.018/testsuite/single/tests/compiler/
tmi2_fluffos_v2/fluffos-2.7-ds2.018/testsuite/single/tests/efuns/
tmi2_fluffos_v2/fluffos-2.7-ds2.018/testsuite/single/tests/operators/
tmi2_fluffos_v2/fluffos-2.7-ds2.018/testsuite/u/
tmi2_fluffos_v2/fluffos-2.7-ds2.018/tmp/
tmi2_fluffos_v2/fluffos-2.7-ds2.018/windows/
tmi2_fluffos_v2/lib/
tmi2_fluffos_v2/lib/adm/
tmi2_fluffos_v2/lib/adm/daemons/languages/
tmi2_fluffos_v2/lib/adm/daemons/network/I3/
tmi2_fluffos_v2/lib/adm/daemons/virtual/
tmi2_fluffos_v2/lib/adm/daemons/virtual/template/
tmi2_fluffos_v2/lib/adm/news/
tmi2_fluffos_v2/lib/adm/obj/
tmi2_fluffos_v2/lib/adm/obj/master/
tmi2_fluffos_v2/lib/adm/priv/
tmi2_fluffos_v2/lib/adm/shell/
tmi2_fluffos_v2/lib/adm/tmp/
tmi2_fluffos_v2/lib/cmds/
tmi2_fluffos_v2/lib/d/
tmi2_fluffos_v2/lib/d/Conf/
tmi2_fluffos_v2/lib/d/Conf/adm/
tmi2_fluffos_v2/lib/d/Conf/boards/
tmi2_fluffos_v2/lib/d/Conf/cmds/
tmi2_fluffos_v2/lib/d/Conf/data/
tmi2_fluffos_v2/lib/d/Conf/logs/
tmi2_fluffos_v2/lib/d/Conf/obj/
tmi2_fluffos_v2/lib/d/Conf/text/help/
tmi2_fluffos_v2/lib/d/Fooland/adm/
tmi2_fluffos_v2/lib/d/Fooland/data/
tmi2_fluffos_v2/lib/d/Fooland/data/attic/
tmi2_fluffos_v2/lib/d/Fooland/items/
tmi2_fluffos_v2/lib/d/TMI/
tmi2_fluffos_v2/lib/d/TMI/adm/
tmi2_fluffos_v2/lib/d/TMI/boards/
tmi2_fluffos_v2/lib/d/TMI/data/
tmi2_fluffos_v2/lib/d/TMI/rooms/
tmi2_fluffos_v2/lib/d/grid/
tmi2_fluffos_v2/lib/d/grid/adm/
tmi2_fluffos_v2/lib/d/grid/data/
tmi2_fluffos_v2/lib/d/std/
tmi2_fluffos_v2/lib/d/std/adm/
tmi2_fluffos_v2/lib/data/adm/
tmi2_fluffos_v2/lib/data/adm/daemons/
tmi2_fluffos_v2/lib/data/adm/daemons/doc_d/
tmi2_fluffos_v2/lib/data/adm/daemons/emoted/
tmi2_fluffos_v2/lib/data/adm/daemons/network/http/
tmi2_fluffos_v2/lib/data/adm/daemons/network/services/mail_q/
tmi2_fluffos_v2/lib/data/adm/daemons/network/smtp/
tmi2_fluffos_v2/lib/data/adm/daemons/news/archives/
tmi2_fluffos_v2/lib/data/attic/connection/
tmi2_fluffos_v2/lib/data/attic/user/
tmi2_fluffos_v2/lib/data/std/connection/b/
tmi2_fluffos_v2/lib/data/std/connection/l/
tmi2_fluffos_v2/lib/data/std/user/a/
tmi2_fluffos_v2/lib/data/std/user/b/
tmi2_fluffos_v2/lib/data/std/user/d/
tmi2_fluffos_v2/lib/data/std/user/f/
tmi2_fluffos_v2/lib/data/std/user/l/
tmi2_fluffos_v2/lib/data/std/user/x/
tmi2_fluffos_v2/lib/data/u/d/dm/working/doc_d/
tmi2_fluffos_v2/lib/data/u/l/leto/doc_d/
tmi2_fluffos_v2/lib/data/u/l/leto/smtp/
tmi2_fluffos_v2/lib/doc/
tmi2_fluffos_v2/lib/doc/driverdoc/applies/
tmi2_fluffos_v2/lib/doc/driverdoc/applies/interactive/
tmi2_fluffos_v2/lib/doc/driverdoc/concepts/
tmi2_fluffos_v2/lib/doc/driverdoc/driver/
tmi2_fluffos_v2/lib/doc/driverdoc/efuns/arrays/
tmi2_fluffos_v2/lib/doc/driverdoc/efuns/buffers/
tmi2_fluffos_v2/lib/doc/driverdoc/efuns/compile/
tmi2_fluffos_v2/lib/doc/driverdoc/efuns/ed/
tmi2_fluffos_v2/lib/doc/driverdoc/efuns/filesystem/
tmi2_fluffos_v2/lib/doc/driverdoc/efuns/floats/
tmi2_fluffos_v2/lib/doc/driverdoc/efuns/functions/
tmi2_fluffos_v2/lib/doc/driverdoc/efuns/general/
tmi2_fluffos_v2/lib/doc/driverdoc/efuns/mappings/
tmi2_fluffos_v2/lib/doc/driverdoc/efuns/numbers/
tmi2_fluffos_v2/lib/doc/driverdoc/efuns/parsing/
tmi2_fluffos_v2/lib/doc/driverdoc/lpc/constructs/
tmi2_fluffos_v2/lib/doc/driverdoc/lpc/preprocessor/
tmi2_fluffos_v2/lib/doc/driverdoc/lpc/types/
tmi2_fluffos_v2/lib/doc/driverdoc/platforms/
tmi2_fluffos_v2/lib/doc/mudlib/
tmi2_fluffos_v2/lib/ftp/
tmi2_fluffos_v2/lib/include/driver/
tmi2_fluffos_v2/lib/log/
tmi2_fluffos_v2/lib/log/driver/
tmi2_fluffos_v2/lib/obj/net/
tmi2_fluffos_v2/lib/obj/shells/
tmi2_fluffos_v2/lib/obj/tools/
tmi2_fluffos_v2/lib/std/adt/
tmi2_fluffos_v2/lib/std/board/
tmi2_fluffos_v2/lib/std/body/
tmi2_fluffos_v2/lib/std/fun/
tmi2_fluffos_v2/lib/std/living/
tmi2_fluffos_v2/lib/std/object/
tmi2_fluffos_v2/lib/std/shop/
tmi2_fluffos_v2/lib/std/socket/
tmi2_fluffos_v2/lib/std/user/
tmi2_fluffos_v2/lib/std/virtual/
tmi2_fluffos_v2/lib/student/
tmi2_fluffos_v2/lib/student/kalypso/
tmi2_fluffos_v2/lib/student/kalypso/armor/
tmi2_fluffos_v2/lib/student/kalypso/rooms/
tmi2_fluffos_v2/lib/student/kalypso/weapons/
tmi2_fluffos_v2/lib/u/l/leto/
tmi2_fluffos_v2/lib/u/l/leto/cmds/
tmi2_fluffos_v2/lib/www/errors/
tmi2_fluffos_v2/lib/www/gateways/
tmi2_fluffos_v2/lib/www/images/
tmi2_fluffos_v2/old/
tmi2_fluffos_v2/win32/
// drizzt wrote this and I hacked it just a little (Leto)
// Leto@earth, feb 4, 1996. Fixed channel emotes
// Support for I3 channels - Brainstorm 1.5.96
#include <daemons.h>
#include <channels.h>
#include <net/i3.h>
#include <uid.h>
void send_channel_e(string from, string visname, string channel, string message)
;

// Inserted channel things here.
void send_chan_who_req( string from, string target, string channel ) {
  I3_DAEMON->send_packet( PRT_CHAN_WHO_REQ, from, target, 0, 
			({ channel }) );
}
void send_channel_listen( string channel, int on_or_off ) {
  I3_DAEMON->send_packet( PRT_CHANNEL_LISTEN, 0, ROUTER_NAME, 0,
			({ channel, on_or_off }) );
}

void send_channel_add( string from, string channel, int type )
{ 
  I3_DAEMON->send_packet( PRT_CHANNEL_ADD, from, ROUTER_NAME, 0,
			  ({ channel, type }) );
}

void send_channel_remove( string from, string channel )
{ 
  I3_DAEMON->send_packet( PRT_CHANNEL_REMOVE, from, ROUTER_NAME, 0,
                          ({ channel }) );
}

void send_channel_admin( string from, string channel, string *add_to_list,
						      string *remove_from_list )
{ 
  I3_DAEMON->send_packet( PRT_CHANNEL_ADMIN, from, ROUTER_NAME, 0,
                          ({ channel, add_to_list, remove_from_list }) );
}

			
private static void send_channel_m(string from, string visname, string channel, string message){

    I3_DAEMON->send_packet(PRT_CHANNEL_M, from, 0, 0, ({ channel, visname, message }));
}

int daemon_apply(object user, int type, mixed *action )
{ string channel, message; 
  int emote;
 
 
  if (!user) return 0 ;
  if (base_name(previous_object())!=CHANNELS_D ) return 0;
 
  switch( type ) {
  case MSG: 
	if( sizeof( action ) != 3 ) return 0;
	channel=action[0]; 
	message=action[1];
	emote=action[2];
 
 	if(emote) {
          send_channel_e(user->query("name"), user->query("cap_name"), 
					channel, message);
	  return 0;
    	}
    	send_channel_m(user->query("name"),user->query("cap_name"),
			channel,message);
 
 
  	return 1;
  case ADM:
	if( sizeof( action ) != 4 ) return 0;
	send_channel_admin( action[0], action[1], action[2], action[3] );
	return 1;
  case LIS:
	if( sizeof( action ) != 2 ) return 0;
	send_channel_listen( action[0], action[1] );
	return 1;
  case CRE:
	if( sizeof( action ) != 3 ) return 0;
	send_channel_add( action[0], action[1], action[2] );
	return 1;
  case DEL:
	if( sizeof( action ) != 2 ) return 9;
	send_channel_remove( action[0], action[1] );
	return 1;
  case WHOREQ:
	if( sizeof( action ) != 3 ) return 0;
        send_chan_who_req( action[0], action[1], action[2] );
        return 1;
  default:
	return 0;
  }
}

static
void send_chan_who_reply( mixed *info ) {
/*      (string)   "chan-who-reply",
        (int)      5,
        (string)   originator_mudname,
        (string)   0,
        (string)   target_mudname,
        (string)   target_username,
        (string)   channel_name,
        (string *) user_list
*/
    if(sizeof(info) != 4) return;
    info[0] = I3_DAEMON->query_network_name(info[0]);
    if(!info[0] || !info[1] || !info[2] || !info[3]) return;
    I3_DAEMON->send_packet(PRT_CHAN_WHO_REPLY, 0, info[0], info[1], info[2..3] );
    return; 

}

void process_chan_who_req( mixed *info )
{
/*      (string) "chan-who-req",
        (int)    5,
        (string) originator_mudname,
        (string) originator_username,
        (string) target_mudname,
        (string) 0,
        (string) channel_name
*/
 mixed *output;
 if( sizeof( info ) != SIZ_CHAN_WHO_REQ ) return 0;
 output=({ info[2],info[3], info[6], 
	explode( CHANNELS_D->display_channel( info[6]), "," ) });
 send_chan_who_reply( output );

} 

// Show which users are listening to this channel
void process_chan_who_reply(mixed *info){

   string msg, which;
   object target;

   if( sizeof(info) != SIZ_CHAN_WHO_REPLY) return;
   target=find_living(info[5]);
   if( target ) {
     msg = "The following users from "+info[2]+" are tuned into "+info[6]+":\n";
     msg += ( implode( info[7], "   " ) + "   <End>\n" );
     message("I3", msg, target );
   }
}          
 
void process_channel_m(mixed *info){

    if(base_name(previous_object()) != I3_DAEMON) return;
    if(sizeof(info) != SIZ_CHANNEL_M) return;
    if(info[2] == MUD_NAME) return; /* This Mud */
    CHANNELS_D->parse_channel(info[6], info[8], info[7]+"@"+info[2],0);
}
 
void send_channel_e(string from, string visname, string channel, string message){

// Lousy hack to fix emote problem ...
  sscanf( message, "%*s %s", message );
  message =  "$N "  + message;
    
    I3_DAEMON->send_packet(PRT_CHANNEL_E, from, 0, 0, ({ channel, visname, message }));
}
 
void process_channel_e(mixed *info){
    string message, from;
 
    if(base_name(previous_object()) != I3_DAEMON) return;

    if(sizeof(info) != SIZ_CHANNEL_E) return;
    if(info[2] == MUD_NAME) return;
    from = sprintf("%s@%s",info[7],info[2]);
    message = replace_string(info[8],"$N",from);
//    if(message == info[8]) message = from+" "+message;
//  CHANNELS_D->parse_channel(info[6],message,info[2],1);
CHANNELS_D->parse_channel(info[6],message,"",1);
    return;
}
         
void send_channel_t(mixed *info){
/* Info should contain the following 
        originator_username,                               
        channel_name,                                       
        targetted_mudname,                                 
        targetted_username,                                 
        message_others,                                     
        message_target,                                     
        originator_visname,                                 
        target_visname                                      
*/
    if(sizeof(info) != 8) return;
    info[2] = I3_DAEMON->query_network_name(info[2]);
    if(!info[2] || !info[3] || !info[4] || !info[5]) return;
    I3_DAEMON->send_packet(PRT_CHANNEL_T,info[0], 0, 0, info[1..7]);
    return;
}
 
void process_channel_t(mixed *info){
    int directed;
    object ob;
    string from, to, mess_o, mess_t;
 
    if(sizeof(info) != SIZ_CHANNEL_T) return;
    from = info[11]+"@"+info[2];
    to = info[12]+"@"+info[7];
    if(info[7] == MUD_NAME) ob = find_living(info[8]);
    mess_o = replace_string(info[9],"$N",from);
    if(mess_o == info[9]) mess_o = from+" "+info[9];
    mess_o = replace_string(mess_o,"$O",to);
    message("I3", sprintf("[%s] %s\n",info[6], mess_o), users(), ob);
    
    mess_t = replace_string(info[10],"$N",from);
    if(mess_t == info[10]) mess_t = from+" "+info[10];
    mess_t = replace_string(mess_t,"$O","You");
    message("I3",sprintf("[%s] %s\n",info[6], mess_t), ob);
    return;
}