$isinchanlist

By brinxy on Nov 12, 2007

Simple code to check if a user/address in a channel list (except,ban,invite) with properties available for use.

;; ----------- $isinchanlist by brinxy ------------ ;;
;; About ;;
;; Simple to use identifier that returns  true if a user is in the channel list....  ;;
;;  You can use regular props as you'd expect from a regular ibl/iil/iel identifier. ;;
;;   There is also use an added prop, .true, to return $true or not and an added prop, .n, to return your number in the list. ;;
;; ----------------------------------------------- ;;
;; Snippet Syntax ;;
;; ----------------------------------------------- ;;
;; $isinchanlist(nick/address,#channel,[i\e\b])[.prop] ;;
;;  - nick/address: obviously being who you are searching for..
;;  - #channel: Being the channel in which you are searching the list...
;;  - [i\e\b]: i meaning Invite list, b meaning ban list, e meaning Except list. It must be one of those three. 
;;  - [.prop]: The property to retrieve when finding the data. (e.g $isinchanlist(brinxy,#mirc,e).date returns the date I was added to the except list)
;; ------------------------------------------------ ;;
;; Examples ;;
;;  For now, let's assume that I am the 2nd user in each list (ban,except, and invite) of the channel #detah
;;      $isinchanlist(brinxy,#detah,b) would return by wildsite, only because that the snippet's default setting without a prop. 
;;      $isinchanlist(brinxy,#detah,b).n would return 2 because I  am the second user in the ban list. 
;;      $isinchanlist(brinxy,#detah,b).true would return $true
;;  The same rule applies for the except list and invite list. Just use e or i instead of b. Also, you can use default properties for the lists as well!
;; ------------------------------------------------- ;;

alias isinchanlist { 
  if ($1-3) {
    var %` = $($+($,i,$3,l($chan,0)),2), %& = $1,%+-
    if (%& && $me ison $2) { 
      while (%`) {
        if $wildtok($($+($,i,$3,l($chan,%`)),2),$+(*,%&,*),1,32) { 
          if ($prop = n) %+- = $($+(%,`),2) 
          elseif ($prop = true) %+- = $true 
          elseif ($prop) %+- = $($+($,i,$3,l($chan,%`),.,$prop),2))
          return $iif(!$prop, $($+($,i,$3,l($chan,%`)),2),%+-)
        }
        dec %`
      }
    }
  }
}

Comments

Sign in to comment.
brinxy   -  Nov 13, 2007

Updated. Now supports except and invite lists as well.

 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.