[Turn off line numbering]1: arg cmdstr, cmd, args; 2: var elements, db, channel, lowerchannel, msg; 3: 4: (> .perms(caller(), 'command) <); 5: elements = args.explode("="); 6: if (elements.length() != 2) { 7: return "Syntax: @addcom <alias>=<channel_name>"; 8: } else if (channel_dict.contains(elements[1])) { 9: return "You are already using that alias for a channel."; 10: } else { 11: catch any 12: channel = tosym(elements[2]); 13: with 14: throw(~stop, "Channel '" + elements[2] + "' contains invalid characters."); 15: lowerchannel = tosym(elements[2].lowercase()); 16: db = (| $channel_db.search(lowerchannel) |) || 0; 17: if (type(db) == 'list) { 18: if (type(db[3]) == 'frob && !db[3].try(sender()) && !$sys.is_system(sender())) 19: return "Sorry, channel " + db[1] + " is join-locked."; 20: msg = "Channel " + elements[2] + " added with alias " + elements[1]; 21: } else if (.can_create_channel()) { 22: db = [channel, 0, 0, 0, sender(), [sender()], 0, 0]; 23: $channel_db.insert(lowerchannel, db); 24: msg = "Channel " + elements[2] + " created with alias " + elements[1]; 25: } else { 26: return "Sorry, that channel doesn't exist, and you are not authorized to create new channels."; 27: } 28: } 29: $channel_db.value_changed(lowerchannel, db.replace(2, db[2] + 1)); 30: channel_dict = channel_dict.add(elements[1], db[1]); 31: .channel_on(db[1]); 32: return msg;
// Created 24-Jul-1996 as a part of ColdCore, see: @help Credit