BNC manager

By zexx0r on Feb 14, 2009

simple bnc add/remove user manager... nothing special :)

on *:load: {
  echo -a $chr(91) $+ 12 $chr(248)  $+ $chr(93) addon loaded
  echo -a $chr(91) $+ 12 $chr(248)  $+ $chr(93) enjoy ;)
}

alias bncmd {
  set %blah are you using sbnc?
  if ($dialog(bncmd)) { dialog -x bnc_ }
  else { 
    set %bnc.type $iif($input(%blah,y,psybnc checker) == $true,1,0)
    dialog -m bnc.mngr bnc.mngr
  } 
}

dialog bnc.mngr {
  title "BNC Manager - by zexx0r"
  size -1 -1 160 120
  option dbu
  box "", 1, 5 10 71 29
  text "User", 2, 28 15 25 8, center
  text "Ident", 3, 28 41 25 8, center
  edit "", 4, 18 50 50 10
  edit "", 5, 18 24 50 10
  box "", 6, 5 37 71 28
  text "Passwd", 7, 27 68 25 8, center
  edit "", 8, 18 77 50 10
  box "", 9, 5 63 71 28
  combo 13, 94 18 49 70, size
  box "List of users", 14, 90 10 57 81
  button "Add User", 10, 8 98 46 13, default
  button "Remove User", 11, 59 98 46 13, default
  button "Close dialog", 12, 109 98 46 13, default
}

on *:dialog:bnc.mngr:*:*: {
  if ( $devent == sclick ) {
    if ( %bnc.type == 1 ) {
      if ( $did == 10 ) { 
        did -a bnc_ 13 $did(5).text
        set %bnc $didtok(bnc_,13,32)
        msg -SBNC adduser $did(5).text $did(8).text
      }
      if ( $did == 11 ) {
        msg -SBNC deluser $did(5).text
        did -d bnc_ 13 $did(13).sel
      }
      if ( $did == 12 ) { dialog -x bnc_ }
    }
    else {
      if ( $did == 10 ) { 
        did -a bnc_ 13 $did(5).text
        set %bnc $didtok(bnc_,13,32)
        adduser $did(4).text $+ : $+ $did(5).text
        password $did(5).text $+ : $+ $did(8).text
      }
      if ( $did == 11 ) {
        deluser $did(5).text
        did -d bnc_ 13 $did(13).sel
      }
      if ( $did == 12 ) { dialog -x bnc_ }
    }
  }
}

on *:unload: {
  echo -a $chr(91) $+ 12 $chr(248)  $+ $chr(93) addon unloaded
  echo -a $chr(91) $+ 12 $chr(248)  $+ $chr(93) thanks for using ;)
}

Comments

Sign in to comment.
disabledacc   -  May 04, 2009
 Respond  
disabledacc   -  May 02, 2009
 Respond  
zexx0r   -  Feb 15, 2009

I got it! :D tnx Kirby :)))

code updated :)

 Respond  
Kirby   -  Feb 15, 2009

Well, $input is like...a prompt.
I sometimes use it for displaying error prompts such as:

"You have to type in a nick!" or something like that.
Not sure where to put it in your code...how about if they don't have enough access or aren't on a bouncer?

 Respond  
zexx0r   -  Feb 15, 2009

okay Kirby, tnx for explanation :)
so the code would be:

 set %bnc.type $iif(%blah != $null,1,0) 

and that's ok, but what about $input() ? :\ how do I link $input() and the rest of the code?

 Respond  
Kirby   -  Feb 15, 2009

I just realized you've already been taught about $iif's. Sorry.

Hey zexxor.
$iif's are basically the identifier for the "if-then-else" parts of a script.

How $iif works: $iif(question,action if statement is true,action if statement is false)
So let's say you have a variable called %test, which has a value of 1. (%test 1 in your variables tab)

$iif(%test = 1,msg $active true,msg $active false)

Because %test = 1, it messages the active channel 'true'.
If you have similar actions in both the true and false portions of the $iif, you can put it in front of the $iif.
So the above one can be re-written as:

msg $active $iif(%test = 1,true,false)

Basically, $iif can just substitute parts whether or not the question is true or false.
Also, you can perform no action if the statement is false so therefore you can put nothing into the third parameter of the $iif, but you MUST have a second parameter always. :)

 Respond  
zexx0r   -  Feb 15, 2009

that's correct. $iif's or $input,
cause I've never used them before and I know that the syntax goes

$input(question,option,title...)
$iif(question,answer if true,answer if false)

... anyone?

 Respond  
Aucun50   -  Feb 15, 2009

You need help with $iif's?

 Respond  
zexx0r   -  Feb 15, 2009

ok I can't figure $input and $iif out at all... ;\
any suggestions?

 Respond  
zexx0r   -  Feb 14, 2009

it would work just for psy... i will update the code though

 Respond  
Kirby   -  Feb 14, 2009

shroudBNC? :O

 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.