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.

script to auto-send WHO for channel sync after join

Requests for complete scripts or modifications/fixes for scripts you didn't write. Response not guaranteed, and no thread bumping!
Post Reply
3
3rdBAR
Voice
Posts: 15
Joined: Mon May 15, 2006 6:39 am

script to auto-send WHO for channel sync after join

Post by 3rdBAR »

I have a need for my bot to issue WHO <channel name> for each channel it joins upon connection. The bot is running through psyBNC and it often loses sync on a few channels after reconnecting. Whenever I issue .dump who #channel it always resyncs for the given channel. I'd like to make this automatic if possible.

I've searched the tcl archives as well as this forum for a small script that will do this but have not been able to find one. If someone can provide such a script I'd be gateful.

TIA
m
metroid
Owner
Posts: 771
Joined: Wed Jun 16, 2004 2:46 am

Post by metroid »

If you can run psybnc 24/7 then why not an eggdrop?
3
3rdBAR
Voice
Posts: 15
Joined: Mon May 15, 2006 6:39 am

Post by 3rdBAR »

MeTroiD wrote:If you can run psybnc 24/7 then why not an eggdrop?
Because it's a relay bot running locally and linked to other relay bots running on the same box. There is less lag of the relay echos that way.

Can you help with a script that will achieve the automatic WHO operations for my channels?
User avatar
De Kus
Revered One
Posts: 1361
Joined: Sun Dec 15, 2002 11:41 am
Location: Germany

Post by De Kus »

well, actually the bot already sends a WHO request on each join. All you can use is used some kind of timed WHO.

I myself found it usefull to use this script:

Code: Select all

bind rejn - "*" resync:s
bind time - "59 *" resync:t

proc resync:s {nick uhost hand chan} {
	if {[matchattr chanserv "|l" $chan] && ![info exists ::resync($chan)] || !$::resync($chan)} {
		set ::resync($chan) 1
		utimer 30 [list resync:reset $chan]
	}
	return 0
}

proc resync:t {min h d m y} {
	set timer 5
	foreach chan [channels] {
		if { ![info exists ::resync($chan)] || !$::resync($chan) } {
			set ::resync($chan) 1
			utimer $timer [list resync:reset $chan]
			incr timer 5
		}
	}
	return 0
}

proc resync:reset {chan} {
	resetchan $chan
	set ::resync($chan) 0
	return 0
}
you might not have a user named "chanserv", delete the matchattr in that case. It simply resets one channel each 5 secs every 1h and on rejoin of a netsplit. I made this not because I use psybnc, but because of masked hosts from hostserv which need nickserv auth :D.
De Kus
StarZ|De_Kus, De_Kus or DeKus on IRC
Copyright © 2005-2009 by De Kus - published under The MIT License
Love hurts, love strengthens...
3
3rdBAR
Voice
Posts: 15
Joined: Mon May 15, 2006 6:39 am

Post by 3rdBAR »

De Kus wrote:well, actually the bot already sends a WHO request on each join. All you can use is used some kind of timed WHO.

I myself found it usefull to use this script:

Code: Select all

blah
you might not have a user named "chanserv", delete the matchattr in that case. It simply resets one channel each 5 secs every 1h and on rejoin of a netsplit. I made this not because I use psybnc, but because of masked hosts from hostserv which need nickserv auth :D.
Thanks. I'll give it a try :D
3
3rdBAR
Voice
Posts: 15
Joined: Mon May 15, 2006 6:39 am

Post by 3rdBAR »

De Kus wrote:you might not have a user named "chanserv", delete the matchattr in that case. It simply resets one channel each 5 secs every 1h and on rejoin of a netsplit. I made this not because I use psybnc, but because of masked hosts from hostserv which need nickserv auth :D.
Hmm, I took out the 'matchattr chanserv' part and it loads fine but doesn't seem to be working. The bot is in 8 channels and all but 2 are showing "(pending)" status. That's the same kind of result I had before calling this script into play. Any ideas?
3
3rdBAR
Voice
Posts: 15
Joined: Mon May 15, 2006 6:39 am

Post by 3rdBAR »

Greetings scripting gurus,

I still haven't found a solution to my egg/psy issue :( I've tried a few things with the code that De Kus so kindly provided. I tried removing this part completely:

Code: Select all

[matchattr chanserv "|l" $chan] &&
which unfortunately made no difference.

I then added it back and tried changing the chanserv to a handle that actually exists and is in the bot's user record and is connected to the IRC network. That didn't work either. In case you're wondering, I always confirm the script changes and rehash after each test mod is added. But these changes never cause the channels showing 'pending' status to sync. The channels always return in the same state, either after a server change by the eggdrop or a disconnect/reconnect from the IRC server by psyBNC.

I DID have a bit of luck with simple server JOIN script lines in psyBNC, but loading the ones that work results in zombied processes on the shell. I'd really like to be able to somehow do a timed resync of all of my channels with a tcl running on the eggdrop. If there were only a script that would duplicate the effect of an on-connect and periodic .dump WHO #channel for each channel that the bot auto-joins, it would make things so much nicer. I've searched this forum and others as well as the web for an answer with no luck.

Does anyone have further ideas?

Thanks
Last edited by 3rdBAR on Thu May 18, 2006 1:45 pm, edited 1 time in total.
User avatar
De Kus
Revered One
Posts: 1361
Joined: Sun Dec 15, 2002 11:41 am
Location: Germany

Post by De Kus »

does a manual ".tcl resetchan #chan" solve current issues? Please check also raw logging of your bot.
De Kus
StarZ|De_Kus, De_Kus or DeKus on IRC
Copyright © 2005-2009 by De Kus - published under The MIT License
Love hurts, love strengthens...
3
3rdBAR
Voice
Posts: 15
Joined: Mon May 15, 2006 6:39 am

Post by 3rdBAR »

De Kus wrote:does a manual ".tcl resetchan #chan" solve current issues? Please check also raw logging of your bot.
Thanks for the response.

.tcl resetchan #chan renders a What? You need '.help', despite that unbind dcc n tcl *dcc:tcl is commented out in the conf file. I'm not sure why it doesn't work; I probably failed to set some other directive properly.

I checked raw log activity occurrence after issuing .jump (note: the psyBNC IP:port is the only server in the bot's server list). What I found is that raw 352 only appears for 2 channels out of my 8. This seems consistent with the failed sync matter in that these 2 channels are the ones that usually always sync properly, whereas the other 6 never seem to sync upon connect. Raw 353 returns for all 8 channels though. Would other information from the output be helpful? If I post the raw log data here I'll have to first do a search & replace for certain items. But please let me know if it would be helpful and I'll do it.
3
3rdBAR
Voice
Posts: 15
Joined: Mon May 15, 2006 6:39 am

Post by 3rdBAR »

One other observation from the raw data: Each WHO #channel sent automatically after connect is prefixed with [!m]... whereas when I manually issue .dump who #channel (which is always successful) the log shows my request prefixed with [!s]. Also, the 2 successful automatic WHO requests upon connect are prefixed with [m=>] with no channel indicated after this. But the correct sync data is returned for both respective channels in response to each [m=>] WHO
User avatar
De Kus
Revered One
Posts: 1361
Joined: Sun Dec 15, 2002 11:41 am
Location: Germany

Post by De Kus »

!s = server queue
!m = mode queue
guess what !h is :)
! is adding for queue, while -> is actually flushing.

About the .tcl thing... maybe you should read the stickings: http://forum.egghelp.org/viewtopic.php?t=10215
De Kus
StarZ|De_Kus, De_Kus or DeKus on IRC
Copyright © 2005-2009 by De Kus - published under The MIT License
Love hurts, love strengthens...
3
3rdBAR
Voice
Posts: 15
Joined: Mon May 15, 2006 6:39 am

Post by 3rdBAR »

De Kus wrote: About the .tcl thing... maybe you should read the stickings: http://forum.egghelp.org/viewtopic.php?t=10215
The instructions in the sticky you've cited are exactly what I'd done. To wit: I commented unbind dcc n tcl *dcc:tcl and unbind dcc n set *dcc:set, saved the file, and restarted the bot. I even did it again to make sure I didn't miss any of these simple steps, but experienced the same result . The result being that neither the .set nor the .tcl commands do anything except generate the response What? You need .help.

As for my request for correct scripting to resolve the sync issue, it's easy to see that for whatever reason this is a problem without a known solution. I can see that it may help tcl script experts to know exactly what the bot and the IRC server are doing (and not doing) before fashioning a script to remedy a problem. However, I was merely hoping that someone with good tcl experience would know exactly how to make a simple script that would send time-delayed WHO $chan requests for each active channel the bot has joined. Apparently it's not as easy as this.

Thanks anyway.
Post Reply