# # Patch name: FunClock # Patch version: 1 # Author's name: Ari # Author's email: ari_j@hotmail.com # Version of PennMUSH: 1.7.2p14 # Date patch made: 10/3/98 # 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. # # Originally Nveid wrote this function, didn't seem to wwork right, # gave to many errors and warnings. SpaceMUSH Hardcoder ARi took a # look at it, coudlnt' fidn why it wasn't working and he made on of # his own so it would work.. And tadda here we got it. # To once you patch this in, #define somewhere in yoru code (options.h # conf.h , localoptions.h, etc..), once you do that just compile your code # reboot and it shld work.. The purpose of this is, is basically what lock() # does, however this does it for channels, like 'think clock(Private/join)' # that will eturn something like '!#879', you can also use it to set channel # locks, clock(Private/join,!*Nveid|!*Blah) etc.. well you get the idea. *** src/funlocal.c Fri Aug 14 17:50:59 1998 --- src/funlocal.c Sat Oct 3 22:07:35 1998 *************** *** 24,29 **** --- 24,32 ---- #include "parse.h" #include "confmagic.h" #include "function.h" + #ifdef FunClock + #include "extchat.h" + #endif void local_functions _((void)); *************** *** 39,47 **** --- 42,115 ---- #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 { + safe_str("#-1 NO LOCK TYPE SPECIFIED", buff, bp); + return; + } + + 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