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.

public !resync command

Old posts that have not been replied to for several years.
Locked
L
LanEvo
Voice
Posts: 18
Joined: Sun May 30, 2004 11:17 pm

public !resync command

Post by LanEvo »

I'm trying to imitate the ChanServ command !resync

basically, it sets mode +o/v to the users that have the proper access, -o/v to the ones that don't, all at once

in my case, the peons all have +A flags.

the code (it's nub):

bind pub - "!resync" pub:resync
proc pub:resync {nick uhost hand chan ext} {
global botnick
foreach ext [chanlist $chan] {
if {[matchattr $ext A]} {
putquick "MODE $chan +v $ext"
} else {
putquick "MODE $chan -v $ext"
}
}
}

expectedly, the bot does this when i use the !resync command (3 users with +A are devoiced, one user with -A is voiced):

[12:17:am] * eggie sets mode: +v bot1
[12:17:am] * eggie sets mode: +v bot2
[12:17:am] * eggie sets mode: +v bot3
[12:17:am] * eggie sets mode: -v bot4

how would the proc go so that it does -v+vvv bot4 bot1 bot2 bot3 and the number of -v/+v corresponds with the numbers of users?
User avatar
awyeah
Revered One
Posts: 1580
Joined: Mon Apr 26, 2004 2:37 am
Location: Switzerland
Contact:

Re: public !resync command

Post by awyeah »

My best guess here would be use pushmode after which call flushmode so that the maximum number of mode changes are sent per line, normally 6.

Code: Select all

bind pub - "!resync" pub:resync

proc pub:resync {nick uhost hand chan ext} {
  foreach ext [chanlist $chan] {
   if {[matchattr $ext A]} {
    pushmode $chan +v $ext
   } else {
    pushmode $chan -v $ext
    }
  }
 flushmode $chan
}
·­awyeah·

==================================
Facebook: jawad@idsia.ch (Jay Dee)
PS: Guys, I don't accept script helps or requests personally anymore.
==================================
L
LanEvo
Voice
Posts: 18
Joined: Sun May 30, 2004 11:17 pm

Post by LanEvo »

great, it works for me. thanks for the help

but i guess it seems like the max number of mode changes per line is 4 and not 6, i guess that's how mirc works. someone suggested reading rfc1459 but it hurt my eyes.

i tested it out with 8 bots that have the necessary +A flag to be voiced, but are devoiced for now:

[3:11:pm] <LanEvo> !resync
[3:11:pm] * eggie sets mode: +vvvv bot1 bot2 bot3 bot4
[3:11:pm] * eggie sets mode: +vvvv bot5 bot6 bot7 bot8
User avatar
awyeah
Revered One
Posts: 1580
Joined: Mon Apr 26, 2004 2:37 am
Location: Switzerland
Contact:

Post by awyeah »

It depends upon your IRCd as well. As far as I know bahamut has maximum 6 mode changes per line for users as well as for IRC operators. However on netsplit rejoins I've seen the count go upto 8 or 9 mode changes per lines for servers.

And as for services, there can be many as you like, supposingly if you send raw text to services for changing channel modes.

See this in the .conf file:
### IRC MODULE - OTHER NETWORKS (net-type 5) ###

# Some networks allow you to stack lots of channel modes into one line.
# They're all guaranteed to support at least 3, so that's the default.
# If you know your network supports more, you may want to adjust this.
# This setting is limited to 6, although if you want to use a higher value,
# you can modify this by changing the value of MODES_PER_LINE_MAX in
# src/chan.h and recompiling the bot.
set modes-per-line 3
·­awyeah·

==================================
Facebook: jawad@idsia.ch (Jay Dee)
PS: Guys, I don't accept script helps or requests personally anymore.
==================================
L
LanEvo
Voice
Posts: 18
Joined: Sun May 30, 2004 11:17 pm

Post by LanEvo »

gotcha, seems like the max for the network i use (GameSurge) is 6:

-!- ANNOUNCE WHOX WALLCHOPS WALLVOICES USERIP CPRIVMSG CNOTICE SILENCE=15 MODES=6
MAXCHANNELS=20 MAXBANS=45 NICKLEN=30 MAXNICKLEN=30 are supported by this server
-!- TOPICLEN=300 AWAYLEN=200 KICKLEN=300 CHANTYPES=#& PREFIX=(ov)@+
CHANMODES=b,k,l,imnpstrDcC CASEMAPPING=rfc1459 NETWORK=GameSurge are supported by
this server

[3:31:pm] * eggie sets mode: +vvvvvv bot1 bot2 bot3 bot4 bot5 bot6
[3:31:pm] * eggie sets mode: +vv bot7 bot8

thanks for the help
Locked