########################################################################
# Podium, V2.0     Dec. 1992, Written by Zalcor@Singlenesia
#
#
# To make this file ready for uploading to the mush, it should be filtered
# with the "strip" program. The effects of this filter are as follows:
#
#   Removes all lines that have a '#' in the first column.
#   Strips leading whitespace from all lines.
#   Concatenates all lines, up until it reaches a line with a '-' in the
#      first column.
#########################################################################
#
# This object sits in the conference room, listening to all activity in
# the room. It relays this activity to the other mud(s) defined with the
# addmud command. In addition, the Podium provide the "rlook" command
# for the use of anyone in the room.
#
# The rlook command is used to look at a remote room defined in the
# podium using the addmud command (see below). It has two basic forms.
# In both forms, "rlook" may be abbreviated as "rl".
#
# The first form is used when the podium only has one other mud in it's
# list. The form is: "rlook [<object>]". If specified, <object> will be
# looked at. If unspecified, the remot room is looked at.
#
# The second form can be used in either case, but is required when there
# is more than one remote connection. The form is: "rlook <mud>=<object>".
#
# Note that the name of this object can be changed freely, without any
# further need for code changes. This object can be set DARK, or take
# any form you wish. Just change its name and give it a desc.
##########################################################################
#
# TO SET UP A CONFERENCE ROOM:
#
#   NOTE: You *must* be a wizard to install a podium
#
#   You need to know the dbref # of the room that will serve as the
#   conference room on the OTHER mud, the one you will be talking to. They
#   will need the dbref # of the room you'll be using, too.
#
#   Once you have this information, create the object defined here, either
#   by using this file, or by @cloning an already existing one. If you
#   @clone an existing Podium, be sure to execute the following commands
#   on the new object:
# 
#      1) @chown Podium=MUDLINK
#      2) @set Podium=!HALTED
#      3) @set Podium=INHERIT
#
#   Once the object is in place in your conference room, issue the command
#   "addmud <dbref #>@<mud name>". So, for instance, to add a link to
#   room #1234 on Anymud, you would type: "addmud #1234@anymud".
#
#   If you are linking many different rooms to your conference room, simply
#   issue seperate "addmud" atatements for each room.
#
#   There are also commands for unlinking a room, and for seeing what the
#   current configuration is. Typing "use podium" will give you a cheat
#   sheet of the commands.
#
#   Once set up, any actions or speech that take place in the room will be
#   seen and heard in the room you have linked to. The other mud must set up
#   their own link to send information the other way.
#
######################################################################
#
# IMPORTANT NOTE: This object must be INHERIT and owned by MUDLINK.
#                 DO NOT, under any circumstances, all MUDLINK or
#                 this object to have wizard priveledges. Anything
#                 wizardlike that needs doing, the LinkTool will
#                 do it.
#
# Please report any comments, suggestions or bugs to:
#
#      johnm@cajal.uoregon.edu
######################################################################

@create Podium
-
@lock Podium=me
-
@Listen Podium=*
-
@Ahear Podium=
   @switch match(%0,*->*)=
      0,{
         @dolist [v(mudlist)]={
            @pemit *MUDLINK=@conf %N@##=%0
         }
      }
-
&ADDMUD Podium=$addmud *:
   @switch hasflag(%#,wizard)=
   1,{
      @switch words(%0)=
         1,{
            &mudlist me=[setunion(v(mudlist),%0)];
            @pemit %#=Added new entry in the connection list.
         },
         0,{
            @pemit %#=
               Please specify which room and mud to link to.%r
               For help, type: use [name(me)]
         },
         {@pemit %#=Spaces are not allowed in the mud name}
   },{@pemit %#=Huh? (Type "help" for help.)}
-
&REMOVEMUD Podium=$removemud *:
   @switch hasflag(%#,wizard)=
   1,{
      &mudlist me=[remove(v(mudlist),%0)];
      @pemit %#=Removed entry from the connection list.
   },{@pemit %#=Huh? (Type "help" for help.)}
-
&LISTMUDS Podium=$listmuds:
   @switch hasflag(%#,wizard)=
   1,{
      @switch words(v(mudlist))=
         0,{@pemit %#=This room is not linked to any muds},
         {
            @pemit %#=
               This room is linked to the following muds:
               [iter(v(mudlist),%r##)]
         }
   },{@pemit %#=Huh? (Type "help" for help.)}
-
&RLOOK Podium=$rl*:
   @switch match(rest(X%0),*=*)=
      0,{
         @switch words(v(mudlist))=
            >1,{
               @pemit %#=
                  This room is connected to more than one mud. Please specify 
                  which mud you wish to look at. For instance, to look at 
                  foobar on AnyMud, type: rlook AnyMud=foobar
            },
            {
               @pemit *MUDLINK=
                  @rlook %N@[after(v(mudlist),@)]=
                     [before(v(mudlist),@)]@[rest(X%0)]
            }
      },
      {
         @switch match(ucstr(v(mudlist)),*@[ucstr(before(rest(X%0),=))]*)=
            0,{
               @pemit %#=
                  Unknown mud. This room is linked with:%r
                  [iter(v(mudlist),[after(##,@)]\,%b)]
            },

            {
               @pemit *MUDLINK=
                  @rlook %N@[before(rest(X%0),=)]=
                     [before(
                        extract(
                           ucstr(v(mudlist)),
                           match(
                              ucstr(v(mudlist)),
                              *@[ucstr(before(rest(X%0),=))]*
                           ),1
                        ),
                        @
                     )]@[after(rest(X%0),=)]
            }
      }
-
@Use Podium=
   [switch(hasflag(%#,wizard),1,{
      The [name(me)] accepts the following commands:%r
      %r
      addmud <room #>@<mud name>%tRelays everything in the room to the named%r
      %t%t%t%tlocation.%r
      removemud <room #>@<mudname>%tStops send output to the named mud.%r
      listmuds%t%t%tReports which muds output is being sent to.%r
      %r
      For example, to start sending output to the room with dbref #1234, on 
      AnyMud, you would type: addmud #1234@anymud
   },You can't figure out how to use that.)]
-
@Aclone Podium=&mudlist me=
-
&MLFOOTPRINT Podium=DO NOT REMOVE THIS ATTRIBUTE
-
@chown Podium=MUDLINK
-
@set Podium=!halted
-
@set Podium=INHERIT
-
drop Podium
--
