Public paste
Chancental
By: ChanCentral | Date: Mar 22 2011 02:07 | Format: mIRC Scripting | Expires: never | Size: 26.85 KB | Hits: 1084

  1. ; ––––––––––––––––––––––––––––––––––––––––
  2. ; NNScript by ESNation v4.22 - channel central - coded by greeny & mute
  3. ; Don't edit anything in here unless you REALLY know what you're doing!
  4. ; ––––––––––––––––––––––––––––––––––––––––
  5. alias cc {
  6.   if ($1 == -t) { var %c = $iif($2 ischan,$2,$active) }
  7.   else { var %c = $iif($1 ischan,$1,$active) }
  8.   if ($status == connected) {
  9.     if (%c ischan) {
  10.       if ($me ison %c) {
  11.         set %chancentral.chan %c
  12.         set %chancentral.cid $cid
  13.         set %chancentral.stt $iif($1 == -t,1,0)
  14.         noop $dialog(chancentral,chancentral,-4)
  15.       }
  16.       else { thmerror -a You are currently not in $thmhl(%c) $+ . }
  17.     }
  18.     else { thmerror -a This feature is only available on channels. }
  19.   }
  20.   else { thmerror -a You are not connected to the server. }
  21. }
  22. dialog chancentral {
  23.   title %chancentral.chan channel central [/cc]
  24.   size -1 -1 478 448
  25.   option pixels
  26.   icon scriptspicsnntray.ico, 0
  27.   tab "Channel modes", 16, 4 68 468 348
  28.   box "General information", 38, 13 95 451 120, tab 16
  29.   text "Active channel", 44, 23 115 82 14, tab 16
  30.   edit "", 48, 191 111 264 22, tab 16 read autohs
  31.   text "Active server/network", 51, 23 139 116 14, tab 16
  32.   edit "", 50, 191 135 264 22, tab 16 read autohs
  33.   text "Current modes", 39, 23 163 82 14, tab 16
  34.   edit "", 40, 191 159 264 22, tab 16 read autohs
  35.   text "Available modes", 41, 23 187 86 14, tab 16
  36.   edit + $+ $chanmodes, 42, 191 183 264 22, tab 16 read autohs
  37.   box "Default channel modes", 24, 13 223 212 180, tab 16
  38.   check "&Limit to", 26, 23 243 58 18, tab 16
  39.   edit "", 27, 83 241 78 22, disable tab 16 limit 5
  40.   check "&Key", 29, 23 265 44 18, tab 16
  41.   edit "", 30, 83 263 130 22, disable tab 16 pass autohs limit 30
  42.   edit "", 130, 83 263 130 22, disable tab 16 autohs limit 30
  43.   check "&Only ops set topic", 31, 23 287 112 18, tab 16
  44.   check "&No external messages", 32, 23 305 132 18, tab 16
  45.   check "&Invite only", 33, 23 323 74 18, tab 16
  46.   check "&Moderated", 36, 23 341 78 18, tab 16
  47.   check "&Private", 35, 23 359 58 18, tab 16
  48.   check "S&ecret", 34, 23 377 58 18, tab 16
  49.   list 25, 246 241 108 150, tab 16 size
  50.   text "users", 28, 169 245 30 14, tab 16
  51.   box "Other channel modes", 23, 234 223 132 180, tab 16
  52.   tab "Bans", 17
  53.   list 6, 11 97 455 292, tab 17 size
  54.   text "Current/maximum bans:", 45, 11 393 122 14, tab 17
  55.   text "unknown", 49, 173 393 290 14, tab 17 right
  56.   text "", 21, 16 219 444 44, hide tab 17 center
  57.   tab "Invites", 18
  58.   list 54, 11 97 455 292, tab 18 size
  59.   text "Current invites:", 63, 11 393 84 14, tab 18
  60.   text "unknown", 62, 173 393 290 14, tab 18 right
  61.   text "", 20, 16 219 444 44, hide tab 18 center
  62.   tab "Excepts", 43
  63.   list 55, 11 97 455 292, tab 43 size
  64.   text "Current excepts:", 65, 11 393 88 14, tab 43
  65.   text "unknown", 64, 173 393 290 14, tab 43 right
  66.   text "", 22, 16 219 444 44, hide tab 43 center
  67.   tab "Topic", 52
  68.   text "Topics", 4, 23 115 34 16, tab 52
  69.   box "Topic history", 14, 13 95 452 62, tab 52
  70.   combo 5, 88 111 368 120, tab 52 drop
  71.   text "Set on", 10, 23 135 36 14, tab 52
  72.   box "Current topic", 15, 13 163 452 242, tab 52
  73.   edit "", 13, 23 179 434 80, tab 52 multi vsbar limit 600
  74.   button "", 8, 23 263 434 100, tab 52
  75.   text "Characters available:", 1, 23 369 106 14, tab 52
  76.   text "", 2, 23 385 431 12, tab 52
  77.   text "", 3, 147 369 308 14, tab 52 right
  78.   text "<no topic selected>", 11, 87 135 369 14, tab 52 right
  79.   button "Clear history", 12, 4 419 80 24, tab 52
  80.   button "Set w/ &Q", 9, 88 419 80 24, tab 52
  81.   button "&Set", 7, 172 419 80 24, tab 52 ok
  82.   tab "Statistics", 53
  83.   list 46, 11 97 455 214, disable tab 53 size
  84.   list 47, 11 313 455 93, disable tab 53 size
  85.   button "&Ok", 19, 309 418 80 24, ok
  86.   button "&Cancel", 37, 393 418 80 24, cancel
  87.   icon 56, 4 4 468 60
  88.   text "Loading...", 57, 66 27 336 16, center
  89.   box "", 58, 3 -3 471 69
  90. }
  91. alias cc.refmodes {
  92.   var %i = 1,%z = $gettok($chanmodes,-1,44)
  93.   while ($mid(%z,%i,1)) {
  94.     if ($regex(cm,$v1,/([^tnimpslkbe])/)) { did -a $dname 25 1 + 0 0 $iif($regml(cm,1) isincs $wd($chan(%chancentral.chan).mode,1),2,1) + $+ $regml(cm,1) }
  95.     inc %i
  96.   }
  97.   var %x = $wd($chan(%chancentral.chan).mode,1)
  98.   if (t isincs %x) { did -c $dname 31 }
  99.   if (n isincs %x) { did -c $dname 32 }
  100.   if (i isincs %x) { did -c $dname 33 }
  101.   if (m isincs %x) { did -c $dname 36 }
  102.   if (p isincs %x) { did -c $dname 35 }
  103.   if (s isincs %x) { did -c $dname 34 }
  104.   if (l isincs %x) {
  105.     did -c $dname 26
  106.     did -ae $dname 27 $chan(%chancentral.chan).limit
  107.   }
  108.   if (k isincs %x) {
  109.     did -c $dname 29
  110.     did -ae $dname 130,30 $chan(%chancentral.chan).key
  111.     did -h $dname $iif($gettok($readini($mircini,options,n7),7,44),130,30)
  112.   }
  113. }
  114. alias cc.getbans {
  115.   did -ra chancentral 6 Refreshing bans...
  116.   did -ra chancentral 49 unknown/ $+ $iif(%maxbans. [ $+ [ $cid ] ],$v1,unknown)
  117.   set -u60 %chancentral.getbans %chancentral.chan
  118.   mode %chancentral.chan +b
  119. }
  120. alias cc.refbans {
  121.   var %c = %chancentral.chan,%i = $ibl(%c,0),%t = %i
  122.   if (%i) {
  123.     window -h @loadbans
  124.     while (%i) {
  125.       tokenize 33 $ibl(%c,%i).by
  126.       echo @loadbans 1 + 0 0 0 $ibl(%c,%i) $+   + 0 0 0 $1 $iif($2,$nbr($2)) $+         + 0 0 0 $asctime($ibl(%c,%i).ctime,%timeformat)
  127.       dec %i
  128.     }
  129.     filter -cwo @loadbans chancentral 6
  130.     close -@ @loadbans
  131.   }
  132.   else { did -ra chancentral 6 1 + 0 0 0 No bans set. }
  133.   if (%maxbans. [ $+ [ $cid ] ]) { did -ra chancentral 49 $+(%t,/,$v1) }
  134.   else { did -ra chancentral 49 %t $+ /unknown }
  135.   cc.checkop
  136. }
  137. alias cc.getinvites {
  138.   did -ra chancentral 54 Refreshing invites...
  139.   did -ra chancentral 62 unknown
  140.   set -u60 %chancentral.getinvites %chancentral.chan
  141.   mode %chancentral.chan +I
  142. }
  143. alias cc.refinvites {
  144.   var %c = %chancentral.chan,%i = $iil(%c,0),%t = %i
  145.   if (%i) {
  146.     window -h @loadinvites
  147.     while (%i) {
  148.       tokenize 33 $iil(%c,%i).by
  149.       echo @loadinvites 1 + 0 0 0 $iil(%c,%i) $+        + 0 0 0 $1 $iif($2,$nbr($2)) $+         + 0 0 0 $asctime($iil(%c,%i).ctime,%timeformat)
  150.       dec %i
  151.     }
  152.     filter -cwo @loadinvites chancentral 54
  153.     close -@ @loadinvites
  154.   }
  155.   else { did -ra chancentral 54 1 + 0 0 0 No invites set. }
  156.   did -ra chancentral 62 %t $+ /unknown
  157.   cc.checkop
  158. }
  159. alias cc.getexcepts {
  160.   did -ra chancentral 55 Refreshing excepts...
  161.   did -ra chancentral 64 unknown
  162.   set -u60 %chancentral.getexcepts %chancentral.chan
  163.   mode %chancentral.chan +e
  164. }
  165. alias cc.refexcepts {
  166.   var %c = %chancentral.chan,%i = $iel(%c,0),%t = %i
  167.   if (%i) {
  168.     window -h @loadexcepts
  169.     while (%i) {
  170.       tokenize 33 $iel(%c,%i).by
  171.       echo @loadexcepts 1 + 0 0 0 $iel(%c,%i) $+        + 0 0 0 $1 $iif($2,$nbr($2)) $+         + 0 0 0 $asctime($iel(%c,%i).ctime,%timeformat)
  172.       dec %i
  173.     }
  174.     filter -cwo @loadexcepts chancentral 55
  175.     close -@ @loadexcepts
  176.   }
  177.   else { did -ra chancentral 55 1 + 0 0 0 No excepts set. }
  178.   did -ra chancentral 64 %t $+ /unknown
  179.   cc.checkop
  180. }
  181.  
  182. raw 367:*:{
  183.   if (%chancentral.getbans == $2) {
  184.     haltdef
  185.     if ($dialog(chancentral)) {
  186.       if (* Refreshing bans...  * iswm $did(chancentral,6,2)) { did -d chancentral 6 2 }
  187.       did -a chancentral 6 0 + 0 0 0 $3 $+      + 0 0 0 $4 $+   + 0 0 0 $asctime($5,%timeformat)
  188.     }
  189.   }
  190. }
  191. raw 368:*:{
  192.   if (%chancentral.getbans == $2) {
  193.     haltdef
  194.     unset %chancentral.getbans
  195.     if ($dialog(chancentral)) {
  196.       if ($did(chancentral,6).lines == 2) && (* Refreshing bans...      * iswm $did(chancentral,6,2)) {
  197.         did -ra chancentral 6 1 + 0 0 0 No bans set.
  198.         did -ra chancentral 49 0/ $+ $iif(%maxbans. [ $+ [ $cid ] ],$v1,unknown)
  199.       }
  200.       else { did -ra chancentral 49 $calc($did(chancentral,6).lines -1) $+ / $+ $iif(%maxbans. [ $+ [ $cid ] ],$v1,unknown) }
  201.       set %chancentral.bansrefreshed 1
  202.     }
  203.   }
  204. }
  205. raw 346:*:{
  206.   if (%chancentral.getinvites == $2) {
  207.     haltdef
  208.     if ($dialog(chancentral)) {
  209.       if (* Refreshing invites...       * iswm $did(chancentral,54,2)) { did -d chancentral 54 2 }
  210.       did -a chancentral 54 0 + 0 0 0 $3 $+     + 0 0 0 $4 $+   + 0 0 0 $asctime($5,%timeformat)
  211.     }
  212.   }
  213. }
  214. raw 347:*:{
  215.   if (%chancentral.getinvites == $2) {
  216.     haltdef
  217.     unset %chancentral.getinvites
  218.     if ($dialog(chancentral)) {
  219.       if ($did(chancentral,54).lines == 2) && (* Refreshing invites...  * iswm $did(chancentral,54,2)) {
  220.         did -ra chancentral 54 1 + 0 0 0 No invites set.
  221.         did -ra chancentral 62 0
  222.       }
  223.       else { did -ra chancentral 62 $calc($did(chancentral,54).lines -1) }
  224.       set %chancentral.invitesrefreshed 1
  225.     }
  226.   }
  227. }
  228. raw 348:*:{
  229.   if (%chancentral.getexcepts == $2) {
  230.     haltdef
  231.     if ($dialog(chancentral)) {
  232.       if (* Refreshing excepts...       * iswm $did(chancentral,55,2)) { did -d chancentral 55 2 }
  233.       did -a chancentral 55 0 + 0 0 0 $3 $+     + 0 0 0 $4 $+   + 0 0 0 $asctime($5,%timeformat)
  234.     }
  235.   }
  236. }
  237. raw 349:*:{
  238.   if (%chancentral.getexcepts == $2) {
  239.     haltdef
  240.     unset %chancentral.getexcepts
  241.     if ($dialog(chancentral)) {
  242.       if ($did(chancentral,55).lines == 2) && (* Refreshing excepts...  * iswm $did(chancentral,55,2)) {
  243.         did -ra chancentral 55 1 + 0 0 0 No excepts set.
  244.         did -ra chancentral 64 0
  245.       }
  246.       else { did -ra chancentral 64 $calc($did(chancentral,55).lines -1) }
  247.       set %chancentral.exceptsrefreshed 1
  248.     }
  249.   }
  250. }
  251. alias cc.remselmodes {
  252.   if ($1 == -b) { var %did = 6,%md = b }
  253.   elseif ($1 == -I) { var %did = 54,%md = I }
  254.   elseif ($1 == -e) { var %did = 55,%md = e }
  255.   var %r,%d = $did(chancentral,%did).lines
  256.   while (%d > 1) {
  257.     var %h = $did(chancentral,%did,%d)
  258.     if (s isin $wd(%h,2)) { %r = %r $gettok($wd(%h,6),1,9) }
  259.     if ($numtok(%r,32) == $modespl) {
  260.       mode %chancentral.chan - $+ $str(%md,$numtok(%r,32)) %r
  261.       %r = ""
  262.     }
  263.     dec %d
  264.   }
  265.   if (%r) { mode %chancentral.chan - $+ $str(%md,$numtok(%r,32)) %r }
  266. }
  267. alias cc.clearmodes {
  268.   if ($1 == -b) { var %did = 6,%md = b }
  269.   elseif ($1 == -I) { var %did = 54,%md = I }
  270.   elseif ($1 == -e) { var %did = 55,%md = e }
  271.   var %r,%d = $did(chancentral,%did).lines
  272.   while (%d > 1) {
  273.     %r = %r $gettok($wd($did(chancentral,%did,%d),6),1,9)
  274.     if ($numtok(%r,32) == $modespl) {
  275.       mode %chancentral.chan - $+ $str(%md,$numtok(%r,32)) %r
  276.       %r = ""
  277.     }
  278.     dec %d
  279.   }
  280.   if (%r) { mode %chancentral.chan - $+ $str(%md,$numtok(%r,32)) %r }
  281. }
  282. on *:dialog:chancentral:*:*:{
  283.   if ($devent == init) {
  284.     mdx SetControlMDX $dname 2 ProgressBar smooth > $mdxfile(ctl_gen)
  285.     mdx SetControlMDX $dname 6,54,55 ListView report showsel rowselect labeltip editlabels > $mdxfile(views)
  286.     mdx SetControlMDX $dname 25 ListView report showsel labeltip checkboxes noheader > $mdxfile(views)
  287.     mdx SetControlMDX $dname 46 ListView report showsel rowselect labeltip > $mdxfile(views)
  288.     mdx SetControlMDX $dname 47 ListView report showsel rowselect labeltip noheader > $mdxfile(views)
  289.     mdx SetFont $dname 13 - $+ $window(Status Window).fontsize 300 $window(Status Window).font
  290.     did -a $dname 40 $iif($chan(%chancentral.chan).mode,$v1,none)
  291.     did -a $dname 48 %chancentral.chan $nbr($nick(%chancentral.chan,0) users)
  292.     did -a $dname 50 $iif($network,$network $nbr($server),$server)
  293.     did -i $dname 6,54,55 1 headerdims 220:1 80:2 110:3
  294.     did -i $dname 6,54,55 1 headertext + 0 Address      + 0 Set by      + 0 Date
  295.     did -i $dname 25 1 headerdims 80:1
  296.     did -i $dname 47 1 headerdims 200:1 60:2 60:3
  297.     did -i $dname 47 1 headertext + 0 a + 0 b + 0 c
  298.     did -i $dname 46 1 headerdims 40:1 30:2 80:3 80:4 80:5 60:6 110:7 80:8 50:9 50:10
  299.     did -i $dname 46 1 headertext + 0 User number       + 0 Status      + 0 Nick        + 0 Auth        + 0 Name        + 0 Ident       + 0 Host        + 0 IP  + 0 Away        + 0 IrcOp
  300.     did -i $dname 6,25,46,47,54,55 1 settxt bgcolor none
  301.     set %chancentral.oldtab 16
  302.     did -ra $dname 49 unknown/ $+ $iif(%maxbans. [ $+ [ $cid ] ],$v1,unknown)
  303.     ppwin $dname 8
  304.     if (Q !ison %chancentral.chan) { did -b $dname 9 }
  305.     did -a $dname 13 $chan(%chancentral.chan).topic
  306.     topic.crev
  307.     prevtopic
  308.     var %i = $hfind(topichist,$+($network,%chancentral.chan,$cr,*),0,w),%r,%z = 1,%g,%n = $nick(%chancentral.chan,0),%cm = $gettok($chanmodes,1,44)
  309.     while (%i) {
  310.       %r = $addtok(%r,$hget(topichist,$hfind(topichist,$+($network,%chancentral.chan,$cr,*),%i,w)) %i,124)
  311.       dec %i
  312.     }
  313.     %r = $sorttok(%r,124)
  314.     while ($gettok(%r,%z,124)) {
  315.       tokenize 32 $v1
  316.       did -i $dname 5 1 $+($decode($gettok($hfind(topichist,$+($network,%chancentral.chan,$cr,*),$2,w),2,13),m),$str( ,150),$1)
  317.       inc %z
  318.     }
  319.     cc.refmodes
  320.     cc.checkop
  321.     did -a $dname 47 1 + 0 0 0 Total users on the channel       + 0 0 0 %n
  322.     did -a $dname 47 1 + 0 0 0 Operators        + 0 0 0 $nick(%chancentral.chan,0,o) $+         + 0 0 0 $percent($nick(%chancentral.chan,0,o),%n,1)
  323.     did -a $dname 47 1 + 0 0 0 Voiced users     + 0 0 0 $nick(%chancentral.chan,0,v) $+         + 0 0 0 $percent($nick(%chancentral.chan,0,v),%n,1)
  324.     did -a $dname 47 1 + 0 0 0 Regulars + 0 0 0 $nick(%chancentral.chan,0,r) $+         + 0 0 0 $percent($nick(%chancentral.chan,0,r),%n,1)
  325.     did -a $dname 47 1 + 0 0 0 Away users       + 0 0 0 0       + 0 0 0 0%
  326.     did -a $dname 47 1 + 0 0 0 IRC operators    + 0 0 0 0       + 0 0 0 0%
  327.     if (%chancentral.stt) {
  328.       var %x = $dialog($dname).x,%y = $dialog($dname).y
  329.       dialog -sp $dname -1000 -1000 -1 -1
  330.       .timer 1 0 did -f $dname 52 $chr(124) dialog -sp $dname %x %y -1 -1
  331.     }
  332.     if (b !isincs %cm) {
  333.       did -h $dname 6,45,49
  334.       did -vra $dname 21 Bans are not supported on $iif($network,$v1,$server) $+ .
  335.     }
  336.     if (I !isincs %cm) {
  337.       did -h $dname 54,62,63
  338.       did -vra $dname 20 Invites are not supported on $iif($network,$v1,$server) $+ .
  339.     }
  340.     if (e !isincs %cm) {
  341.       did -h $dname 55,64,65
  342.       did -vra $dname 22 Excepts are not supported on $iif($network,$v1,$server) $+ .
  343.     }
  344.     openad chancentral 57 56 58
  345.   }
  346.   elseif ($devent == edit) {
  347.     if ($did == 13) {
  348.       topic.crev
  349.       if ($did(3) < 0) { mdx SetColor 3 text 255 }
  350.       else { mdx SetColor 3 text reset }
  351.       prevtopic
  352.     }
  353.     elseif ($did == 27) { numonlyedit $dname $did }
  354.   }
  355.   elseif ($devent == sclick) {
  356.     if ($istok(46 47 6 25 54 55,$did,32)) { sortmdx }
  357.     if ($did == 46) {
  358.       tokenize 32 $did($did,1)
  359.       if ($1 == rclick) && ($did($did).sel) {
  360.         var %o = $iif(!$ccontrol(%chancentral.chan),+g,+),%n = $cell($did,3)
  361.         popdll.new
  362.         popdll.add 1    +g 1 0 $shorten(10,%n) $+ :
  363.         popdll.add 2    + 2 0 -
  364.         popdll.add 3    + 3 0 Whoiswe %n
  365.         popdll.add 4    + 4 0 -
  366.         popdll.add 5     $+ %o 5 0 Kickk %chancentral.chan %n
  367.         popdll.add 6     $+ %o 6 0 Kickbankb %chancentral.chan %n
  368.         popdll.add 7     $+ %o 7 0 Timekickbantkb %chancentral.chan %n
  369.         popdll.disp
  370.       }
  371.     }
  372.     elseif ($did == 56) { openad.clicked  % [ $+  [ $dname $+ .oa ] ] }
  373.     elseif ($did == 6) {
  374.       var %r
  375.       if ($did($did).sel) && ($cell($did,2)) && ($ccontrol(%chancentral.chan)) { %r = 1 }
  376.       if (beginlabeledit * iswm $did($did,1)) && (!$did(20).enabled) { did -i $dname $did 1 cancel }
  377.       elseif (endlabeledit * iswm $did($did,1)) { cc.chgban $cell($did,1) $wd($did($did,1),3-) }
  378.       else { cc.checkop }
  379.       if (rclick * iswm $did($did,1)) {
  380.         tokenize 47 $did(49)
  381.         popdll.new
  382.         if (%r) {
  383.           popdll.add 1  +g 1 0 $shorten(10,$cell($did,1)) $+ :
  384.           popdll.add 2  + 2 0 -
  385.         }
  386.         popdll.add 3     $+ $iif($1 == $2,+g,+) 3 0 &Add ban...cc.addban
  387.         popdll.add 4     $+ $iif(%r,+,+g) 4 0 &Edit ban...cc.chgban $cell($did,1) -e
  388.         popdll.add 5    + 5 0 -
  389.         popdll.add 6     $+ $iif(%r,+,+g) 6 0 &Remove ban(s)cc.remselmodes -b
  390.         popdll.add 7     $+ $iif($1 && %r,+,+g) 7 0 &Clear ban(s)cc.clearmodes -b
  391.         popdll.add 8     $+ $iif($1 && Q ison %chancentral.chan,+,+g) 7 0 &Clear ban(s) with Q.msg Q unbanall %chancentral.chan
  392.         popdll.disp
  393.       }
  394.     }
  395.     elseif ($did == 54) {
  396.       var %r
  397.       if ($did($did).sel) && ($cell($did,2)) && ($ccontrol(%chancentral.chan)) { %r = 1 }
  398.       if (beginlabeledit * iswm $did($did,1)) && (!$did(57).enabled) { did -i $dname $did 1 cancel }
  399.       elseif (endlabeledit * iswm $did($did,1)) { cc.chginvite $cell($did,1) $wd($did($did,1),3-) }
  400.       else { cc.checkop }
  401.       if (rclick * iswm $did($did,1)) {
  402.         popdll.new
  403.         if (%r) {
  404.           popdll.add 1  +g 1 0 $shorten(10,$cell($did,1)) $+ :
  405.           popdll.add 2  + 2 0 -
  406.         }
  407.         popdll.add 3    + 3 0 &Add invite...cc.addinvite
  408.         popdll.add 4     $+ $iif(%r,+,+g) 4 0 &Edit invite...cc.chginvite $cell($did,1) -e
  409.         popdll.add 5    + 5 0 -
  410.         popdll.add 6     $+ $iif(%r,+,+g) 6 0 &Remove invite(s)cc.remselmodes -I
  411.         popdll.add 7     $+ $iif($did(62),+,+g) 7 0 &Clear invite(s)cc.clearmodes -I
  412.         popdll.disp
  413.       }
  414.     }
  415.     elseif ($did == 55) {
  416.       var %r
  417.       if ($did($did).sel) && ($cell($did,2)) && ($ccontrol(%chancentral.chan)) { %r = 1 }
  418.       if (beginlabeledit * iswm $did($did,1)) && (!$did(60).enabled) { did -i $dname $did 1 cancel }
  419.       elseif (endlabeledit * iswm $did($did,1)) { cc.chgexcept $cell($did,1) $wd($did($did,1),3-) }
  420.       else { cc.checkop }
  421.       if (rclick * iswm $did($did,1)) {
  422.         popdll.new
  423.         if (%r) {
  424.           popdll.add 1  +g 1 0 $shorten(10,$cell($did,1)) $+ :
  425.           popdll.add 2  + 2 0 -
  426.         }
  427.         popdll.add 3    + 3 0 &Add except...cc.addexcept
  428.         popdll.add 4     $+ $iif(%r,+,+g) 4 0 &Edit except...cc.chgexcept $cell($did,1) -e
  429.         popdll.add 5    + 5 0 -
  430.         popdll.add 6     $+ $iif(%r,+,+g) 6 0 &Remove except(s)cc.remselmodes -e
  431.         popdll.add 7     $+ $iif($did(64),+,+g) 7 0 &Clear except(s)cc.clearmodes -e
  432.         popdll.disp
  433.       }
  434.     }
  435.     elseif ($did == 12) {
  436.       if ($ydialog(Do you really want to clear the topic history?)) {
  437.         did -r $dname 5
  438.         did -ra $dname 11 <no topic selected>
  439.         hdel -w topichist *
  440.       }
  441.     }
  442.     elseif ($did == 17) {
  443.       if (b isincs $gettok($chanmodes,1,44)) {
  444.         if ($chan(%chancentral.chan).ibl == $true) { cc.refbans }
  445.         else { cc.getbans }
  446.       }
  447.     }
  448.     elseif ($did == 18) {
  449.       if (I isincs $gettok($chanmodes,1,44)) {
  450.         if ($chan(%chancentral.chan).iil == $true) { cc.refinvites }
  451.         else { cc.getinvites }
  452.       }
  453.     }
  454.     elseif ($did == 56) { cc.getinvites }
  455.     elseif ($did == 43) {
  456.       if (e isincs $gettok($chanmodes,1,44)) {
  457.         if ($chan(%chancentral.chan).iel == $true) { cc.refexcepts }
  458.         else { cc.getexcepts }
  459.       }
  460.     }
  461.     elseif ($did == 59) { cc.getexcepts }
  462.     elseif ($did == 53) {
  463.       if (!%chancentral.statsdone) {
  464.         if (!$remc(who)) {
  465.           set %chanstats. $+ $cid %chancentral.chan
  466.           set %chancentral.statsdone 1
  467.           who %chancentral.chan $iif($q.net || $u.net,% $+ acfhinru)
  468.         }
  469.         else {
  470.           idialog there is already another /who request going on. Please wait for it to finish before trying to refresh the channel statistics.
  471.           did -f $dname %chancentral.oldtab
  472.           return
  473.         }
  474.       }
  475.     }
  476.     elseif ($did == 26) { did $iif($did($did).state,-e,-b) $dname 27 }
  477.     elseif ($did == 29) { did $iif($did($did).state,-e,-b) $dname 130,30 }
  478.     elseif ($did == 5) {
  479.       var %t = $gettok($did($did),-1,160)
  480.       did -ra $dname 13 $deltok($did($did),-1,160)
  481.       did -ra $dname 11 $longtime(%t) $nbr($sduration($calc($ctime - %t)).nosec ago)
  482.       topic.crev
  483.       if ($did(3) < 0) { mdx SetColor 3 text 255 }
  484.       else { mdx SetColor 3 text reset }
  485.       prevtopic
  486.     }
  487.     elseif ($istok(7 9,$did,32)) {
  488.       var %c = %chancentral.chan,%z = $edtxt($dname,13)
  489.  
  490.       if ($did == 9) { .msg q settopic %c $iif(%z,%z,) }
  491.       else { .raw topic %c : $+ %z }
  492.  
  493.     }
  494.     elseif ($did == 20) { cc.chgban $cell(6,1) -e }
  495.     elseif ($did == 57) { cc.chginvite $cell(54,1) -e }
  496.     elseif ($did == 60) { cc.chgexcept $cell(55,1) -e }
  497.     elseif ($did == 21) { cc.remselmodes -b }
  498.     elseif ($did == 58) { cc.remselmodes -I }
  499.     elseif ($did == 61) { cc.remselmodes -e }
  500.     elseif ($did == 22) { cc.getbans }
  501.     elseif ($did == 19) {
  502.       var %a = %chancentral.chan,%i = $did(25).lines,%r,%d,%m = $wd($chan(%a).mode,1),%z,%j = 1
  503.       while (%i > 1) {
  504.         tokenize 32 $gettok($did(25,%i),1,9)
  505.         var %z = $mid($6,2)
  506.         if ($5 == 2) { if (%z !isincs %m) { %r = $+(%r,$iif(!%r,+),%z) } }
  507.         elseif (%z isincs %m) { %d = $+(%d,$iif(!%d,-),%z) }
  508.         if ($regex(%r $+ %d,/[a-zA-Z]/g) >= $modespl) {
  509.           mode %chancentral.chan %r $+ %d
  510.           var %r = "",%d = ""
  511.         }
  512.         dec %i
  513.       }
  514.       if ($did(26).state) { if (l !isincs %m) || ($chan(%a).limit != $did(27)) { mode %a +l $did(27) } }
  515.       elseif (l isincs %m) { %d = $+(%d,$iif(!%d,-),l) }
  516.       if ($did(29).state) {
  517.         var %z = $iif($did(30).visible,$did(30),$did(130))
  518.         if (%z != $null) && ((k !isincs %m) || ($chan(%a).key != %z)) {
  519.           if (k isincs %m) { mode %a -k $chan(%a).key }
  520.           mode %a +k %z
  521.         }
  522.       }
  523.       elseif (k isincs %m) { mode %a -k $chan(%a).key }
  524.       while ($wd(31 t 32 n 33 i 36 m 35 p 34 s,$+(%j,-,$calc(%j +1)))) {
  525.         tokenize 32 $v1
  526.         if ($did($1).state) { if ($2 !isincs %m) { %r = $+(%r,$iif(!%r,+),$2) } }
  527.         elseif ($2 isincs %m) { %d = $+(%d,$iif(!%d,-),$2) }
  528.         if ($regex(%r $+ %d,/[a-zA-Z]/g) >= $modespl) {
  529.           mode %chancentral.chan %r $+ %d
  530.           var %r = "",%d = ""
  531.         }
  532.         inc %j 2
  533.       }
  534.       if (%r) || (%d) { mode %a %r $+ %d }
  535.       if ($edtxt($dname,13) !== $chan(%a).topic) { topic %a $v1 }
  536.     }
  537.     if ($istok(16 17 18 43 52 53,$did,32)) { set %chancentral.oldtab $dialog($dname).tab }
  538.   }
  539.   elseif ($devent == dclick) && ($istok(6 54 55,$did,32)) { did -i $dname $did 1 labeledit begin $did($did).sel }
  540.   elseif ($devent == close) {
  541.     unset %modedsp. [ $+ [ %chancentral.cid ] $+ ] . [ $+ [ %chancentral.chan ] ]
  542.     unset %chancentral.oldtab %chancentral.cid %chancentral.chan %chancentral.statsdone %chancentral.invitesrefreshed %chancentral.exceptsrefreshed %chancentral.bansrefreshed
  543.     unset % [ $+  [ $dname $+ .oa ] ]
  544.  
  545.   }
  546. }
  547. alias cc.addban { mode %chancentral.chan +b $$eddialog(Please enter a ban mask in nick!ident@host.com format.) }
  548. alias cc.addexcept { mode %chancentral.chan +e $$eddialog(Please enter an except mask in nick!ident@host.com format.) }
  549. alias cc.addinvite { mode %chancentral.chan +I $$eddialog(Please enter an invite mask in nick!ident@host.com format.) }
  550. alias chanstats.add {
  551.   if ($1 == -l) { var %a = unknown,%h = $4,%p = unknown }
  552.   else { var %a = $iif($8,$8,n/a),%h = $5,%p = $iif($4 == 127.0.0.1,unknown,$4) }
  553.   var %w = $iif(G isincs $7,Yes,No),%o = $iif(* isin $7,Yes,No)
  554.   if (G isincs $7) {
  555.     var %z = $calc($wd($gettok($did(chancentral,47,6),2,9),5) +1)
  556.     did -o chancentral 47 6 1 + 0 0 0 Away users        + 0 0 0 %z $+   + 0 0 0 $percent(%z,$nick($2,0),1)
  557.   }
  558.   if (* isin $7) {
  559.     var %y = $calc($wd($gettok($did(chancentral,47,7),2,9),5) +1)
  560.     did -o chancentral 47 7 1 + 0 0 0 IRC operators     + 0 0 0 %y $+   + 0 0 0 $percent(%y,$nick($2,0),1)
  561.   }
  562.   did -a chancentral 46 1 + 0 0 0 $did(chancentral,46).lines $+ .       + 0 0 0 $iif($6 !isreg $2,$left($nick($2,$6).pnick,1)) $+       + 0 0 0 $6 $+   + 0 0 0 %a $+   + 0 0 0 $strip($9-) $+  + 0 0 0 $3 $+   + 0 0 0 %h $+   + 0 0 0 %p $+   + 0 0 0 %w $+   + 0 0 0 %o
  563. }
  564. on *:op:%chancentral.chan:{ if (%chancentral.cid == $cid) && ($opnick == $me) { cc.checkop } }
  565. on *:deop:%chancentral.chan:{ if (%chancentral.cid == $cid) && ($opnick == $me) { cc.checkop } }
  566. on *:help:%chancentral.chan:{ if (%chancentral.cid == $cid) && ($hnick == $me) { cc.checkop } }
  567. on *:dehelp:%chancentral.chan:{ if (%chancentral.cid == $cid) && ($hnick == $me) { cc.checkop } }
  568. on *:usermode:{ if (%chancentral.cid == $cid) && (%chancentral.chan) { cc.checkop } }
  569. on *:part:%chancentral.chan:{
  570.   if (%chancentral.cid == $cid) && ($nick == $me) {
  571.     dialog -c chancentral
  572.     .timer 1 0 errdialog you have been kicked out of $chan $+ , closing channel central...
  573.   }
  574. }
  575. on *:kick:%chancentral.chan:{
  576.   if (%chancentral.cid == $cid) && ($knick == $me) {
  577.     dialog -c chancentral
  578.     .timer 1 0 errdialog you have been kicked out of $chan $+ , closing channel central...
  579.   }
  580. }
  581. on *:rawmode:%chancentral.chan:{
  582.   if (b isincs $1) { cc.refbans }
  583.   if (e isincs $1) { cc.refexcepts }
  584.   if (I isincs $1) { cc.refinvites }
  585. }
  586. raw 315:*:{
  587.   if (%chanstats. [ $+ [ $cid ] ] == $2) {
  588.     haltdef
  589.     unset %chanstats. $+ $cid
  590.     if ($dialog(chancentral)) { did -e chancentral 46,47 }
  591.   }
  592. }
  593. raw 333:*:{ topic.shist $2 $4 $chan($2).topic }
  594. raw 352:*:{
  595.   if (%chanstats. [ $+ [ $cid ] ] == $2) {
  596.     haltdef
  597.     if ($dialog(chancentral)) { chanstats.add -l $2- }
  598.   }
  599. }
  600. raw 354:*:{
  601.   if (%chanstats. [ $+ [ $cid ] ] == $2) {
  602.     haltdef
  603.     if ($dialog(chancentral)) { chanstats.add -a $2- }
  604.   }
  605. }
  606. alias cc.chgban {
  607.   if ($2 == -e) { tokenize 32 $1 $$eddialog(Please enter the changed ban.,$1) }
  608.   if ($1 != $2) { mode %chancentral.chan -b+b $1-2 }
  609. }
  610. alias cc.chginvite {
  611.   if ($2 == -e) { tokenize 32 $1 $$eddialog(Please enter the changed invite.,$1) }
  612.   if ($1 != $2) { mode %chancentral.chan -I+I $1-2 }
  613. }
  614. alias cc.chgexcept {
  615.   if ($2 == -e) { tokenize 32 $1 $$eddialog(Please enter the changed except.,$1) }
  616.   if ($1 != $2) { mode %chancentral.chan -e+e $1-2 }
  617. }
  618. alias topic.crev {
  619.   var %z = $edlen(chancentral,13),%t = $topiclen,%v = $calc(%t - %z)
  620.   if (%t) {
  621.     did -ra chancentral 3 $+(%v,/,%t) $nbr($round($calc(%v / %t *100),0) $+ %)
  622.     did -a chancentral 2 %z 0 %t
  623.   }
  624.   else {
  625.     did -ra chancentral 3 unknown
  626.     did -a chancentral 2 0 0 1
  627.   }
  628. }
  629. alias topiclen { return $iif(%topiclen. [ $+ [ $cid ] ],$v1,0) }
  630. alias prevtopic {
  631.   var %i = 0,%w = @sprev.chancentral.8,%y = 1,%t = $edtxt(chancentral,13),%f = $window(%chancentral.chan).font,%s = $window(%chancentral.chan).fontsize,%h = $calc($height(%t,%f,%s) +1)
  632.   drawrect -nf %w $color(back) 1 0 0 $window(%w).w $window(%w).h
  633.   if (%t != $null) {
  634.     while (%y < $window(%w).h) {
  635.       drawtext -npb %w $color(topic) $color(back) $qt(%f) %s $calc(2-(%i *($window(%w).w -6))) %y %t
  636.       inc %y %h
  637.       inc %i
  638.     }
  639.     drawrect -n %w $color(back) 2 0 0 $calc($window(%w).w -2) $calc($window(%w).h -2)
  640.   }
  641.   drawdot %w
  642. }
  643. alias cc.checkop {
  644.   var %z = 7 $+ $chr(44)
  645.   if (t !isincs $wd($chan(%chancentral.chan).mode,1)) {
  646.     did -e chancentral 7
  647.     %z = ""
  648.   }
  649.   if ($ccontrol(%chancentral.chan)) { did -e chancentral 7,19 }
  650.   else { did -b chancentral %z $+ 19 }
  651. }
  652. alias topic.shist {
  653.   if ($encode($3-,m)) {
  654.     var %t = $v1,%h = $+($network,$1,$cr,%t)
  655.     if ($1 == %chancentral.chan) && (!$hget(topichist,%h)) { did -i chancentral 5 1 $+($3-,$str( ,150),$2) }
  656.     hadd -m topichist %h $2
  657.   }
  658.   if ($hfind(topichist,$+($network,$1,$cr,*),0,w) > 50) {
  659.     var %i = $v1,%l = $ctime,%r
  660.     while (%i) {
  661.       var %h = $hfind(topichist,$+($network,$1,$cr,*),%i,w)
  662.       if ($hget(topichist,%h) < %l) { var %l = $v1,%r = %h }
  663.       dec %i
  664.     }
  665.     hdel topichist %r
  666.   }
  667. }
  668. ; ––––––––––––––––––––––––––––––––––––––––
  669. ; End of file
  670. ; ––––––––––––––––––––––––––––––––––––––––