# # Patch name: FunClock # Patch version: 1.1 # Author's name: Ari & Chili@M*U*S*H # Author's email: ari_j@hotmail.com & nveid@netzero.com # Version of PennMUSH: 1.7.2p21 # Date patch made: 3/19/99 # Author is willing to support (yes/no): yes # Patch format: diff -c # # # This is a contributed PennMUSH patch. Its use is subject to the # same restrictions found in PennMUSH's hdrs/copyrite.h file. # # No warranty is given for this patch. It is not necessarily going # to work on your system, with any version of PennMUSH other than # the one above, etc. # # If the author given above was willing to support the patch, you # should write to the author if you have any questions or problems. Do # *NOT* send email messages to Javelin or any PennMUSH mailing list about # this patch! # # Below this line is the author's description of the patch, # followed by the patch itself. If the patch is in context diff # format, you'll probably apply it by typing: patch < patchfile # in your top-level MUSH directory, unless instructed otherwise # below. # # # This is a small adjustment of the previous contributed clock() # One good thing about this one, is now that you don't have to specify # the type of lock always, it will default to join lock on channels. # You also don't have to manually define this for yourself, i set it up # so it checks if side_effects & the chat system is defined before it is # enabled, but you can still disable it for yourself easy enough. # # Example to use this is, clock([/][,new lock]), uses # all the same locktypes @clock has & works similar to lock(). If the # clocktype is left out, it will default to Join Lock. If the new lock arg is # left out then you can check the lock on the channel(which till this function # hasn't been possible unless you decompiled teh channel). # # If you need any help, please just login to M*U*S*H & get ahold of chili(me), # thanx. :) *** ../pennmush/hdrs/conf.h Wed Mar 3 16:06:44 1999 --- ./hdrs/conf.h Fri Mar 19 00:26:35 1999 *************** *** 16,22 **** /*----- Miscellaneous other stuff -----*/ #define God(x) ((x) == GOD) ! /* limit on player name length */ #define PLAYER_NAME_LIMIT 16 --- 16,25 ---- /*----- Miscellaneous other stuff -----*/ #define God(x) ((x) == GOD) ! /* Function Equivalent for @clock, 'clock()', defined below */ ! #if (defined(FUNCTION_SIDE_EFFECTS) && defined(CHAT_SYSTEM)) ! #define FunClock ! #endif /* limit on player name length */ #define PLAYER_NAME_LIMIT 16 *** ../pennmush/src/funlocal.c Fri Mar 19 00:41:05 1999 --- ./src/funlocal.c Fri Mar 19 00:35:26 1999 *************** *** 24,29 **** --- 24,32 ---- #include "parse.h" #include "confmagic.h" #include "function.h" + #ifdef FunClock + #include "extchat.h" + #endif void local_functions _((void)); *************** *** 38,47 **** --- 41,113 ---- } #endif + #ifdef FunClock + FUNCTION(local_fun_clock) { + CHAN *c = NULL; + char *p = NULL; + struct boolexp *lock_ptr = NULL; + int which_lock = 0; + + if((p = strchr(args[0], '/'))) { + *p++ = '\0'; + } else { + p = "JOIN"; + } + + switch(find_channel(args[0], &c)) { + case CMATCH_NONE: + safe_str("#-1 NO SUCH CHANNEL", buff, bp); + return; + case CMATCH_AMBIG: + safe_str("#-2 AMBIGUOUS CHANNEL MATCH", buff, bp); + return; + } + + if(!strcasecmp(p, "JOIN")) { + which_lock = CL_JOIN; + lock_ptr = ChanJoinLock(c); + } else if(!strcasecmp(p, "SPEAK")) { + which_lock = CL_SPEAK; + lock_ptr = ChanSpeakLock(c); + } else if(!strcasecmp(p, "MOD")) { + which_lock = CL_MOD; + lock_ptr = ChanModLock(c); + } else if(!strcasecmp(p, "SEE")) { + which_lock = CL_SEE; + lock_ptr = ChanSeeLock(c); + } else if(!strcasecmp(p, "HIDE")) { + which_lock = CL_HIDE; + lock_ptr = ChanHideLock(c); + } else { + safe_str("#-1 NO SUCH LOCK TYPE", buff, bp); + return; + } + + if(nargs == 2) { + if(!command_check_byname(executor, "@clock")) { + safe_str("#-1 PERMISSION DENIED", buff, bp); + return; + } + do_chan_lock(executor, args[0], args[1], which_lock); + return; + } + + if(Chan_Can_Decomp(c, executor)) { + safe_str(unparse_boolexp(executor, lock_ptr, 1), buff, bp); + return; + } else { + safe_str("#-1 PERMISSION DENIED", buff, bp); + return; + } + } + #endif /* FunClock */ void local_functions() { + #ifdef FunClock + function_add("CLOCK", local_fun_clock, 1, 2, FN_REG); + #endif /* FunClock */ #ifdef EXAMPLE function_add("SILLY", local_fun_silly, 1, 1, FN_REG); #endif