This is the new home of the egghelp.org community forum.
All data has been migrated (including user logins/passwords) to a new phpBB version.


For more information, see this announcement post. Click the X in the top right-corner of this box to dismiss this message.

TCL Quit status notifier

Requests for complete scripts or modifications/fixes for scripts you didn't write. Response not guaranteed, and no thread bumping!
Post Reply
d
doni
Voice
Posts: 18
Joined: Tue Aug 21, 2018 4:13 am

TCL Quit status notifier

Post by doni »

Hi guys,
I am looking for tcl script to notify (with private msg to nick) quit events of certain people on channel.

I am following my friend az

Ex. on channel
* Quits: @az (az@slackware.com) (Ping Timeout)

Ex. in pvt

Egg > hi, doni. az quit right now. Reason: Ping Timeout

Someone help me?
Thanks a lot!
w
willyw
Revered One
Posts: 1203
Joined: Thu Jan 15, 2009 12:55 am

Re: TCL Quit status notifier

Post by willyw »

Experiment with this.

You will have to edit three lines.

Code: Select all


# August 21, 2018

#  #http://forum.egghelp.org/viewtopic.php?t=20495

# I am looking for tcl script to notify (with private msg to nick) quit events of certain people on channel.
#
# I am following my friend az
#
# Ex. on channel
# * Quits: @az (az@slackware.com) (Ping Timeout)
#
# Ex. in pvt
#
# Egg > hi, doni. az quit right now. Reason: Ping Timeout

###########################################


# set the list of nicks to watch for quits
set nicks2watch "foo moo who"

# set the nick to notify via pm
set pm_nick "your_nick"

# set the channel to watch
bind sign - "#temptest *" do_quit_notify


#####
proc do_quit_notify {nick uhost handle chan reason} {
global nicks2watch pm_nick

        if {[lsearch -nocase [split $nicks2watch] [split $nick] ] != -1 } {
                putserv "privmsg $pm_nick :Hi $pm_nick. $nick quit right now. Reason: $reason"
        }
}
####


Only tested twice. Worked for me. :)

I hope this helps.
For a fun (and popular) Trivia game, visit us at: irc.librairc.net #science-fiction . Over 300K Q & A to play in BogusTrivia !
d
doni
Voice
Posts: 18
Joined: Tue Aug 21, 2018 4:13 am

Re: TCL Quit status notifier

Post by doni »

[08:48] Tcl error [do_quit_notify]: bad search mode "-nocase": must be -exact, - glob, or -regexp

i am using -exact and it's work! what are the differences between exact, glob or regexp?

"#temptest *" --> why *?
THANKS!
w
willyw
Revered One
Posts: 1203
Joined: Thu Jan 15, 2009 12:55 am

Re: TCL Quit status notifier

Post by willyw »

doni wrote: ...
[08:48] Tcl error [do_quit_notify]: bad search mode "-nocase": must be -exact, - glob, or -regexp

i am using -exact and it's work! what are the differences between exact, glob or regexp?
The main page for TCL commands is:
http://www.tcl.tk/man/tcl8.6/TclCmd/contents.htm

Once there, you can find the lsearch command:
http://www.tcl.tk/man/tcl8.6/TclCmd/lsearch.htm

and all those things are explained there.

I don't even try to remember all that stuff - I just remember (I have it bookmarked) where and how to look it up when I need it. ;)

"#temptest *" --> why *?
For this one, go here:
http://docs.eggheads.org/mainDocs/tcl-commands.html
and text search or scroll down to:
bind sign
and see this in context:
".... Wildcards can be used in the mask, which is matched against '#channel nick!user@host'. "

In other words, I put an asterisk there so that the bind would trigger on every quit. I thought that was what you wanted / needed.
If you WANT to limit it to triggering only on certain hostmasks, you can do it right there. Up to you. Hack at it. Experiment. Have fun. :)

Tip: When editing bind lines, a simple .rehash is often not sufficient. You may get unexpected results. While there are other ways to handle it, the simple, easiest way is: When editing bind lines, do a .restart to effect the change.
If you really want more explanation on why, say so and we'll go over it.
:)


As for why you got that error ... about the -nocase switch I used with the lsearch command - I wonder what version of TCL you have.
I wonder if it is somehow a very old version....

In partyline, do: .status
and the version of TCL will be on one of the lines in the report returned.

I hope this helped.
For a fun (and popular) Trivia game, visit us at: irc.librairc.net #science-fiction . Over 300K Q & A to play in BogusTrivia !
User avatar
Ezekiel
Voice
Posts: 21
Joined: Tue Dec 16, 2014 8:05 am

Post by Ezekiel »

it seems you use an older TCL version, try replacing the line:
if {[lsearch -nocase [split $nicks2watch] [split $nick] ] != -1 } {
with this one:
if {[lsearch [string tolower [split $nicks2watch]] [string tolower [split $nick]] ] != -1 } {
Last edited by Ezekiel on Thu Aug 23, 2018 12:57 am, edited 1 time in total.
http://tclscripts.net - home of BlackTools.tcl the most complete channel management script who can manage channels from all the IRC networks.
User avatar
caesar
Mint Rubber
Posts: 3778
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

The -nocase argument was introduced in version 8.5, so most likely he's using 8.4 (if not lower).

doni you should consider upgrading the TCL library because everyone tends to use stuff that can be found in newer versions of the library.
Once the game is over, the king and the pawn go back in the same box.
w
willyw
Revered One
Posts: 1203
Joined: Thu Jan 15, 2009 12:55 am

Post by willyw »

caesar wrote:The -nocase argument was introduced in version 8.5, so most likely he's using 8.4 (if not lower).
I was unsure of this, and didn't take time to go try to look it up. Thank you.

As a matter of fact, it is easy to lose track of time ... I don't remember how long ago it has been when version 8.4 was typical. Time flies - it's getting to be a while now.

doni : What Ezekiel said, is what I would do too.

You can read about what the command that he uses does, here:
http://www.tcl.tk/man/tcl8.6/TclCmd/string.htm#M44
For a fun (and popular) Trivia game, visit us at: irc.librairc.net #science-fiction . Over 300K Q & A to play in BogusTrivia !
d
doni
Voice
Posts: 18
Joined: Tue Aug 21, 2018 4:13 am

Post by doni »

Guys, You are amazing!!! Thanks a lot!!!
Just last question...

In the same TCL:
- how can i set for multiple users in the same tcl?
ex. az want check quits of some nicks in #ipv6 channel
john want check quits of different nicks in #tcl channel

- like quit, how can eggdrop catch full NOTICES from channel to send (paste) to user?

ex. on channel:
[Notice] john : hi guys, whatsup?

ex. in pvt or channel
Egg > john : hi guys, whatsup?

Thanks <3
w
willyw
Revered One
Posts: 1203
Joined: Thu Jan 15, 2009 12:55 am

Post by willyw »

doni wrote:Guys, You are amazing!!! Thanks a lot!!!
You're welcome.
Just last question...

In the same TCL:
- how can i set for multiple users in the same tcl?
ex. az want check quits of some nicks in #ipv6 channel
john want check quits of different nicks in #tcl channel
You said "multiple users", yet your examples are ALSO multi-channel. :)

Either one of those complicates it.

I'd have to think about it a while, before deciding just how it would be best to go about it.

I'm not sure at all if or when I'll get to it. Perhaps somebody else here will want to jump in.

If they do - even if I do - don't expect it to be a simple couple lines of code to modify what you have now. It will most likely be all new.
- like quit, how can eggdrop catch full NOTICES from channel to send (paste) to user?
You'd just asked for "to user". That's singular. Are you going to later ask for it to be multi-user? :)
ex. on channel:
[Notice] john : hi guys, whatsup?

ex. in pvt or channel
Egg > john : hi guys, whatsup?


I don't get it. Perhaps that is because I get notices in channel, in my client. But why would you want to repeat what was just said, just using a different method? Especially why would you want to take what was said in a notice, and repeat it in the open channel?
There must be something that I'm not understanding....
For a fun (and popular) Trivia game, visit us at: irc.librairc.net #science-fiction . Over 300K Q & A to play in BogusTrivia !
d
doni
Voice
Posts: 18
Joined: Tue Aug 21, 2018 4:13 am

Post by doni »

ex. on channel:
[Notice] john : hi guys, whatsup?

ex. in pvt or channel
Egg > john : hi guys, whatsup?
I don't get it. Perhaps that is because I get notices in channel, in my client. But why would you want to repeat what was just said, just using a different method? Especially why would you want to take what was said in a notice, and repeat it in the open channel?
There must be something that I'm not understanding....
I need to catch from channel &SERVERS notices of join and leave of irc servers (netsplit) and paste it in another channel as text message
d
doni
Voice
Posts: 18
Joined: Tue Aug 21, 2018 4:13 am

Re: TCL Quit status notifier

Post by doni »

Hi, how can i show full mask after $nick in privmsg?

Code: Select all

"privmsg $pm_nick :Hi $pm_nick. $nick quit right now. Reason: $reason"
ex. Hi John. Mario!ident@host.com quit right now etc..

Thankyou
w
willyw
Revered One
Posts: 1203
Joined: Thu Jan 15, 2009 12:55 am

Re: TCL Quit status notifier

Post by willyw »

doni wrote: ...
Hi, how can i show full mask after $nick in privmsg?

Code: Select all

"privmsg $pm_nick :Hi $pm_nick. $nick quit right now. Reason: $reason"
ex. Hi John. Mario!ident@host.com quit right now etc..
...

Code: Select all

  putserv "privmsg $pm_nick :Hi $pm_nick. $nick $uhost quit right now. Reason: $reason" 
Reference: http://docs.eggheads.org/mainDocs/tcl-commands.html
and text search to find: bind sign
For a fun (and popular) Trivia game, visit us at: irc.librairc.net #science-fiction . Over 300K Q & A to play in BogusTrivia !
d
doni
Voice
Posts: 18
Joined: Tue Aug 21, 2018 4:13 am

Re: TCL Quit status notifier

Post by doni »

Code: Select all

  putserv "privmsg $pm_nick :Hi $pm_nick. $nick $uhost quit right now. Reason: $reason" 
Reference: http://docs.eggheads.org/mainDocs/tcl-commands.html
and text search to find: bind sign
Thanks
d
doni
Voice
Posts: 18
Joined: Tue Aug 21, 2018 4:13 am

add JOIN watch notify

Post by doni »

Hi guys, thanks for help. One last thing. How can i add JOIN notify in same TCL? So, QUIT and JOIN Notify in one TCL.

Thanks in advance!
w
willyw
Revered One
Posts: 1203
Joined: Thu Jan 15, 2009 12:55 am

Re: add JOIN watch notify

Post by willyw »

doni wrote:Hi guys, thanks for help. One last thing. How can i add JOIN notify in same TCL? So, QUIT and JOIN Notify in one TCL.

Code: Select all

	


# August 21, 2018

#  #http://forum.egghelp.org/viewtopic.php?t=20495

# I am looking for tcl script to notify (with private msg to nick) quit events of certain people on channel.
#
# I am following my friend az
#
# Ex. on channel
# * Quits: @az (az@slackware.com) (Ping Timeout)
#
# Ex. in pvt
#
# Egg > hi, doni. az quit right now. Reason: Ping Timeout

###########################################


# set the list of nicks to watch for quits
set nicks2watch "foo moo who"

# set the nick to notify via pm
set pm_nick "your_nick"

# set the channel to watch
bind sign - "#temptest *" do_quit_notify


#####
proc do_quit_notify {nick uhost handle chan reason} {
global nicks2watch pm_nick

        if {[lsearch -nocase [split $nicks2watch] [split $nick] ] != -1 } {
                putserv "privmsg $pm_nick :Hi $pm_nick. $nick quit right now. Reason: $reason"
        }
}
####

###
###  August 25, 2019
# One last thing. How can i add JOIN notify in same TCL? So, QUIT and JOIN # Notify in one TCL. 


bind join - "* *" do_join_notify

proc do_join_notify {nick uhost handle chan} {
global nicks2watch pm_nick

   if {[lsearch [string tolower [split $nicks2watch]] [string tolower [split $nick]] ] != -1 } {

     putserv "privmsg $pm_nick :Hi $pm_nick. $nick joined $chan . [strftime %c]"
        }

}
###
###
For a fun (and popular) Trivia game, visit us at: irc.librairc.net #science-fiction . Over 300K Q & A to play in BogusTrivia !
Post Reply