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.

string map

Old posts that have not been replied to for several years.
Locked
N
Nexus6
Op
Posts: 114
Joined: Mon Sep 02, 2002 4:41 am
Location: Tuchola, Poland

string map

Post by Nexus6 »

It actually works, I want it to ignore users whose nicknames are the same as ident. It works as long as user has enbled ident, when ident is disabled "~" is placed in a front of it and it doesn't work. I thought string map {~ ""} $user would fix it but it doesn't. Example when, nickname!nickname@host joins bots does nothing, and it should do nothing when nickname!~nickname@host as well. I don't know if string map {~ ""} is correct. I also wonder how could I make bot also do nothing if some part of nick is in ident, exmple
nickname!nicknam@host
...
# it gets IRC ident
set user [lindex [split $uhost "@"] 0]
# if ~ is in ident it should be removed
string map {~ ""} $user
# checking is string is in nick and in ident
if {([string tolower $nick] == [string tolower $user]) || (![regexp "^\[a-zA-Z~\]{[string length $user]}" $user])} { return 0 }
foreach rnn $randomnicks {
if {([string match $rnn $nick]) || ([string match $rnn $user])} {
...

Thanks for any help
User avatar
stdragon
Owner
Posts: 959
Joined: Sun Sep 23, 2001 8:00 pm
Contact:

Post by stdragon »

1. "string map" is fine, but you're not saving the return value (the modified string) so it's having no effect

2. You could matching $user* against nick
Locked