Invitation Control

By RusselB on Apr 12, 2008

This is a simple dialog (well, simple to use, I hope), that tracks any and all invitations sent to you on your current network. You can accept or decline (with a reason) any or all of the invitations, as well as auto-accept or auto-decline selected or all invitations. NOTE: An invitation must be received before Auto-accept or Auto-Decline will work.
Image

dialog Invite_Control {
  size -1 -1 290 155
  option pixels
  text "Invite List", 1, 5 5 100 16, center
  list 2, 5 20 100 110, size check
  button "Checked", 3, 115 15 75 25, disable
  button "All", 6, 115 45 75 25
  button "Automatic", 8, 115 75 75 25
  link "Russel Bairstow", 10, 200 114 75 16
  button "Close", 11, 110 110 75 20, ok cancel
  box "Accept", 12, 110 0 85 105
  box "Decline", 4, 193 0 85 105
  button "Checked", 5, 198 15 75 25, disable
  button "All", 7, 198 45 75 25
  button "Automatic", 9, 198 75 75 25
}
ctcp *:version:*:  ctcpreply $nick VERSION Invite Control 04.12.2008 by Russel Bairstow
on *:dialog:Invite_Control:*:*:{
  if $devent == init {
    dialog -t $dname Invite Control for $network
    var %a = 1, %b = $ini($invite,$network,0)
    while %a <= %b {
      var %ic.chan = $ini($invite,$network,%a), %query = $readini($invite,n,$network,%ic.chan)
      if Decline !isin %query && Accept !isin %query && %ic.chan !ischan {        did -a $dname 2 %ic.chan      }
      inc %a
    }
  }
  elseif $devent == sclick {
    if $did == 10 {      url -n mailto:r.k.bairstow@gmail.com?subject=Invite_Control_04.12.2008    }
    elseif $did == 2 {
      var %invite.chan = $iif($istok(%invite.chan,$did(2).seltext,44),$remtok(%invite.chan,$did(2).seltext,1,44),$addtok(%invite.chan,$did(2).seltext,44))
      did $iif($did(2,0).csel,-e,-b) $dname 3,5
    }
    elseif $did == 3 {
      .join  %invite.chan
    }
    elseif $did == 6 {
      var %invite.chan = $didtok($dname,2,44)
      .join  %invite.chan
    }
    elseif $did  == 8 {
      var %a = 1, %b = $did(2).lines
      while %a <= %b {
        .writeini -n $invite $network $did(2,%a) Accept
        .join $did(2,%a)
        inc %a
      }
    }
    elseif $did == 5 {
      if $did(2,0).csel = 1 {
        var %inv.chan = $did(2).seltext, %inviter = $readini($invite,n,$network,%inv.chan)
        var %ic.decline = $input(Enter reason for declining invite from %inviter to %inv.chan,e,,No reason given)
        .notice %inviter Invitation to join %inv.chan has been declined for the following reason: %ic.decline
      }
      else {
        var %ic.decline = $input(Do you want to use the same reason for all $did(2,0).csel requests,y)
        if %ic.decline {
          var %ic.decline = $input(Enter reason to be used for all of the currently selected invites,e,,No reason given)
          var %a = 1, %b = $did(2,0).csel
          while %a <= %b {
            .timer 1 %a .notice $readini($invite,n,$network,$did(2,%a).csel) Invitation to join $did(2,%a).csel has been declined for the following reason: %ic.decline
            inc %a
          }
        }
        else {
          var %a = 1, %b = $did(2,0).csel
          while %a <= %b {
            var %inv.chan = $did(2,%a).csel, %inviter = $readini($invite,n,$network,%inv.chan)
            var %ic.decline = $input(Enter reason for declining invite from %inviter to %inv.chan,e,,No reason given)
            .notice %inviter Invitation to join %inv.chan has been declined for the following reason: %ic.decline
            inc %a
          }
        }
      }
    }
    elseif $did == 7 {
      var %ic.decline = $input(Enter reason to be used for all of the current invites,e,,No reason given)
      var %a = 1, %b = $did(2).lines
      while %a <= %b {
        .timer 1 %a .notice $readini($invite,n,$network,$did(2,%a)) Invitation to join $did(2,%a) has been declined for the following reason: %ic.decline
        inc %a
      }
    }
    elseif $did == 9 {
      var %ic.decline = $input(Do you want to use the same reason for all $did(2,0).csel requests,y)
      if %ic.decline {
        var %ic.decline = $input(Enter reason to be used for all of the currently selected invites,e,,Auto-Declined)
        var %a = 1, %b = $did(2,0).csel
        while %a <= %b {
          .timer -m 1 $calc(%a * 1000)  .notice $readini($invite,n,$network,$did(2,%a).csel) Invitation to join $did(2,%a).csel has been declined for the following reason: %ic.decline
          if decline !isin %ic.decline {            %ic.decline = Declined for %ic.decline          }
          .timer -m 1 $calc((%a + .5)  * 1000) .writeini -n $invite $network $did(2,%a).csel %ic.decline
          inc %a
        }
      }
      else {
        var %a = 1, %b = $did(2,0).csel
        while %a <= %b {
          var %inv.chan = $did(2,%a).csel, %inviter = $readini($invite,n,$network,%inv.chan)
          var %ic.decline = $input(Enter reason for declining invite from %inviter to %inv.chan,e,,No reason given)
          .notice %inviter Invitation to join %inv.chan has been declined for the following reason: %ic.decline
          if decline !isin %ic.decline {            %ic.decline = Declined for %ic.decline          }
          .writeini -n $invite $network $did(2,%a).csel %ic.decline
          inc %a
        }
      }
    }
  }
}
on *:invite:#:{
  if $chan ischan {    .notice $nick I'm already in $chan $+. Thanks for the invite anyways.  }
  else {
    if !$ini($invite,$network,$chan) {
      .writeini -n $invite $network $chan $nick 
      if $dialog(Invite_Control) && !$didwm(Invite_Control,2,$chan) {          did -a Invite_Control 2 $chan        }
    }
    else {
      if $readini($invite,n,$network,$chan) == Accept {      .join $chan    }
      elseif Decline isin $v1 {      .notice $1 Invitation to $chan has been declined due to $v1    }
    }
  }
}
menu * {
  Invite Control : ic
}
alias ic {
  if $dialog(Invite_Control) {    dialog -evh Invite_Control Invite_Control  }
  elseif !$ini($invite,$network,0) {    echo 4 -a No Invitations have been received on $network  }
  else {
    var %a = 1, %b = $ini($invite,$network,0)
    while %a <= %b {
      var %invite.chan = $ini($invite,$network,%a), %invite.nick = $readini($invite,n,$network,%invite.chan)
      if Decline !isin %invite.nick && Accept !isin %invite.nick {        dialog -mdh Invite_Control Invite_Control       }
      inc %a
    }
    if !$dialog(Invite_Control) {      echo 4 -a All received invitations on $network have been auto-accepted or auto-declined    }
  }
}
alias -l invite {
  return $qt($scriptdirinvite.ini)
}

Comments

Sign in to comment.
RusselB   -  Oct 30, 2008

Updated code and picture will be posted soon.

 Respond  
RusselB   -  Jul 16, 2008

k1322: Thanks for the note. I\'ll see what I can do about adding that.

 Respond  
k1322   -  Jun 21, 2008

Nice script. A feature for password protected channels would be nice. If the channel is password protected you still need to join the channel manualy after the invitation.

 Respond  
ryu.dragonryder   -  Apr 14, 2008

i got no errors from this script - nice work

 Respond  
RusselB   -  Apr 14, 2008

Eugenio: I\'m obviously not blind, or I wouldn\'t be able to read the comment that were made. I made a simple request, and a request is all it was. If I wanted to ensure that only relevant comments were made, I would\'ve just deleted the irrelevant posts and not bothered making my request.

napa182: Would you kindly check your other scripts to see if any of them also use %invite.chan as either a global or local variable? If there is, that might account for the error you got, as the join command uses that variable to track the names of the channels to be joined by the invitation issued. Other than that, I can\'t (at the moment) think of any reason why that error would show.

 Respond  
napa182   -  Apr 14, 2008

iv only had one error /join: insufficient parameters (line 35

 Respond  
napa182   -  Apr 14, 2008

nice work RusselB

 Respond  
EL   -  Apr 14, 2008

LOL ^5 Eugene :P # RusselB i havent hada chance to test it but ya know this is a site full of ppl we are gunna chit chat about crapp maybe shouldnt do it on your comment pag but remember the more traffic you get the more interest there is in checking the page out so its double edged.`-.-

 Respond  
Eugenio   -  Apr 14, 2008

Please keep comments relative to this snippet. Thanks in advance.

WTF are you blind mate ?!? there is a \"delete this comment\" option ffs.

 Respond  
RusselB   -  Apr 14, 2008

Please keep comments relative to this snippet. Thanks in advance.

 Respond  
Eugenio   -  Apr 13, 2008

LMFAO
and dont call me boy oldage pensioner

 Respond  
EL   -  Apr 13, 2008

Isnt he the Nick that comes to my server chatscape.net ?!?

LAWL you wish it was yours boy.

 Respond  
Eugenio   -  Apr 13, 2008

Isnt he the Nick that comes to my server chatscape.net ?!?

 Respond  
EL   -  Apr 13, 2008

Do i know you?

 Respond  
Nick   -  Apr 13, 2008

El the Bell...or may i say hell:) hehe

 Respond  
EL   -  Apr 13, 2008

Or they could just test the damn thing and see it...

 Respond  
RusselB   -  Apr 12, 2008

Got it...and thanks

 Respond  
Hawkee   -  Apr 12, 2008

Go to your image URL: http://www.hawkee.com/profile/img/1501/

Find the BBCode below the image and copy it. Then edit your snippet and paste it into your Introduction. Let me know if you have any problems.

 Respond  
RusselB   -  Apr 12, 2008

If I knew how to post a link to the image, or how to use the BB code, I would, but unless someone wants to tell me how to do that, I\'m still no further ahead

 Respond  
BlueThen   -  Apr 12, 2008

There\'s a BB code on your image\'s page.

 Respond  
Scakk   -  Apr 12, 2008

Post the link to the image in the Introduton part

 Respond  
RusselB   -  Apr 12, 2008

I did upload a screenshot of this dialog, but I\'m not sure how to get it to show with the snippet.

 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.