Method code for $channel_ui.broadcast()

[Turn off line numbering]
  1: arg channel, msg;
  2: var q, spammer_name, message, target, user;
  3: 
  4: (> .perms(sender()) <);
  5: 
  6: // is this really a command?. If so, do the command.
  7: catch any {
  8:     switch (msg) {
  9:         case "who":
 10:             if (channel in $channel_db.system_channels() && !$sys.is_system(sender()))
 11:                 return "Sorry, that's a listen only channel.";
 12:             return .channel_members(channel);
 13:         case "off":
 14:             .channel_off(channel);
 15:             return;
 16:         case "on":
 17:             .channel_on(channel);
 18:             return;
 19:     }
 20: } with {
 21:     return traceback()[1][2];
 22: }
 23: if (channel in $channel_db.system_channels() && channel != 'All)
 24:     return "Sorry, that's a listen only channel.";
 25: if (!active_channels.contains(channel))
 26:     return "You must be on a channel to send a message to it.";
 27: spammer_name = .name();
 28: if (msg[1] == "'" || msg[1] == "-") {
 29:     target = (msg.explode())[1].subrange(2);
 30:     msg = msg.subrange(target.length() + 3);
 31:     catch ~namenf
 32:         user = $user_db.match(target);
 33:     with
 34:         return target + " is not a valid user.";
 35:     if (!user.connected())
 36:         return user.name() + " is not connected.";
 37:     if (!user.channel_member(channel))
 38:         return user.name() + " is not a member of that channel.";
 39:     spammer_name += " (to " + user.name() + ")";
 40: }
 41: 
 42: // check for poses, thinking, etc.
 43: switch (msg[1]) {
 44:     case ":":
 45:         message = spammer_name + " " + msg.subrange(2);
 46:     case "%":
 47:         message = spammer_name + " . o O ( " + msg.subrange(2) + " )";
 48:     case "!":
 49:         (> .channel_moderator_ok() <);
 50:         message = msg.subrange(2);
 51:     default:
 52:         message = msg ? $code_lib.punctuation_type(msg) : "say";
 53:         message = spammer_name + " " + message + "s, \"" + msg + "\"";
 54: 
 55:         // message = spammer_name + ": " + msg;
 56: }
 57: ._broadcast(channel, message);

// Created 24-Jul-1996 as a part of ColdCore, see: @help Credit

Tlon