egghelp.org community Forum Index
[ egghelp.org home | forum home ]
egghelp.org community
Discussion of eggdrop bots, shell accounts and tcl scripts.
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Is this actual idle time in #channel or away duration?

 
Post new topic   Reply to topic    egghelp.org community Forum Index -> Scripting Help
View previous topic :: View next topic  
Author Message
roughnecks
Voice


Joined: 14 Sep 2008
Posts: 33
Location: Italy

PostPosted: Tue Apr 12, 2022 9:54 am    Post subject: Is this actual idle time in #channel or away duration? Reply with quote

I've got this script but am not sure how it works related to idle time checking.
Is it calculating the time you haven't send a single message to chan or the actual away duration?

Trying to explain what I mean:
I'm away at night. The next morning I chat on #chan1 where the bot isn't joined and the away automatically lifts (have a script on weechat that does it).
Then I go away away for another hour or so and, before I come back, someone calls me on #chan2, where the bot is joined.. At this point the script says I've been idle for 15hrs, i.e. from the night before, while I was chatting this morning and the away was unset and then reset. I'd expect the script to say I was idle only for an hour or so, when the second away was set this morning..

Here's the script:

Code:
# Fully Automated Away Detection by speechles
# Egghelp version v1.3 - tested and working.. yay!!
# Donate to slennox @ egghelp.org if you like this script!

# Fully automatic, you configure nothing.
# The script will decide based upon the length of the nicklist
# or the length of user input on which to scan with, it will
# use whichever is shorter which makes it faster, enjoy.

# MAKE SURE TO .chanset #yourchan +checkaway
# afterwards the script will function in #yourchan

# revision history
# v1.3 - added idle time duration to the away message reply
# v1.2 - now wont react if that nickname is away and
#        mentions their own nickname in channel. This prevents
#        public away messages, etc from making this script
#        spam channels.
# v1.1 - now fully automated, no more checklist
# v1.0 - scripted using checklist user sets in config.

# SCRIPT begins: there is no config this is 100% automatic.
# -------------

# initialize the global variables
variable checknick ""
variable checkchan ""

# flag to control behavior per channel
setudef flag checkaway

# bind to raw reply concerning away status of whois
bind RAW  -|-  301 checkaway

# bind to everything said in channel
bind pubm -|- * checkcriteria

# check which token to whois phrased from user input.
# if we have a match, discern which token to evaluate as nick
# and if they are indeed on the channel issue a whois request
proc checkcriteria {nick uhost hand chan text} {
   if {[lsearch -exact [channel info $chan] +checkaway] == -1} { return }
   set ::checkchan $chan
   set ::checknick ""
   set text [encoding convertto utf-8 $text]

   if {[llength [chanlist $chan]] < [llength [split $text]]} {
      foreach n [chanlist $chan] {
         if {[lsearch [split [string tolower $text]] [string tolower $n]] != -1} {
            if {[string equal [string length $n] [string length [lindex [split $text] [lsearch [split [string tolower $text]] [string tolower $n]]]]]} {
               set ::checknick $n
               break
            }
         }
      }
   } else {
      foreach n [split $text] {
         if {[lsearch [split [string tolower [join [chanlist $chan]]]] [string tolower $n]] != -1} {
            set ::checknick $n
            break
         }
      }
   }
   if {[string length $::checknick] && ![string equal $n $nick] && [onchan $::checknick $chan]} {
      putserv "WHOIS $::checknick"
   }
}

# interpret the whois request and make sure the nick requested matches
# the whois reply we are searching for. If the person is not away, a 301
# will not be sent, and the whois will be ignored as per requested.
proc checkaway {from key text} {
   if {![string match -nocase [lindex [split $text] 1] $::checknick]} { return }
   putserv "privmsg $::checkchan :[lindex [split $text] 1] is away: [string range [join [lrange [split $text] 2 end]] 1 end] \(idle: [duration [expr {[getchanidle $::checknick $::checkchan] * 60}]])"
   set ::checknick ""
}

putlog "Automated away detection Loaded"
Back to top
View user's profile Send private message
CrazyCat
Revered One


Joined: 13 Jan 2002
Posts: 1032
Location: France

PostPosted: Wed Apr 13, 2022 4:12 am    Post subject: Reply with quote

The eggdrop only sees your idle on the chan it's on (it uses getchanidle).

If you want a real back from away notifier, and if your ircd has ircv3 CAP, I've a small script to manage the away
_________________
https://www.eggdrop.fr - French IRC network
Offer me a coffee - Do not ask me help in PM, we are a community.
Back to top
View user's profile Send private message Visit poster's website
roughnecks
Voice


Joined: 14 Sep 2008
Posts: 33
Location: Italy

PostPosted: Wed Apr 13, 2022 7:03 am    Post subject: Reply with quote

CrazyCat wrote:
The eggdrop only sees your idle on the chan it's on (it uses getchanidle).


Ah, that's it then.

CrazyCat wrote:

If you want a real back from away notifier, and if your ircd has ircv3 CAP, I've a small script to manage the away


No, but thanks anyway.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    egghelp.org community Forum Index -> Scripting Help All times are GMT - 4 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Forum hosting provided by Reverse.net

Powered by phpBB © 2001, 2005 phpBB Group
subGreen style by ktauber