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 

recognize special characters in nicknames

 
Post new topic   Reply to topic    egghelp.org community Forum Index -> Script Requests
View previous topic :: View next topic  
Author Message
Arnold_X-P
Op


Joined: 30 Oct 2006
Posts: 166
Location: DALnet - Trinidad - Beni - Bolivia

PostPosted: Sat Feb 10, 2018 9:06 pm    Post subject: recognize special characters in nicknames Reply with quote

I was trying out this little tcl
to recognize special characters in nicknames works but does not recognize all the special variants in nicknames
example : [L|I|T|0] [-Nick-] {N}ick [-Nick-]

Code:
bind PUB o !op procname

proc procname {nick uhost hand chan text} {
  set target [string trim $text]
  if {[regexp -- {^[\x41-\x7D][-\d\x41-\x7D]*$} $target]} {
  if {$target == ""} {
  putserv "mode $chan +o $target"
  } else {
  putserv "PRIVMSG $chan :$nick It's not in $chan"
  }
} }

_________________
Very Happy thanks to that they help, that others learn Very Happy
Back to top
View user's profile Send private message Send e-mail Visit poster's website MSN Messenger
Arnold_X-P
Op


Joined: 30 Oct 2006
Posts: 166
Location: DALnet - Trinidad - Beni - Bolivia

PostPosted: Sat Feb 10, 2018 9:12 pm    Post subject: Re: recognize special characters in nicknames Reply with quote

Try to use the same resource but in the second example it did not work for me:
Code:
bind PUB o !op op

proc op {nick host hand chan text} {
global flagaccess
 if {![matchattr $hand $flagaccess $chan]} {
if {[regexp -- {^[\x41-\x7D][-\d\x41-\x7D]*$} $target]} {
  if {$target == ""} {
set target [lindex $text 0]
set target1 [lindex $text 1]
set target2 [lindex $text 2]
set target3 [lindex $text 3]
set target4 [lindex $text 4]
if {![botisop $chan]} {
puthelp "NOTICE $nick :I'm down I do not have @ in $chan"
}
if {$target == ""} {
 puthelp "MODE $chan +o $nick"
  }
 puthelp "MODE $chan +ooooo $target $target1 $target2 $target3 $target4"
 return 0
 }

error in partyline
[20:24:46] Tcl error [op]: list element in braces followed by "ick" instead of space
_________________
Very Happy thanks to that they help, that others learn Very Happy
Back to top
View user's profile Send private message Send e-mail Visit poster's website MSN Messenger
caesar
Ass Kicker


Joined: 14 Oct 2001
Posts: 3455
Location: Area 51

PostPosted: Fri Feb 16, 2018 3:23 am    Post subject: Reply with quote

What if the "text" contains only one name (or better said element)? What would you say it happens?

Don't know what that regexp is supposed to do but if $text has just one element (is a list of unknown number of elements at this time) then it will fail to grab index number 1, 2, 3 and obviously 4 thus failing with an error. My guess is that you didn't see it because of that regexp doing something and execution is halted there.

Safest option in my opinion would be a foreach loop over splitting that $text list cos it's not safe to trust your users input and based on how many of the "elements" need op, are on the channel and whatever other checks you want to add and then add them into another list that you just create then loop over it outside the first one to do the actual +o on each element you found in the first.

This has been discussed many times in the past so will let you figure out what code you actually need. Razz

If you try something and get stuck then I will help you out.
_________________
You may say anything about me, but at least don't misspell my name. xD
Back to top
View user's profile Send private message
Arnold_X-P
Op


Joined: 30 Oct 2006
Posts: 166
Location: DALnet - Trinidad - Beni - Bolivia

PostPosted: Fri Feb 23, 2018 3:51 pm    Post subject: Reply with quote

it works but not very well...
recognizes normal nicknames
but nicknames with special characters do not recognize them example : {N}ick

Code:
bind PUB o !topme op

proc op {nick host hand chan text} {
global flagaccess
  foreach user [split $text] {
if {![botisop $chan]} {
puthelp "NOTICE $nick :I'm down I do not have @ in $chan"
}
if {$user == ""} {
 puthelp "MODE $chan +o $user"
  }
 puthelp "MODE $chan +ooooo $user $user $user $user $user"
 return 0
 }

and error in partyline:

Code:
[15:47:40] Tcl error [op]: list element in braces followed by "ick" instead of space

_________________
Very Happy thanks to that they help, that others learn Very Happy
Back to top
View user's profile Send private message Send e-mail Visit poster's website MSN Messenger
Display posts from previous:   
Post new topic   Reply to topic    egghelp.org community Forum Index -> Script Requests 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