PM Blocker/Checker Update 1.1

By iCub on May 31, 2009

Hey,
This is pretty much what is says it is. Load into remotes (Alt-R > New File > Ctrl-V > Ok)
Right click in the channel, in the nicklist or in a query turn enable/disable the blocker.
Pretty much just a play-a-round with dialogs, you be the judge.

Update
Ability to add nicks to auto block/allow list
Small WHOIS on nicks showing address
Customisable accept or decline message
Switch between Block All, Allow Selected, Block List or Block None.

Also thanks to Aucun50 for the help he gave me with the update.

dialog pmb { 
  title "Pm Block/Checker" 
  option dbu 
  size -1 -1 150 125 
  tab "Messages" 1, 2 1 146 122 
  tab "Accepted/Declined Address's" 2 
  box "Message" 3, 5 15 139 62, tab 1 
  button "" 4, 10 35 35 10, tab 1 
  combo 5, 50 35 88 10, tab 1 
  button "" 6, 10 60 35 10, tab 1 
  combo 7, 50 60 88 10, tab 1 
  text "Accepted Messages" 8, 10 25 100 10, tab 1 
  text "Declined Messages" 9, 10 50 100 10, tab 1 
  box "Options" 10, 5 78 139 37, tab 1 
  check "Use Accept Message" 11, 10 89 70 10, tab 1 
  check "Use Decline Message" 12, 10 101 70 10, tab 1 
  ; 
  box "Address's" 13, 5 15 139 105, tab 2 
  text "Accepted" 14, 10 25 50 10, tab 2 
  combo 15, 10 35 100 10, tab 2 
  button "LIST" 16, 115 35 25 10, tab 2 
  text "Declined" 17, 10 49 50 10, tab 2 
  combo 18, 10 59 100 10, tab 2 
  button "LIST" 19, 115 59 25 10, tab 2 
  button "Add" 20, 10 75 65 10, tab 2 
  button "Delete" 21, 75 75 65 10, tab 2 
  box "Address Finder" 22, 10 89 130 25, tab 2 
  button "Addres Finder" 23, 40 97 70 12, tab 2 
} 
dialog list { 
  option dbu 
  size -1 -1 100 73 
  list 1, 5 5 90 64, size vsbar 
} 
on *:dialog:list:*:*: { 
  if ($devent == sclick) { 
    if ($did == 1) { 
      if (%l == list1) { echo -a Copy: $did(1).seltext } 
      elseif (%l == list2) { echo -a Copy: $did(1).seltext } 
    } 
  } 
  elseif ($devent == close) { unset %l } 
} 
on *:dialog:pmb:init:0: { 
  $iif((%atmessageu),did -c pmb 11,) 
  $iif((%atmessage),did -ra pmb 4 Delete,did -ra pmb 4 Save) 
  $iif((%dcmessageu),did -c pmb 12,) 
  $iif((%dcmessage),did -ra pmb 6 Delete,did -ra pmb 6 Save) 
} 
on *:dialog:pmb:sclick:*: { 
  if ($did == 4) { 
    if (%atmessage) { unset %atmessage | did -ra pmb 4 Save | echo -a Accept message deleted } 
    elseif (!%atmessage) { 
      if (!$did(5)) { echo -a No message entered } 
      elseif ($did(5)) { set %atmessage $did(5) | did -ra pmb 4 Delete | echo -a Accept message saved } 
    } 
  } 
  elseif ($did == 6) { 
    if (%dcmessage) { unset %dcmessage | did -ra pmb 6 Save | echo -a Decline message deleted } 
    elseif (!%dcmessage) { 
      if (!$did(7)) { echo -a No message entered } 
      elseif ($did(7)) { set %dcmessage $did(7) | did -ra pmb 6 Delete | echo -a Decline message deleted } 
    } 
  } 
  elseif ($did == 11) { 
    if (%atmessageu) { unset %atmessageu | echo -a Accept message is now disabled } 
    elseif (!%atmessageu) { set %atmessageu on | echo -a Accept message enabled } 
  } 
  elseif ($did == 12) { 
    if (%dcmessageu) { unset %dcmessageu | echo -a Decline message is now disabled } 
    elseif (!%dcmessageu) { set %dcmessageu on | echo -a Decline message enabled } 
  } 
  elseif ($did == 16) { dialog -m list list | list1 } 
  elseif ($did == 19) { dialog -m list list | list2 } 
  elseif ($did == 20) { 
    if (!$did(15)) && (!$did(18)) { echo -a No information to add } 
    elseif ($did(15)) && (!$did(18)) { 
      if ($read(accepted.txt,w,$did(15))) { echo -a Address was found in the file already } 
      else { write accepted.txt $did(15) | echo -a Address added to file } 
    } 
    elseif (!$did(15)) && ($did(18)) { 
      if ($read(declined.txt,w,$did(18))) { echo -a Address was found in the file already } 
      else { write declined.txt $did(18) | echo -a Address added to file } 
    } 
    elseif ($did(15)) && ($did(18)) { echo -a Information found in both lines, no information will be added } 
  } 
  elseif ($did == 21) { 
    if (!$did(15)) && (!$did(18)) { echo -a No information to add } 
    elseif ($did(15)) && (!$did(18)) { 
      if (!$read(accepted.txt,w,$did(15))) { echo -a Address was not found in the file } 
      else { write -ds $+ $did(15) accepted.txt | echo -a Address deleted from file } 
    } 
    elseif (!$did(15)) && ($did(18)) { 
      if (!$read(declined.txt,w,$did(18))) { echo -a Address was not found in the file } 
      else { write -ds $+ $did(18) declined.txt | echo -a Address deleted from file } 
    } 
    elseif ($did(15)) && ($did(18)) { echo -a Infromation found in both lines, no information will be added } 
  } 
  elseif ($did == 23) { afinder } 
} 
on *:open:?: { 
  if (%block == all) { 
    if (%dcmessage) && (%dcmessageu) { msg $nick %dcmessage | close -m $nick } 
    else { msg $nick Sorry I'm not taking Pm's at the moment, contact me in a channel are after. | close -m $nick | halt } 
  } 
  elseif (%block == sel) { 
    if (!$read(accepted.txt,w,$address($nick,3))) { 
      if (%dcmessage) && (%dcmessageu) { msg $nick %dcmessage | close -m $nick }      
      else { msg $nick Sorry I'm not taking Pm's at the moment, contact me in a channel are after. | close -m $nick | halt } 
    } 
    elseif ($read(accepted.txt,w,$address($nick,3))) { 
      if (%atmessage) && (%atmessageu) { msg $nick %atmessage } 
      else { msg $nick Your Pm has been accepted, I'll get back to you as soon as i can. } 
    } 
  } 
  elseif (%block == del) { 
    if (!$read(declined.txt,w,$address($nick,3))) { 
      if (%atmessage) && (%atmessageu) { msg $nick %atmessage }  
      else { msg $nick Your Pm has been accepted, I'll get back to you as soon as i can. }      
    } 
    elseif ($read(declined.txt,w,$address($nick,3))) { 
      if (%dcmessage) && (%dcmessageu) { msg $nick %dcmessage | close -m $nick } 
      else { msg $nick Sorry I'm not taking Pm's at the moment, contact me in a channel are after. | close -m $nick | halt }      
    } 
  } 
  elseif (!%block) { 
    if (%atmessage) && (%atmessageu) { msg $nick %atmessage } 
    else { msg $nick Your Pm has been accepted, I'll get back to you as soon as i can. } 
  } 
} 
menu nicklist,channel,query,status { 
  iCub's PM Blocker 
  .Dialog Setup: dialog -m pmb pmb 
  .$iif((%pmblock),OFF,ON): $iif((%pmblock),unset %pmblock,set %pmblock on) 
  .Blocks 
  ..Block All: set %block all 
  ..Allow Selected: set %block sel 
  ..Block Declined: set %block del 
  ..Block None: unset %block 
} 
alias list1 { 
  var %list = 1 
  while (%list <= $lines(accepted.txt)) { 
    did -a list 1 $read(accepted.txt,%list) 
    inc %list 
  } 
  set %l list1 
} 
alias list2 { 
  var %list 1 
  while (%list <= $lines(declined.txt)) { 
    did -a list 1 $read(declined.txt,%list) 
    inc %list 
  } 
  set %l list2 
} 
alias afinder { 
  var %af $$?="Enter NickName:" 
  echo -a There adress is: $address(%af,3) 
} 

Comments

Sign in to comment.
iCub   -  Jun 29, 2009

Wow, No comments on the update :/

 Respond  
Aucun50   -  May 31, 2009

I can't help you right now but tomorrow i might be able to, if you have questions about how to do parts pm me are post it on the forums.

 Respond  
iCub   -  May 31, 2009

Yeah I ahh probably will need a hand if it's not too much trouble

 Respond  
Aucun50   -  May 31, 2009

To start off with yes make the dialog have some more buttons and an edit box. You will need to have a txt file to store the nick or address's to block and maybe add a list in your dialog then a while loop to fill it.

If you need help doing some of the code i would be happy to give you a hand.

 Respond  
iCub   -  May 31, 2009

Updated, thanks Aucun50. How would I go about your idea? I'm guessing enlarge the dialog and add extra buttons.

 Respond  
Aucun50   -  May 31, 2009

You could have had block all, block selected or block none for your dialog. In the menu you can shorten the on and off to one line with a $iif statement like:

menu nicklist,channel,query {
  iCub's PM Blocker
  .$iif((%pmblock == on),Off,On): $iif((%pmblock == on),unset %pmblock,set %pmblock)
}

Also not really a big difference but you can use only one on dialog like:

on *:dialog:af:sclick:*:{
  if ($did == 1) {
    /window -w %qnick
    .msg %qnick I Suppose Someone Has To Be You're Friend
    /dialog -x af
    /window -a %qnick
    /unset %qnick
  }
  elseif ($did == 2) {
    close -m %qnick
    .msg %qnick Fuck Off I Dont Want To Talk To You
    /dialog -x af
    unset %qnick
  }
  elseif ($did == 3) {
    close -m %qnick
    .msg %qnick Sorry.. I Don't Like You
    /dialog -x af
    unset %qnick
  }
}

Overall it's a good dialog, good job.

 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.