/*
Created by: Kool-aid_Man @ irc.hackthissite.org (SSL Port: 7000)
Things to get done:
*Lots more...
--Send to multiple windows maybe? (for one send only maybe?)
--Menus need work
--Customization dialog?
*NOTICEs does not work
--Make it work so that either ALL notices show up OR
--Any notice from some1 on a Watched channel shows up
*!!!!!JOIN/PART support
*A nick completer specifically for use w/in @ChannelWatch
*/
;The command that begins it all and the startup functions necessary to it's performance.
alias ChannelWatch {
;Create custom window @ChannelWatch
window -dek0l12mRSv @ChannelWatch -1 -1 700 500
;Enables the on:TEXT/ACTION/NOTICE/INPUT events
.enable #ChannelWatch.T/A/N/I
;Adds all channels to the listbox, and the variable %ChannelWatch.chans
set %ChannelWatch.i 1
while (%ChannelWatch.i <= $chan(0)) {
ChannelWatch.AddChan $chan(%ChannelWatch.i)
inc %ChannelWatch.i
}
}
;$chr(35) == #
alias ChannelWatch.AddChan {
;Checks that channel name is prepended with '#' and that
;'#' does not appear more than once (to eliminate adding multiple channels)
if (($left($$1,1) == $chr(35)) && ($chr(35) !isin $right($$1,-1))) {
;Add channel to the listbox
aline -l @ChannelWatch $$1
;Colors channel name if there is still a color available for it [range: 3-15 (starts with 3, then 4,...)]
if (%ChannelWatch.i <= 13) { cline -ml $calc(%ChannelWatch.i +2) @ChannelWatch $fline(@ChannelWatch,$$1,1,1) }
;Stores the channels for later reference
set %ChannelWatch.chans $addtok(%ChannelWatch.chans,$$1,44)
}
else {
if ($left($$1,1) != $chr(35)) { echo 4 @ChannelWatch ***ERROR: Channel you attempted to add was not prepended with '#'. }
elseif ($chr(35) isin $right($$1,-1)) { echo 4 @ChannelWatch ***ERROR: You attempted to add more than one channel at a time ('#' was in the channel name other than the first character). }
}
}
;Disables the on:TEXT/ACTION/NOTICE/INPUT events when @ChannelWatch is closed
on *:CLOSE:@ChannelWatch:{ .disable #ChannelWatch.T/A/N/I }
menu @ChannelWatch {
Add a Channal:{
var %ChannelWatch.tmp $?="Enter ONE channel you want to add. $crlf $+ Make sure to prefix the channel with '#'."
ChannelWatch.AddChan %ChannelWatch.tmp
}
Remove a Channel:{
if ($sline(@ChannelWatch,1) == $Null) { echo 4 @ChannelWatch ***ERROR: To remove a channel please select it in the listbox first. }
elseif ($?!="This will remove $sline(@ChannelWatch,1) from the Watch list. $ctrl $+ Continue?" == $true) {
;Removes channel from the %ChannelWatch.chans variable where they are stored for reference
set %ChannelWatch.chans $remtok(%ChannelWatch.chans,$sline(@ChannelWatch,1),1,44)
;Removes channel from the listbox
dline -l @ChannelWatch $sline(@ChannelWatch,1).ln
}
}
;enable/disable colours, %ChannelWatch.colors == $true or $false, $true = currently enabled
Turn Colors $iif(%ChannelWatch.colors,OFF,ON) {
$iif(%ChannelWatch.colors,set %ChannelWatch.colors $false,set %ChannelWatch.colors $true)
}
}
menu Status {
ChannelWatch
.$iif($window(@ChannelWatch) == $null,Run):/ChannelWatch
.$iif($window(@ChannelWatch) == @ChannelWatch,Stop):{
.disable #ChannelWatch.T/A/N/I
window -c @ChannelWatch
}
}
menu Channel {
ChannelWatch
.$iif($window(@ChannelWatch) == $null,Run):/ChannelWatch
.$iif($window(@ChannelWatch) == @ChannelWatch,Stop):{
.disable #ChannelWatch.T/A/N/I
window -c @ChannelWatch
}
;Allows the active channel ($active) to be added if @ChannelWatch exists
.$iif($window(@ChannelWatch) == @ChannelWatch,Add This Channel):ChannelWatch.AddChan $active
}
;All events that control the manipulation of text for display within @ChannelWatch
#ChannelWatch.T/A/N/I on
/*Echoes all standard conversation text originating from
- - a Watched channel (%ChannelWatch.chans) to @ChannelWatch.
Prepends that text with the originating time, channel, and nick.
If colours are enabled it colours the time and channel to match their colour in the listbox
--the colour is applied to the background, not the foreground
--doesn't colour anything if the colour is less than 3 (for contrast purposes)
*/
on *:TEXT:*:%ChannelWatch.chans:{
if ($window(@ChannelWatch) == @ChannelWatch) {
/*The following IF and ELSE statement could be replaced with this:
echo @ChannelWatch $iif(($line(@ChannelWatch,$fline(@ChannelWatch,$chan,1,1),1).color > 2) && (%ChannelWatch.colors), $+ $chr(44) $+ $line(@ChannelWatch,$fline(@ChannelWatch,$chan,1,1),1).color $+ $time([HH:nn:ss]) $chan $+ ,$time([HH:nn:ss]) $chan) < $+ $nick $+ > $1-
*/
if (($line(@ChannelWatch,$fline(@ChannelWatch,$chan,1,1),1).color > 2) && (%ChannelWatch.colors)) {
echo @ChannelWatch 1, $+ $line(@ChannelWatch,$fline(@ChannelWatch,$chan,1,1),1).color $+ $time([HH:nn:ss]) $chan $+ < $+ $nick $+ > $1-
}
else {
echo @ChannelWatch $time([HH:nn:ss]) $chan < $+ $nick $+ > $1-
}
}
}
/*Echoes all ACTIONs (/me) originating from a Watched channel (%ChannelWatch.chans) to @ChannelWatch.
Prepends that text with the originating time, channel, and nick.
If colours are enabled it colours the time and channel to match their colour in the listbox
--the colour is applied to the foreground, the background is black
--doesn't colour anything if the colour is less than 3 (for contrast purposes)
Formats the nick and message into the standard purple *Joe does this
*/
on *:ACTION:*:%ChannelWatch.chans:{
if ($window(@ChannelWatch) == @ChannelWatch) {
if (($line(@ChannelWatch,$sline(@ChannelWatch,1).ln,1).color > 2) && (%ChannelWatch.colors)) {
echo 6 @ChannelWatch $+ $line(@ChannelWatch,$fline(@ChannelWatch,$chan,1,1),1).color $+ ,1 $+ $time([HH:nn:ss]) $chan $+ * $+ $nick $1-
}
else { echo 6 @ChannelWatch $time([HH:nn:ss]) $chan * $+ $nick $1- }
}
}
/*Echoes all CHANNEL notices originating from a Watched channel (%ChannelWatch.chans) to @ChannelWatch.
Prepends that text with the originating time, channel, and nick.
If colours are enabled it colours the time and channel to match their colour in the listbox
--the colour is applied to the foreground, the background is black
--doesn't colour anything if the colour is less than 3 (for contrast purposes)
Formats the nick and message into the standard maroon
*/
;FIX ME vv FIX ME vv FIX ME vv FIX ME vv FIX ME vv FIX ME vv FIX ME vv FIX ME vv FIX ME
;on *:NOTICE:*:%ChannelWatch.chans:{
; if ($window(@ChannelWatch) == @ChannelWatch) {
; if (($fline(@ChannelWatch,$chan,1,1) <= 13) && (%ChannelWatch.colors)) {
; echo 5 @ChannelWatch $+ $line(@ChannelWatch,$fline(@ChannelWatch,$chan,1,1),1).color $+ ,1 $+ $time([HH:nn:ss]) $chan $+ < $+ $nick $+ > $1-
; }
; else { echo 5 @ChannelWatch $time([HH:nn:ss]) $chan < $+ $nick $+ > $1- }
; }
;}
;FIX ME ^^ FIX ME ^^ FIX ME ^^ FIX ME ^^ FIX ME ^^ FIX ME ^^ FIX ME ^^ FIX ME ^^ FIX ME
/*Echoes user's input when entered into a Watched channel (%ChannelWatch.chans)
--If /me: echoes the action properly formatted into @ChannelWatch
----Format is: Time Channel *Me does something
----Time & Channel coloured to match channel's colour in nicklist (foreground, bkg is blank)
----*Me does something <<standard purple
--Leaves all input to mIRC's processes if first character is == / (is a command) and isn't /me
Everything else (standard text for chatting) is echoed to @ChannelWatch
Prepends echoed text with the originating time, channel, and nick (user's)
If colours are enabled it colours the time and channel to match their colour in the listbox
--The colour is applied to the foreground, the background is blank
--Doesn't colour anything if the colour is less than 3 (for contrast purposes)
*/
on *:INPUT:%ChannelWatch.chans:{
if ($1 == /me) { echo 6 @ChannelWatch $time([HH:nn:ss]) $chan * $+ $nick $1- }
elseif (($left($1,1) != /) && ($window(@ChannelWatch) == @ChannelWatch)) {
if (($line(@ChannelWatch,$sline(@ChannelWatch,1).ln,1).color > 2) && (%ChannelWatch.colors)) {
echo @ChannelWatch $+ $line(@ChannelWatch,$fline(@ChannelWatch,$chan,1,1),1).color $+ $time([HH:nn:ss]) $chan $+ < $+ $nick $+ > $1-
}
else { echo @ChannelWatch $time([HH:nn:ss]) $chan < $+ $nick $+ > $1- }
}
}
/*For all input when entered into @ChannelWatch:
-Returns an error if /me is attempted to be executed from within @ChannelWatch
-Leaves all input to mIRC's processes if first character is == / (is a command)
-Sends everything else (standard text) to the channel selected in the listbox via /msg
echoes that text into @ChannelWatch
Prepends echoed text with the time, selected channel, and nick (user's)
If colours are enabled it colours the time and channel to match their colour in the listbox
--The colour is applied to the foreground, the background is blank
--Doesn't colour anything if the colour is less than 3 (for contrast purposes)
*/
on *:INPUT:@ChannelWatch:{
;The /me error
if ($1 == /me) { echo 4 @ChannelWatch ***ERROR: CAN NOT EXECUTE AN ACTION COMMAND FROM A NON CHANNEL WINDOW*** }
;Filter out commands
elseif ($left($1,1) != /) {
;No channel selected error
if ($sline(@ChannelWatch,1) == $null) { echo 4 @ChannelWatch ***ERROR: You must select a channel the from listbox before sending a message. }
else {
;Send the message to the selected channel
msg $sline(@ChannelWatch,1) $1-
;Echo the msg coloured if the colour > 2 into @ChannelWatch
if (($line(@ChannelWatch,$sline(@ChannelWatch,1).ln,1).color > 2) && (%ChannelWatch.colors)) {
echo @ChannelWatch $+ $line(@ChannelWatch,$sline(@ChannelWatch,1).ln,1).color $+ $time([HH:nn:ss]) $sline(@ChannelWatch,1) $+ < $+ $nick $+ > $1-
}
;Echo the message into @ChannelWatch if previous statement fails (colour <= 2)
else { echo @ChannelWatch $time([HH:nn:ss]) $sline(@ChannelWatch,1) < $+ $me $+ > $1- }
}
}
}
#ChannelWatch.T/A/N/I end