All pastes #55700 Raw Edit

Unnamed

public text v1 · immutable
#55700 ·published 2006-05-14 06:33 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
  .Open:/friends
  .Edit Profile:/dialog -md cpro cpro
}
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
  .Edit Profile:/dialog -md cpro cpro
  .View Profile:/getpro $1
}
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
  /unset %wchans
}
#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 }

alias getpro {
  .enable #getpro
  .notice $1 PROFILE
  .timer 1 5 .disable #getpro
}

#getpro off
on ^*:NOTICE:Yes:*:{
  /dialog -ma pro pro
  halt
}
on ^*:NOTICE:Nick*:*:{
  /did -r pro 2
  /did -a pro 2 $2-
  halt
}
on ^*:NOTICE:Age*:*:{
  /did -r pro 10
  /did -a pro 10 $2-
  halt
}
on ^*:NOTICE:Name*:*:{
  /did -r pro 13
  /did -a pro 13 $2-
  halt
}
on ^*:NOTICE:Chan*:*:{
  /did -r pro 14
  /did -a pro 14 $2-
  halt
}
on ^*:NOTICE:url*:*:{
  /did -r pro 12
  /did -a pro 12 $2-
  halt
}
on ^*:NOTICE:Email*:*:{
  /did -r pro 11
  /did -a pro 11 $2-
  halt
}
on ^*:NOTICE:quote*:*:{
  /did -r pro 17
  /did -a pro 17 $2-
  halt
}
on ^*:NOTICE:end*:*:{
  .disable #getpro
  halt
}
#getpro end



dialog pro {
  title "View Profile"
  size -1 -1 159 145
  option dbu
  text "Nick-", 1, 7 5 30 8
  edit "", 2, 69 5 85 10
  text "Age-", 3, 7 17 22 8
  text "Name-", 4, 7 29 25 8
  text "Favorite Channel-", 5, 7 41 50 8
  text "Website-", 6, 7 53 25 8
  text "Email-", 7, 7 65 25 8
  edit "", 10, 69 17 85 10a
  edit "", 11, 69 65 85 10
  edit "", 12, 69 53 85 10
  edit "", 13, 69 29 85 10
  edit "", 14, 69 41 85 10
  text "---------------------------------------------------------------------------------------", 15, 0 79 159 8
  text "Quote-", 16, 3 91 25 8
  edit "", 17, 69 91 85 49, multi return autovs
  button "Close", 18, 11 127 37 12, cancel
}
dialog Cpro {
  title "Create Profile"
  size -1 -1 159 157
  option dbu
  text "Create your profile for AlternativeNick's Friends System.", 8, 9 6 135 8
  text "---------------------------------------------------------------------------------------", 15, 2 102 159 8
  text "Quote-", 16, 5 114 25 8
  text "Nick-", 1, 9 28 30 8
  text "Age-", 3, 9 40 22 8
  text "Name-", 4, 9 52 25 8
  text "Favorite Channel-", 5, 9 64 50 8
  text "Website-", 6, 9 76 25 8
  text "Email-", 7, 9 88 25 8
  edit "", 17, 71 113 85 40
  edit "", 2, 70 28 85 10
  text "WARNING: Other users can see this profile", 9, 9 14 103 8
  edit "", 10, 70 40 85 10
  edit "", 13, 70 52 85 10
  edit "", 14, 70 64 85 10
  edit "", 11, 70 88 85 10
  edit "", 12, 70 76 85 10
  button "SAVE",18, 8 140 25 12
  button "CANCEL",19, 34 140 25 12

}
on *:DIALOG:cpro:init:*:{
  /did -ra $dname 2 $read(pro.txt,s,nick)
  /did -ra $dname 10 $read(pro.txt,s,age)
  /did -ra $dname 11 $read(pro.txt,s,email)
  /did -ra $dname 12 $read(pro.txt,s,url)
  /did -ra $dname 13 $read(pro.txt,s,name)
  /did -ra $dname 14 $read(pro.txt,s,chan)
  /did -ra $dname 17 $read(pro.txt,s,quote)
}
on *:DIALOG:cpro:sclick:19:{
  /dialog -x cpro
}
on *:DIALOG:cpro:sclick:18:{
  /write -dsnick pro.txt 
  /write pro.txt nick $did($dname,2)
  /write -dsage pro.txt 
  /write pro.txt age $did($dname,10)
  /write -dsemail pro.txt 
  /write pro.txt email $did($dname,11)
  /write -dsurl pro.txt 
  /write pro.txt url $did($dname,12)
  /write -dsname pro.txt 
  /write pro.txt name $did($dname,13)
  /write -dschan pro.txt 
  /write pro.txt chan $did($dname,14)
  /write -dsquote pro.txt
  /write pro.txt quote $did($dname,17)
  /write -asquote pro.txt $chr(32)
  var %i = 0
  while (%i < $did($dname,17).lines) {
    inc %i 1
    /write -asquote pro.txt $did($dname,17,$calc(%i + 1)) 
    /write -asquote pro.txt $chr(32)
  }
  dialog -x cpro

}
on ^*:notice:Profile:*:{
  .set %pnick $nick
  .notice $nick YES  
  .timer -h 1 500 sendpro
  halt
}
alias sendpro {
  .notice %pnick NICK $read(pro.txt,s,nick)
  .notice %pnick Age $read(pro.txt,s,age)
  .notice %pnick name $read(pro.txt,s,name)
  .notice %pnick chan $read(pro.txt,s,chan)
  .notice %pnick url $read(pro.txt,s,url)
  .notice %pnick email $read(pro.txt,s,email)
  .notice %pnick quote $read(pro.txt,s,quote)
  .notice %pnick end
  .unset %pnick
  halt
}