When I did what you want to do I used popups.dll. This allowed me to put loops in my menu to scan through the different scons. Other than that I can't think of how you would dynamically list all connections and have 3+ deep nested menus.

Oh, picwin menus. Seems like a lot of work though.

With popups.dll:

Code:
;I wrote this 4 or 5 years ago.
;Change paths to your dll.
;$hget(soulfly,$chan(%ch_i)) is the channel name cleaned up.
;these are all aliases. Load to alias section or add the word alias to each one.
;Window List
chann {
  echo -a chan 1= $1 2= $2
  var %a = $active, %m = $mnick
  mdx_pop New ch 16 16
  mdx_pop SetStyle ch bordericon bordertext
  mdx_pop LoadImg ch icon small $mdx_icon(1x)
  mdx_pop LoadImg ch icon small $mdx_icon(o)
  mdx_pop LoadImg ch icon small $mdx_icon(q)
  mdx_pop LoadImg ch icon small $mdx_icon(w)
  mdx_pop LoadImg ch icon small $mdx_icon(refresh)
  mdx_pop AddItem ch end +D,d 1 $str($chr(160),6) Windows List
  mdx_pop AddItem ch end
  var %sc = $scon(0), %sc_i = 1
  while (%sc_i <= %sc) {
    scon %sc_i | var %sx = $scon(%sc_i), %sn = $scon(%sc_i).mnick
    mdx_pop AddItem ch end 1 $chr(160) Status $str($chr(160),3) ( %sn ) $cr sta_sc %sx
    $iif(!$chan(1),mdx_pop AddItem ch end)
    var %ch = $chan(0), %ch_i = 1 | while (%ch_i <= %ch) {
      mdx_pop AddItem ch end +D $iif(%a == $chan(%ch_i),5,2) $iif(%a == $chan(%ch_i),5,1) $str($chr(160),5) -> $hget(soulfly,$chan(%ch_i)) $cr sta_sc %sx $chan(%ch_i)
      inc %ch_i | if (%ch_i > %ch) mdx_pop AddItem ch end
    }
    var %q = $query(0), %q_i = 1
    $iif(%q != 0,mdx_pop AddItem ch end $+(+D,$chr(44),d) 3 $str($chr(160),5) Whispers)
    while (%q_i <= %q) {
      var %qn = $query(%q_i)
      mdx_pop AddItem ch end $iif($1 == %qn,1,2) 1 $str($chr(160),11) %qn $cr sta_sc %sx %qn
      inc %q_i | if (%q_i > %q) mdx_pop AddItem ch end
    }
    inc %sc_i
  }
  var %w = $window(0), %w_i = 1
  $iif(%w > 1,mdx_pop AddItem ch end $+(+D,$chr(44),d) 4 Windows)
  while (%w_i <= %w) {
    var %wn = $window(%w_i)
    $iif(%wn != @uwho,mdx_pop AddItem ch end $iif($1 == %wn,1,2) 1 $str($chr(160),7) $+($chr(40),-,$chr(41)) $str($chr(160),3) $remove(%wn,@) $cr window -a %wn)
    inc %w_i
  }
  pop1 ch $mouse.dx $mouse.dy
}
sta_sc {
  scid $1
  if ($2) window -a $2
  else window -a "Status Window"
}
;popup
mdx_pop {
if ($isid) return soulfly\dll\popups.dll
else dll soulfly\dll\popups.dll $1-
}
pop1 {
tokenize 32 $dll(soulfly\dll\popups.dll,Popup,$1-)
if ($isid) return $1-
$iif($4- != did not select a menu item,$4-)
}