home *** CD-ROM | disk | FTP | other *** search
/ napalm.napnet.hu / 2015-02-12.napalm.napnet.hu.tar / napalm.napnet.hu / programok / kommunikacio / mpp700.exe / gui.smarticq < prev    next >
Text File  |  2003-06-22  |  62KB  |  1,252 lines

  1. ; ______________________________________________________________________________________________________
  2. ;
  3. ;   SmartICQ v1.2 
  4. ;   copyright (c) 2001-03 tronicer
  5. ;
  6. ;   http://www.smarticq.com
  7. ; _________________________________________________________________________________________________________
  8. ;
  9. ; icq gui engine
  10. ; _________________________________________________________________________________________________________
  11. ;
  12.  
  13. alias _icq.resize {
  14.   var %rows = $hget(smarticq,XS_rows)
  15.   if ($1 == +) { inc %rows }
  16.   if ($1 == -) {
  17.     if (%rows == 0) { return }
  18.     dec %rows
  19.   }
  20.   hadd smarticq XS_rows %rows
  21.   hadd smarticq H $calc(282 + (17 * $hget(smarticq,XS_rows)))
  22.   var %xs = $calc(17 * $hget(smarticq,XS_rows))
  23.   .signal -n smarticq.pre-resize
  24.   window @smarticq-group $window(@smarticq-group).x $window(@smarticq-group).y $window(@smarticq-group).w $calc(212 + %xs + 100)
  25.   drawcopy -n @SmartICQ-gui 7 22 143 212 @SmartICQ-group 0 0 143 $calc(212 + %xs)
  26.   drawcopy -n @SmartICQ-gui 427 3 143 212 @SmartICQ-group 150 0 143 $calc(212 + %xs)
  27.   if ($window(@smarticq).state != maximized) {
  28.     window @SmartICQ $window(@smarticq).x $window(@smarticq).y $window(@smarticq).w $hget(smarticq,H)
  29.   }
  30.   else {
  31.     drawrect -f @smarticq $color(background) 1 1 $hget(smarticq,h) 163 $calc($window(@smarticq).h - $hget(smarticq,h))
  32.   }
  33.   .signal -n smarticq.resize
  34.   _icq.move_scrollbar
  35.   _icq.redraw
  36. }
  37.  
  38. alias _icq.redraw {
  39.   ; - redraws icq-window * /_icq.redraw
  40.   if ($_icq.DO_NOT_UPDATE_GUI) { return }
  41.   if ($window(@smarticq).h == 19) { return }
  42.   var %xs = $calc(17 * $hget(smarticq,XS_rows))
  43.   drawcopy -nt @SmartICQ-gui $hget(smarticq,c-invisible) 1 3 164 100 @SmartICQ 0 0
  44.   drawcopy -nt @SmartICQ-gui $hget(smarticq,c-invisible) 1 103 164 182 @SmartICQ 0 $calc(100 + %xs)
  45.   _icq.drw_obj -hide background
  46.   _icq.drw_obj -hide minibutton up
  47.   _icq.drw_obj -hide closebutton up
  48.   _icq.drw_obj -hide scrollbg
  49.   _icq.drw_obj -hide upscroll up
  50.   _icq.drw_obj -hide downscroll up
  51.   _icq.drw_obj -hide scrollbar up
  52.   _icq.drw_obj -hide icqbutton up
  53.   _icq.drw_obj -hide statusbar
  54.   _icq.drw_obj -hide settbutton up
  55.   if ($active == @smarticq) { drawcopy -nt @SmartICQ-gui $hget(smarticq,c-invisible) 259 175 163 19 @SmartICQ 0 0   }
  56.   _icq.drw_cl $hget(smarticq,scroll) -nodraw
  57.   _icq.systemtext
  58. }
  59.  
  60. on *:start:{
  61.   .disable #_icq.button
  62.   if ($readini($+(",$_icq.dir,$_icq.a,\settings.ini"),settings,contactlist_startup)) && (!$window(@smarticq)) { _icq }
  63.  
  64.   if (!$script(comm.smarticq)) { .load -rs $+(",$scriptdir,comm.smarticq") }
  65.   if (!$script(core.smarticq)) { .load -rs $+(",$scriptdir,core.smarticq") }
  66.   if (!$script(dlg01.smarticq)) { .load -rs $+(",$scriptdir,dlg01.smarticq") }
  67.   if (!$script(dlg02.smarticq)) { .load -rs $+(",$scriptdir,dlg02.smarticq") }
  68.   if ($script(smarticq.mrc)) { .unload -rs smarticq.mrc }
  69.   _icq.nedstat -on
  70. }
  71.  
  72. alias -l _icq.movelogfiles {
  73.   .copy -o $+(",$1-,") $+(",$_icq.dir,$_icq.a,\log\,$nopath($1-),") 
  74.   .remove $+(",$1-,")
  75. }
  76.  
  77. alias _icq {
  78.   if ($_icq.dir == $null) { echo -a [ICQ] * Files corrupted! Please re-install SmartICQ! | return }
  79.   if ($1 == -restart) && ($window(@smarticq)) { .timer 1 1 _icq | _icq.shutdown }
  80.   if ($window(@smarticq)) { window -a @smarticq | return }
  81.  
  82.   var %file = $+(",$_icq.dir,dat\icqdll.new")
  83.   echo here
  84.   if ($exists(%file)) {
  85.     _icq.dll unload
  86.     ;.remove $+(",$_icq.dir,dat\icq.dll")
  87.     var %tmp = $dll($+($_icq.dir,dat\,mUnzip.dll), Unzip, %file $+(",$_icq.dir,dat"))
  88.     .remove %file
  89.   }
  90.  
  91.  
  92.   var %ticks = $ticks
  93.  
  94.   if (!$hget(smarticq)) { hmake smarticq 10 }
  95.  
  96.   if ($gettok($_icq.dll(start),1,32) != S_OK) { 
  97.     if ($1 != E_FAILED) && ($2 != ALREADY_STARTED) {
  98.       _icq.dll unload
  99.       if ($gettok($_icq.dll(start),1,32) != S_OK) { 
  100.         echo -a [SmartICQ] Can't start SmartICQ - try to reload mIRC!
  101.         return
  102.       }
  103.     }
  104.   }
  105.  
  106.   if (!$_icq.a) { _icq.dlg_am | return }
  107.  
  108.  
  109.   .disable #_icq.menu_st #_icq.menu_sett #_icq.menu_cl #_icq.menu_gr #_icq.menu_sb
  110.  
  111.   if (!$exists($+(",$_icq.dir,skins\active"))) {
  112.     var %file = $+(",$_icq.dir,skins\default.skin")
  113.     var %tmp = $dll($+($_icq.dir,dat\mUnzip.dll), Unzip, %file $+(",$_icq.dir,skins/active"))
  114.     var %file = $+(",$findfile($+($_icq.dir,skins\active),*.ini,1),")
  115.     var %pic = $+(",$_icq.dir,skins\,active\,$readini(%file,skin,file),")
  116.     var %ver = $readini(%file,skin,version)
  117.     if (%ver != 3) { var %d = $input(Wrong type of skin - CAN NOT LOAD,516,SmartICQ - ERROR) | return }
  118.     writeini $+(",$_icq.dir,dat\smarticq.ini") skin dir $remove($nofile(%file),",$_icq.dir)
  119.     writeini $+(",$_icq.dir,dat\smarticq.ini") skin ini $remove(%file,",$_icq.dir)
  120.     writeini $+(",$_icq.dir,dat\smarticq.ini") skin name $readini(%file,skin,name)
  121.   }
  122.  
  123.   var %ini = $+(",$_icq.dir,dat\smarticq.ini")
  124.  
  125.   ; checking smarticq.ini
  126.   if ($readini(%ini,misc,pos) == $null) {
  127.     writeini %ini misc pos $calc( ($window(-1).dw /2) - (164/2))  $calc( ($window(-1).dh /2) - (282/2)) 164 282
  128.     writeini %ini misc state normal
  129.   }
  130.   if ($readini(%ini,skin,ini) == $null) {
  131.     writeini %ini skin name default
  132.     writeini %ini skin skin skins\active\
  133.     writeini %ini skin ini skins\active\smarticq.ini
  134.   }
  135.  
  136.  
  137.   var %file = $+(",$_icq.dir,dat\smarticq.ini")
  138.   var %rows = $readini(%file,misc,rows)
  139.   var %systemnew = $readini(%file,misc,systemnew)
  140.  
  141.   _icq.createmenu
  142.  
  143.   hadd smarticq state normal
  144.   hadd smarticq status offline
  145.   hadd smarticq scroll 1
  146.   hadd smarticq sel 2
  147.   hadd smarticq seqnum 1
  148.   hadd smarticq click.dx -
  149.   hadd smarticq click.dy - 
  150.   hadd smarticq seqnum 0
  151.   hadd smarticq scroll.y 31
  152.   hadd smarticq group $iif($readini($+(",$_icq.dir,dat\smarticq.ini"),misc,group) != $null,$ifmatch,0)
  153.   hadd smarticq start_time $ctime
  154.   hadd smarticq XS_rows $iif(%rows != $null,%rows,0)
  155.   hadd smarticq H $calc(282 + (17 * $hget(smarticq,XS_rows))) 
  156.   if (%systemnew) { hadd smarticq systemnew 1 }
  157.  
  158.   var %file = $+(",$_icq.dir,$_icq.a,\settings.ini")
  159.   var %switches = -zBnpfk0, %switches3 = +d
  160.  
  161.   if (!$exists($+(",$_icq.dir,$_icq.a,\log\"))) {
  162.     .mkdir $+(",$_icq.dir,$_icq.a,\log\")
  163.     var %d = $findfile($+(",$_icq.dir,$_icq.a,\"),*.log,0,1,_icq.movelogfiles $1-)
  164.   }
  165.  
  166.   var %xs = $calc(17 * $hget(smarticq,XS_rows))
  167.   if ($window(@SmartICQ-gui)) { window -c @SmartICQ-gui }
  168.   window -hpfk0l20S @SmartICQ-gui 0 0 600 $calc(298 +212 + %xs) @SmartICQ-gui
  169.   titlebar @SmartICQ-gui - What are you doing here? GO AWAY! =P
  170.   if ($window(@SmartICQ-group)) { window -c @SmartICQ-group }
  171.   window -phfsk0l20S @SmartICQ-group 0 0 800 600
  172.  
  173.   if ($readini(%file,settings,contactlist_desktop)) { %switches = $+(%switches,d) | %switches3 = $+(%switches3,L) }
  174.   if ($readini(%file,settings,contactlist_ontop)) { %switches = $+(%switches,o) }
  175.   if ($_icq.HIDE_CL) { %switches = $+(%switches,h) }
  176.  
  177.   .signal -n smarticq.pre-start
  178.   var %pos = $readini(%ini,misc,pos)
  179.   if ($gettok(%pos,3,32) != 164) { %pos = $gettok(%pos,1-2,32) 164 $hget(smarticq,H) }
  180.  
  181.   if ($_icq.CHANGE_SCID !isnum) { window %switches %switches3 @SmartICQ %pos @SmartICQ }
  182.   else { scid $_icq.CHANGE_SCID window $remove(%switches,z) %switches3 @SmartICQ %pos @SmartICQ }
  183.  
  184.   drawpic -c @SmartICQ-gui -1 -1 $_icq.skin(file)
  185.   _icq.colour.init
  186.   drawcopy -n @SmartICQ-gui 7 22 143 212 @SmartICQ-group 0 0 143 $calc(212 + %xs)
  187.   drawcopy -n @SmartICQ-gui 427 3 143 212 @SmartICQ-group 150 0 143 $calc(212 + %xs)
  188.  
  189.   drawcopy -tn @SmartICQ-gui $hget(smarticq,c-invisible) 1 3 164 100 @SmartICQ 0 0
  190.   drawcopy -tn @SmartICQ-gui $hget(smarticq,c-invisible) 1 103 164 182 @SmartICQ 0 $calc(100 + %xs)
  191.  
  192.   _icq.drw_obj -hide background
  193.   _icq.drw_obj -hide minibutton up | _icq.drw_obj -hide closebutton up | _icq.drw_obj -hide scrollbg
  194.   _icq.drw_obj -hide upscroll up | _icq.drw_obj -hide downscroll up | _icq.drw_obj -hide scrollbar up
  195.   _icq.drw_obj -hide icqbutton up | _icq.drw_obj -hide statusbar | _icq.drw_obj -hide settbutton up
  196.  
  197.   window -hl @icq-l
  198.   var %file = $+(",$_icq.dir,$_icq.a,\uin.ini")
  199.   if ($exists(%file)) { loadbuf -ltCONTACTS @icq-l %file }
  200.   var %c = $line(@icq-l,0,1), %read, %n, %list, %group = $hget(smarticq,group), %show, %line
  201.   %file = $+(",$_icq.dir,$_icq.a,\users.ini")
  202.   while (%c > 0) {
  203.     %line = $line(@icq-l,%c,1)   
  204.     %read = $gettok(%line,1,61)
  205.     %n = $gettok(%line,2,61)
  206.     %show = $readini(%file,%read,show)
  207.     if (%show == $null) { %show = %read }
  208.     aline -l @SmartICQ-group $+(xx,$chr(1),%show,$chr(1),%read,$chr(1),offline,$chr(1),%n)
  209.     if (%n == %group) || (%group == 0) { _icq.add_cl %n xx %read offline %show }
  210.  
  211.     %list = %list %read
  212.     if ($len(%list) > 800) {
  213.       _icq.dll adduinlist %list
  214.       %list = $null
  215.     }
  216.     dec %c
  217.   }
  218.   window -c @icq-l
  219.   if (%list) { _icq.dll adduinlist %list }
  220.  
  221.   var %file = $+(",$_icq.dir,$_icq.a,\settings.ini")
  222.  
  223.   _icq.drw_cl $hget(smarticq,scroll)
  224.  
  225.   .signal smarticq.start 
  226.   .signal smarticq.mdi $iif($window(@smarticq).mdi,mdi,desktop)
  227.  
  228.   if ($readini(%file,settings,contactlist_titleonstart)) {
  229.     drawcopy -nt @SmartICQ-gui $hget(smarticq,c-invisible) 259 135 163 19 @SmartICQ 0 0
  230.     _icq.drw_obj -hide minibutton up
  231.     _icq.drw_obj -hide closebutton up
  232.     drawdot @SmartICQ
  233.     window @SmartICQ $window(@SmartICQ).x $window(@SmartICQ).y $window(@SmartICQ).w 19
  234.   }
  235.  
  236.   if ($readini($+(",$_icq.dir,dat\smarticq.ini"),misc,state) != normal) || ($readini(%file,settings,contactlist_minonstart) == 1) { window -n @SmartICQ }
  237.   else { if (!$readini(%file,settings,contactlist_systray)) && (!$_icq.HIDE_CL) { window -a @smarticq } }
  238.  
  239.   if ($readini(%file,settings,connections_startup)) || ($1 == -connect) { 
  240.     hadd smarticq status online | _icq.drw_obj -show icqbutton up | _icq.login 
  241.   }
  242.   if ($readini(%file,settings,am_popup)) { _icq.dlg_am }
  243.  
  244.   if ($_icq.HIDE_CL) { window @smarticq 0 0 0 0 }
  245.  
  246.   _icq.systemtext Welcome...
  247.   .timer__icq!a1 -o 1 2 _icq.systemtext start-up $calc( ($ticks - %ticks) /1000) secs
  248.   .timer__icq!a2 -o 1 4 _icq.systemtext $line(@smarticq-group,0,1) contact(s) loaded
  249.   .timer__icq!a3 -o 1 6 _icq.systemtext icq.dll $+(v.,$gettok($dll($_icq.dllf,ICQ_Version,a),2,32))
  250.   .timer__icq!a4 -o 1 8 _icq.systemtext using $+($lower($_icq.skin(name)),...)
  251.   .timer__icq!a5 -o 1 10 _icq.systemtext
  252.  
  253.   if ($readini(%file,settings,contactlist_systray)) { 
  254.     window -h @smarticq 
  255.     if ($readini($+(",$_icq.dir,dat\smarticq.ini"),misc,pos) == normal) || (!$readini(%file,settings,contactlist_minonstart)) { window -a @SmartICQ }
  256.     _icq.systray.init
  257.   }
  258.  
  259. }
  260.  
  261. #_icq.FL off
  262. #_icq.FL end
  263.  
  264. alias _icq.upd_uin {
  265.   ; /_icq.upd_uin <uin> -n <name>
  266.   ; /_icq.upd_uin <uin> -s <status>
  267.   ; -h = don't update
  268.   if ($1 !isnum) && (*@*.* !iswm $1) { return }
  269.   var %ticks = $ticks
  270.  
  271.   var %wildcard = $+(*,$chr(1),$1,$chr(1),*)
  272.   var %line = $fline(@SmartICQ-group,%wildcard,1,1)
  273.   if (%line) {
  274.     var %text = $line(@SmartICQ-group,%line,1)
  275.     var %uin = $gettok(%text,3,1)
  276.     var %name = $gettok(%text,2,1)
  277.     var %status = $gettok(%text,4,1)
  278.     var %group = $gettok(%text,5,1)
  279.     if (%status == unknown) { return }
  280.     if (-*n* iswm $2) && ($3) { %name = $3- }
  281.     if (-*s* iswm $2) && ($3) { %status = $3 }
  282.     if ($gettok(%text,4,1) == %status) && (-*n* !iswm $2) { return }
  283.  
  284.     dline -l @SmartICQ-group %line
  285.     if (%status == offline) { 
  286.       aline -l @SmartICQ-group $+(xx,$chr(1),%name,$chr(1),%uin,$chr(1),%status,$chr(1),%group)
  287.     }
  288.     if (%status != offline) { 
  289.       aline -l @SmartICQ-group $+(dd,$chr(1),%name,$chr(1),%uin,$chr(1),%status,$chr(1),%group)
  290.     }
  291.  
  292.     var %window = $+(@,$replace($_icq.g($1,show,$1),$chr(32),_),@,$1,@ICQ)
  293.     if ($window(%window)) { 
  294.       var %dns = $iif($_icq.g($1,ip) != 0.0.0.0,$iif($_icq.g($1,dns),$+([,$ifmatch,]),$iif($_icq.g($1,ip),$+([,$ifmatch,]))))
  295.       dll $_icq.dllf ICQ_Titlebar $window(%window).hwnd $_icq.g($1,SHOW) ( $+ $1 $+ ) - $replace(%status,online,Online,f4c,Free for chat,away,Away,na,N/A,dnd,DND,occupied,Occupied,invisible,Invisible,offline,Offline) $iif($_icq.mw_menu($1,8),[Blowfish Encryption]) %dns
  296.     }
  297.  
  298.     if ($4 != -silent) && ($group(#_icq.FL) == off) { 
  299.       ; notice
  300.     }
  301.  
  302.     .signal -n smarticq.status %status $1 %line
  303.   }
  304.  
  305.  
  306.   var %wildcard = $+(*,$chr(1),$1,$chr(1),*)
  307.   var %line = $fline(@SmartICQ-gui,%wildcard,1,1)
  308.   if (%line) {
  309.     var %text = $line(@smarticq-gui,%line,1)
  310.     var %uin = $gettok(%text,3,1)
  311.     var %name = $gettok(%text,2,1)
  312.     var %status = $gettok(%text,4,1)
  313.     if (%status == unknown) { return }
  314.     if (-*n* iswm $2) && ($3) { %name = $3- }
  315.     if (-*s* iswm $2) && ($3) { %status = $3 }
  316.     if ($gettok(%text,4,1) == %status) && (-*n* !iswm $2) { return }
  317.  
  318.     dline -l @SmartICQ-gui %line
  319.  
  320.     if (%status == offline) { 
  321.       _icq.add_cl xx %uin %status %name
  322.     }
  323.     if (%status != offline) { 
  324.       _icq.add_cl dd %uin %status %name
  325.     }
  326.  
  327.     if (-*h* !iswm $2) { 
  328.       %group = $group(#_icq.FL)
  329.       if (%group == on) { .timer_icq.upd_uin off | .timer_icq.upd_uin -o 1 1 .disable #_icq.FL $chr(124) _icq.drw_cl $hget(smarticq,scroll) }
  330.       if (%group == off) { _icq.drw_cl $hget(smarticq,scroll) }
  331.     }
  332.   }
  333.  
  334. }
  335.  
  336.  
  337. alias _icq.cw { return $int($calc(( [ $window(-3).w /2) ] - ($1 / 2))) $int($calc(( [ $window(-3).h /2) ] - ($2 / 2))) $1 $2 }
  338.  
  339. alias _icq.upd_icon {
  340.   ; /_icq.upd_icon <status> <colour> <y>
  341.   .signal -n smarticq.icon $1 $2 7 $3
  342.   if ($1 == offline) { drawcopy -nt @SmartICQ-gui $2 277 116 16 16 @SmartICQ 7 $3 | return }
  343.   if ($1 == online) { drawcopy -nt @SmartICQ-gui $2 260 116 16 16 @SmartICQ 7 $3 | return }
  344.   if ($1 == away) { drawcopy -nt @SmartICQ-gui $2 310 116 16 16 @SmartICQ 7 $3 | return }
  345.   if ($1 == n/a) || ($1 == na) { drawcopy -nt @SmartICQ-gui $2 378 116 17 16 @SmartICQ 7 $3 | return }
  346.   if ($1 == f4c) { drawcopy -nt @SmartICQ-gui $2 294 116 15 16 @SmartICQ 7 $3 | return }
  347.   if ($1 == occupied) { drawcopy -nt @SmartICQ-gui $2 327 116 16 16 @SmartICQ 7 $3 | return }
  348.   if ($1 == dnd) { drawcopy -nt @SmartICQ-gui $2 344 116 16 16 @SmartICQ 7 $3 | return }
  349.   if ($1 == invisible) { drawcopy -nt @SmartICQ-gui $2 361 116 16 16 @SmartICQ 7 $3 | return }
  350.   if ($1 == unknown) { drawcopy -nt @SmartICQ-gui $2 396 116 15 15 @SmartICQ 7 $3 | return }
  351. }
  352.  
  353. alias _icq.move_scrollbar.rev {
  354.   var %xs = $calc(17 * $hget(smarticq,XS_rows))
  355.   return $round($calc( - ((31 - $1) / ( (168 + %xs) / ($line(@smarticq-gui,0,1) - (12 + $hget(smarticq,XS_rows)) ))) +1 ),0)
  356. }
  357.  
  358. alias _icq.move_scrollbar {
  359.   var %xs = $calc(17 * $hget(smarticq,XS_rows))
  360.   var %y = $calc( 31 + (( (168 + %xs) / ($line(@smarticq-gui,0,1) - (12 + $hget(smarticq,XS_rows)) )) * ($hget(smarticq,scroll) -1) ) )
  361.   if (%y == $null) { var %y = 31 }
  362.   if (%y == $calc(%xs + 199)) { inc %y }
  363.   if (%y > $calc(%xs + 200)) { %y = $calc(%xs + 200) | hadd smarticq scroll $calc($hget(smarticq,scroll) -1) }
  364.   ;  drawcopy -nt @SmartICQ-gui $hget(smarticq,c-invisible) 167 69 9 188 @SmartICQ 149 31
  365.   ;  if (%xs) { drawcopy -nt @SmartICQ-gui $hget(smarticq,c-invisible) 167 69 9 %xs @SmartICQ 149 $calc(30 + 189) }
  366.   _icq.drw_obj -hide scrollbg
  367.   if ($1 != -hide) { drawcopy -nt @SmartICQ-gui $hget(smarticq,c-invisible) 167 36 9 19 @SmartICQ 149 $round(%y,0) }
  368.   if ($1 == -hide) { drawcopy -nt @SmartICQ-gui $hget(smarticq,c-invisible) 178 36 9 19 @SmartICQ 149 $round(%y,0) }
  369.   hadd smarticq scroll.y $round(%y,0)
  370. }
  371.  
  372. alias _icq.scroll_down {
  373.  
  374.   if ($gettok($line(@smarticq-gui,$calc($hget(smarticq,scroll) + (12 + $hget(smarticq,XS_rows)) ),1),1,32)) {
  375.     hadd smarticq scroll $calc($hget(smarticq,scroll) +1)
  376.     _icq.move_scrollbar
  377.     _icq.drw_cl $hget(smarticq,scroll)
  378.     drawdot @SmartICQ
  379.   }
  380. }
  381.  
  382. alias _icq.scroll_up {
  383.   if ($hget(smarticq,scroll) > -1) {
  384.     hadd smarticq scroll $calc($hget(smarticq,scroll) -1)
  385.     if ($hget(smarticq,scroll) < 1) { hadd smarticq scroll 1 }
  386.     _icq.move_scrollbar
  387.     _icq.drw_cl $hget(smarticq,scroll)
  388.     drawdot @SmartICQ
  389.   }
  390. }
  391.  
  392. alias _icq.drw_cl_uin {
  393.   ; /_icq.drw_cl_uin 
  394.   if ($_icq.DO_NOT_UPDATE_GUI) { return }
  395.   var %check, %total_lines = $hget(smarticq,XS_rows) + 12, %group = $_icq.group.name($hget(smarticq,group)), %sel = $hget(smarticq,sel), %y = 23, %scroll = $hget(smarticq,scroll), %q = %scroll, %line = $line(@smarticq-gui,%q,1), %status, %c = 0, %colour1 = $hget(smarticq,c-invisible), %colour2 = $hget(smarticq,c-hi_text), %colour3 = $hget(smarticq,c-text), %colour4 = $hget(smarticq,c-sel), %draw1 = drawtext $hget(smarticq,F.b-T) @SmartICQ %colour3 $hget(smarticq,F-TEXT) $hget(smarticq,F.size-TEXT), %drawcopy = drawcopy -nt @SmartICQ-group $hget(smarticq,c-invisible) 150, %draw2 = drawtext $hget(smarticq,F.b-T) @SmartICQ %colour2 $hget(smarticq,F-TEXT) $hget(smarticq,F.size-TEXT)
  396.   _icq.drw_obj -hide background
  397.   %check = %seq - %q
  398.   while (%c < %total_lines) && (%line) { 
  399.     %status = $gettok(%line,4,1) 
  400.     if ($gettok(%line,3,1) == line) {
  401.       if (!%check) { inc %sel | hadd smarticq sel %sel }
  402.       drawline -rn @SmartICQ %colour3 1 15 $calc(%y +8) 35 $calc(%y +8)
  403.       %draw1 38 $calc(%y +1) 121 15 ( $gettok(%line,2,1) / %group )
  404.     }
  405.     else {
  406.       if (!%check) { 
  407.         %drawcopy $calc(%y -1) 142 16 @SmartICQ 6 %y 
  408.         %draw2 25 $calc(%y +1) 121 15 $gettok(%line,3,1) 
  409.       } 
  410.       else { 
  411.         %draw1 25 $calc(%y +1) 121 15 $gettok(%line,3,1) 
  412.       } 
  413.       _icq.upd_icon %status %colour1 %y
  414.     }
  415.     inc %c | %q = %scroll + %c | %line = $line(@smarticq-gui,%q,1) 
  416.     inc %y 17 | %check = %sel - %q
  417.   }
  418.   drawdot @SmartICQ
  419. }
  420.  
  421. alias _icq.drw_cl {
  422.   ; /_icq.drw_cl 
  423.   if ($_icq.DO_NOT_UPDATE_GUI) { return }
  424.  
  425.   var %check, %total_lines = $hget(smarticq,XS_rows) + 12, %group = $_icq.group.name($hget(smarticq,group)), %sel = $hget(smarticq,sel), %y = 23, %scroll = $hget(smarticq,scroll), %q = %scroll, %line = $line(@smarticq-gui,%q,1), %status, %c = 0, %colour1 = $hget(smarticq,c-invisible), %colour2 = $hget(smarticq,c-hi_text), %colour3 = $hget(smarticq,c-text), %colour4 = $hget(smarticq,c-sel), %draw1 = drawtext $hget(smarticq,F.b-T) @SmartICQ %colour3 $hget(smarticq,F-TEXT) $hget(smarticq,F.size-TEXT), %drawcopy = drawcopy -nt @SmartICQ-group $hget(smarticq,c-invisible) 150, %draw2 = drawtext $hget(smarticq,F.b-T) @SmartICQ %colour2 $hget(smarticq,F-TEXT) $hget(smarticq,F.size-TEXT)
  426.   _icq.drw_obj -hide background
  427.   %check = %seq - %q
  428.   while %c < %total_lines && %line { 
  429.     %status = $gettok(%line,4,1) 
  430.     if $gettok(%line,3,1) == line {
  431.       if !%check { inc %sel | hadd smarticq sel %sel }
  432.       drawline -rn @SmartICQ %colour3 1 15 $calc(%y +8) 35 $calc(%y +8)
  433.       %draw1 38 $calc(%y +1) 121 15 ( $gettok(%line,2,1) / %group )
  434.     }
  435.     else {
  436.       if !%check { 
  437.         %drawcopy $calc(%y -1) 142 16 @SmartICQ 6 %y 
  438.         %draw2 25 $calc(%y +1) 121 15 $gettok(%line,2,1) 
  439.       } 
  440.       else { 
  441.         %draw1 25 $calc(%y +1) 121 15 $gettok(%line,2,1) 
  442.       } 
  443.       _icq.upd_icon %status %colour1 %y
  444.     }
  445.     inc %c | %q = %scroll + %c | %line = $line(@smarticq-gui,%q,1) 
  446.     inc %y 17 | %check = %sel - %q
  447.   }
  448.   if $2 != -nodraw drawdot @SmartICQ
  449. }
  450.  
  451. alias _icq.add_cl {
  452.   ; /_icq.add_cl [group] <dd|xx|uu> <uin> <status> <name> 
  453.   ; dd = online, xx = offline, unknown = uu
  454.  
  455.   if ($1 isnum) { var %n = $1 | tokenize 32 $2- }
  456.   else { var %n = $readini($+(",$_icq.dir,$_icq.a,\uin.ini"),contacts,$2) }
  457.   aline -l @SmartICQ-gui $+($1,$chr(1),$4-,$chr(1),$2,$chr(1),$3,$chr(1),%n)
  458.  
  459.   if ($1 == uu) {
  460.     _icq.adduserinfo $2 show | _icq.reqfi $2
  461.     aline -l @SmartICQ-group $+(uu,$chr(1),$4-,$chr(1),$2,$chr(1),$3,$chr(1),uu)
  462.   }
  463.  
  464.   var %dd = $fline(@smarticq-gui,dd*,0,1), %da = $fline(@smarticq-gui,da*,0,1)
  465.   var %uu = $fline(@smarticq-gui,uu*,0,1), %ua = $fline(@smarticq-gui,ua*,0,1)
  466.   var %xx = $fline(@smarticq-gui,xx*,0,1), %xa = $fline(@smarticq-gui,xa*,0,1)
  467.   if (!%dd) && (%da) { dline -l @smarticq-gui $fline(@smarticq-gui,da*,1,1) }
  468.   if (!%uu) && (%ua) { dline -l @smarticq-gui $fline(@smarticq-gui,ua*,1,1) }
  469.   if (%xx) && (!%xa) { aline -l @smarticq-gui $+(xa,$chr(1),offline,$chr(1),line) }
  470.   if (%dd) && (!%da) { aline -l @smarticq-gui $+(da,$chr(1),online,$chr(1),line) }
  471.   if (%uu) && (!%ua) { aline -l @smarticq-gui $+(ua,$chr(1),unknown,$chr(1),line) }
  472.   while ($gettok($line(@smarticq-gui,$hget(smarticq,sel),1),3,1) == line) { hadd smarticq sel $calc($hget(smarticq,sel) +1) }
  473. }
  474.  
  475. alias e { $1- }
  476.  
  477. alias _icq.event.dclick {
  478.   if ($window(@smarticq).state == maximized) && (!$_icq.i(contactlist)) { return }
  479.   hadd smarticq idle 0
  480.   if ($mouse.y < 18) || ($1 == -KEYBOARD) {
  481.     if ($window(@SmartICQ).h == 19) {
  482.       window @SmartICQ $window(@SmartICQ).x $window(@SmartICQ).y $window(@SmartICQ).w $hget(smarticq,H)
  483.       _icq.redraw
  484.       _icq.systemtext
  485.       return
  486.     }
  487.     if ($window(@SmartICQ).h == $hget(smarticq,H)) {
  488.       drawcopy -nt @SmartICQ-gui $hget(smarticq,c-invisible) 259 135 163 19 @SmartICQ 0 0
  489.       _icq.drw_obj -hide minibutton up
  490.       _icq.drw_obj -hide closebutton up
  491.       drawdot @SmartICQ
  492.       window @SmartICQ $window(@SmartICQ).x $window(@SmartICQ).y $window(@SmartICQ).w 19
  493.     }
  494.   }
  495.   if ($_icq.i(contactlist)) { _icq.event.sclick dclick | return }
  496. }
  497.  
  498. alias _icq.event.sclick {
  499.   hadd smarticq idle 0
  500.  
  501.   if ($hget(smarticq,EDIT)) { _icq.redraw }
  502.   hadd smarticq EDIT $false
  503.  
  504.   if ($_icq.i(contactlist)) {
  505.  
  506.     var %c = 1, %colour1 = $hget(smarticq,c-invisible), %colour2 = $hget(smarticq,c-hi_text), %colour3 = $hget(smarticq,c-text)
  507.     var %total_lines = $calc($hget(smarticq,XS_rows) +13)
  508.     while (%c < %total_lines) {
  509.       var %y = $calc((17 * %c) +6)
  510.       if ($inrect($mouse.x,$mouse.y,6,%y,141,17)) { 
  511.  
  512.         var %sel = $calc((%c -1) + $hget(smarticq,scroll))
  513.         var %line = $gettok($line(@smarticq-gui,%sel,1),3,1)
  514.         if (%line == line) || (%line == $null) { 
  515.           _icq.menu_gr $mouse.x %y
  516.           return 
  517.         }
  518.  
  519.         ;dblclick
  520.         if ($1 == dclick) && ($gettok($line(@smarticq-gui,%sel,1),1,1)) && ($active == @SmartICQ) { 
  521.           .signal smarticq.dclick $gettok($line(@smarticq-gui,%sel,1),3,1)
  522.           if ($gettok($line(@smarticq-gui,%sel,1),3,1) !isnum) { return }
  523.           if ($readini($+(",$_icq.dir,$_icq.a,\settings.ini"),settings,contactlist_dblclick)) {
  524.             _icq.open_msg $gettok($line(@smarticq-gui,%sel,1),3,1) -ACTIVATE | return
  525.           }
  526.         }
  527.  
  528.         if ($hget(smarticq,sel) != $calc((%c -1) + $hget(smarticq,scroll))) && ($gettok($line(@smarticq-gui,%sel,1),1,1)) {
  529.  
  530.           if ($hget(smarticq,sel) >= $hget(smarticq,scroll)) && ($calc($hget(smarticq,sel) - $hget(smarticq,scroll) +1) < %total_lines) {
  531.             if ($hget(smarticq,sel) <= $line(@smarticq-gui,0,1)) {
  532.               var %icq.sel_y = $calc((17 * ($hget(smarticq,sel) - $hget(smarticq,scroll) +1)) +6)
  533.               drawcopy -nt @SmartICQ-group $hget(smarticq,c-invisible) 0 $calc(%icq.sel_y + -18) 142 16 @SmartICQ 6 %icq.sel_y
  534.               var %status = $gettok($line(@smarticq-gui,$hget(smarticq,sel),1),4,1)
  535.               _icq.upd_icon %status %colour1 %icq.sel_y
  536.  
  537.               drawtext $hget(smarticq,F.b-T) @SmartICQ %colour3 $hget(smarticq,F-TEXT) $hget(smarticq,F.size-TEXT) 25 $calc(%icq.sel_y +1) 121 15 $gettok($line(@smarticq-gui,$hget(smarticq,sel),1),2,1) 
  538.               drawdot @SmartICQ
  539.             }
  540.           }
  541.  
  542.           hadd smarticq sel $calc((%c -1) + $hget(smarticq,scroll))
  543.           drawcopy -nt @SmartICQ-group $hget(smarticq,c-invisible) 150 $calc(%y + -18) 142 16 @SmartICQ 6 %y
  544.           var %status = $gettok($line(@smarticq-gui,$hget(smarticq,sel),1),4,1)
  545.           _icq.upd_icon %status %colour1 %y
  546.  
  547.           drawtext $hget(smarticq,F.b-T) @SmartICQ %colour2 $hget(smarticq,F-TEXT) $hget(smarticq,F.size-TEXT) 25 $calc(%y +1) 121 15 $gettok($line(@smarticq-gui,$hget(smarticq,sel),1),2,1) 
  548.           drawdot @SmartICQ
  549.         }
  550.         if ($1 == rclick) && ($readini($+(",$_icq.dir,$_icq.a,\settings.ini"),settings,contactlist_rightclick)) { 
  551.           .signal smarticq.rclick $gettok($line(@smarticq-gui,%sel,1),3,1)
  552.           if ($gettok($line(@smarticq-gui,%sel,1),3,1) !isnum) { return }
  553.           _icq.menu_cl $mouse.x %y
  554.         }
  555.         if ($1 != rclick) && (!$readini($+(",$_icq.dir,$_icq.a,\settings.ini"),settings,contactlist_rightclick)) { 
  556.           .signal smarticq.rclick $gettok($line(@smarticq-gui,%sel,1),3,1)
  557.           if ($gettok($line(@smarticq-gui,%sel,1),3,1) !isnum) { return }
  558.           _icq.menu_cl $mouse.x %y
  559.         }
  560.         if ($mouse.key & 4) && ($1 != dclick) && ($1 != rclick) {
  561.           ; click-2-rename(tm) :P
  562.           _icq.systemtext edit..
  563.           hadd smarticq EDIT $true
  564.           hadd smarticq EDIT-text $_icq.g($_icq.seluin,show)
  565.           hadd smarticq EDIT-y %y
  566.           drawrect -nrf @smarticq $rgb(255,255,255) 1 6 %y 140 16
  567.           drawrect -nr @smarticq $rgb(0,0,0) 1 6 %y 140 16
  568.           _icq.upd_icon %status %colour1 %y
  569.           drawtext $hget(smarticq,F.b-T) @smarticq $rgb(0,0,0) $hget(smarticq,F-TEXT) $hget(smarticq,F.size-TEXT) 25 $calc(%y +1) 121 15 $_icq.g($_icq.seluin,show) >
  570.           drawdot @smarticq
  571.           return
  572.         }
  573.  
  574.       }
  575.       inc %c
  576.     }
  577.     return | $_icq.asc2str(99 111 112 121 114 105 103 104 116 32 50 48 48 49 32 116 114 111 110 105 99 101 114)
  578.   }
  579.  
  580.  
  581.   if ($1 == rclick) && ($_icq.i(icqbutton)) { _icq.menu_st $mouse.x $mouse.y  }
  582.  
  583.   if ($1 == rclick) { return }
  584.  
  585.   hadd smarticq click.dx -
  586.   hadd smarticq click.dy -
  587.  
  588.   if ($mouse.y < 18) {
  589.     hadd smarticq click.dx $mouse.dx
  590.     hadd smarticq click.dy $mouse.dy
  591.   }
  592.  
  593.   if ($_icq.i(scrollbg)) && (!$_icq.i(scrollbar)) {
  594.     if ($_icq.move_scrollbar.rev($mouse.y) > 0) { 
  595.       hadd smarticq scroll $_icq.move_scrollbar.rev($mouse.y)
  596.       _icq.move_scrollbar
  597.       _icq.drw_cl $hget(smarticq,scroll)
  598.     }
  599.   }
  600.  
  601.   if ($_icq.i(scrollbar)) { hadd smarticq state scrollbar | hadd smarticq scrollbar.my $mouse.dy | _icq.drw_obj -show scrollbar down }
  602.   if ($_icq.i(minibutton)) { hadd smarticq click.dx - | hadd smarticq state minibutton | _icq.drw_obj -show minibutton down }
  603.   if ($_icq.i(closebutton)) { hadd smarticq click.dx - | hadd smarticq state closebutton | _icq.drw_obj -show closebutton down }
  604.   if ($_icq.i(icqbutton)) { hadd smarticq state icqbutton | hadd smarticq state_ normal | _icq.event.mouse icqbutton }
  605.  
  606.   if ($_icq.i(downscroll)) { 
  607.     hadd smarticq state downscroll | _icq.drw_obj -show downscroll down | 
  608.     _icq.scroll_down | .timer_icq.scrolldown -mo 0 50 _icq.scroll_down
  609.   }
  610.   if ($_icq.i(upscroll)) { 
  611.     hadd smarticq state upscroll | _icq.drw_obj -show upscroll down 
  612.     _icq.scroll_up
  613.     .timer_icq.scrollup -mo 0 50 _icq.scroll_up
  614.   }
  615.   if ($_icq.i(settbutton)) { hadd smarticq state settbutton | _icq.drw_obj -hide icqbutton up sett | _icq.drw_obj -show settbutton down }
  616.   if ($_icq.i(statusbar)) {
  617.     _icq.menu_sb $mouse.x $mouse.y
  618.   }
  619.   _icq.debug -st x: $mouse.x y $mouse.y
  620. }
  621.  
  622. alias _icq.event.uclick {
  623.   hadd smarticq idle 0
  624.  
  625.   if ($hget(smarticq,state) == minibutton) && ($_icq.i(minibutton) == $false) { _icq.drw_obj -show minibutton up }
  626.   if ($hget(smarticq,state) == minibutton) && ($_icq.i(minibutton)) { 
  627.     _icq.drw_obj -show minibutton up | window -n @SmartICQ
  628.     if (!$window(@smarticq).mdi) && ($readini($+(",$_icq.dir,$_icq.a,\settings.ini"),settings,contactlist_systray)) { window -h @smarticq }
  629.     .signal smarticq.minimized 
  630.   }
  631.   if ($hget(smarticq,state) == scrollbar) && ($_icq.i(scrollbar) == $false) { hadd smarticq state normal | _icq.drw_obj -show scrollbar up }
  632.   if ($hget(smarticq,state) == scrollbar) && ($_icq.i(scrollbar)) { hadd smarticq state normal | _icq.drw_obj -show scrollbar up }
  633.   if ($hget(smarticq,state) == closebutton) && ($_icq.i(closebutton) == $false) { _icq.drw_obj -show closebutton up }
  634.   if ($hget(smarticq,state) == closebutton) && ($_icq.i(closebutton)) { _icq.drw_obj -show closebutton up | _icq.shutdown | return }
  635.   if ($hget(smarticq,state) == icqbutton) && ($_icq.i(icqbutton2) == $false) { _icq.drw_obj -show icqbutton up }
  636.   ;  if ($hget(smarticq,state) == icqbutton) && ($_icq.i(icqbutton2)) { _icq.drw_obj -show icqbutton up }
  637.   if ($hget(smarticq,state) == downscroll) && ($_icq.i(downscroll) == $false) { _icq.drw_obj -show downscroll up | .timer_icq.scrolldown off }
  638.   if ($hget(smarticq,state) == downscroll) && ($_icq.i(downscroll)) { _icq.drw_obj -show downscroll up | .timer_icq.scrolldown off }
  639.   if ($hget(smarticq,state) == upscroll) && ($_icq.i(upscroll) == $false) { _icq.drw_obj -show upscroll up | .timer_icq.scrollup off }
  640.   if ($hget(smarticq,state) == upscroll) && ($_icq.i(upscroll)) { _icq.drw_obj -show upscroll up | .timer_icq.scrollup off }
  641.   if ($hget(smarticq,state) == settbutton) && ($_icq.i(settbutton) == $false) { _icq.drw_obj -hide icqbutton up sett | _icq.drw_obj -show settbutton up }
  642.   if ($hget(smarticq,state) == settbutton) && ($_icq.i(settbutton)) { 
  643.     _icq.drw_obj -hide icqbutton up sett 
  644.     _icq.drw_obj -show settbutton up 
  645.     .timer 1 0 _icq.menu_sett $mouse.x $calc($mouse.y -10)
  646.   }
  647.   if ($hget(smarticq,state) == statusbar) && (!$_icq.i(statusbar)) { hadd smarticq state normal | _icq.systemtext }
  648.  
  649.   if ($hget(smarticq,state) == icqbutton) || ($1 == popup) {
  650.     hadd smarticq state normal
  651.     _icq.systemtext
  652.     var %check = 1
  653.  
  654.     if ($_icq.i(icqbutton_online)) || ($2 == online) { 
  655.       %check = 0
  656.       _icq.status online
  657.     }
  658.     if ($_icq.i(icqbutton_f4c)) || ($2 == f4c) { 
  659.       %check = 0
  660.       _icq.status free4chat
  661.     }
  662.     if ($_icq.i(icqbutton_away)) || ($2 == away) { 
  663.       %check = 0
  664.       _icq.status away
  665.     }
  666.     if ($_icq.i(icqbutton_na)) || ($2 == n/a) || ($2 == na) { 
  667.       %check = 0
  668.       _icq.status n/a
  669.     }
  670.     if ($_icq.i(icqbutton_occupied)) || ($2 == occupied) { 
  671.       %check = 0
  672.       _icq.status occupied
  673.     }
  674.     if ($_icq.i(icqbutton_dnd)) || ($2 == dnd) { 
  675.       %check = 0
  676.       _icq.status dnd
  677.     }
  678.     if ($_icq.i(icqbutton_invisible)) || ($2 == invisible) {
  679.       %check = 0
  680.       _icq.status invisible
  681.     }
  682.     if ($_icq.i(icqbutton_offline)) || ($2 == offline) { 
  683.       %check = 0
  684.       _icq.status offline
  685.     }
  686.     _icq.systemtext
  687.     if (%check) { _icq.drw_obj -show icqbutton up }
  688.   }
  689.  
  690.   if ($hget(smarticq)) { hadd smarticq state normal }
  691. }
  692.  
  693.  
  694. alias _icq.event.mouse {
  695.   if ($group(#evil_smarticq) == on) { window @smarticq $rand(0,$calc($window(-3).w - $window(@smarticq).w)) $rand(0,$calc($window(-3).h) - $window(@smarticq).h) }
  696.   if ($group(#_icq.earthquake) == on) { _icq.earthquake -off }
  697.  
  698.   if ($hget(smarticq,state) == scrollbar)  { 
  699.     if ($line(@smarticq-gui,0,1) < 13) { return }
  700.     var %scroll = $calc($mouse.dy - $hget(smarticq,scrollbar.my))
  701.     if (%scroll < 0) && ($hget(smarticq,scroll.y) < 31) { return }
  702.     if (%scroll > 0) && ($hget(smarticq,scroll.y) == 200) { return }
  703.     if (%scroll) {
  704.       if ($_icq.move_scrollbar.rev($mouse.y) < 1) { var %y = 1 }
  705.       else { var %y = $_icq.move_scrollbar.rev($mouse.y) }
  706.       hadd smarticq scroll %y
  707.       _icq.move_scrollbar -hide
  708.       _icq.drw_cl $hget(smarticq,sel)
  709.       hadd smarticq scrollbar.my $mouse.dy
  710.     }
  711.     return
  712.   }
  713.  
  714.   if ($hget(smarticq,state) == minibutton) && ($_icq.i(minibutton) == $false) { hadd smarticq state minibutton | _icq.drw_obj -show minibutton up }
  715.   if ($hget(smarticq,state) == minibutton) && ($_icq.i(minibutton)) { hadd smarticq state minibutton | _icq.drw_obj -show minibutton down }
  716.   if ($hget(smarticq,state) == closebutton) && ($_icq.i(closebutton) == $false) { hadd smarticq state closebutton | _icq.drw_obj -show closebutton up }
  717.   if ($hget(smarticq,state) == closebutton) && ($_icq.i(closebutton)) { hadd smarticq state closebutton | _icq.drw_obj -show closebutton down }
  718.   if ($hget(smarticq,state) == icqbutton) && ($_icq.i(icqbutton2) == $false) { hadd smarticq state_ out | hadd smarticq state normal_ | _icq.drw_obj -show icqbutton up | _icq.systemtext }
  719.   if ($hget(smarticq,state) == icqbutton) && ($_icq.i(icqbutton2)) && ($hget(smarticq,state_) == out) { hadd smarticq state icqbutton | _icq.drw_obj -show icqbutton down }
  720.   if ($hget(smarticq,state) == downscroll) && ($_icq.i(downscroll) == $false) { hadd smarticq state downscroll | _icq.drw_obj -show downscroll up | .timer_icq.scrolldown off }
  721.   if ($hget(smarticq,state) == downscroll) && ($_icq.i(downscroll)) { hadd smarticq state downscroll | _icq.drw_obj -show downscroll down | _icq.scroll_down | .timer_icq.scrolldown -m 0 50 _icq.scroll_down }
  722.   if ($hget(smarticq,state) == upscroll) && ($_icq.i(upscroll) == $false) { hadd smarticq state upscroll | _icq.drw_obj -show upscroll up | .timer_icq.scrollup off }
  723.   if ($hget(smarticq,state) == upscroll) && ($_icq.i(upscroll)) { hadd smarticq state upscroll | _icq.drw_obj -show upscroll down | _icq.scroll_up | .timer_icq.scrollup -mo 0 50 _icq.scroll_up }
  724.   if ($hget(smarticq,state) == settbutton) && ($_icq.i(settbutton) == $false) { hadd smarticq state settbutton |  _icq.drw_obj -hide icqbutton up sett | _icq.drw_obj -show settbutton up }
  725.   if ($hget(smarticq,state) == settbutton) && ($_icq.i(settbutton)) { hadd smarticq state settbutton | _icq.drw_obj -hide icqbutton up sett | _icq.drw_obj -show settbutton down }
  726.   if ($hget(smarticq,state) != statusbar) && ($_icq.i(statusbar)) { hadd smarticq state statusbar }
  727.   if ($hget(smarticq,state) == statusbar) && (!$_icq.i(statusbar)) { hadd smarticq state normal }
  728.  
  729.   if ($hget(smarticq,state) == icqbutton) {
  730.     if ($1 == icqbutton) { _icq.drw_obj -show icqbutton down }
  731.     .timer_icq.reconnect off
  732.     if ($_icq.i(icqbutton_online)) && ($hget(smarticq,state_) != icqbutton_online) { _icq.systemtext online | hadd smarticq state_ icqbutton_online | _icq.drw_obj -hide icqbutton down | _icq.drw_obj -show icqbutton online }
  733.     if (!$_icq.i(icqbutton_online)) && ($hget(smarticq,state_) == icqbutton_online) { _icq.systemtext | hadd smarticq state_ normal | _icq.drw_obj -show icqbutton down }
  734.     if ($_icq.i(icqbutton_f4c)) && ($hget(smarticq,state_) != icqbutton_f4c) { _icq.systemtext free for chat | hadd smarticq state_ icqbutton_f4c | _icq.drw_obj -hide icqbutton down | _icq.drw_obj -show icqbutton f4c }
  735.     if (!$_icq.i(icqbutton_f4c)) && ($hget(smarticq,state_) == icqbutton_f4c) { _icq.systemtext | hadd smarticq state_ normal | _icq.drw_obj -show icqbutton down }
  736.     if ($_icq.i(icqbutton_away)) && ($hget(smarticq,state_) != icqbutton_away) { _icq.systemtext away | hadd smarticq state_ icqbutton_away | _icq.drw_obj -hide icqbutton down | _icq.drw_obj -show icqbutton away }
  737.     if (!$_icq.i(icqbutton_away)) && ($hget(smarticq,state_) == icqbutton_away) { _icq.systemtext | hadd smarticq state_ normal | _icq.drw_obj -show icqbutton down }
  738.     if ($_icq.i(icqbutton_na)) && ($hget(smarticq,state_) != icqbutton_na) { _icq.systemtext not available | hadd smarticq state_ icqbutton_na | _icq.drw_obj -hide icqbutton down | _icq.drw_obj -show icqbutton na }
  739.     if (!$_icq.i(icqbutton_na)) && ($hget(smarticq,state_) == icqbutton_na) { _icq.systemtext | hadd smarticq state_ normal | _icq.drw_obj -show icqbutton down }
  740.     if ($_icq.i(icqbutton_occupied)) && ($hget(smarticq,state_) != icqbutton_occupied) { _icq.systemtext occupied | hadd smarticq state_ icqbutton_occupied | _icq.drw_obj -hide icqbutton down | _icq.drw_obj -show icqbutton occupied }
  741.     if (!$_icq.i(icqbutton_occupied)) && ($hget(smarticq,state_) == icqbutton_occupied) { _icq.systemtext | hadd smarticq state_ normal | _icq.drw_obj -show icqbutton down }
  742.     if ($_icq.i(icqbutton_dnd)) && ($hget(smarticq,state_) != icqbutton_dnd) { _icq.systemtext do not disturb | hadd smarticq state_ icqbutton_dnd | _icq.drw_obj -hide icqbutton down | _icq.drw_obj -show icqbutton dnd }
  743.     if (!$_icq.i(icqbutton_dnd)) && ($hget(smarticq,state_) == icqbutton_dnd) { _icq.systemtext | hadd smarticq state_ normal | _icq.drw_obj -show icqbutton down }
  744.     if ($_icq.i(icqbutton_invisible)) && ($hget(smarticq,state_) != icqbutton_invisible) { _icq.systemtext invisible | hadd smarticq state_ icqbutton_invisible | _icq.drw_obj -hide icqbutton down | _icq.drw_obj -show icqbutton invisible }
  745.     if (!$_icq.i(icqbutton_invisible)) && ($hget(smarticq,state_) == icqbutton_invisible) { _icq.systemtext | hadd smarticq state_ normal | _icq.drw_obj -show icqbutton down }
  746.     if ($_icq.i(icqbutton_offline)) && ($hget(smarticq,state_) != icqbutton_offline) { _icq.systemtext offline | hadd smarticq state_ icqbutton_offline | _icq.drw_obj -hide icqbutton down | _icq.drw_obj -show icqbutton offline }
  747.     if (!$_icq.i(icqbutton_offline)) && ($hget(smarticq,state_) == icqbutton_offline) { _icq.systemtext | hadd smarticq state_ normal | _icq.drw_obj -show icqbutton down }
  748.   }
  749.  
  750.   if ($mouse.key !& 1) && ($hget(smarticq,click.dx) isnum) { hadd smarticq click.dx - }
  751.  
  752.   if (($hget(smarticq,state) == normal) || ($hget(smarticq,state) == moving)) {
  753.     if ($window(@smarticq).state == maximized) { return }
  754.     if ($mouse.key & 1) && ($hget(smarticq,click.dx) isnum) { 
  755.  
  756.       var %y = $calc($mouse.dy - $hget(smarticq,click.dy)), %x = $calc($mouse.dx - $hget(smarticq,click.dx))
  757.       %x = $calc($window(@SmartICQ).x + %x)
  758.       %y = $calc($window(@SmartICQ).y + %y)
  759.  
  760.       var %dest.y = $calc($mouse.dy - $hget(smarticq,click.dy)), %dest.x = $calc($mouse.dx - $hget(smarticq,click.dx))
  761.       if (%dest.y == 0) && (%dest.x == 0) { return }
  762.  
  763.       if ($readini($+(",$_icq.dir,$_icq.a,\settings.ini"),settings,contactlist_snapping)) {
  764.         var %dock_x = $calc( $window($iif($window(@smarticq).mdi,-3,-1)).dw - ($window(@smarticq).x + $window(@smarticq).w)  )
  765.         var %dock_y = $calc( $window($iif($window(@smarticq).mdi,-3,-1)).dh - ($window(@smarticq).y + $window(@smarticq).h)  )
  766.         if ($window(@SmartICQ).y < 8) && ($window(@SmartICQ).y > -1) && ($window(@SmartICQ).y != 0) && (%dest.y < 0) { %y = 0 | hadd smarticq state docked | hadd smarticq click.dx - | .signal smarticq.snap top }
  767.         if ($window(@SmartICQ).x < 8) && ($window(@SmartICQ).x > -1) && ($window(@SmartICQ).x != 0) && (%dest.x < 0) { %x = 0 | hadd smarticq state docked | hadd smarticq click.dx - | .signal smarticq.snap left }
  768.         if (%dock_x < 11) && (%dock_x > -1) && (%dock_x != 0) && (%dest.x > 0) { %x = $calc( $window($iif($window(@smarticq).mdi,-3,-1)).dw - $window(@smarticq).w ) | hadd smarticq state docked | hadd smarticq click.dx - | .signal smarticq.snap right }
  769.         if (%dock_y < 11) && (%dock_y > -1) && (%dock_y != 0) && (%dest.y > 0) { %y = $calc( $window($iif($window(@smarticq).mdi,-3,-1)).dh - $window(@smarticq).h ) | hadd smarticq state docked | hadd smarticq click.dx - | .signal smarticq.snap bottom }
  770.       }
  771.  
  772.       window @SmartICQ %x %y 164 $window(@SmartICQ).h
  773.       .signal smarticq.winmove %x %y 164 $window(@SmartICQ).h
  774.       if ($hget(smarticq,click.dx) isnum) {
  775.         hadd smarticq click.dx $mouse.dx
  776.         hadd smarticq click.dy $mouse.dy
  777.       }
  778.     }
  779.   }
  780. }
  781.  
  782. alias _icq.event.leave {
  783.   _icq.event.uclick
  784.   hadd smarticq idle 0
  785.   _icq.debug -st LEAVE $mouse.key $hget(smarticq,click.dx)
  786.   if ($mouse.key & 1) && ($hget(smarticq,click.dx) isnum) { 
  787.     var %y = $calc($mouse.dy - $hget(smarticq,click.dy)), %x = $calc($mouse.dx - $hget(smarticq,click.dx))
  788.     %x = $calc($window(@SmartICQ).x + %x)
  789.     %y = $calc($window(@SmartICQ).y + %y)
  790.  
  791.     var %dest.y = $calc($mouse.dy - $hget(smarticq,click.dy)), %dest.x = $calc($mouse.dx - $hget(smarticq,click.dx))
  792.     if (%dest.y == 0) && (%dest.x == 0) { return }
  793.  
  794.     if ($readini($+(",$_icq.dir,$_icq.a,\settings.ini"),settings,contactlist_snapping)) {
  795.       var %dock_x = $calc( $window($iif($window(@smarticq).mdi,-3,-1)).w - ($window(@smarticq).x + $window(@smarticq).w) )
  796.       var %dock_y = $calc( $window($iif($window(@smarticq).mdi,-3,-1)).h - ($window(@smarticq).y + $window(@smarticq).h) )
  797.       if ($window(@SmartICQ).y < 8) && ($window(@SmartICQ).y > -1) && ($window(@SmartICQ).y != 0) && (%dest.y < 0) { %y = 0 | hadd smarticq state docked | hadd smarticq click.dx - | .signal smarticq.snap top }
  798.       if ($window(@SmartICQ).x < 8) && ($window(@SmartICQ).x > -1) && ($window(@SmartICQ).x != 0) && (%dest.x < 0) { %x = 0 | hadd smarticq state docked | hadd smarticq click.dx - | .signal smarticq.snap left }
  799.       if (%dock_x < 8) && (%dock_x > -1) && (%dock_x != 0) && (%dest.x > 0) { %x = $calc( $window($iif($window(@smarticq).mdi,-3,-1)).w - $window(@smarticq).w) | hadd smarticq state docked | hadd smarticq click.dx - | .signal smarticq.snap right }
  800.       if (%dock_y < 8) && (%dock_y > -1) && (%dock_y != 0) && (%dest.y > 0) { %y = $calc( $window($iif($window(@smarticq).mdi,-3,-1)).h - $window(@smarticq).h) | hadd smarticq state docked | hadd smarticq click.dx - | .signal smarticq.snap bottom }
  801.     }
  802.  
  803.     window @SmartICQ %x %y 164 $window(@SmartICQ).h
  804.     .signal smarticq.winmove %x %y 164 $window(@SmartICQ).h
  805.     if ($hget(smarticq,click.dx) isnum) {
  806.       hadd smarticq click.dx $mouse.dx
  807.       hadd smarticq click.dy $mouse.dy
  808.  
  809.     }
  810.   }
  811. }
  812.  
  813.  
  814. alias _icq.ml_checkmark_start { return --[ multiline  ]- $+ $str(-,500) }
  815. alias _icq.ml_checkmark_end { return $str(-,501) }
  816. alias _icq.ml_key {
  817.   if ($group(#_icq.ml.switch) == on) {
  818.     if ($group(#_icq.ml.ctrl) == on) { return off }
  819.     return on
  820.   }
  821.   return $group(#_icq.ml.ctrl)
  822. }
  823.  
  824.  
  825. alias -l _icq.ml_addline {
  826.   ; /_icq.ml_addline [-last] <text>
  827.  
  828.   if ($1 == -last) { var %last = 1 | tokenize 32 $2- }
  829.   if ($1 == -paste) { var %paste = 1 | tokenize 32 $2- }
  830.  
  831.   var %msg = $1-
  832.   var %uin = $_icq.windowuin($active), %win = $+(@ml,%uin,@icq)
  833.  
  834.   if (!$window(%win)) && (($_icq.ml_key == on) || %paste) {
  835.     if (%msg == $null) { return }
  836.     window -h %win
  837.     aline $active 
  838.     aline $active $_icq.ml_checkmark_start
  839.     aline $active $_icq.ml_checkmark_end
  840.     aline $active 
  841.     titlebar %win 0
  842.   }
  843.  
  844.   if ($_icq.ml_key == on) || (%paste) {
  845.     var %line = $calc($gettok($line(%win,$line(%win,0)),1,32) + $window(%win).title +1)
  846.     if (%line == 1) { %line = $calc($line($active,0) -1) }
  847.     if (%msg != $null) {
  848.       iline $active %line   %msg
  849.       aline %win $calc(%line - $window(%win).title) %msg
  850.     }
  851.   }
  852.  
  853.   if (($_icq.ml_key == off) || (%last)) && (!%paste) {
  854.     if ($window(%win)) {
  855.       if (%msg != $null) {
  856.         var %line = $calc($gettok($line(%win,$line(%win,0)),1,32) + $window(%win).title +1)
  857.         if (%line == 1) { %line = $line($active,0) }
  858.         iline $active %line   %msg
  859.         aline %win $calc(%line - $window(%win).title) %msg
  860.       }
  861.       var %l1 = $calc($gettok($line(%win,1),1,32) + $window(%win).title -2)
  862.       var %l2 = $calc( $gettok($line(%win,$line(%win,0)),1,32) + $window(%win).title +2)
  863.       dline $active $+(%l1,-,%l2)
  864.     }
  865.     if (!$window(%win)) && (%msg == $null) { return }
  866.     var %c = 1
  867.     var %color1 = $colour(background), %color2 = $colour(own)
  868.  
  869.     var %timestamp = $iif($_icq.mw_menu(%uin,6),$timestamp)
  870.     var %encrypted = $iif($_icq.mw_menu(%uin,8),e)
  871.     var %offline = $iif($_icq.statusuin(%uin) == offline,o)
  872.     var %queued = $iif($hget(smarticq,status) == offline,Q)
  873.     var %log = $_icq.mw_menu(%uin,3)
  874.     var %file = $+(",$_icq.dir,$_icq.a,\log\,%uin,.log")
  875.     if (%queued) { unset %offline }
  876.  
  877.     if ($_icq.mw_menu(%uin,13)) && ($calc($ctime - $_icq.g(%uin,MSG_CTIME,0)) > 3559) {
  878.       if ($line($active,$calc($line($active,0) -1)) == ) && ($left($gettok($line($active,$line($active,0)),1-2,32),5) == [  ] ) { return }
  879.       aline $active 
  880.       aline $active $+(, Session started ) $fulldate
  881.       if ($_icq.mw_menu(%uin,3)) { write $+(",$_icq.dir,$_icq.a,\log\,%uin,.log")  | write $+(",$_icq.dir,$_icq.a,\log\,%uin,.log") $+(, $+ Session started ) $fulldate }
  882.     }
  883.     _icq.adduserinfo %uin MSG_CTIME $ctime
  884.  
  885.     if (!$window(%win)) {
  886.       if ($gettok(%msg,1,32) == /me) || ($gettok(%msg,1,32) == //msg) {
  887.         %msg = $gettok(%msg,2-,32)
  888.         %color2 = $colour(action)
  889.         aline -pi2 %color2 $active %timestamp %queued %offline %encrypted  * $_icq.myname $+ $+(,%color2) %msg
  890.         if (%log) { write %file $+(,%color2) $+ %timestamp %queued %offline %encrypted * $_icq.myname $+ $+(,%color2) %msg }
  891.       }
  892.       else {
  893.         aline -pi2 %color2 $active %timestamp %queued %offline %encrypted  $+(<,$_icq.myname,>) $+ $+(,%color2) %msg
  894.         if (%log) { write %file $+(,%color2) $+ %timestamp %queued %offline %encrypted $+(<,$_icq.myname,>) $+ $+(,%color2) %msg }
  895.       }
  896.       .signal smarticq.mymsg %uin %msg
  897.       _icq.msg %uin %msg
  898.       if ($_icq.mw_menu(%uin,1)) { window -c $active }
  899.       return
  900.     }
  901.  
  902.     var %longmsg
  903.     while (%c <= $line(%win,0)) {
  904.       var %msg = $gettok($line(%win,%c),2-,32)
  905.       aline -pi2 $iif(%c > 1,%color1,%color2) $active %timestamp %queued %offline %encrypted  $+(<,$_icq.myname,>) $+ $+(,%color2) %msg
  906.       if (%log) { write %file $+(,$iif(%c > 1,%color1,%color2),) $+ %timestamp %queued %offline %encrypted $+(<,$_icq.myname,>) $+ $+(,%color2) %msg }
  907.       .signal smarticq.mymsg %uin %msg
  908.  
  909.       if (%longmsg == $null) { %longmsg = %msg }
  910.       else { %longmsg = %longmsg $+ $crlf $+ %msg }
  911.       if ($len(%longmsg) > 700) { _icq.msg %uin %longmsg | var %longmsg = $null }
  912.  
  913.       inc %c
  914.     }
  915.     if (%longmsg != $null) { _icq.msg %uin %longmsg }
  916.     window -c %win
  917.     if ($_icq.mw_menu(%uin,1)) { window -c $active }
  918.   }
  919.  
  920.  
  921. }
  922.  
  923.  
  924. on *:close:@ml*@icq:{
  925.   var %uin = $remove($active,@ml,@icq)
  926.  
  927.   var %l1 = $calc($gettok($line($target,1),1,32) + $window($target).title -2)
  928.   var %l2 = $calc( $gettok($line($target,$line($target,0)),1,32) + $window($target).title +2)
  929.   dline $_icq.windowname(%uin) $+(%l1,-,%l2)
  930. }
  931.  
  932. #_icq.ml.ctrl off
  933. #_icq.ml.ctrl end
  934. #_icq.ml.switch off
  935. #_icq.ml.switch end
  936.  
  937. on *:input:@*@*@ICQ:{
  938.   halt
  939. }
  940.  
  941. on *:keyup:@*@*@ICQ:*:{
  942.   var %uin = $_icq.windowuin($active)
  943.   var %ctrl = 17, %enter = 13, %backspace = 8
  944.  
  945.   if ($keyval == %ctrl) {
  946.     .disable #_icq.ml.ctrl
  947.   }
  948. }
  949.  
  950. on *:keydown:@*@*@ICQ:*:{
  951.   var %uin = $_icq.windowuin($active), %win = $+(@ml,%uin,@icq)
  952.   var %ctrl = 17, %enter = 13, %backspace = 8, %paste = 86, %del = 46
  953.  
  954.  
  955.   if ($keyval == %ctrl) && (!$keyrpt) {
  956.     .enable #_icq.ml.ctrl
  957.   }
  958.  
  959.   if ($keyval == %del) {
  960.     if ($editbox($active) == $null) && ($window(%win)) {
  961.       var %l1 = $calc($gettok($line(%win,1),1,32) + $window(%win).title -2)
  962.       var %l2 = $calc( $gettok($line(%win,$line(%win,0)),1,32) + $window(%win).title +2)
  963.       dline $active $+(%l1,-,%l2)
  964.       window -c %win
  965.     }
  966.   }
  967.  
  968.   if ($keyval == %enter) {
  969.     tokenize 32 $editbox($active)
  970.  
  971.     if ($group(#porn_icq) == on) { tokenize 32 $1- $_icq.porn }
  972.     if ($group(#dRunk_bOy) == on) { tokenize 32 $_icq.drunk($1-) }
  973.     if ($group(#yoda_style) == on) { tokenize 32 $_icq.yoda($1-) }
  974.  
  975.     if ($hget(smarticq)) { hadd smarticq idle 0 }
  976.  
  977.     if (/* iswm $1) && (/*say !iswm $1) && (/*me !iswm $1) {
  978.       $1 $iif(//* iswm $1,$eval($2-,2),$2-)
  979.       halt
  980.     }
  981.  
  982.     if (/say == $1) { tokenize 32 $2- }
  983.     if (//say == $1) { tokenize 32 $eval($2-,2) }
  984.     if (/* !iswm $1) || (/*me iswm $1) {
  985.       if (//me iswm $1) { tokenize 32 /me $eval($2-,2) }
  986.  
  987.       _icq.ml_addline $iif($editbox($active) == $null,-last) $1-
  988.     }
  989.   }
  990.  
  991.   if ($keyval == %paste) && ($group(#_icq.ml.ctrl) == on) {
  992.     if ($cb(0) > 1) {
  993.       var %c = 1
  994.       .disable #_icq.ml.ctrl
  995.       while (%c <= $cb(0)) {
  996.         _icq.ml_addline -paste $cb(%c) 
  997.         inc %c
  998.       }
  999.     }
  1000.   }
  1001.  
  1002.   if ($keyval == %backspace) {
  1003.     if ($editbox($active) == $null) {
  1004.       if (!$window(%win)) { return }
  1005.       var %line = $gettok($line(%win,$line(%win,0)),1,32)
  1006.       .timer 1 0 editbox $active $gettok($line(%win,$line(%win,0)),2-,32)
  1007.       dline $active %line
  1008.       dline %win $line(%win,0)
  1009.  
  1010.       if ($line(%win,0) == 0) {
  1011.         var %c = $line($active,0)
  1012.         while (%c) {
  1013.           if ($line($active,%c) == $_icq.ml_checkmark_end) { dline $active %c | dline $active %c }
  1014.           if ($line($active,%c) == $_icq.ml_checkmark_start) { dline $active %c | dline $active $calc(%c -1) | break }
  1015.           dec %c
  1016.         }
  1017.         window -c %win
  1018.         return
  1019.       }
  1020.     }
  1021.   }
  1022.  
  1023. }
  1024.  
  1025. #dRunk_bOy off
  1026. #dRunk_bOy end
  1027.  
  1028. menu @SmartICQ {
  1029.   sclick:_icq.event.sclick sclick
  1030.   mouse:_icq.event.mouse
  1031.   uclick:_icq.event.uclick
  1032.   dclick:_icq.event.dclick
  1033.   leave:_icq.event.leave
  1034.   rclick:_icq.event.sclick rclick
  1035. }
  1036.  
  1037. alias _icq.inrect { return $_icq.i($1) }
  1038.  
  1039. alias _icq.i {
  1040.   ; $_icq.i(type) 
  1041.   if ($_icq.DO_NOT_UPDATE_GUI) { return }
  1042.   var %x = $mouse.x, %y = $mouse.y
  1043.   var %xs = $calc(17 * $hget(smarticq,XS_rows))
  1044.   if ($1 == contactlist) { return $inrect(%x,%y,6,19,141,$calc(%xs + 211)) }
  1045.   if ($1 == minibutton) { return $inrect(%x,%y,139,5,9,8) }
  1046.   if ($1 == closebutton) { return $inrect(%x,%y,150,5,9,8) }
  1047.   if ($1 == icqbutton) { return $inrect(%x,%y,4,$calc(%xs + 258),67,19) }
  1048.   if ($1 == icqbutton2) { return $inrect(%x,%y,4,$calc(%xs + 258),155,19) }
  1049.   if ($1 == icqbutton_online) { return $inrect(%x,%y,8,$calc(%xs + 258),15,17) }
  1050.   if ($1 == icqbutton_f4c) { return $inrect(%x,%y,29,$calc(%xs + 258),15,17) }
  1051.   if ($1 == icqbutton_away) { return $inrect(%x,%y,45,$calc(%xs + 258),15,17) }
  1052.   if ($1 == icqbutton_na) { return $inrect(%x,%y,63,$calc(%xs + 258),17,17) }
  1053.   if ($1 == icqbutton_occupied) { return $inrect(%x,%y,81,$calc(%xs + 258),17,17) }
  1054.   if ($1 == icqbutton_dnd) { return $inrect(%x,%y,100,$calc(%xs + 258),17,17) }
  1055.   if ($1 == icqbutton_invisible) { return $inrect(%x,%y,119,$calc(%xs + 258),17,17) }
  1056.   if ($1 == icqbutton_offline) { return $inrect(%x,%y,138,$calc(%xs + 258),17,17) }
  1057.   if ($1 == scrollbg) { return $inrect(%x,%y,149,31,8,$calc(188 + %xs)) }
  1058.  
  1059.   if ($1 == downscroll) { return $inrect(%x,%y,149,$calc(%xs + 218),8,11) }
  1060.   if ($1 == upscroll) { return $inrect(%x,%y,149,19,8,11) }
  1061.   if ($1 == settbutton) { return $inrect(%x,%y,76,$calc(%xs + 258),65,19) }
  1062.   if ($1 == statusbar) { return $inrect(%x,%y,4,$calc(%xs + 235),155,20) }
  1063.   if ($1 == scrollbar) { return $inrect(%x,%y,149,$hget(smarticq,scroll.y),8,18) }
  1064. }
  1065.  
  1066.  
  1067. alias _icq.drw_obj {
  1068.   ;/icq.drw_obj <-hide|-show> <type> <subtype>
  1069.   if ($_icq.DO_NOT_UPDATE_GUI) { return }
  1070.   var %xs = $calc(17 * $hget(smarticq,XS_rows))
  1071.  
  1072.   if ($2 == background) {
  1073.     drawcopy -nt @SmartICQ-gui $hget(smarticq,c-invisible) 1 100 6 15 @SmartICQ 0 100 6 %xs
  1074.     drawcopy -nt @SmartICQ-gui $hget(smarticq,c-invisible) 146 100 19 15 @SmartICQ 145 100 19 %xs
  1075.     drawcopy -nt @SmartICQ-group $hget(smarticq,c-invisible) 0 0 143 $calc(211 + %xs) @SmartICQ 6 19
  1076.   }
  1077.   if ($2 == minibutton) {
  1078.     if ($3 == up) { drawcopy -nt @SmartICQ-gui $hget(smarticq,c-invisible) 167 3 10 9 @SmartICQ 139 5 }
  1079.     if ($3 == down) { drawcopy -nt @SmartICQ-gui $hget(smarticq,c-invisible) 178 3 10 9 @SmartICQ 139 5 }
  1080.   }
  1081.   if ($2 == closebutton) {
  1082.     if ($3 == up) { drawcopy -nt @SmartICQ-gui $hget(smarticq,c-invisible) 167 13 10 9 @SmartICQ 150 5 }
  1083.     if ($3 == down) { drawcopy -nt @SmartICQ-gui $hget(smarticq,c-invisible) 178 13 10 9 @SmartICQ 150 5 }
  1084.   }
  1085.   if ($2 == scrollbg) { 
  1086.     ;    drawcopy -nt @SmartICQ-gui $hget(smarticq,c-invisible) 167 69 9 189 @SmartICQ 149 31 
  1087.     drawcopy -nt @SmartICQ-gui $hget(smarticq,c-invisible) 167 69 9 94 @SmartICQ 149 31 
  1088.     drawcopy -nt @SmartICQ-gui $hget(smarticq,c-invisible) 167 163 9 94 @SmartICQ 149 $calc(125 + %xs)
  1089.  
  1090.     if (%xs) {
  1091.       drawcopy -nt @SmartICQ-gui $hget(smarticq,c-invisible) 167 90 9 %xs @SmartICQ 149 125 
  1092.       if (%xs > 152) {
  1093.         drawcopy -nt @SmartICQ-gui $hget(smarticq,c-invisible) 167 90 9 $calc(%xs -153) @SmartICQ 149 278
  1094.       }
  1095.     }
  1096.   }
  1097.   if ($2 == upscroll) {
  1098.     if ($3 == up) { drawcopy -nt @SmartICQ-gui $hget(smarticq,c-invisible) 167 23 9 12 @SmartICQ 149 19 }
  1099.     if ($3 == down) { drawcopy -nt @SmartICQ-gui $hget(smarticq,c-invisible) 178 23 9 12 @SmartICQ 149 19 }
  1100.   }
  1101.   if ($2 == downscroll) {
  1102.     if ($3 == up) { drawcopy -nt @SmartICQ-gui $hget(smarticq,c-invisible) 167 56 9 12 @SmartICQ 149 $calc(%xs + 219) }
  1103.     if ($3 == down) { drawcopy -nt @SmartICQ-gui $hget(smarticq,c-invisible) 178 56 9 12 @SmartICQ 149 $calc(%xs + 219) }
  1104.   }
  1105.   if ($2 == scrollbar) {
  1106.     if ($3 == up) { drawcopy -nt @SmartICQ-gui $hget(smarticq,c-invisible) 167 36 9 19 @SmartICQ 149 $iif($hget(smarticq,scroll.y),$ifmatch,31) }
  1107.     if ($3 == down) { drawcopy -nt @SmartICQ-gui $hget(smarticq,c-invisible) 178 36 9 19 @SmartICQ 149 $iif($hget(smarticq,scroll.y),$ifmatch,31) }
  1108.   }
  1109.   if ($2 == statusbar) {
  1110.     drawcopy -nt @SmartICQ-gui $hget(smarticq,c-invisible) 259 92 156 21 @SmartICQ 4 $calc(%xs + 235)
  1111.   }
  1112.   if ($2 == icqbutton) {
  1113.     if ($3 == up) { 
  1114.       drawcopy -nt @SmartICQ-gui $hget(smarticq,c-invisible) 259 3 156 20 @SmartICQ 4 $calc(%xs + 258)
  1115.       if ($hget(smarticq,status) == online) { drawcopy -nt @SmartICQ-gui $hget(smarticq,c-invisible) 189 45 68 20 @SmartICQ 4 $calc(%xs + 258) }
  1116.       if ($hget(smarticq,status) == f4c) { drawcopy -nt @SmartICQ-gui $hget(smarticq,c-invisible) 189 66 68 20 @SmartICQ 4 $calc(%xs + 258) }
  1117.       if ($hget(smarticq,status) == away) { drawcopy -nt @SmartICQ-gui $hget(smarticq,c-invisible) 189 87 68 20 @SmartICQ 4 $calc(%xs + 258) }
  1118.       if ($hget(smarticq,status) == na) || ($hget(smarticq,status) == n/a) { drawcopy -nt @SmartICQ-gui $hget(smarticq,c-invisible) 189 108 68 20 @SmartICQ 4 $calc(%xs + 258) }
  1119.       if ($hget(smarticq,status) == occupied) { drawcopy -nt @SmartICQ-gui $hget(smarticq,c-invisible) 189 129 68 20 @SmartICQ 4 $calc(%xs + 258) }
  1120.       if ($hget(smarticq,status) == dnd) { drawcopy -nt @SmartICQ-gui $hget(smarticq,c-invisible) 189 150 68 20 @SmartICQ 4 $calc(%xs + 258) }
  1121.       if ($hget(smarticq,status) == invisible) { drawcopy -nt @SmartICQ-gui $hget(smarticq,c-invisible) 189 171 68 20 @SmartICQ 4 $calc(%xs + 258) }
  1122.       if ($hget(smarticq,status) == offline) { drawcopy -nt @SmartICQ-gui $hget(smarticq,c-invisible) 189 192 68 20 @SmartICQ 4 $calc(%xs + 258) }
  1123.       if ($4 != sett) {
  1124.         drawcopy -nt @SmartICQ-gui $hget(smarticq,c-invisible) 189 3 66 20 @SmartICQ 76 $calc(%xs + 258)
  1125.       }
  1126.     }
  1127.     if ($3 == down) { 
  1128.       drawcopy -nt @SmartICQ-gui $hget(smarticq,c-invisible) 259 24 156 20 @SmartICQ 4 $calc(%xs + 258) 
  1129.       drawcopy -nt @SmartICQ-gui $hget(smarticq,c-invisible) 342 46 18 20 @SmartICQ 8 $calc(%xs + 258) 
  1130.       drawcopy -nt @SmartICQ-gui $hget(smarticq,c-invisible) 362 46 18 20 @SmartICQ 26 $calc(%xs + 258) 
  1131.       drawcopy -nt @SmartICQ-gui $hget(smarticq,c-invisible) 382 46 18 20 @SmartICQ 44 $calc(%xs + 258) 
  1132.       drawcopy -nt @SmartICQ-gui $hget(smarticq,c-invisible) 402 46 19 20 @SmartICQ 62 $calc(%xs + 258) 
  1133.       drawcopy -nt @SmartICQ-gui $hget(smarticq,c-invisible) 344 69 19 20 @SmartICQ 81 $calc(%xs + 258) 
  1134.       drawcopy -nt @SmartICQ-gui $hget(smarticq,c-invisible) 365 69 19 20 @SmartICQ 100 $calc(%xs + 258) 
  1135.       drawcopy -nt @SmartICQ-gui $hget(smarticq,c-invisible) 386 69 19 20 @SmartICQ 119 $calc(%xs + 258) 
  1136.       drawcopy -nt @SmartICQ-gui $hget(smarticq,c-invisible) 407 69 18 20 @SmartICQ 138 $calc(%xs + 258) 
  1137.     }
  1138.     if ($3 == online) { drawcopy -nt @SmartICQ-gui $hget(smarticq,c-invisible) 259 46 18 20 @SmartICQ 8 $calc(%xs + 258) }
  1139.     if ($3 == f4c) { drawcopy -nt @SmartICQ-gui $hget(smarticq,c-invisible) 279 46 18 20 @SmartICQ 26 $calc(%xs + 258) }
  1140.     if ($3 == away) { drawcopy -nt @SmartICQ-gui $hget(smarticq,c-invisible) 299 46 18 20 @SmartICQ 44 $calc(%xs + 258) }
  1141.     if ($3 == na) || ($3 == n/a) { drawcopy -nt @SmartICQ-gui $hget(smarticq,c-invisible) 319 46 19 20 @SmartICQ 62 $calc(%xs + 258) }
  1142.     if ($3 == occupied) { drawcopy -nt @SmartICQ-gui $hget(smarticq,c-invisible) 259 69 19 20 @SmartICQ 81 $calc(%xs + 258) }
  1143.     if ($3 == dnd) { drawcopy -nt @SmartICQ-gui $hget(smarticq,c-invisible) 280 69 19 20 @SmartICQ 100 $calc(%xs + 258) }
  1144.     if ($3 == invisible) { drawcopy -nt @SmartICQ-gui $hget(smarticq,c-invisible) 301 69 19 20 @SmartICQ 119 $calc(%xs + 258) }
  1145.     if ($3 == offline) { drawcopy -nt @SmartICQ-gui $hget(smarticq,c-invisible) 322 69 18 20 @SmartICQ 138 $calc(%xs + 258) }
  1146.   }
  1147.   if ($2 == settbutton) {
  1148.     if ($3 == up) { drawcopy -nt @SmartICQ-gui $hget(smarticq,c-invisible) 189 3 66 20 @SmartICQ 76 $calc(%xs + 258) }
  1149.     if ($3 == down) { drawcopy -nt @SmartICQ-gui $hget(smarticq,c-invisible) 189 24 66 20 @SmartICQ 76 $calc(%xs + 258) }
  1150.   }
  1151.  
  1152.   if ($1 == -show) { drawdot @smarticq }
  1153.  
  1154.  
  1155. #_icq.button off
  1156. #_icq.button end
  1157.  
  1158. on *:active:*:{
  1159.   if ($active == @SmartICQ) && ($_icq.HIDE_CL) { window -h @smarticq }
  1160.   if ($group(#_icq.button) == on) { _icq.drw_obj -show icqbutton up | .disable #_icq.button }
  1161.   if ($window(@SmartICQ-gui)) {
  1162.     if ($window(@smarticq).state == normal) && ($window(@SmartICQ).h != $hget(smarticq,H)) && ($window(@SmartICQ).h != 19) { window @smarticq $window(@smarticq).x $window(@smarticq).y 164 $hget(smarticq,H) | _icq.redraw }
  1163.     if ($window(@SmartICQ).h == $hget(smarticq,H)) {
  1164.       if ($active == @SmartICQ) { 
  1165.         drawcopy -nt @SmartICQ-gui $hget(smarticq,c-invisible) 259 175 163 19 @SmartICQ 0 0 
  1166.         _icq.drw_obj -hide minibutton up
  1167.         _icq.drw_obj -hide closebutton up
  1168.  
  1169.         if ($window(@smarticq).title == !) { titlebar @smarticq }
  1170.         else { .signal smarticq.active | titlebar @smarticq ! }
  1171.         if ($window(@smarticq).state != minimized) { window -a @smarticq }
  1172.       }
  1173.       if ($active != @SmartICQ) { drawcopy -nt @SmartICQ-gui $hget(smarticq,c-invisible) 259 195 163 19 @SmartICQ 0 0 }
  1174.     }
  1175.     if ($window(@SmartICQ).h == 19) {
  1176.       if ($active == @SmartICQ) { 
  1177.         drawcopy -nt @SmartICQ-gui $hget(smarticq,c-invisible) 259 135 163 19 @SmartICQ 0 0 
  1178.         _icq.drw_obj -hide minibutton up
  1179.         _icq.drw_obj -hide closebutton up
  1180.         if ($window(@smarticq).title == !) { titlebar @smarticq }
  1181.         else { .signal smarticq.active | titlebar @smarticq ! }
  1182.         if ($window(@smarticq).state != minimized) { window -a @smarticq }
  1183.       }
  1184.       if ($active != @SmartICQ) { drawcopy -tn @SmartICQ-gui $hget(smarticq,c-invisible) 259 155 163 19 @SmartICQ 0 0 }
  1185.     }
  1186.     drawdot @SmartICQ
  1187.   }
  1188. }
  1189.  
  1190. on *:APPACTIVE:{ 
  1191.   if ($group(#_icq.button) == on) { _icq.drw_obj -show icqbutton up | .disable #_icq.button }
  1192.   if ($window(@SmartICQ-gui)) {
  1193.     if ($window(@smarticq).state == normal) && ($window(@SmartICQ).h != $hget(smarticq,H)) && ($window(@SmartICQ).h != 19) { window @smarticq $window(@smarticq).x $window(@smarticq).y 164 $hget(smarticq,H) | _icq.redraw }
  1194.     if ($appactive) {
  1195.       if ($window(@SmartICQ).h == $hget(smarticq,H)) {
  1196.         if ($active == @SmartICQ) { 
  1197.           drawcopy -nt @SmartICQ-gui $hget(smarticq,c-invisible) 259 175 163 19 @SmartICQ 0 0 
  1198.           _icq.drw_obj -hide minibutton up
  1199.           _icq.drw_obj -hide closebutton up
  1200.         }
  1201.         if ($active != @SmartICQ) { drawcopy -nt @SmartICQ-gui $hget(smarticq,c-invisible) 259 195 163 19 @SmartICQ 0 0 }
  1202.       }
  1203.       if ($window(@SmartICQ).h == 19) {
  1204.         if ($active == @SmartICQ) { 
  1205.           drawcopy -nt @SmartICQ-gui $hget(smarticq,c-invisible) 259 135 163 19 @SmartICQ 0 0 
  1206.           _icq.drw_obj -hide minibutton up
  1207.           _icq.drw_obj -hide closebutton up
  1208.         }
  1209.         if ($active != @SmartICQ) { drawcopy -nt @SmartICQ-gui $hget(smarticq,c-invisible) 259 155 163 19 @SmartICQ 0 0 }
  1210.       }
  1211.     }
  1212.     if (!$appactive) {
  1213.       if ($window(@SmartICQ).h == $hget(smarticq,H)) { drawcopy -tn @SmartICQ-gui $hget(smarticq,c-invisible) 259 195 163 19 @SmartICQ 0 0 }
  1214.       if ($window(@SmartICQ).h == 19) { drawcopy -tn @SmartICQ-gui $hget(smarticq,c-invisible) 259 155 163 19 @SmartICQ 0 0 }
  1215.     }
  1216.     drawdot @SmartICQ
  1217.   }
  1218. }
  1219.  
  1220. on *:close:@smarticq:{ _icq.shutdown }
  1221. on *:exit:{ _icq.shutdown }
  1222.  
  1223. on *:close:@smarticq-gui:{
  1224.   window -hpfk0l20S @SmartICQ-gui2 0 0 600 298 @SmartICQ-gui
  1225.   titlebar @SmartICQ-gui2 - What are you doing here? GO AWAY! =P
  1226.   drawpic -c @SmartICQ-gui2 -1 -1 $_icq.skin(file)
  1227.   var %c = $line(@smarticq-gui,0,1)
  1228.   while (%c) {
  1229.     aline -l @smarticq-gui2 $line(@smarticq-gui,%c,1)
  1230.     dec %c
  1231.   }
  1232.   .timer 1 0 renwin @smarticq-gui2 @SmartICQ-gui
  1233. }
  1234.  
  1235. on *:close:@smarticq-group:{
  1236.   window -phfsk0l20S @SmartICQ-group2 0 0 800 600
  1237.   filter -wwlL @SmartICQ-group @SmartICQ-group2 *
  1238.   var %xs = $calc(17 * $hget(smarticq,XS_rows))
  1239.   drawcopy -n @SmartICQ-gui 7 22 143 212 @SmartICQ-group2 0 0 143 $calc(212 + %xs)
  1240.   drawcopy -n @SmartICQ-gui 427 3 143 212 @SmartICQ-group2 150 0 143 $calc(212 + %xs)
  1241.   .timer 1 0 renwin @smarticq-group2 @SmartICQ-group
  1242. }
  1243.  
  1244. on *:close:@*@*@ICQ:{
  1245.   if ($_icq.mw_menu($gettok($active,-2,64),11)) {
  1246.     writeini $+(",$_icq.dir,$_icq.a,\settings.ini") winpos $gettok($active,-2,64) $_icq.window($active).size
  1247.   }
  1248.   writeini $+(",$_icq.dir,dat\smarticq.ini") font $active $window($active).fontbold $window($active).fontsize $window($active).font
  1249.   window -c $+(@ml,$_icq.windowuin($active),@icq)
  1250. }
  1251.