PM(query) Blocker

By MichaelA on Sep 09, 2010

Here is a PM blocker i made when i got bored. I know it could be better, but it gets the job done :P

Please fell free comment and tell me what you think :D

menu channel {
  [-[- $+ $me $+ 's PM Blocker-]-]
  .Activate Channel Message (Notify people that you are turning your PMs ON/OFF): set %PMNotify ON
  .Deactivate Channel Message (Notify people that you are turning your PMs ON/OFF): set %PMNotify OFF
  .Activate PM Blocker: set %PMBlock ON | set %PMBlockMSG $$?"What Do You Want The Block Reason To Be?" | echo -a PM's are now being blocked. | if (%PMNotify == ON) amsg PM's are now being blocked. [AMSG] | if (%PMNotify != ON) HALT
  .Deactivate PM Blocker: set %PMBlock OFF | echo -a PM's are no longer being blocked. | if (%PMNotify == ON) amsg PM's are no longer being blocked. [AMSG] | if (%PMNotify != ON) HALT
}

on 1:open:?:{
  if (%PMBlock == ON) { 
    msg $nick .:[My Private Messages are currently switched off. Please try again later]:. .:[Reason: %PMBlockMSG ]:.
    close -m $nick
  }
  if (%PMBlock != ON) {
    { HALT }
  }
}

Comments

Sign in to comment.
MichaelA   -  Sep 11, 2010

thanks for the suggestions and help :) much appreciated :D

Napa182
look into using groups instead of vars.
why have all the unnecessary coding?
also maybe learn from the hints/help others offer you on this site then update/fix ur snippets instead of posting more snippets with the same mistakes.

i made them at the same time thats why its like that :)

i'm still learning so i'll fix it up as i learn :P

 Respond  
gooshie   -  Sep 10, 2010

If you use the ^ then you can HALT the window BEFORE it opens instead of having it pop open and then close.

on ^*:open:?:{
  if (%PMBlock == ON) { 
    .msg $nick Your Custom Message.
    halt
  }
}

Also, For the switch you could have it appear as one entry which becomes more useful as your menu list gets longer.

menu menubar {
  PM Blocker is now $iif(%PMBlock,On,Off): $iif(%PMBlock,unset,inc) %PMBlock
}
_____________________________________________________________________________

There is no real need to set the variable to On/Off instead just inc it for a true and unset it to create a false. Then the above code could be:

on ^*:open:?:{
  if %PMBlock {
    .msg $nick Your Custom Message.
    halt
  }
}
 Respond  
napa182   -  Sep 10, 2010

look into using groups instead of vars.
why have all the unnecessary coding?
also maybe learn from the hints/help others offer you on this site then update/fix ur snippets instead of posting more snippets with the same mistakes.

 Respond  
MichaelA   -  Sep 09, 2010

lol yea true :D

thanks :)

 Respond  
WorldDMT   -  Sep 09, 2010

what's this??

  .Activate Channel Message (Notify people that you are turning your PMs ON/OFF): set %PMNotify ON
  .Deactivate Channel Message (Notify people that you are turning your PMs ON/OFF): set %PMNotify OFF

no need for this part u can remove it

  if (%PMBlock != ON) {
    { HALT }
  }
 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.