vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 2.x Full Releases (https://vborg.vbsupport.ru/forumdisplay.php?f=4)
-   -   Users in Chat -with eggdrop, works no matter what- (https://vborg.vbsupport.ru/showthread.php?t=40855)

Banana 02-15-2003 11:34 PM

Quote:

Originally posted by pjgoncalves
Hi!

i'm getting this 2 errors when i do the rehash:

Code:

TCL error in script for 'timer11':
can't read "count": no such variable

any idea how to solve this? :)

I get the same thing :(

Banana 02-16-2003 01:05 PM

OK got this working now. Trick is to use the userchatting.tcl from the second .zip file attached to this thread and make this change (also from elsewhere in the thread):

Find:
Code:

bind join - "$i2h_chan %" i2h:make
bind part - "$i2h_chan %" i2h:make

and ADD BELOW
Code:

bind sign - "$i2h_chan %" i2h:make
bind topc - "$i2h_chan %" i2h:make
bind kick - "$i2h_chan %" i2h:make
bind nick - "$i2h_chan %" i2h:make
bind rejn - "$i2h_chan %" i2h:make

I installed eggdrop on my server and got it to dump the txt file of users in the forums directory so the changes to index.php are

replace:
Code:

eval("dooutput(\"".gettemplate('forumhome')."\");");
with:
Code:

if(file_exists('<homedir>/www/forums/chatuserlist.txt'))
{
        $openfile = fopen ("<homedir>/www/forums/chatuserlist.txt", "r");
        while (!feof($openfile))
        {
                $chatters .= fgets($openfile, 4096);
        }
        fclose($openfile);
}

eval("dooutput(\"".gettemplate('forumhome')."\");");

In the forumhome template I simply added this
Code:

<smallfont>
<b>Chatroom Users: $chatters</b>
</smallfont>
<br>

Simple! Now I'm gonna try and remove the bot from my list of chatters.....

Twin-x 02-25-2003 10:04 AM

The above only is valid if yuo have your eggdrop running on the same server as you host the forum.

Axe 03-19-2003 10:30 PM

If you actually own the IRC server, or have access to add servers to the IRC network (as opposed to just having a channel on somebody's network), it might be worth looking into Thales.

I've been using it on our site for a couple of months now. It basically hooks up to the network, and for all intents & purposes, it's just another IRC server on the network, like Bahamut or IRC services.

The only difference is that it doesn't accept users. It stores live data regarding all the channels & users in a MySQL database, then you can just use standard queries to call the information.

If you don't have access to add servers, perhaps you could contact the people who do run the network and see if they want to install it and make some kind of web-based API so you can grab information and parse it out in your own scripts (something I've done with Thales so users who run channels on my server can call the live information regarding their channel and publish it on their own sites).

Here's a live example of it running.

http://chat.reptilerap.com <-- The URL of the main chat site, scripts directly querying the database.

ReptileRooms.com Chat Page <-- URL of an external site that has no access to the database, yet manages to show the channel information through the web-based API I wrote.

I can't remember the URL off-hand, but just go to google and search for "Thales IRC" and it'll come up on the first page of results :)

noppid 04-02-2003 06:33 PM

Nice hack! The TCL works great. We added a timer as well and the updates work great, thanks.

We do however have webspace on the same server we run our eggdrop bot and were able to avoid using the FTP method. The eggdrop bot server and the Forums Server are different locations though and we get to the file created by the eggdrop's userschatting.TCL script like this...

The TCL script is in /home/username/eggdrop/scripts
The web space is at /var/www/html/
We created /var/www/html/ircstats
then we linked to /home/username/eggdrop/scripts/userlist.txt

To link the files in linux(we did it as root)...
link /home/username/eggdrop/scripts/userlist.txt /var/www/html/ircstats/userlist.txt
The second file is created by the link command and should not exist.

Now whenever the bot updates the main file, the linked file will reflect the changes to be accessable to the web via HTTP.

This is the code we used in the index.php file to fetch the userslist.txt when a user accesses index.php, the forumhome.
PHP Code:

// Begin Joey irc hack ############################################################
    
$openfile = @fopen ("http://your.server.com/ircstats/userlist.txt""r");

    if (
$openfile ) {
        while (!
feof($openfile)) {
        
$buffer .= fgets($openfile4096);
        }

        
$chatterson str_replace("%20"", "$buffer);
        
fclose($openfile);
    }
    else {
        
$chatterson "<center>Sorry, Statistis are offline, please logon for more information.
<br>Server: support.irclive.com | Port: 6667 | Channel: #vbcustom</center>"
;        
         }    
// END Joey irc hack ################################################################## 

Hope it helps someone.

noppid 04-02-2003 10:46 PM

While reading the thread a few things came up that we would like to share. Here are our TCL modifications to Joey's great irc hack.

1) Putting the "No matter what" back in to the title, a Timer.
This method allows the script to wait for the user to exit before compiling the stats. No more two users have to exit to decrement the count. Plus since the userslist.txt is updated within 5 seconds of any bound event, there is no need for a constantly running timer. The file updates only when necessary.

2) Remove the bot from the list and the count.
Done! If that's what ya want, it's in here.

Thanks again to Joey for Excellent code to work with!

Although this is TCL, I'm gonna tag it php.

PHP Code:

# joey's irc hack userschatting.tcl
#
# modified to remove the bot's name and count.
# modified to Run "No matter what" and be up to
# date in 5 seconds of an event that is bound.

# Set the bots name here. (noppid) 
set i2h_botname "PitBoss"

set i2h_htmlfile "/home/username/eggdrop/scripts/userlist.txt" 
set i2h_chan "#vbcustom"
set i2h_text "#000000"

# all modified to i2h:make2, our new proc (noppid)
bind join "$i2h_chan %" i2h:make2
bind part 
"$i2h_chan %" i2h:make2
bind sign 
"$i2h_chan %" i2h:make2
bind topc 
"$i2h_chan %" i2h:make2
bind kick 
"$i2h_chan %" i2h:make2
bind nick 
"$i2h_chan %" i2h:make2
bind rejn 
"$i2h_chan %" i2h:make2

# set timer to wait 5 seconds before update on above events 
# This allows the exiting updates to be correct and not
# have to have a timer constantly running (noppid)
proc i2h:make2 {args} {
  
# set timer to wait 5 seconds before running the stats proc (noppid)
  
utimer 5 i2h:make
  
return 1
}

proc i2h:make {args} {
  global 
i2h_htmlfile i2h_chan i2h_text server i2h_botname
  set i2h_file 
[open $i2h_htmlfile w]
  
puts $i2h_file "<b>Topic</b>: $i2h_chan \[[lindex [getchanmode $i2h_chan] 0]\]: '[i2h:convert [topic $i2h_chan]]'<br>"
  
puts $i2h_file "<b>Server</b>: [string range $server 0 [expr [string last ":$server] - 1]]<br>\n"
  
  
set users ""
  
set online [chanlist $i2h_chan]
  
set count [llength $online]
  
set users [lindex $online 0]

  for {
set i 0} {$i $count} {incr i 1} {
     
set user [lindex $online $i]
     
set users "$users%20$user"
  
}
  
  
# decrement user count, don't count the bot (noppid)
  
set count [expr $count 1]
  
# Sometimes the names appear with %20, remove the bot name (noppid)
  
regsub -all "$i2h_botname%20" $users "" users 
  
# Sometimes the botname is in the array without a %20, remove those if present (noppid)
  
regsub -all $i2h_botname $users "" users    
  
  
# Simplified the user count to a singel var (noppid)
  
puts $i2h_file "<b>Users</b> \[$count\]: $users<br>\n"
  
close $i2h_file
  
return 1
}

proc i2h:convert {i2h_text} {
  
#Strip control codes.. sorta
  
regsub -all $i2h_text "" i2h_text
  regsub 
-all $i2h_text "" i2h_text
  regsub 
-all $i2h_text "" i2h_text
  regsub 
-all $i2h_text "" i2h_text
  regsub 
-all $i2h_text "" i2h_text
  
#Convert special chars
  
regsub -all $i2h_text "\\&amp;" i2h_text
  regsub 
-all \$i2h_text "\\&quot;" i2h_text
  regsub -all < 
$i2h_text "\\&lt;" i2h_text
  regsub -all > 
$i2h_text "\\&gt;" i2h_text
  regsub -all "  " 
$i2h_text " \\&nbsp;" i2h_text
  return 
$i2h_text
}

set i2h_file [open 
$i2h_htmlfile w]
puts 
$i2h_file "<b>Topic</b>: $i2h_chan \[\]: ''<br>"
puts 
$i2h_file "<b>Server</b>: unknown<br>"
puts 
$i2h_file "<b>Users</b>: unknown<br>\n"
close 
$i2h_file

utimer 3 i2h:make

putlog "
SaS IRC nick list loaded.

Follow the homepage link in my profile to see it in action.

Regards

bloodcult 05-04-2003 02:50 PM

hi there,

i try all files and stuff in this Thread, but nothing would work....

ok, here is what i have, make and what comes out:

What i have:
eggdrop v1.6.13, on Linux 2.4.19-4GB

What i make:
put the tcl in scripts dir, bind it in config, make rehash/restart and it comes --->

with orginal script... the count problem, with modified orginalscript (like the postings here)


(17:38:04) (Bloodcult) [16:37] SaS IRC nick list loaded.
(17:38:04) (Bloodcult) [16:37] Userfile loaded, unpacking...
(17:38:15) (Bloodcult) [16:38] Tcl error in script for 'timer3':
(17:38:15) (Bloodcult) [16:38] wrong # args: should be "auth hand idx args"


with the tcl from noppid:


(17:33:13) (Bloodcult) [16:32] SaS IRC nick list loaded.
(17:33:13) (Bloodcult) [16:32] Userfile loaded, unpacking...
(17:33:14) (Bloodcult) [16:33] Tcl error in script for 'timer6':
(17:33:14) (Bloodcult) [16:33] wrong # args: should be "auth hand idx args"
(17:33:15) (Bloodcult) [16:33] Tcl error in script for 'timer7':
(17:33:15) (Bloodcult) [16:33] extra characters after close-quote


every time someone leaves or joins my channel it comes the same errors...


so what can i do?

thanks for answer

Bumpaneer 05-05-2003 12:55 PM

Is it possible to get the status characters in front of a username? (@, %, +) If so, is it also possible to get another? irc.resum.net allows admins (! char), can that be included?

Thanks,
~Bumpaneer

Bumpaneer 05-05-2003 12:56 PM

Code I found if someone can modify it:
PHP Code:

# Location to save files 
set location "/home/ircadmin/MonkBOT/userlists/" 

# Channel to watch 
set chan "#unrealplayground" 

# How often to update file in minutes 
set updatetime 2 

# Check to see if the timer is running - only needed really during a .rehash 

putlog "users2list.tcl v1.0 has started" 

if {![info exists fileusers_running]} { 
  
timer $updatetime fileusers 
  set fileusers_running 1 


proc fileusers {} { 
  global 
updatetime chan file location 
  
if {![validchan $chan]} { 
    
putlog "ERROR - users2file.tcl - I am not on $chan, so I cannot output lists" 
    
return 
  

  
set l1 [chanlist $chan
  
set l2 {} 
  
set l3 {} 
  foreach 
u $l1 
    if {[
isop $u $chan]} { 
      
lappend l3 "@" 
    
} elseif {[isvoice $u $chan]} { 
      
lappend l3 "+v" 
    
} else { 
      
lappend l3 "" 
    

    
lappend l3 $u 
    lappend l3 
[getchanidle $u $chan
    
lappend l3 "[getchanhost $u $chan]" 
    
lappend l2 [join $l3 {,}] 
    
set l3 {} 
  } 

  
#write the files 
  
set fp [open "${location}${chan}.users.txt" w
  
puts $fp [join $l1 {,}] 
  
close $fp 
  set fp 
[open "${location}${chan}.status.txt" w
  
puts $fp [join $l2 n
  
close $fp 

  
#restart the timer 
  
timer $updatetime fileusers 



noppid 05-05-2003 02:06 PM

Bloodcult, the code posted above has been running fine for us on
Eggdrop v1.6.12 (C) 1997 Robey Pointer (C) 2002 Eggheads and RHL8.0.

I'm at a loss for suggestions other then check the path to the files and be sure they exist.


All times are GMT. The time now is 01:10 PM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01599 seconds
  • Memory Usage 1,827KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (6)bbcode_code_printable
  • (3)bbcode_php_printable
  • (1)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (3)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (10)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete