All pastes #55580 Raw Edit

Miscellany

public text v1 · immutable
#55580 ·published 2006-05-13 19:53 UTC
rendered paste body
on *:LOAD:*:{ /echo -a Friendslist By AlternativeNick
echo -a You can type /friends, right click > friendslist, F8, or use the 'Commands' Menu to open the friendslist }
menu status,channel,menubar {
  Friends List:/friends
}
menu query,nicklist {
  Friends List
  .Add to Friends:{ if ($read(friends.txt,s, $1) == $null) {
      if ($notify($1) == $null) {

        /write friends.txt $1 $1
        /notify on
        /notify $1
      }
      else {
        if ($notify($1).ison == $true) {

          /write friends.txt $1 $1
          /notify on
        }
        else {

          /write friends.txt $1 $1
          /notify on
        }
      }
    }
  }

  .Open FriendsList:/friends
}
alias F8 {
  /friends
}
alias noton {
  dialog -mo noton noton
  /.timer 1 2 dialog -x noton
  halt
}
dialog noton {
  title "User Not Online"
  size -1 -1 75 25
  option type dbu
  text "This user is not online" 1, 14 2 60 10
  button "OK" 2, 20 10 37 12
}
on *:DIALOG:noton:sclick:2:{
  dialog -x noton
}
alias friends {
  if ($dialog(list) == $null) {
    dialog -md list list
  }
  else { dialog -iev list list }
}
dialog list {
  title $me
  size -1 -1 86 144
  option dbu
  text "ONLINE USERS",6, 2 1 50 10  
  list 1, 2 8 80 50, size
  list 7, 2 64 80 47, size
  text "OFFLINE USERS",8, 2 58 50 6  
  button "Add", 2, 2 114 37 12
  button "Remove", 3, 44 114 37 12
  button "Info", 5, 2 128 37 12  
  button "Close", 4, 44 128 37 12
}
on *:DIALOG:list:sclick:2:{
  /dialog -am adn adn
}
on *:dialog:list:sclick:5:{ if (%nick != $null) { 
  info }
}
on *:DIALOG:list:sclick:4:{
  if ($?!="Are you sure you want to exit friendslist?" == $true) { dialog -x list }
  else { dialog -v list }
}
on *:DIALOG:list:sclick:1:{
  set %nick $did(list,1).seltext
  did -e $dname 5
  set %did $did
  /.enable #silenceraws
  whois %nick
  /.timer -h 1 500 /.disable #silenceraws
}
#silenceraws off
raw 318:*:halt
raw 301:*:halt
raw 310:*:halt
raw 311:*:halt
raw 312:*:halt
raw 313:*:halt
raw 317:*:halt
raw 319:*:{ set %wchans $remove($3-,+,%,@) | halt }
raw 431:*:halt
raw 378:*:halt
raw 307:*:halt
raw 401:*:noton
#silenceraws end
on *:DIALOG:list:dclick:1:{
  set %nick $did(list,1).seltext
  /.query %nick $$?="What would you like to say?"
  dialog -v list
  did -e $dname 5
}
on *:DIALOG:list:sclick:7:{
  set %nick $did(list,7).seltext
  did -b $dname 5
  set %did $did
}
on *:DIALOG:list:sclick:3:{
  /set %nick# $didwm(list,%did,%nick)
  /did -d $dname %did %nick#
  /write -ds $+ %nick friends.txt
  /notify -r %nick
}
on *:DIALOG:list:init:*:{
  var %i = 0
  while (%i < $lines(friends.txt)) {
    inc %i 1
    if ($notify($gettok($read(friends.txt,%i),2,32)).ison == $true) {
      /did -a $dname 1 $gettok($read(friends.txt,%i),2,32)
    }
    elseif ($notify($gettok($read(friends.txt,%i),2,32)).ison == $false) {
      /did -a $dname 7 $gettok($read(friends.txt,%i),2,32)
    }
  }
}
on ^*:NOTIFY:{
  var %i = 0
  while (%i < $lines(friends.txt)) {
    inc %i 1
    if ($nick isin $gettok($read(friends.txt,%i),2,32)) {
      set %snick $gettok($read(friends.txt,%i),2,32))
      if ($dialog(list) != $null) {  
        /set %snick# $didwm(list,7,%snick)
        /.did -d list 7 %snick#
        /.did -a list 1 %snick      
      }
      /unset %snick#
      /dialog -ma son son      
      halt
    }
  }
}

on ^*:UNOTIFY:{
  var %i = 0
  while (%i < $lines(friends.txt)) {
    inc %i 1
    if ($nick isin $gettok($read(friends.txt,%i),2,32)) {
      set %snick $gettok($read(friends.txt,%i),2,32))
      if ($dialog(list) != $null) {      
        /set %snick# $didwm(list,1,%snick)
        /did -d list 1 %snick#
        /did -a list 7 %snick      
      }
      /unset %snick#
      /dialog -ma soff soff    
      halt
    }
  }
}


dialog soff {
  title "Sign Off"
  size -1 -1 74 29
  option dbu
  text %snick Has Signed Off, 1, 5 4 58 24
  button "CLOSE", 2, 27 18 24 10
}
on *:DIALOG:soff:init:*:{
  unset %snick
}
on *:DIALOG:soff:sclick:2:{
  dialog -x soff
}
dialog son {
  title "Sign On"
  size -1 -1 74 29
  option dbu
  text %snick Has Signed On, 1, 5 4 58 24
  button "CLOSE", 2, 27 18 24 10
}
on *:DIALOG:son:init:*:{
  unset %snick
}
on *:DIALOG:son:sclick:2:{
  dialog -x son
}
;Add A Nick to FriendsList
dialog adn {
  title ""
  size -1 -1 57 36
  option dbu
  text "Add Nickname", 1, 10 3 38 8
  edit "", 2, 4 12 50 10
  button "OK", 3, 4 24 20 9
  button "Cancel", 4, 28 24 25 9, cancel
}
on *:DIALOG:adn:sclick:3:{
  if ($did(adn,2).edited == $true) && ($read(friends.txt,s, $did(adn,2).text) == $null) {
    if ($notify($did(adn,2).text) == $null) {
      /did -a list 7 $did(adn,2).text
      /write friends.txt $did(adn,2).text $did(adn,2).text
      /notify on
      /notify $did(adn,2).text
    }
    else {
      if ($notify($did(adn,2).text).ison == $true) {
        /did -a list 1 $did(adn,2).text
        /write friends.txt $did(adn,2).text $did(adn,2).text
        /notify on
      }
      else {
        /did -a list 1 $did(adn,2).text
        /write friends.txt $did(adn,2).text $did(adn,2).text
        /notify on
      }
    }
    dialog -x adn
  }
}
;Info section
alias info {
  dialog -am inf inf
}
dialog inf {
  title %nick Info
  size -1 -1 95 51
  option dbu
  list 1, 1 1 50 48, size
  button "Join Channel", 2, 55 1 37 8
  button "PM", 3, 55 11 37 8
  button "Notice", 4, 55 21 37 8
  button "Whois", 5, 55 31 37 8
  button "Close", 6, 55 41 37 8, cancel
}
on *:DIALOG:inf:init:*:{
  var %i = 0
  while ( $numtok(%wchans,32) > %i) {
    inc %i 1
    /did -a $dname 1 $gettok(%wchans,%i,32)
  }
  unset %wchans
}
on *:DIALOG:inf:sclick:1:{
  set %tempchan $did(inf,1).seltext
}
on *:DIALOG:inf:sclick:2:{ /join %tempchan 
  unset %tempchan
}
on *:DIALOG:inf:sclick:3:{ /.query %nick $??="What would you like to say?" }
on *:DIALOG:inf:sclick:4:{ /.notice %nick $??="What would you like to say?" }
on *:DIALOG:inf:sclick:5:{ /whois %nick }
on *:DIALOG:list:close:*:{ unset %nick }