Peace & Protection 4.00 — File Browser

PeaceProtection4.00v4.0 / PeaceProtection4.00v4.0 / SCRIPT / FAVORITE.MRC

FAVORITE.MRC — 28.25 KB — Download this file

; #= P&P -rs
; ########################################
; Peace & Protection
; Favorites, also default theme
; ########################################

;
; Add to favorites dialog
;
dialog favadd {
  title "Add to Favorites"
  size -1 -1 300 120

  text "&Channel(s) to add to favorites?", 202, 14 10 280 20

  edit "", 1, 10 30 280 22, result autohs

  check "", 2, 11 60 280 16

  button "OK", 101, 60 86 80 25, OK default
  button "Cancel", 102, 160 86 80 25, cancel
}
on *:DIALOG:favadd:init:*:{
  if (%.net) did -c $dname 2
  elseif (%!net != Offline) %.net = %!net
  else { %.net = (unknown) | did -b $dname 2 | did -f $dname 1 }
  did -a $dname 2 &Only for %.net network favorites
  if ($active ischan) did -a $dname 1 $active
unset %.net
}
on *:DIALOG:favadd:sclick:101:if ($did(2).state) set -u1 %.net $gettok($did(2),3,32) | else unset %.net

;
; Favorites
;

; /fav
; /fav +/- [network] [#channel(s)]
; /fav j [on/off]
; /fav c
alias fav {
  var %todo,%net,%chan,%ndisp,%fav,%num = 1
  if ($_ischan($2)) %todo = $_c2s($2-)
  else { %todo = $_c2s($3-) | %net = $2 }
  if ($1 == c) {
    if ($_favnets == $null) disp Your favorites are already empty.
    else {
      _okcancel 1 Delete ALL favorite channels?
      remini $_cfg(config.ini) fav | disp All favorites deleted. (cleared)
    }
  }
  elseif ($1 == +) {
    if (%todo == $null) { set %.net %net | %todo = $_c2s($$dialog(favadd,favadd,-4)) | %net = %.net }
    if (%net) %ndisp = (on %net $+ )
    else %net = all
    %fav = $_cfgx(fav,%net)
    :loop
    %chan = $gettok(%todo,%num,32)
    if (%chan) {
      %chan = $_patch(%chan)
      if ($istok(%fav,%chan,44)) disp $:t(%chan) is already in your favorites. (cannot add)
      else { %fav = $addtok(%fav,%chan,44) | disp Added $:t(%chan) to favorites. %ndisp }
      inc %num | goto loop
    }
    _cfgxw fav %net %fav
  }
  elseif ($1 == -) {
    if (%todo == $null) %todo = $_c2s($_entry(0,$iif($active ischan,$active,$null),Channel(s) to remove from favorites?))
    %net = $_favnets
    if (%net == $null) _error You have no favorites to remove.
    var %found,%numn,%netc
    :loopA
    %chan = $gettok(%todo,%num,32)
    if (%chan) {
      %chan = $_patch(%chan)
      %numn = $numtok(%net,44)
      %found = 0
      :loopB
      %netc = $gettok(%net,%numn,44)
      %fav = $_cfgx(fav,%netc)
      if ($istok(%fav,%chan,44)) {
        disp Removed $:t(%chan) from favorites. $iif(%netc != all,(on [ [ %netc ] $+ ] ))
        %fav = $remtok(%fav,%chan,44)
        _cfgxw fav %netc %fav
        %found = 1
      }
      if (%numn > 1) { dec %numn | goto loopB }
      if (%found == 0) disp $:t(%chan) is not in your favorites. (cannot remove)
      inc %num | goto loopA
    }
  }
  elseif ($1 == j) {
    if ($2 == on) { disp Favorites will be automatically joined when you connect to IRC. | _cfgw fav.auto 1 }
    elseif ($2 == off) { disp Favorites will $:b(not) be joined when you connect to IRC. | _cfgw fav.auto 0 }
    else {
      if ($_favs(%!net)) {
        if ($_favs(%!net,1)) { _linedance j $ifmatch | disp Joining favorite channels... }
        else disp You are already on all of your favorite channels.
      }
      elseif ($2 != x) _error You have no favorite channels to join.Use /fav + to add to your favorites.
    }
  }
  else _dialog -md favorites favorites
}

; Returns a comma delimited list of what networks (and 'all' if used) there are stored favorites for
; 'all' will always be LAST if present
alias -l _favnets {
  var %line,%ret,%file = $_cfg(config.ini),%num = $read -tns[fav] %file
  if ($readn == $null) return
  %num = $calc($readn + 1)
  :loop
  %line = $read -tnl [ $+ [ %num ] ] %file
  if ((%line) && (= isin %line)) { %ret = $addtok(%ret,$gettok(%line,1,61),44) | inc %num | goto loop }
  if ($istok(%ret,all,44)) %ret = $remtok(%ret,all,44) $+ ,All
  return %ret
}
; $_favs([network[,minus]])
; Returns list of favorites for given network plus favorites for all, minus dupes; minus current chans if 'minus' param is true
alias -l _favs {
  var %fav1 = $_cfgx(fav,all),%fav2 = $_cfgx(fav,$1)
  if (%fav2) {
    var %num = $numtok(%fav2,44)
    :loop1
    %fav1 = $addtok(%fav1,$gettok(%fav2,%num,44),44)
    if (%num > 1) { dec %num | goto loop1 }
  }
  if (($chan(0)) && ($2)) {
    var %num = $chan(0)
    :loop2
    %fav1 = $remtok(%fav1,$chan(%num),44))
    if (%num > 1) { dec %num | goto loop2 }
  }
  return %fav1
}

; Prepare popup list
alias _favpop {
  unset %_fpop??
  var %count = 1,%num = 1,%fav = $_cfgx(fav,all)
  :loop1
  if ($gettok(%fav,%num,44)) {
    %_fpopa [ $+ [ %num ] ] = %count $+ . $replace($ifmatch,&,&&)
    inc %count
    if (%num < 5) { inc %num | goto loop1 }
  }
  %fav = $_cfgx(fav,%!net)
  %num = 1
  :loop2
  if ($gettok(%fav,%num,44)) {
    %_fpopb [ $+ [ %num ] ] = %count $+ . $replace($ifmatch,&,&&)
    inc %count
    if (%num < 5) { inc %num | goto loop2 }
  }
  return
}

;
; Favorites editor
;

dialog favorites {
  title "Favorites"
  size -1 -1 390 310

  text "Select or add a favorites group... (by network)", 201, 10 10 300 20

  combo 1, 10 30 180 100, sort edit

  button "A&dd", 11, 200 30 80 25
  button "Re&move", 12, 200 60 80 25

  text "...then add or remove channels.", 202, 10 130 200 20

  combo 2, 10 150 180 100, edit

  button "&Add", 21, 200 150 80 25
  button "&Remove", 22, 200 180 80 25
  button "&Join", 23, 200 210 80 25
  button "&Up", 24, 290 150 80 25
  button "D&own", 25, 290 180 80 25

  check "Join &favorites on connect", 101, 10 250 140 16
  check "Auto-fill &channels menu to", 102, 160 250 140 16
  text "&entries", 203, 332 251 40 20
  edit "", 103, 304 247 25 22

  button "Do&ne", 104, 110 276 80 25, OK default
  button "&Help", 105, 200 276 80 25, disable

  edit "", 200, 1 1 1 1, hide autohs
}
on *:DIALOG:favorites:sclick:102:if ($did(102).state) did -n favorites 103 | else did -m favorites 103
on *:DIALOG:favorites:init:*:{
  if ($_cfgi(fav.auto)) did -c favorites 101
  if ($_cfgi(fill.chan)) did -c favorites 102
  else did -m favorites 103
  did -a favorites 103 $_cfgi(num.chan)

  var %net,%nets = $addtok($_favnets,All,44),%num = $numtok(%nets,44)
  :loop
  %net = $gettok(%nets,%num,44)
  did -a favorites 1 $iif(%net == all,(all networks),%net)
  if (%num > 1) { dec %num | goto loop }
  did -a favorites 1 (channels menu)
}
on *:DIALOG:favorites:edit:1:{
  did -t favorites 11
  loadfavs $did($did)
}
on *:DIALOG:favorites:sclick:1:{
  if ($did($did,$did($did).sel) == (all networks)) loadfavs all
  elseif ($did($did,$did($did).sel) != (channels menu)) loadfavs $ifmatch
  else loadfavs chan
}
on *:DIALOG:favorites:sclick:11:{
  if (($did(1) == all) || ($did(1) == chan)) { did -f favorites 2 | return }
  if ($chr(32) isin $did(1)) return
  var %num = $did(1).lines
  :loop
  if ($did(1,%num) == $did(1)) did -c favorites 1 %num
  else {
    if (%num > 1) { dec %num | goto loop }
    did -ca favorites 1 $did(1)
  }
  did -t favorites 104
  loadfavs $did(1)
  did -f favorites 2
}
on *:DIALOG:favorites:sclick:12:{
  if (($did(1).sel) && ($chr(32) !isin $did(1,$did(1).sel))) {
    did -r favorites 2
    did -o favorites 200 1 $did(1)
    updchans
    did -d favorites 1 $did(1).sel
    did -u favorites 1
  }
}
on *:DIALOG:favorites:edit:2:{
  did -t favorites 21
}
on *:DIALOG:favorites:sclick:21:{
  if ($did(1) == $null) return
  if (($chr(32) isin $did(2)) || ($_not($_ischan($did(2))))) return
  var %num = $did(2).lines
  :loop
  if (($did(2,%num) != $did(2)) || (%num < 1)) {
    if (%num > 1) { dec %num | goto loop }
    did -ca favorites 2 $did(2)
    did -o favorites 200 1 $did(1)
  }
  did -t favorites 104
  did -u favorites 2
}
on *:DIALOG:favorites:sclick:22:{
  if ($did(2).sel) {
    did -d favorites 2 $did(2).sel
    did -c favorites 2 $ifmatch
    did -o favorites 200 1 $did(1)
  }
}
on *:DIALOG:favorites:sclick:23:if ($did(2)) join $did(2)
on *:DIALOG:favorites:sclick:24:{
  if ($did(2).sel > 1) {
    did -i favorites 2 $calc($did(2).sel + 1) $did(2,$calc($did(2).sel - 1))
    did -d favorites 2 $calc($did(2).sel - 1)
    did -o favorites 200 1 $did(1)
  }
}
on *:DIALOG:favorites:sclick:25:{
  if (($did(2).sel) && ($did(2).sel < $did(2).lines)) {
    did -i favorites 2 $did(2).sel $did(2,$calc($did(2).sel + 1))
    did -d favorites 2 $calc($did(2).sel + 1)
    did -o favorites 200 1 $did(1)
  }
}
on *:DIALOG:favorites:sclick:104:{
  updchans
  _cfgw fav.auto $did(101).state
  _cfgw fill.chan $did(102).state
  if ($did(103) isnum 1-15) _cfgw num.chan $int($did(103))
}

alias -l loadfavs {
  updchans
  did -r favorites 2
  if ($1 = chan) {
    var %num = 1
    :loop1
    if (%=chan. [ $+ [ %num ] ] ) {
      did -a favorites 2 $ifmatch
      inc %num | goto loop1
    }
  }
  else {
    var %fav = $_cfgx(fav,$1),%num = 1
    :loop2
    if ($gettok(%fav,%num,44)) {
      did -a favorites 2 $ifmatch
      inc %num | goto loop2
    }
  }
}
alias -l updchans {
  if ($did(200)) {
    if ($did(200) == (all networks)) updfavs all
    elseif (($did(200) == chan) || ($did(200) == (channels menu))) updmenu
    else updfavs $did(200)
    did -r favorites 200
  }
}
alias -l updfavs {
  var %set,%num = 1
  :loop
  if ($did(2,%num)) {
    %set = $addtok(%set,$ifmatch,44)
    inc %num | goto loop
  }
  _cfgxw fav $1 %set
}
alias -l updmenu {
  _recclr chan
  var %num = $did(2).lines
  :loop
  if (%num > 0) {
    _recent chan 15 $did(2,%num)
    dec %num | goto loop
  }
}

;
; Default theme aliases (any codes are probably ^O)
;

alias <chan.txt> return < $+ $_nwrap($1,$3,$4) $+ > $6-
alias <chan.act> return * $1 $6-
alias <chan.not> return - $+ $1: $+ $4 $+ - $6-
alias <chan.you.txt> if ($_optn(0,23)) return < $+ $_nwrap($1,%!myself,$4) $+ > $6- | return > $6-
alias <chan.you.act> return * $1 $6-
alias <query.txt> return < $+ $1> $6-
alias <query.act> return * $1 $6-
alias <query.you.txt> if ($_optn(0,23)) return < $+ $1> $6- | return > $6-
alias <query.you.act> return * $1 $6-
alias <dqwin.txt> return * $+ $1 $+ * $6-
alias <dqwin.act> return * $1 $6-
alias <priv.txt> return * $+ $1 $+ * $6-
alias <priv.act> return * $+ $1 $+ * $6-
alias <priv.not> return - $+ $1 $+ - $6-
alias <priv.you.txt> return -> * $+ $5 $+ * $6-
alias <priv.you.act> return -> * $+ $5 $+ * $6-
alias <priv.you.not> return -> - $+ $5 $+ - $6-
alias <dcc.txt> return < $+ $1> $6-
alias <dcc.act> return * $1 $6-
alias <dcc.you.txt> if ($_optn(0,23)) return < $+ $1> $6- | return > $6-
alias <dcc.you.act> return * $1 $6-
alias <clones> if ($1) return - $:b(Clones) $+ : $1 from $gettok($2,2-,33) ( $+ $_s2cs($3-) $+ ) $iif(%`show.fkeys,CtrlF1 whois; ShiftF8 ping)
alias <chan.join> {
  if ($_optn(2,19)) { if ($_optn(0,2)) return *** Joins: $1 ( $+ $2) $<clones>($7,$8,$9) | else return *** Joins: $1 $<clones>($7,$8,$9) }
  else { if ($_optn(0,2)) return *** $1 ( $+ $2) has joined $4 $<clones>($7,$8,$9) | else return *** $1 has joined $4 $<clones>($7,$8,$9) }
}
alias <chan.part> {
  if ($_optn(2,19)) {
    if ($_optn(0,2)) return *** Parts: $1 ( $+ $2) $iif($6,$chr(40)) $+ $iif($6,$6-) $+ $iif($6,$chr(41))
    else return *** Parts: $1 $iif($6,$chr(40)) $+ $iif($6,$6-) $+ $iif($6,$chr(41))
  }
  else {
    if ($_optn(0,2)) return *** $1 ( $+ $2) has left $4 $iif($6,$chr(40)) $+ $iif($6,$6-) $+ $iif($6,$chr(41))
    else return *** $1 has left $4 $iif($6,$chr(40)) $+ $iif($6,$6-) $+ $iif($6,$chr(41))
  }
}
alias <chan.quit> {
  if ($_optn(2,19)) return *** Quits: $1 $iif($6,$chr(40)) $+ $iif($6,$6-) $+ $iif($6,$chr(41))
  else return *** $1 has quit IRC $iif($6,$chr(40)) $+ $iif($6,$6-) $+ $iif($6,$chr(41))
}
; this is one that you are allowed to halt
alias <chan.you.join> return *** Now talking in $4
alias <status.join> {
  if ($_optn(2,19)) { if ($_optn(0,2)) return *** Joins $4: $1 ( $+ $2) $<clones>($7,$8,$9) | else return *** Joins $4: $1 $<clones>($7,$8,$9) }
  else { if ($_optn(0,2)) return *** $1 ( $+ $2) has joined $4 $<clones>($7,$8,$9) | else return *** $1 has joined $4 $<clones>($7,$8,$9) }
}
alias <status.part> {
  if ($_optn(2,19)) {
    if ($_optn(0,2)) return *** Parts $4: $1 ( $+ $2) $iif($6,$chr(40)) $+ $iif($6,$6-) $+ $iif($6,$chr(41))
    else return *** Parts $4: $1 $iif($6,$chr(40)) $+ $iif($6,$6-) $+ $iif($6,$chr(41))
  }
  else {
    if ($_optn(0,2)) return *** $1 ( $+ $2) has left $4 $iif($6,$chr(40)) $+ $iif($6,$6-) $+ $iif($6,$chr(41))
    else return *** $1 has left $4 $iif($6,$chr(40)) $+ $iif($6,$6-) $+ $iif($6,$chr(41))
  }
}
alias <status.quit> return *** $1 ( $+ $2) Quit $iif($6,$chr(40)) $+ $iif($6,$6-) $+ $iif($6,$chr(41))
alias <chan.kick> return *** $5 was kicked by $1 ( $+ $6-)
alias <chan.you.kick> return *** You were kicked by $1 ( $+ $6-)
alias <chan.you.attempt> return *** Attempting to rejoin...
alias <chan.you.rejoin> return *** Rejoined channel $4
alias <status.you.kick> return *** You were kicked from $4 by $1 ( $+ $6-)
alias <chan.nick> return *** $1 is now known as $5
alias <status.you.nick> return *** Your nick is now $5
alias <chan.topic> return *** $1 changes topic to ' $+ $6- $+ '
alias <chan.mode> return *** $1 sets mode: $6-
alias <status.mode> return *** $1 sets $4 mode: $6-
alias <chan.op.txt> return * $+ $1: $+ $5* $6-
alias <chan.op.act> return * $1: $+ $5 $6-
alias <chan.op.not> return - $+ $1: $+ $5 $+ - $6-
alias <chan.you.op.txt> return -> $6-
alias <chan.you.op.act> return -> $6-
alias <chan.you.op.not> return -> $6-
alias <mass.notice> return -> $6-

; <disp.whois> [window] [nickname] [ident] [host] [nick or hidden or blanks]
; (final parameter is 'nickname' used for second+ lines and may be multiple 'words')
; %-mwho.type = is or was
; %-mwho.real = 'real name'
; %-mwho.ircop = ircop line
; %-mwho.misc = other info
; %-mwho.serv = server
; %-mwho.servinfo = server info
; %-mwho.chan = channels
; %-mwho.chanbare = channels bare (no - or @%+ junk)
; %-mwho.away = away msg
; %-mwho.signoff = signoff time
; %-mwho.signon = signon timestamp
; %-mwho.idle = idle time
; %.end = end message (whois only)
alias <disp.whois> {
  var %sep = $_cfgi(whois.sep)
  if (%sep) dispr-div $1
  _dispw $1 $:t($2) %-mwho.type $:s($3) $+ @ $+ $:s($4)
  _dispw $1 $5- %-mwho.type $:wq(%-mwho.real)
  if (%-mwho.serv) _dispw $1 $5- $iif(%-mwho.type == was,was) on $:s(%-mwho.serv) $iif(($_cfgi(whois.serv)) && (%-mwho.servinfo),$:wq(%-mwho.servinfo))
  if (%-mwho.ircop) _dispw $1 $5- %-mwho.ircop
  if (%-mwho.misc) _dispw $1 $5- %-mwho.misc
  if (%-mwho.chan) {
    _dispw $1 $5- on $_format.chans(%-mwho.chan)
    _w.show³ $1 $_s2c(%-mwho.chanbare) $5-
  }
  if (%-mwho.away) _dispw $1 $5- $iif(%-mwho.type == was,was) away $:wq(%-mwho.away)
  if (%-mwho.signoff) _dispw $1 $5- signed off $:h(%-mwho.signoff)
  if (%-mwho.signon) _dispw $1 $5- idle $:h($_dur(%-mwho.idle)) $+ , signed on $:wq($_datetime(%-mwho.signon))
  elseif (%-mwho.idle) _dispw $1 $5- idle $:h($_dur(%-mwho.idle))
  if (%sep) _dispw-div $1
  if (%.end) _dispw $1 End of $:s(WHOIS) matching $:t(%.end) $iif(@ isin $1,(right-click for options),(see P&P menu for whois options))
}
; used from _w.show³
alias <disp.whois2> _dispw $1 $5- on channel " $+ $:s($2) $+ " containing $3-4

; <no.whois> [window] [nickname] [WHOIS/WHOWAS]
alias <no.whois> _dispw $1 $:n($2) $iif($3 == WHOIS,No,There was no) such user ( $+ $:s($3) $+ )

; <disp.who> [window] [whoparams] (unmodified- $2 matches to $2 and so on)
alias <disp.who> {
  if ($2 == *) dispr $1 $:t($6) is $:s($3) $+ @ $+ $:s($4) $+  ( $+ $iif(G isin $7,away,not away) $+ $iif(* isin $7,; IRCop) $+ $iif(d isin $7,; deaf) $+ )
  else dispr $1 $:t($6) is $:s($3) $+ @ $+ $:s($4) $+ , on $remove($iif(@ isin $7,@,$iif(% isin $7,%,$iif(+ isin $7,+,0))),0) $+ $:s($2) $+  ( $+ $iif(G isin $7,away,not away) $+ $iif(* isin $7,; IRCop) $+ $iif(d isin $7,; deaf) $+ )
  dispr $1 $iif(%`whois.nick == on,$:t($6),$iif(%`whois.nick == hide,$:b($:mc(back,$6)),   )) is $:wq($9-) on $:s($5) ( $+ $8 hops)
}

; <end.who> [window] [pattern] [count]
alias <end.who> {
  if ($3 == 0) dispr $1 End of $:s(WHO) matching $:t($2) - No users found
  else { dispr $1 End of $:s(WHO) matching $:t($2) - $:s($3) $iif($3 > 1,users,user) found | dispr-div $1 }
}

; Simple error raws
alias <no.serv> disps No such server $:s($1)
alias <no.cmd> disps Server does not recognize $:s($1) command
alias <no.chan> disps $:cl($1) No such channel
alias <no.user> disprs $1 $:n($1) No such user
alias <nick.in.use> disps $:n($1) Nickname already in use! $:s(CtrlF1) to whois; $:s(CtrlF9) to automatically take nick when available
alias <no.exist> disprs $1 $:cl($1) Channel does not exist
; $1 = chan, $2 = reason (1 +n 2 +m 3 desynch 4 +b)
alias <no.speak> {
  goto $2
  :1 | disps $:cl($1) Cannot send to channel- No $:s(outside messages) allowed | return
  :2 | disprs $1 $:cl($1) Cannot send to channel- $:s(Moderated) | return
  :3 | disprs $1 $:cl($1) Cannot send to channel- Probable $:s(desynch) detected | return
  :4 | disprs $1 $:cl($1) Cannot send to channel- You are $:s(banned) or channel may be $:s(desynched)
}
alias <no.on> disprs $1 $:cl($1) $:t($2) is not on channel
alias <no.you> disprs $1 $:cl($1) You are not on that channel
; $1 = chan, $2 = reason (1 +l 2 +i 3 +b 4 +R 5 +k 6 +k but trying keys, 7 +k and tried all keys), $3 = fkey, or number of stored keys for reason 6
alias <no.join> {
  goto $2
  :1 | disprs $1 $:cl($1) Cannot join channel- Channel is $:s(full) (mode $:s(+l) $+ ) Press $:s($3) to keep trying to join | return
  :2 | disprs $1 $:cl($1) Cannot join channel- You must be $:s(invited) (mode $:s(+i) $+ ) Press $:s($3) to keep trying to join | return
  :3 | disprs $1 $:cl($1) Cannot join channel- You are $:s(banned) (mode $:s(+b) $+ ) Press $:s($3) to keep trying to join | return
  :4 | disprs $1 $:cl($1) Cannot join channel- You must have a $:s(registered nick) (mode $:s(+R) $+ ) Press $:s($3) to keep trying to join | return
  :5 | disprs $1 $:cl($1) Cannot join channel- You need the correct $:s(key) (mode $:s(+k) $+ ) Press $:s($3) to keep trying to join | return
  :6 | disprs $1 $:cl($1) Cannot join channel- You need the correct $:s(key) (mode $:s(+k) $+ ) Attempting stored key(s)... ( $+ $:t($3) stored) | return
  :7 | disprs $1 $:cl($1) Failed to join channel- Stored keys incorrect; Press $:s($3) to keep trying to join
}
alias <no.op> disprs $1 $:cl($1) Sorry, you aren't a channel operator

; Simple display raws
alias <disp.away> dispr $1 $:n($1) User is away $:wq($2-)
alias <disp.mode> if ($2 == +) disprs $1 $:cl($1) mode- $:s((none)) | else disprs $1 $:cl($1) mode- $:s($2-)
alias <disp.url> disprs $1 $:cl($1) url- $:h($2-)
alias <disp.ts> disprs $1 $:cl($1) formed- $:h($_datetime($2))
alias <disp.notopic> disprs $1 $:cl($1) topic- $:s((none))
alias <disp.topic> disprs $1 $:cl($1) topic- $:q($2-)
alias <disp.topicset> disprs $1 $:cl($1) topic- set by $:t($2) ( $+ $:h($_datetime($3)) $+ )

alias <disp.joinpre> disprs-div $1

; Names / user count displays
; names1 = channel, names2 = status
alias <disp.names1> disprs $1 $:cl($1) names- $:s($replace($5-,@,$2,+,$3,%,$4))
alias <disp.names2> disps $:cl($1) names- $:s($replace($5-,@,$2,+,$3,%,$4))
; <disp.users> [channel] [total] [ops] [voiced] [regulars]
alias <disp.users> {
  disprs $1 $:cl($1) users- $:t($2) total $iif($2 == 1,user,users)
  if ($2 != $5) {
    var %users
    if ($3) %users = - $:t($3) $iif($3 == 1,op,ops) $:s($_p($3,$2))
    if ($4) %users = %users - $:t($4) voiced $:s($_p($4,$2)) 
    if ($5) %users = %users - $:t($5) $iif($5 == 1,other,others) $:s($_p($5,$2))
    disprs $1 $:cl($1) users $+ %users
  }
  disprs-div $1
}
alias <disp.nousers> disprs $1 $:cl($1) No users on channel, or channel is secret/private
alias <disp.allinvis> disprs $1 $:cl($1) All users on channel are invisible

; Away stuff
; $1 pager (quiet/1/0) $2 logging (1/0) $3- reason
alias <set.away> disp You are now marked as away. ( $+ $3- $+ ) Pager: $upper($iif($1 == quiet,quiet,$_tf2o($1))) / Logging: $upper($_tf2o($2))
; $6- old reason %.gone duration gone ($1- = %!away)
alias <set.back> disp You are no longer marked as away. ( $+ $6- $+ ) Gone: %.gone
; $1 num msgs $2 num notices $3 num chan msgs $4 num events
alias <away.log> {
  var %logged
  if ($1) %logged = , $:b($1) $iif($1 == 1,message,messages)
  if ($2) %logged = %logged $+ , $:b($2) $iif($2 == 1,notice,notices)
  if ($3) %logged = %logged $+ , $:b($3) channel $iif($3 == 1,msg,msgs)
  if ($4) %logged = %logged $+ , $:b($4) $iif($4 == 1,event,events)
  if (%logged) disp Logged while away- $right(%logged,-1) $iif(%`show.fkeys,- [ $:s(CtrlF12) ] to view away log)
  else disp Nothing was logged while you were away.
}
; <pager> [window] [nickname] [ignore?] [how] [pageron/off] [message (many words)]
alias <pager> dispr $1 $iif($chan ischan,$:c($chan)) $:x Paged by $:t($2) $_p2s($4) (Pager is $iif($3,being ignored,$iif($5,ON,OFF)) $+ ) $iif($6,Message-) $iif($6,$:q($6-))

; CTCP/reply (ping?) stuff
alias -l _form.ctcp if ($2 != $null) return $:s($1) : $:s($2-) | return $:s($1)
alias -l _show.ctcp if ($chan) dispr $chan $:cl($chan) $:x $1- $iif($me isop $chan,(F8 to punish)) | else disp $:x $1-
alias <ctcp.echo> _show.ctcp $iif($3 == ECHO,CTCP) $:s($upper($3)) from $:t($1) ( $+ $:s($len($3-)) bytes) $:x Ignored
alias <ctcp.ignore> _show.ctcp CTCP $_form.ctcp($3,$4-) from $:t($1) $:x Ignored
alias <ctcp.ping1> if (%`show.pingcode) _show.ctcp $:s(PING) from $:t($1) ( $+ $4- $+ ) | else _show.ctcp $:s(PING) from $:t($1)
alias <ctcp.ping2> if (%`show.pingcode) _show.ctcp $:s(PING) from $:t($1) ( $+ $4- $+ ) $:x Sent $:q(%.creply) | else _show.ctcp $:s(PING) from $:t($1) $:x Sent $:q(%.creply)
alias <ctcp.other1> _show.ctcp CTCP $_form.ctcp($4,$5-) from $:t($1) $:x No known reply, press $:s($3) to reply
alias <ctcp.other2> _show.ctcp CTCP $_form.ctcp($3,$4-) from $:t($1) $:x Replied $:q(%.creply)
alias <ctcp.other3> _show.ctcp CTCP $_form.ctcp($3,$4-) from $:t($1)
; for invalid dccs only- $1 nick $2 addr $3 s2p reason $4- full ctcp
alias <ctcp.dcc> _show.ctcp Invalid DCC from $:t($1) $:x $_p2s($3) ( $+ $4- $+ )

; $1 = target $2- = sent
alias <send.ctcp> {
  if (($2- == USERINFO) || ($2- == CLIENTINFO)) dispr $1 $:x $:s($2) requested from $:t($1)
  elseif ($istok(SCRIPT FINGER TIME VERSION,$2-,32)) dispr $1 $:x $:s($2) info requested from $:t($1)
  elseif ($3 == $null) dispr $1 $:x $:s($2) sent to $:t($1)
  elseif ($2 == PAGE) dispr $1 $:x $:s(PAGE) sent to $:t($1) $:x Message $:q($3-)
  else dispr $1 $:x $:s($2) : $:s($3-) sent to $:t($1)
}
; $1 target $2- reply
alias <send.reply> if ($3 == $null) dispr $1 $:x Reply of $:s($2) sent to $:t($1) | else dispr $1 $:x Reply of $:s($2) : $:s($3-) sent to $:t($1)
; $1 target $2 type of ping $3- ping code
alias <send.ping> dispr $1 $:x $iif($2 != ping,$:s($2)) $:s(PING) sent to $:t($1)

; $1 target $2 type of ping $3 0 for new average 1 for latest average $4 average (in secs) or blank for none
alias <ping.avg> {
  if ($4 == $null) dispr $1 $:cl($1) $:x No average $iif($2 != ping,$:s($2)) $:s(PING) reply known
  elseif ($3 == 1) dispr $1 $:cl($1) $:x Latest average $iif($2 != ping,$:s($2)) $:s(PING) reply- $:s($_dur($4))
  else dispr $1 $:cl($1) $:x Average $iif($2 != ping,$:s($2)) $:s(PING) reply - $:s($_dur($4))
}
; $1 target $2 nick $3 addr $4- reply
alias <ctcp.reply> {
  if ($target ischan) { if ($5 == $null) dispr $target $:cl($target) $:x $:s($4) reply from $:t($2) | else dispr $target $:cl($target) $:x $:s($4) reply from $:t($2) of $:q($5-) }
  else { if ($5 == $null) disp $:x $:s($4) reply from $:t($2) | else disp $:x $:s($4) reply from $:t($2) of $:q($5-) }
}
; $1 where to show (@win requires aline) $2 source channel or 0 $3 nick $4 seconds $5 type of ping $6- reply itself
alias <ping.reply> {
  if (@* iswm $1) {
    if (($5 == ping) || ($6 == $null)) aline -ha $:d $1 $:x $iif($5 != ping,$:s($5)) $:s(PING) reply of $:s($_dur($4)) from $:t($3)
    else aline -ha $:d $1 $:x $iif($5 != ping,$:s($5)) $:s(PING) reply of $:s($_dur($4)) from $:t($3) (reply of $:q($6-) $+ )
    sline -r $1 $line($1,0)
  }
  elseif (($5 == ping) || ($6 == $null)) dispr $1 $iif($2,$:cl($2)) $:x $iif($5 != ping,$:s($5)) $:s(PING) reply of $:s($_dur($4)) from $:t($3)
  else dispr $1 $iif($2,$:cl($2)) $:x $iif($5 != ping,$:s($5)) $:s(PING) reply of $:s($_dur($4)) from $:t($3) (reply of $:q($6-) $+ )
}
; $1 = average lag dur $2 = count waiting for (used in window only)
alias <ping.summary> {
  if ($1 == 0) return $:x Average ping unknown
  elseif ($2) return $:x Average ping $:s($_dur($1)) - Waiting for $:t($2) $iif($2 == 1,reply,replies)
  else return $:x Average ping $:s($_dur($1)) [ping complete]
}

; /dns stuff
alias <dns.start> echo $colour(other) -t $+ $_cfgi(eroute) $:* Looking up $iif($2 != -h,host of) $:b($1)
alias <dns.end> echo $colour(other) -t $+ $_cfgi(eroute) $:* Resolved $1 to $:b($2) (Press $3 to copy to clipboard)
alias <dns.fail1> echo $colour(other) -t $+ $_cfgi(eroute) $:* Failed to find $1 (no such user)
alias <dns.fail2> echo $colour(other) -t $+ $_cfgi(eroute) $:* Failed to resolve $1
alias <dns.fail3> echo $colour(other) -t $+ $_cfgi(eroute) $:* Failed to resolve $1 (Press $2 to copy to clipboard)

; notify stuff
alias <notify.ext> {
  var %note,%how
  if ($7 != $null) %note = $:b($chr(40)) $+ $7- $+ $:b($chr(41))
  if ($6 == match) %how = , address verified.
  elseif ($6 == fail) %how = , address check $:b(failed) $+ .
  echo $colour(notify) -t [ $+ [ $5 ] ] »»» $:b($1) is on IRC $+ %how %note $iif(%`show.fkeys,CtrlF1 whois; ShiftF1 query)
  echo $colour(notify) -t [ $+ [ $5 ] ] »»» $:b($1) is $:b($chr(40)) $+ $2 $+ $:b($chr(41)) and is $iif($3 == -,$:b(away),not away)
}
alias <notify.short> {
  var %note,%how
  if ($7 != $null) %note = $:b($chr(40)) $+ $7- $+ $:b($chr(41))
  if ($6 == match) %how = , address verified.
  elseif ($6 == fail) %how = , address check $:b(failed) $+ .
  echo $colour(notify) -t [ $+ [ $5 ] ] »»» $:b($1) is on IRC $+ %how %note $iif(%`show.fkeys,CtrlF1 whois; ShiftF1 query,-) $iif($3 == -,$:b((away)), [ [ $:b($chr(40)) ] $+ here $+ [ $:b($chr(41)) ] ] )
}
alias <unotify.ext> {
  echo $4 -t [ $+ [ $5 ] ] ««« $:b($1) left IRC $:b($chr(40)) $+ was on $_dur($3) $+ $:b($chr(41)) $iif(%`show.fkeys,CtrlF1 whowas)
  echo $4 -t [ $+ [ $5 ] ] ««« $:b($1) was $:b($chr(40)) $+ $2 $+ $:b($chr(41)) $iif($6 == match,(verified address),$iif($6 == fail,(failed address check),$chr(32)))
}
alias <unotify.short> echo $4 -t [ $+ [ $5 ] ] ««« $:b($1) left IRC $:b($chr(40)) $+ was on $_dur($3) $+ $:b($chr(41)) $iif(%`show.fkeys,CtrlF1 whowas) $iif($6 == match,(verified address),$iif($6 == fail,(failed address check),$chr(32)))

; you being invited - $1 chan $2 nick $3 = 1 auto join 0 manual join $4- modes if appropriate
alias <invite.plain> echo $colour(invite) -ti2 $+ $iif($_optn(3,26),a,s) $:* You were invited to $:b($1) by $:b($2) $iif($3,(auto-joining),- Press ShiftF11 to join)
alias <invite.found> echo $colour(invite) -ti2 $+ $iif($_optn(3,26),a,s) $:* You were invited to $:b($1) (channel mode $4- $+ ) by $2 $iif($3,(auto-joining),- Press ShiftF11 to join)
alias <invite.fail> echo $colour(invite) -ti2 $+ $iif($_optn(3,26),a,s) $:* You were invited to $:b($1) (channel does not exist) by $2 - Press ShiftF11 to join

; sound display (window can be -s!)
; $1 = window $2 = nick $3 = 1 if you own sound (played by -other-) $4- = action if any %.file = file
alias <show.sound> {
  if ($4 == $null) echo $:d $iif($1 == -s,-sti2,-ti2) $iif($1 != -s,$1) [[ $+ $2  $+ $read -tl7 $_cfg(display.dat) $+ , $+ $:d $replace(%.file,?,$chr(32)) ]
  else echo $colour(action) $iif($1 == -s,-sti2,-ti2) $iif($1 != -s,$1) %`popupmark $2 $4-
}
; for sending a sound to an unopen window
alias <show.sound.send> {
  if ($3 == $null) echo $:d -sti2 -> $1 [[ $+ $2  $+ $read -tl7 $_cfg(display.dat) $+ , $+ $:d $replace(%.file,?,$chr(32)) ]
  else echo $colour(action) -sti2 -> $1 %`popupmark $2-
}

; ircop check- $1 = chan, $2 = nick, $3- = msg from whois (or fabricated from userhost)
alias <warn.ircop> disprs $1 $:cl($1) Warning: $:t($2) $3-

; empty (ban) list
alias <empty.list> disprs $1 $:cl($1) $2list is empty.

; show users banned
; $1 = chan $2 = count $3- = users, if <11
alias <show.banned> {
  if ($3) {
    if ($2 > 1) disprs $1 $:cl($1) Banned- $:l($3-) ( $+ $2 users)
    else disprs $1 $:cl($1) Banned- $:l($3-)
  }
  else disprs $1 $:cl($1) Banned- $:t($2) users
}