Project

General

Profile

[Script] Channel Statistics on StatusBar v2.0

Added by westor (GR) almost 5 years ago

Description:

The following code is adding some extra informations about the total number of "Owners/Admins/Ops/HalfOps/Voicers/Regular" users are in the active channel in AdiIRC statusbar , you can also right click and announce the data in the active channel, it based on what mode prefixes your irc network (IRCD) supporting, so if the network doesn't supporting +q (~) or +a (&) then the script will auto-hide them, working on AdiIRC 3.4+

Changelog:

  • v2.0
    - Changed some functions, now is more faster.
    - Added right click and "Announce in #channel" item.
    - Fixed a security risk in timers.
  • v1.1
    - Fixed an small issue on loading.
  • v1.0
    - First public release.

Contact:

westor on IRC FreeNode in #AdiIRC

Preview:


or

or

Code:

ON *:LOAD: { update_opstats $active }
ON *:UNLOAD: { close_opstats }

ON *:QUIT: { if ($active ischan) { update_opstats $active } }
ON *:JOIN:#: { if ($active == $chan) { update_opstats $chan } }
ON *:PART:#: { if ($active == $chan) { update_opstats $chan } }
ON *:OWNER:#: { if ($active == $chan) { update_opstats $chan } }
ON *:DEOWNER:#: { if ($active == $chan) { update_opstats $chan } }
ON *:ADMIN:#: { if ($active == $chan) { update_opstats $chan } }
ON *:DEADMIN:#: { if ($active == $chan) { update_opstats $chan } }
ON *:OP:#: { if ($active == $chan) { update_opstats $chan } }
ON *:DEOP:#: { if ($active == $chan) { update_opstats $chan } }
ON *:HELP:#: { if ($active == $chan) { update_opstats $chan } }
ON *:DEHELP:#: { if ($active == $chan) { update_opstats $chan } }
ON *:VOICE:#: { if ($active == $chan) { update_opstats $chan } }
ON *:DEVOICE:#: { if ($active == $chan) { update_opstats $chan } }

ON *:APPACTIVE: { .timer[OPS_STATS] -m 1 100 update_opstats $unsafe($active) }
ON *:ACTIVE:*: { .timer[OPS_STATS] -m 1 100 update_opstats $unsafe($active) }

alias close_opstats {
  if ($statusbar(opstatsep)) { statusbar -h opstatsep }
  if ($statusbar(opstats)) { statusbar -h opstats }
}

alias update_opstats {
  if (!$1) || ($status !== connected) || ($active !ischan) { close_opstats | return }

  .timer[OPS_STATS] off

  var %t = $nick($1,0)
  var %prefix = $prefix

  var %owners = 0
  var %admins = 0
  var %ops = 0
  var %halfops = 0
  var %voicers = 0

  var %i = 1
  while (%i <= %t) { 
    var %p = $nick($1,%i).cmode

    if (*~* iswm %prefix) && (~ == %p) { inc %owners 1 }
    if (*&* iswm %prefix) && (& == %p) { inc %admins 1 }
    if (*@* iswm %prefix) && (@ == %p) { inc %ops 1 }
    if (*%* iswm %prefix) && (% == %p) { inc %halfops 1 }
    if (*+* iswm %prefix) && (+ == %p) { inc %voicers 1 }

    inc %i
  }

  var %line = $iif(*~* iswm %prefix,Owners: %owners $chr(166)) $iif(*&* iswm %prefix,Admins: %admins $chr(166)) $iif(*@* iswm %prefix,Ops: %ops $chr(166)) $iif(*%* iswm %prefix,HalfOps: %halfops $chr(166)) $iif(*+* iswm %prefix,Voicers: %voicers $chr(166)) Regular: $nick($1,0,r)

  if (!$statusbar(opstatsep)) { statusbar -a opstatsep $qt() $chr(160) $qt() | return }
  if (!$statusbar(opstats)) { statusbar -a opstats $qt(%line) @opstats $qt(%line) | return }

  statusbar -w opstatsep
  statusbar -wg opstats $qt(%line)
}

menu @opstats {
  Announce in $active $+ :say Currenly on $active are: $statusbar(opstats).text
}

Replies (1)

RE: [Script] Channel Statistics on StatusBar v2.0 - Added by Sonny Bonds almost 5 years ago

I registered to the Forum only to say Thank You westor for making this Awesome script that av requested. It's not only helpful to me but to all the ops and the users in the channel I'm running.
Much appreciated mate!

    (1-1/1)