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 

doesnt set certain modes

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


Joined: 22 Mar 2015
Posts: 485

PostPosted: Fri Jul 31, 2020 7:35 am    Post subject: doesnt set certain modes Reply with quote

i was wondering why this sets like:

+k jhjhas
and like +o nick nick nick

but wont set like:

+l 22
+J 10

Code:

bind pubm - "#% +?*" pub:massmodez316
bind pubm - "#% -?*" pub:massmodez316

proc pub:massmodez316 {nick host hand chan text} {
       if {![matchattr [nick2hand $nick] o|o $chan] && ![isop $nick $chan] && ![ishalfop $nick $chan]} { return 0  }
        set modex [lindex [split $text] 0]
        set nickz [join [lrange [split $text] 1 end]]
        set nickz [string trim $nickz]
        if {[onchan [string trimleft [split $modex 0] "+-"] $chan]} { return 0 }
        if {![llength [split $nickz]]} {
                pushmode $chan $modex
                return 0
        }   else { foreach user [split $nickz] {
         pushmode $chan $modex $user
        }
}
       flushmode $chan
}

_________________
Coming together is a beginning, staying together is progress, working together is succes.
Back to top
View user's profile Send private message
CrazyCat
Owner


Joined: 13 Jan 2002
Posts: 564
Location: France

PostPosted: Fri Jul 31, 2020 8:22 am    Post subject: Reply with quote

Well, peharps do you play too much with list/string conversions...
And you call pushmode2, what is this procedure ?
finally, what is exactly doing
Code:
if {[onchan [string trimleft [split $modex 0] "+-"] $chan]} { return 0 }


Here is how I think your proc must be:
Code:
bind pubm - "#% +?*" pub:massmodez316
bind pubm - "#% -?*" pub:massmodez316

proc pub:massmodez316 {nick host hand chan text} {
   if {![matchattr [nick2hand $nick] o|o $chan] && ![isop $nick $chan] && ![ishalfop $nick $chan]} { return 0  }
   set modex [join [lindex [split $text] 0]]
   if { [llength [split $text]]==1 } {
      pushmode $chan $modex
   } else {
      foreach user [lrange [split $text] 1 end] {
         pushmode $chan $modex $user
      }
   }
    flushmode $chan
}

_________________
https://www.eggdrop.fr - French speaking IRC network
Back to top
View user's profile Send private message Visit poster's website
simo
Master


Joined: 22 Mar 2015
Posts: 485

PostPosted: Fri Jul 31, 2020 8:36 am    Post subject: Reply with quote

tnx for your reply crazycat
the : if {[onchan [string trimleft [split $modex 0] "+-"] $chan]} { return 0 }
is to check if the first parameter doesnt contain a nick wich is on channel
and the pushmode2 was a typo should be pushmode

i tried your code it works for +l 22 but not for like +J 10
_________________
Coming together is a beginning, staying together is progress, working together is succes.
Back to top
View user's profile Send private message
CrazyCat
Owner


Joined: 13 Jan 2002
Posts: 564
Location: France

PostPosted: Fri Jul 31, 2020 8:45 am    Post subject: Reply with quote

Ok, I was guessing something like that...
But $modex is just the mode, so don't complicate things:
Code:
if { [onchan [string map {+ "" - ""} $modex] $chan] } { return 0 }


simo wrote:
i tried your code it works for +l 22 but not for like +J 10

Does pushmode only accept RFC modes ? I'll have a look on that
_________________
https://www.eggdrop.fr - French speaking IRC network
Back to top
View user's profile Send private message Visit poster's website
simo
Master


Joined: 22 Mar 2015
Posts: 485

PostPosted: Fri Jul 31, 2020 8:52 am    Post subject: Reply with quote

yes thommey told me pushmode only excepts RFC modes
but even using the custom pushmode thommey wrote for me doesnt seem to take it so it must be something else
_________________
Coming together is a beginning, staying together is progress, working together is succes.
Back to top
View user's profile Send private message
CrazyCat
Owner


Joined: 13 Jan 2002
Posts: 564
Location: France

PostPosted: Fri Jul 31, 2020 8:55 am    Post subject: Reply with quote

I'm to lazzy to search, can you paste the custom pushmode you have plz ?
_________________
https://www.eggdrop.fr - French speaking IRC network
Back to top
View user's profile Send private message Visit poster's website
simo
Master


Joined: 22 Mar 2015
Posts: 485

PostPosted: Fri Jul 31, 2020 8:59 am    Post subject: Reply with quote

would there be a way to use without the pushmode to evade all these issues with RFC

like using user's massmode code:

Code:

proc massmode {chan mode arg} {
  scan $mode {%[-+]%[bov]} p m
  set j [llength $arg]
  set k [expr {${::modes-per-line}-1}]
  set out "";
for {set i 0} {$i<$j} {incr i} {
  set args [lrange $arg $i [incr i $k]]
  append out "MODE $chan $p[string repeat $m [llength $args]] [join
  $args]\n"
 }
   putnow $out
 }
 



http://forum.egghelp.org/viewtopic.php?t=7273&highlight=massmode
_________________
Coming together is a beginning, staying together is progress, working together is succes.
Back to top
View user's profile Send private message
caesar
Mint Rubber


Joined: 14 Oct 2001
Posts: 3651
Location: Mint Factory

PostPosted: Fri Jul 31, 2020 2:45 pm    Post subject: Reply with quote

Why do you bother with [matchattr [nick2hand $nick] o|o $chan] when:

1. you already got the user's account in the hand variable;
2. you should change the bind to bind pubm o|o directly and drop this part.

What issues you got with massmode? Apart it not seeing other flags apart than bov obviously? Smile
_________________
Once the game is over, the king and the pawn go back in the same box.
Back to top
View user's profile Send private message
simo
Master


Joined: 22 Mar 2015
Posts: 485

PostPosted: Fri Jul 31, 2020 3:52 pm    Post subject: Reply with quote

oh euhm yea true didnt see that part thnx caesar heh

also the thing is if we use bind pubm o|o
it wont recognize like chanops and chanhalfops

as some may not have the flag set on them and there is no need to if they are chanops halfops

what would be the proper way to check if flag o is set on a nick to give it access to this command while also allowing regular chanops halfops access as well
_________________
Coming together is a beginning, staying together is progress, working together is succes.
Back to top
View user's profile Send private message
simo
Master


Joined: 22 Mar 2015
Posts: 485

PostPosted: Sat Aug 01, 2020 10:41 am    Post subject: Reply with quote

would there be any other method to have this set any channel mode instead of being restricted ?

these are the available channel modes on the ircd :

Quote:

IXbegwkBEFHJLQWdfjlxACDGKMNOPRSTUVcimnprstuz

_________________
Coming together is a beginning, staying together is progress, working together is succes.
Back to top
View user's profile Send private message
CrazyCat
Owner


Joined: 13 Jan 2002
Posts: 564
Location: France

PostPosted: Sat Aug 01, 2020 11:47 am    Post subject: Reply with quote

Read what caesar said and your proc:
Code:
proc massmode {chan mode arg} {
  scan $mode {%[-+]%[bov]} p m
  set j [llength $arg]
  set k [expr {${::modes-per-line}-1}]
  set out "";
  for {set i 0} {$i<$j} {incr i} {
    set args [lrange $arg $i [incr i $k]]
    append out "MODE $chan $p[string repeat $m [llength $args]] [join $args]\n"
   }
   putnow $out
 }

It appears that "bov" are in the first line, so try correcting it using:
Code:
scan $mode {%[-+]%[IXbegwkBEFHJLQWdfjlxACDGKMNOPRSTUVcimnprstuz]} p m

_________________
https://www.eggdrop.fr - French speaking IRC network
Back to top
View user's profile Send private message Visit poster's website
simo
Master


Joined: 22 Mar 2015
Posts: 485

PostPosted: Sat Aug 01, 2020 1:35 pm    Post subject: Reply with quote

tnx crazycat i already figured that part but not sure how to use it with the code i posted
_________________
Coming together is a beginning, staying together is progress, working together is succes.
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