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.

Displaying the number of users on channels, in a webpage.

Requests for complete scripts or modifications/fixes for scripts you didn't write. Response not guaranteed, and no thread bumping!
w
willyw
Revered One
Posts: 1205
Joined: Thu Jan 15, 2009 12:55 am

Post by willyw »

caesar wrote:
if {"$nick" == "$botnick"} {
you should use the 'isbonick' function instead, or at least either 'string tolower' both variables
Right you are.
Thank you for catching this and pointing it out.

I've done this in the past, and it bit me in the butt, and I had to come back and I used string tolower to cover it.
(I must have a mental block... since I should know better now..sigh)

Question:
Does isbotnick take care of differences in case automatically?
I never thought to use isbotnick.....
...
Here's my version of the code to exclude from the list:

Code: Select all


bind time - "* * * * *" time:webusers

# Path to save text files.
set webusers(file) "you/need/to/edit/this/path/web_users.txt"
set webusers(count_file) "you/need/to/edit/this/path/web_users_count.txt" 
set webusers(exclude) "bot1 bot2 bot3 user1 user2" 
[/quote]

I think though, that he is looking for a way for the determination to happen automatically.... without having to maintain a list of nicks manually.

[quote]
proc cron:webusers {min hour day month year} {

[/quote]

The bind time above calls
 [b]time[/b]:webusers

Typo ?

....

[quote]
Eventually, instead of
[code]
[lsearch -nocase $webusers(exclude) $nick] == -1
you could use:

Code: Select all

[matchattr [nick2hand $nick] bf #AirfixDogfighter]
to exclude all users that have the b or f flag, or whatever you wish for that specific channel or some global flags.
This is another form of a list that he'd have to maintain though.


I think that he owns the IRC server too, and requires all bots to set some mode on themselves... is it +B ? ....
such that a /whois has a line like this in it:
Durga is a bot on irc.icq.com
We could do something where his bot sends a whois to each nick in the channel, and have a raw bind that traps for whatever numeric corresponds to that line.

If by now you are thinking that it is far easier (if the list is short and doesn't change very often) to maintain a simple list manually - I agree.

That doesn't mean that making it work automatically wouldn't be a fun project, just the for the heck of it. :)
r
rayvtirx
Voice
Posts: 16
Joined: Mon May 31, 2010 9:35 am
Location: bristol,england
Contact:

Post by rayvtirx »

doh!
i see, botnick is the nick of the bot this script is running on
oops :oops: lol
its true all bots have to set +B but a whois every minute on every nick (although not a problem now) could cause problems if it ever got busy
ive gone back to the one you wrote its working great thanks
User avatar
caesar
Mint Rubber
Posts: 3778
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

Ah, damn typo. Was going to redo the code using cron instead of time, but changed my mind and forgot about changing there too. :)

I think 'isbotnick' function either dose the lowercase transformation before comparing (honestly doubt it's this method) or ignores it completely by using 'string equal -nocase' would be one of the ways to do it (I bet my money on this one).

Now, about that +B thing, well, it's easy as you said. All you need is a raw bind for that 'Durga is a bot on irc.icq.com' notice and add the host to a exclude list, either plain file or in the bot's internal userlist.

What happens if you would do a '/who #channel' Doesn't that 'B' flag show up or something?
Once the game is over, the king and the pawn go back in the same box.
w
willyw
Revered One
Posts: 1205
Joined: Thu Jan 15, 2009 12:55 am

Post by willyw »

caesar wrote: ...
What happens if you would do a '/who #channel' Doesn't that 'B' flag show up or something?
If this question was directed to me, ... Sorry, I don't know.
rayvtirx would have to try it and let you know.

But I think that flag is a mode flag set on each individual user, not a channel mode flag.
n
nml375
Revered One
Posts: 2860
Joined: Fri Aug 04, 2006 2:09 pm

Post by nml375 »

Just a comment regarding "isbotnick" vs "string equal";
isbotnick uses the _rfc_casecmp(const char *, const char *) c function, which honors RFC1459 extended character sets, such as { and [ are the same character in upper/lowercase. String equal does not honor such mappings, regardless of the -nocase option.
NML_375
Post Reply