src/command.h

Go to the documentation of this file.
00001 
00002 /* command.h - declarations used by the command processor */
00003 
00004 /* $Id: command.h,v 1.4 2005/08/08 09:43:05 murrayma Exp $ */
00005 
00006 #include "copyright.h"
00007 #include "config.h"
00008 
00009 #ifndef __COMMAND_H
00010 #define __COMMAND_H
00011 
00012 #include "db.h"
00013 
00014 
00015 #define CMD_NO_ARG(name) \
00016     extern void name(dbref, dbref, int)
00017 #define CMD_ONE_ARG(name) \
00018     extern void name(dbref, dbref, int, char *)
00019 #define CMD_ONE_ARG_CMDARG(name) \
00020     extern void name(dbref, dbref, int, char *, char *[], int)
00021 #define CMD_TWO_ARG(name) \
00022     extern void name(dbref, dbref, int, char *, char *)
00023 #define CMD_TWO_ARG_CMDARG(name) \
00024     extern void name(dbref, dbref, int, char *, char *, char*[], int)
00025 #define CMD_TWO_ARG_ARGV(name) \
00026     extern void name(dbref, dbref, int, char *, char *[], int)
00027 #define CMD_TWO_ARG_ARGV_CMDARG(name) \
00028     extern void name(dbref, dbref, int, char *, char *[], int, char*[], int)
00029 
00030 /* Command function handlers */
00031 
00032 
00033 /* from comsys.c */
00034 
00035 CMD_TWO_ARG(do_cemit);          /* channel emit */
00036 CMD_TWO_ARG(do_chboot);         /* channel boot */
00037 CMD_TWO_ARG(do_editchannel);    /* edit a channel */
00038 CMD_ONE_ARG(do_checkchannel);   /* check a channel */
00039 CMD_ONE_ARG(do_createchannel);  /* create a channel */
00040 CMD_ONE_ARG(do_destroychannel); /* destroy a channel */
00041 CMD_TWO_ARG(do_edituser);       /* edit a channel user */
00042 CMD_NO_ARG(do_chanlist);        /* gives a channel listing */
00043 CMD_ONE_ARG(do_chanstatus);     /* gives channelstatus */
00044 CMD_TWO_ARG(do_chopen);         /* opens a channel */
00045 CMD_ONE_ARG(do_channelwho);     /* who's on a channel */
00046 CMD_TWO_ARG(do_addcom);         /* adds a comalias */
00047 CMD_ONE_ARG(do_allcom);         /* on, off, who, all aliases */
00048 CMD_NO_ARG(do_comlist);         /* channel who by alias */
00049 CMD_TWO_ARG(do_comtitle);       /* sets a title on a channel */
00050 CMD_NO_ARG(do_clearcom);        /* clears all comaliases */
00051 CMD_ONE_ARG(do_delcom);         /* deletes a comalias */
00052 CMD_TWO_ARG(do_tapcom);         /* taps a channel */
00053 
00054 /* from mail.c */
00055 
00056 CMD_TWO_ARG(do_mail);           /* mail command */
00057 CMD_TWO_ARG(do_malias);         /* mail alias command */
00058 CMD_ONE_ARG(do_prepend);
00059 CMD_ONE_ARG(do_postpend);
00060 
00061 CMD_TWO_ARG(do_admin);          /* Change config parameters */
00062 CMD_TWO_ARG(do_alias);          /* Change the alias of something */
00063 CMD_TWO_ARG(do_attribute);      /* Manage user-named attributes */
00064 CMD_ONE_ARG(do_boot);           /* Force-disconnect a player */
00065 CMD_TWO_ARG(do_chown);          /* Change object or attribute owner */
00066 CMD_TWO_ARG(do_chownall);       /* Give away all of someone's objs */
00067 CMD_TWO_ARG(do_chzone);         /* Change an object's zone. */
00068 CMD_TWO_ARG(do_clone);          /* Create a copy of an object */
00069 CMD_NO_ARG(do_comment);         /* Ignore argument and do nothing */
00070 CMD_TWO_ARG_ARGV(do_cpattr);    /* Copy attributes */
00071 CMD_TWO_ARG(do_create);         /* Create a new object */
00072 CMD_ONE_ARG(do_cut);            /* Truncate contents or exits list */
00073 CMD_NO_ARG(do_dbck);            /* Consistency check */
00074 CMD_TWO_ARG(do_decomp);         /* Reproduce commands to recrete obj */
00075 CMD_ONE_ARG(do_destroy);        /* Destroy an object */
00076 CMD_TWO_ARG_ARGV(do_dig);       /* Dig a new room */
00077 CMD_ONE_ARG(do_doing);          /* Set doing string in WHO report */
00078 CMD_TWO_ARG_CMDARG(do_dolist);  /* Iterate command on list members */
00079 CMD_ONE_ARG(do_drop);           /* Drop an object */
00080 CMD_NO_ARG(do_dump);            /* Dump the database */
00081 CMD_TWO_ARG_ARGV(do_edit);      /* Edit one or more attributes */
00082 CMD_ONE_ARG(do_enter);          /* Enter an object */
00083 CMD_ONE_ARG(do_entrances);      /* List exits and links to loc */
00084 CMD_ONE_ARG(do_examine);        /* Examine an object */
00085 CMD_ONE_ARG(do_find);           /* Search for name in database */
00086 CMD_TWO_ARG(do_fixdb);          /* Database repair functions */
00087 CMD_TWO_ARG_CMDARG(do_force);   /* Force someone to do something */
00088 CMD_ONE_ARG_CMDARG(do_force_prefixed);  /* #<num> <cmd> variant of FORCE */
00089 CMD_TWO_ARG(do_function);       /* Make iser-def global function */
00090 CMD_ONE_ARG(do_get);            /* Get an object */
00091 CMD_TWO_ARG(do_give);           /* Give something away */
00092 CMD_ONE_ARG(do_global);         /* Enable/disable global flags */
00093 CMD_ONE_ARG(do_halt);           /* Remove commands from the queue */
00094 CMD_ONE_ARG(do_help);           /* Print info from help files */
00095 CMD_ONE_ARG(do_history);        /* View various history info */
00096 CMD_NO_ARG(do_multis);          /* View multiplayers (possibly) */
00097 CMD_NO_ARG(do_inventory);       /* Print what I am carrying */
00098 CMD_TWO_ARG(do_prog);           /* Interactive input */
00099 CMD_ONE_ARG(do_quitprog);       /* Quits @prog */
00100 CMD_TWO_ARG(do_kill);           /* Kill something */
00101 CMD_ONE_ARG(do_last);           /* Get recent login info */
00102 CMD_NO_ARG(do_leave);           /* Leave the current object */
00103 CMD_TWO_ARG(do_link);           /* Set home, dropto, or dest */
00104 CMD_ONE_ARG(do_list);           /* List contents of internal tables */
00105 CMD_ONE_ARG(do_list_file);      /* List contents of message files */
00106 CMD_TWO_ARG(do_lock);           /* Set a lock on an object */
00107 CMD_ONE_ARG(do_look);           /* Look here or at something */
00108 CMD_ONE_ARG(do_motd);           /* Set/list MOTD messages */
00109 CMD_ONE_ARG(do_move);           /* Move about using exits */
00110 CMD_TWO_ARG_ARGV(do_mvattr);    /* Move attributes on object */
00111 CMD_TWO_ARG(do_mudwho);         /* WHO for inter-mud page/who suppt */
00112 CMD_TWO_ARG(do_name);           /* Change the name of something */
00113 CMD_TWO_ARG(do_newpassword);    /* Change passwords */
00114 CMD_TWO_ARG(do_notify);         /* Notify or drain semaphore */
00115 CMD_TWO_ARG_ARGV(do_open);      /* Open an exit */
00116 CMD_TWO_ARG(do_page);           /* Send message to faraway player */
00117 CMD_TWO_ARG(do_parent);         /* Set parent field */
00118 CMD_TWO_ARG(do_password);       /* Change my password */
00119 CMD_TWO_ARG(do_pcreate);        /* Create new characters */
00120 CMD_TWO_ARG(do_pemit);          /* Messages to specific player */
00121 CMD_ONE_ARG(do_poor);           /* Reduce wealth of all players */
00122 CMD_TWO_ARG(do_power);          /* Sets powers */
00123 CMD_ONE_ARG(do_ps);             /* List contents of queue */
00124 CMD_ONE_ARG(do_queue);          /* Force queue processing */
00125 CMD_TWO_ARG(do_quota);          /* Set or display quotas */
00126 CMD_NO_ARG(do_readcache);       /* Reread text file cache */
00127 CMD_NO_ARG(do_restart);         /* Restart the game. */
00128 CMD_ONE_ARG(do_say);            /* Messages to all */
00129 CMD_NO_ARG(do_score);           /* Display my wealth */
00130 CMD_ONE_ARG(do_search);         /* Search for objs matching criteria */
00131 CMD_TWO_ARG(do_set);            /* Set flags or attributes */
00132 CMD_TWO_ARG(do_setattr);        /* Set object attribute */
00133 CMD_TWO_ARG(do_setvattr);       /* Set variable attribute */
00134 CMD_ONE_ARG(do_shutdown);       /* Stop the game */
00135 CMD_ONE_ARG(do_stats);          /* Display object type breakdown */
00136 CMD_ONE_ARG(do_sweep);          /* Check for listeners */
00137 CMD_TWO_ARG_ARGV_CMDARG(do_switch);     /* Execute cmd based on match */
00138 CMD_TWO_ARG(do_teleport);       /* Teleport elsewhere */
00139 CMD_ONE_ARG(do_think);          /* Think command */
00140 CMD_ONE_ARG(do_timewarp);       /* Warp various timers */
00141 CMD_TWO_ARG(do_toad);           /* Turn a tinyjerk into a tinytoad */
00142 CMD_TWO_ARG_ARGV(do_trigger);   /* Trigger an attribute */
00143 CMD_ONE_ARG(do_unlock);         /* Remove a lock from an object */
00144 CMD_ONE_ARG(do_unlink);         /* Unlink exit or remove dropto */
00145 CMD_ONE_ARG(do_use);            /* Use object */
00146 CMD_NO_ARG(do_version);         /* List MUX version number */
00147 CMD_TWO_ARG_ARGV(do_verb);      /* Execute a user-created verb */
00148 CMD_TWO_ARG_CMDARG(do_wait);    /* Perform command after a wait */
00149 CMD_ONE_ARG(do_wipe);           /* Mass-remove attrs from obj */
00150 CMD_NO_ARG(do_dbclean);         /* Remove stale vattr entries */
00151 CMD_TWO_ARG(do_addcommand);     /* Add or replace a global command */
00152 CMD_TWO_ARG(do_delcommand);     /* Delete an added global command */
00153 CMD_ONE_ARG(do_listcommands);   /* List added global commands */
00154 #ifdef SQL_SUPPORT
00155 CMD_TWO_ARG(do_query);          /* Trigger an externalized query */
00156 #endif
00157 /* from log.c */
00158 #ifdef ARBITRARY_LOGFILES
00159 CMD_TWO_ARG(do_log);            /* Log to arbitrary logfile in 'logs' */
00160 #endif
00161 
00162 /* Mecha stuff */
00163 CMD_TWO_ARG(do_show);
00164 CMD_ONE_ARG(do_charclear);
00165 CMD_NO_ARG(do_show_stat);
00166 
00167 #ifdef HUDINFO_SUPPORT
00168 CMD_ONE_ARG(fake_hudinfo);
00169 #endif
00170 
00171 #ifdef USE_PYTHON
00172 
00173 /* From python.c */
00174 CMD_ONE_ARG(do_python);
00175 #endif
00176 
00177 typedef struct cmdentry CMDENT;
00178 struct cmdentry {
00179     char *cmdname;
00180     NAMETAB *switches;
00181     int perms;
00182     int extra;
00183     int callseq;
00184     void (*handler) ();
00185 };
00186 
00187 typedef struct addedentry ADDENT;
00188 struct addedentry {
00189     dbref thing;
00190     int atr;
00191     char *name;
00192     struct addedentry *next;
00193 };
00194 
00195 /* Command handler call conventions */
00196 
00197 #define CS_NO_ARGS      0x0000  /* No arguments */
00198 #define CS_ONE_ARG      0x0001  /* One argument */
00199 #define CS_TWO_ARG      0x0002  /* Two arguments */
00200 #define CS_NARG_MASK    0x0003  /* Argument count mask */
00201 #define CS_ARGV         0x0004  /* ARG2 is in ARGV form */
00202 #define CS_INTERP       0x0010  /* Interpret ARG2 if 2 args, ARG1 if 1 */
00203 #define CS_NOINTERP     0x0020  /* Never interp ARG2 if 2 or ARG1 if 1 */
00204 #define CS_CAUSE        0x0040  /* Pass cause to old command handler */
00205 #define CS_UNPARSE      0x0080  /* Pass unparsed cmd to old-style handler */
00206 #define CS_CMDARG       0x0100  /* Pass in given command args */
00207 #define CS_STRIP        0x0200  /* Strip braces even when not interpreting */
00208 #define CS_STRIP_AROUND 0x0400  /* Strip braces around entire string only */
00209 #define CS_ADDED        0X0800  /* Command has been added by @addcommand */
00210 #define CS_NO_MACRO     0x1000  /* Command can't be used inside macro */
00211 #define CS_LEADIN       0x2000  /* Command is a single-letter lead-in */
00212 
00213 /* Command permission flags */
00214 
00215 #define CA_PUBLIC       0x00000000      /* No access restrictions */
00216 #define CA_GOD          0x00000001      /* GOD only... */
00217 #define CA_WIZARD       0x00000002      /* Wizards only */
00218 #define CA_BUILDER      0x00000004      /* Builders only */
00219 #define CA_IMMORTAL     0x00000008      /* Immortals only */
00220 #define CA_ROBOT        0x00000010      /* Robots only */
00221 #define CA_ANNOUNCE     0x00000020      /* Announce Power */
00222 #define CA_ADMIN        0x00000800      /* Wizard or royal */
00223 #define CA_NO_HAVEN     0x00001000      /* Not by HAVEN players */
00224 #define CA_NO_ROBOT     0x00002000      /* Not by ROBOT players */
00225 #define CA_NO_SLAVE     0x00004000      /* Not by SLAVE players */
00226 #define CA_NO_SUSPECT   0x00008000      /* Not by SUSPECT players */
00227 #define CA_NO_GUEST     0x00010000      /* Not by GUEST players */
00228 #define CA_NO_IC        0x00020000      /* Not by IC players */
00229 
00230 
00231 #define CA_GBL_BUILD    0x01000000      /* Requires the global BUILDING flag */
00232 #define CA_GBL_INTERP   0x02000000      /* Requires the global INTERP flag */
00233 #define CA_DISABLED     0x04000000      /* Command completely disabled */
00234 #define CA_NO_DECOMP    0x08000000      /* Don't include in @decompile */
00235 #define CA_LOCATION     0x10000000      /* Invoker must have location */
00236 #define CA_CONTENTS     0x20000000      /* Invoker must have contents */
00237 #define CA_PLAYER       0x40000000      /* Invoker must be a player */
00238 #define CF_DARK         0x80000000      /* Command doesn't show up in list */
00239 
00240 extern int check_access(dbref, int);
00241 extern void process_command(dbref, dbref, int, char *, char *[], int);
00242 
00243 #endif

Generated on Mon May 28 04:25:19 2007 for BattletechMUX by  doxygen 1.4.7