Friends system for pvt

By MoshMage on Feb 16, 2011

It's a Friend System based on ident or realname.

You can choose to block all the incoming query windows, allow only friends to speak with you, allow only people who are in common channel or allow everyone.

It uses popups to add or remove a new friend and set all settings.

;review:March2012
alias query {
  set %pvpown 1
  .enable #common
  .whois $1
  query $1
}
on *:input:@AddFriend:{
  if (%q != 1) && ($1 != no) && ($1 != n) && ($1 != y) && ($1 != yes) {
    if ($1 == $chr(63)) {
      clear @AddFriend
      aline -p @AddFriend List:
      aline -p @AddFriend $replace(%friends,$chr(47),$chr(44) $+ $chr(32))
      window @AddFriend 500 200 400 100
      halt
    }
    if ($1 == $chr(35)) {
      clear @AddFriend
      aline -p @AddFriend v1.020107Ago
      aline -p @AddFriend Write the ident/real name of your friend 
      aline -p @AddFriend and it will add itself to the list.
      aline -p @AddFriend -
      aline -p @AddFriend You can see your friend ident/real name
      aline -p @AddFriend by /whois nickname 
      aline -p @AddFriend ex: MoshMage is MoshPT@unknownBnc.x.am *  PitWizz
      aline -p @AddFriend ident = MoshPT ; real name PitWizz
      aline -p @AddFriend -
      aline -p @AddFriend To remove, Type -ident/real name
      aline -p @AddFriend exemple: -MoshPT
      aline -p @AddFriend -
      aline -p @AddFriend To list, just type ?
      aline -p @AddFriend --------------------------------------MoshMage@PTnet
      window @AddFriend 500 200 400 300
      halt
    }
    if ($chr(45) == $left($1,1)) {
      set %r 1
      aline -p @AddFriend You are about to Remove $+(",$right($1,-1),") from Friends list.
      aline -p @AddFriend is that correct? (yes/no)
      set %q 1 $right($1,-1)
      halt
    }
    else {
      aline -p @AddFriend You are about to Add $+(",$1,") to Friends list.
      aline -p @AddFriend is that correct? (yes/no)
      set %q 1 $1
      halt
    }
  }
  else {
    if (!%q) {
      clear @AddFriend
      aline -p @AddFriend Who, in their right mind, would answer
      aline -p @AddFriend to a machined that didn't ask anything?
      aline -p @AddFriend :)
      window @AddFriend 500 200 400 100
      halt
    }
    if ($1 == y) || ($1 == yes) {
      var %f $gettok(%q,2,32)
      if (!%r) set %friends $addtok(%friends,%f,47)
      else set %friends $remtok(%friends,%f,0,47)
      unset %q
      aline -p @AddFriend %f $iif(%r,removed from,added to) Friends list. $iif(!%r,use $+(-,%f) to remove.)
      if (%r) unset %r
      halt
    }
    if ($1 == n) || ($1 == no) {
      unset %q
      if (%r) unset %r
      aline -p @AddFriend Cancelled.
      halt
    }
    else {
      unset %q
      if (%r) unset %r
      aline -p @AddFriend Cancelled. This is yes/no command.
      halt
    }
  }
}
alias pvtAddFriend {
  window -de @AddFriend 500 200 400 100 Courier New
  aline -p @AddFriend Type your friends IDENT
  aline -p @AddFriend or REAL NAME. Type # for help.
}

on *:open:?:{
  if (!%pvpown) {
    if (%block == all) {
      .msg $nick That's just SO RUDE of you. Ask me if i want to chat first.
      .msg $nick This pvt has been ignored.
      close -m $nick
      .ignore -pu600 $nick
      if (%warnlvl) echo -as $timestamp <pvtShite> $nick said: $1-
    }
    if (%block == onlyf) {
      .enable #identCheck
      .whois $nick $$1
    }
    if (%block) && (%block != all) {
      .enable #common
      .whois $nick
    }
  }
}
on *:join:#:{ if ($nick == $me) { set %my_chans $addtok(%my_chans,$chan,32) } }
on *:part:#:{ if ($nick == $me) { set %my_chans $remtok(%my_chans,$chan,1,32) } }
on *:start:{ unset %my_chans }

#identCheck off
raw 311:*:{
  if (!%pvpown) {
    if ($3 isin %friends) || ($6 isin %friends) {
      var %t $findtok(%friends,$3,1,47)
      var %y $findtok(%friends,$6,1,47)
      if (%t) var %i $gettok(%friends,%t,47)
      if (%y) var %r $gettok(%friends,%y,47)
      unset %t,%y
      echo $2 $timestamp <Friends> $2 is in your Friends List.
      echo $2 $timestamp <Friends> $iif(%i,ident: %i,realname: %r)
      .disable #identCheck
      halt
    }
    else {
      .msg $2 it seems you're not an acquaintance of mine. Buzz off.
      if (%warnlvl) echo -as $timestamp <pvtShite> $2 just opened a query with you.
      .ignore -pu600 $2 
      close -m $2
      .disable #identCheck
      halt
    }
  }
}
#identCheck end
#common off
raw 319:*:{
  set %cn 0
  var %s_ $3-
  var %s_ $remove(%s,$chr(58))
  var %i $numtok(%s,32)
  var %x 1
  while (%x <= %i) {
    if ($gettok(%s,%x,32) isin %my_chans) {
      var %c $gettok(%s,%x,32)
      var %s_$reptok(%s,%c,$+(,%c,),1,32)
      inc %cn
    }
    inc %x
  }
  if (%pvpown) {
    echo $2 $timestamp $+(<,/whois,>) %s
    unset %pvpown
    .disable #common
    halt
  }
  if (%block == common) {
    if (%cn) {
      echo $2 $timestamp $+(<,%cn,inCommon,>) %s
    }
    else {
      .msg $2 I'm sorry, i have no common channel with you. Go away.
      .msg $2 This pvt has been ignored.
      if (%warnlvl) echo -as $timestamp <pvtShite> $2 just opened a query with you. /whois %s
      .ignore -pu600 $2
    }
  }
  .disable #common
}
#common end
menu nicklist {
  Friend
  .Add $1 $+(",$ial($1,1).user,"):pvtAddFriend | editbox @AddFriend $ial($1,1).user
  .Rem $1 $+(",$ial($1,1).user,"):pvtAddFriend | editbox @AddFriend $+(-,$ial($1,1).user)
}
menu channel,query,nicklist {
  pvtBlock
  .Add $iif($chr(35) isin $active,Friends,$nick):pvtAddFriend | if ($chr(35) !isin $active) { editbox @AddFriend $ial($nick,1).user }
  .-
  .Allow Friends Only $iif(%block == onlyf,x) :set %block onlyf
  .Block all querys $iif(%block == all,x) :set %block all
  .Block if #nonCommon $iif(%block == common,x) :set %block common
  .-
  .Allow All $iif(!%block,x) :unset %block | echo -a $timestamp <pvtBlock> ITS THE QUERY PARTAY ~~*.*~~
  .-
  .Warn $iif(%warnlvl,on,off):{
    if (%warnlvl) { unset %warnlvl }
    else { set %warnlvl 1 }
  }
}

Comments

Sign in to comment.
MoshMage   -  Feb 16, 2011

i was in a hurry. good point. taken care of.

 Respond  
_Dean_   -  Feb 16, 2011

which are the commands for this?
you just post a snippet here, and dont explain nothing, just wait till someone come and ask, how it works

 Respond  
Are you sure you want to unfollow this person?
Are you sure you want to delete this?
Click "Unsubscribe" to stop receiving notices pertaining to this post.
Click "Subscribe" to resume notices pertaining to this post.