Show Common Channels in Whois

By ctrl-alt-me on Mar 21, 2015

This script will highlight any common channels that are shared between you and whoever you /whois

/*
\/-----------------------------------------------------------\
;               Show Common Channels in Whois                ;  
;               -----------------------------                ;
;    Will highlight common channels in a /whois              ;
;                                                            ;
;    Also has the ability to display shared channels on      ;
:    networks which obscure the channel list by default.     ;
;    (+I on inspIRCD)                                        ;
;                                                            ;
;                                                            ;
;    how to use:                                             ;
;                                                            ;
;    /ccColor #                                              ;
;    Sets the color to highlight common channels with.       ;
;    Defaults to 11 if not set (or set improperly.)          ;
;    # must be in the 0 - 15 range.                          ;
;                                                            ;
;                                                            ;
;    /noChans [-r] [network]                                 ;
;    Adds a network name to the list of networks who         ;
;    hide the channel list from a /whois.                    ;
;    If network is not specified it uses the network         ;
;    on which the command was used.                          ;
;    Use parameter -r to remove a network from the list.     ;
;                                                            ;
;                                                            ;
;                   ___________________                      ;
;                   |©2015 ctrl-alt-me|                      ;
/\-----------------------------------------------------------/
*/

alias ccColor { 
  if ($1 isnum 0-15) { set %cc.color $1 | echo -c info Common channel color set to: $+ $chr(3) $+ $iif($1 <= 9, 0 $+ $1, $1) $1 }
  else echo -c info Please use a number between 0 and 15. 
}

alias noChans {
  var %1 = $1, %2 = $2
  if ($1 == $null) %1 = $network
  if ($1 == -r) { 
    if ($2 == $null) %2 = $network
    if ($istok(%noChans,%2,44)) { set %noChans $remtok(%noChans,%2,0,44) | echo -c info %2 removed from list of networks with no channel list }
    else { echo -c info %2 is not on the list of networks with no channel list }
  }
  elseif ($istok(%noChans,%1,44)) { echo -c info %1 is already on the list of networks with no channel list }
  else { set %noChans $addtok(%noChans,%1,44) | echo -c info %1 has been added to list of networks with no channel list }
}

raw 311:*: {
  echo -sc whois $2 is $3 $+ @ $+ $4 $5 $6-
  if (%cc.color == $null) || (%cc.color !isnum 0-15) set %cc.color 11   
  if ($istok(%noChans,$network,44) == $true) {
    var %cc = $comchan($2,0)
    if (%cc > 0) {
      var %i = 1
      var %tokcc
      while (%i <= %cc) { 
        %tokcc = $addtok(%tokcc,$comchan($2,%i),32)
        inc %i
      }
      /echo -sc whois $2 is in %cc common $iif(%cc > 1,channels,channel) $+ : $+ $chr(3) $+ $iif(%cc.color <= 9, 0 $+ %cc.color, %cc.color)  %tokcc $+ $chr(3)
    }
  }
  haltdef
}

raw 319:*: {  
  var %chans  = $3-
  var %tc = $wildtok($3-,*,0,32)
  var %cc = $comchan($2,0)
  if (%cc.color == $null) || (%cc.color !isnum 0-15) set %cc.color 11   
  if (%cc > 0) {
    var %i = 1, %ii = 1
    var %tokcc
    while (%i <= %cc) { 
      var %tchan = $comchan($2,%i)
      %tokcc = $addtok(%tokcc,%tchan,32)
      inc %i
    }
    while (%ii <= %tc) {
      var %tchan = $gettok(%chans,%ii,32)
      if ($right(%tchan,-1) isin %tokcc) { %chans = $reptok(%chans,%tchan,$chr(3) $+ %cc.color $+ %tchan $+ $chr(3),1,32) }
      inc %ii
    }   
    echo -sc whois $2 on %chans 
    haltdef
  }  
}

Comments

Sign in to comment.
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.