Go Back   vb.org Archive > vBulletin Modifications > Archive > vB.org Archives > vBulletin 2.x > vBulletin 2.x Full Releases
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools
Users in Chat -with eggdrop, works no matter what- Details »»
Users in Chat -with eggdrop, works no matter what-
Version: 1.00, by sas1911 sas1911 is offline
Developer Last Online: Mar 2007 Show Printable Version Email this Page

Version: 2.2.x Rating:
Released: 07-08-2002 Last Update: Never Installs: 18
 
No support by the author.

First and foremost, I would like to thank Sparkz for a little bit of TCL help. I had been playing with the idea for some time now of using an eggdrop bot and vBulletin to put current chatters on my forum home. Unfortunately, I couldn't find the perfect TCL to use. The current TCL is a mix between my own script, a script I found online and Sparkz script.

** YOU MUST HAVE AN EGGDROP BOT **

After seeing this hack on vbulleting.org, I wanted it for my site. Unfortunately, it was not being released, so I decided to make my own! Here it is, hopefully you can figure most of it out yourself.

What it does is uses an eggdrop bot (not going to explain what it is). The bot refreshes the userlist when a user leaves or enters the channel, this keeps the list up to date always. When you load index.php, the list is downloaded from the shell and read into a variable. This variable can be put on your forumhome template
and viewed by the user. This hack also gets the current channel topic and the current server that the chat is on.

Pros:
* Works for any IRC method (jpilot, mirc, eirc, etc.)
* No page refreshing or database calls
* Is ALWAYS up-to-date

Cons:
* Uses FTP and eggdrop

Support for this hack is limited due to the fact that I am a busy person.

I hope you enjoy this hack, it's my first.

- joey

Show Your Support

  • This modification may not be copied, reproduced or published elsewhere without author's permission.

Comments
  #32  
Old 02-15-2003, 11:34 PM
Banana Banana is offline
 
Join Date: Oct 2002
Posts: 45
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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
Reply With Quote
  #33  
Old 02-16-2003, 01:05 PM
Banana Banana is offline
 
Join Date: Oct 2002
Posts: 45
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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.....
Reply With Quote
  #34  
Old 02-25-2003, 10:04 AM
Twin-x Twin-x is offline
 
Join Date: Nov 2001
Posts: 25
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

The above only is valid if yuo have your eggdrop running on the same server as you host the forum.
Reply With Quote
  #35  
Old 03-19-2003, 10:30 PM
Axe's Avatar
Axe Axe is offline
 
Join Date: Dec 2002
Posts: 29
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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
Reply With Quote
  #36  
Old 04-02-2003, 06:33 PM
noppid noppid is offline
 
Join Date: Mar 2003
Location: Florida
Posts: 1,875
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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.
Reply With Quote
  #37  
Old 04-02-2003, 10:46 PM
noppid noppid is offline
 
Join Date: Mar 2003
Location: Florida
Posts: 1,875
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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
Reply With Quote
  #38  
Old 05-04-2003, 02:50 PM
bloodcult bloodcult is offline
 
Join Date: Apr 2003
Location: Hameln/Germany
Posts: 20
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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
Reply With Quote
  #39  
Old 05-05-2003, 12:55 PM
Bumpaneer's Avatar
Bumpaneer Bumpaneer is offline
 
Join Date: Nov 2002
Posts: 35
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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
Reply With Quote
  #40  
Old 05-05-2003, 12:56 PM
Bumpaneer's Avatar
Bumpaneer Bumpaneer is offline
 
Join Date: Nov 2002
Posts: 35
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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 

Reply With Quote
  #41  
Old 05-05-2003, 02:06 PM
noppid noppid is offline
 
Join Date: Mar 2003
Location: Florida
Posts: 1,875
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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.
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 06:48 AM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.04888 seconds
  • Memory Usage 2,375KB
  • Queries Executed 25 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (6)bbcode_code
  • (3)bbcode_php
  • (1)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)modsystem_post
  • (1)navbar
  • (6)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (3)pagenav_pagelink
  • (11)post_thanks_box
  • (11)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (11)post_thanks_postbit_info
  • (10)postbit
  • (11)postbit_onlinestatus
  • (11)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.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/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.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
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete