@verb #3797:"process_audio_openreq" this none this rxdo #833 @program #3797:"process_audio_openreq" this none this $perm_utils:can_hack() || raise(E_PERM) {comm, text, speech, chans} = args "Look for 'X to Y' or 'X to Y and Z', and open a channel if possible." suspend(0) if (!(m = match(speech, "^%(.*[^ ]%) +%(to%|calling%) +%(.*%)$"))) return 0 endif words = $max_utils:matchlist(m) words[2..2] = {} if (m = match(words[2], "^%([^.!?]*%)[.!?]+$")) words[2] = $max_utils:matchlist(m)[1] endif if (comm:who(words[1]) != comm:user()) return 0 endif "Translate names of people/rooms being called into object numbers." names = $list_utils:from_string(words[2]) callees = {} for name in (names) if (!valid(callee = this:identify_fool(name))) comm:action("error", name) return 1 else callees = setadd(callees, callee) endif endfor "Find callee communicators." callee_comms = {} for callee in (callees) if (valid(callee_comm = this:find_comm(callee))) callee_comms = {@callee_comms, {callee, callee_comm}} else comm:action("error", callee) return 1 endif endfor "Find/initialize channel." if (!(chan = this:find_chan($list_utils:slice(callee_comms, 2)))) chan = this:next_chan() this:chan_opts(chan, "autoclose") endif "Decide who's going to be joined." joining = {} for pair in (callee_comms) {callee, callee_comm} = pair if (setremove(this:ls_chan(callee_comm), chan)) comm:action("error", callee) else joining = setadd(joining, callee_comm) valid(callee_comm:user()) || callee_comm:_set_user(callee) endif endfor if (joining) this:chan_part("control", "silently", comm) this:chan_join(chan, comm, @joining) this:chan_send(chan, comm, text) endif return 1 .