[Turn on line numbering]arg cmdstr, cmd, args; var elements, db, channel, lowerchannel, msg; (> .perms(caller(), 'command) <); elements = args.explode("="); if (elements.length() != 2) { return "Syntax: @addcom <alias>=<channel_name>"; } else if (channel_dict.contains(elements[1])) { return "You are already using that alias for a channel."; } else { catch any channel = tosym(elements[2]); with throw(~stop, "Channel '" + elements[2] + "' contains invalid characters."); lowerchannel = tosym(elements[2].lowercase()); db = (| $channel_db.search(lowerchannel) |) || 0; if (type(db) == 'list) { if (type(db[3]) == 'frob && !db[3].try(sender()) && !$sys.is_system(sender())) return "Sorry, channel " + db[1] + " is join-locked."; msg = "Channel " + elements[2] + " added with alias " + elements[1]; } else if (.can_create_channel()) { db = [channel, 0, 0, 0, sender(), [sender()], 0, 0]; $channel_db.insert(lowerchannel, db); msg = "Channel " + elements[2] + " created with alias " + elements[1]; } else { return "Sorry, that channel doesn't exist, and you are not authorized to create new channels."; } } $channel_db.value_changed(lowerchannel, db.replace(2, db[2] + 1)); channel_dict = channel_dict.add(elements[1], db[1]); .channel_on(db[1]); return msg;
// Created 24-Jul-1996 as a part of ColdCore, see: @help Credit