PDA

View Full Version : jPilot hack


WEBDosser
08-12-2001, 10:00 PM
i have this installed on my site but would like to know if there is a way of telling people that some is in the chatroom, say like there username changes colour or something like that. or even the link to it on the main forum page adds the number or name of the people in there..

I think this would be a great hack.

Thnx..

Aram
08-15-2001, 02:42 AM
There are instructions for integrating jpilot chat here - http://www.vbulletin.com/forum/showthread.php?threadid=17866&perpage=15&pagenumber=2

Be warned, the full scale integration that you speak of is not for the faint of heart. It requires considerable resources and know-how. More than I posses anyway ;).

WEBDosser
08-15-2001, 08:18 AM
I have it installed and use chat template it works great. But would like a way for other users to to see who or howmany users are in the room.

ethank
08-15-2001, 08:07 PM
This is long and involved, but this is how I did it:

http://sourceforge.net/projects/phpegg/

This is a PHP program that creates a daemon in the chat room. Behind it lives a few MySQL tables. Basically after configuration (which when I have time I'll post, but its not hard to figure out), the bot logs all user in/out activity in a SQL Database. All it takes is this query to get who's in the room(s):


select DISTINCT nick as username from chan_users where (chan_name = '#general_rem' or chan_name='#everything_else') and reason IS NULL AND nick !='murmurs_bot';


Similar code gets you the amount of time. Basically I modified some code from the PHPMyChat hack to do this:


// CHAT HACK


// Ok Get Users and Stats

$chatusers=$DB_murmurs->query("select DISTINCT nick as username from chan_users where chan_name = '#general_rem' AND mode='u' and reason IS NULL AND nick !='rem_bot';");
if ($chatuser=$DB_murmurs->fetch_array($chatusers)) {

$numchatusers = $DB_murmurs->query_first("select count(nick) as chatcount from chan_users where chan_name = '#general_rem' AND mode='u' and reason IS NULL AND nick !='rem_bot';");
$numchatuser = $numchatusers[chatcount];

$chatusername=$chatuser[username];
$activechatusers=$chatusername;
while ($chatuser=$DB_murmurs->fetch_array($chatusers)) {
$chatusername=$chatuser[username];
$activechatusers.=", ".$chatusername;
}
if ($numchatuser == 1) {
$numchatuser = "There is ".$numchatuser." person in the chat room";
} else {
$numchatuser = "There are ".$numchatuser." people in the chat room";
}
$lightbulb = 'on';
} else {
$lightbulb='off';
$numchatuser = "Nobody is in the chat room at this time.";
}
eval("\$chatinfo .= \"".gettemplate("chatloggedin")."\";");


// END CHAT HACK


Then, just use the jPilot hack already posted.

But the key is the php_egg program. Also, I did a cron job that restarts the bot every half hour, just to make sure it stays alive. Right now our IRC server is in a different datacenter, so it died sometimes.

You can see a demo of this at http://tony.murmurs.com

EThan

WEBDosser
08-15-2001, 08:49 PM
Thankyou very much:) now i just got to work all this out..

ethank
08-15-2001, 10:11 PM
Originally posted by WEBDosser
Thankyou very much:) now i just got to work all this out..

E-mail me if you need help. It isn't really two difficult, its just kind of wacky.

EThan

TigerLily
08-18-2001, 02:50 AM
I have mine integrated as a forum in my boards as well. I don't have the resources or the knowledge to do the eggbot hack either.

I am wondering- is there a way to use this in conjunction with the Who's Online information? If someone is in the chat forum, I think they show up on the Who's Online Page since it's still a forum. I wonder if there is a way to take that info (those who are only in the chat forum) and place it in a Who's In Chat list beneath the Online Users on the main page. I know that was done with the eggbot, but is there a way to do it with the logged in user tables instead?

TigerLily:)

ethank
08-18-2001, 02:54 AM
Originally posted by TigerLily
I have mine integrated as a forum in my boards as well. I don't have the resources or the knowledge to do the eggbot hack either.

I am wondering- is there a way to use this in conjunction with the Who's Online information? If someone is in the chat forum, I think they show up on the Who's Online Page since it's still a forum. I wonder if there is a way to take that info (those who are only in the chat forum) and place it in a Who's In Chat list beneath the Online Users on the main page. I know that was done with the eggbot, but is there a way to do it with the logged in user tables instead?

TigerLily:)

Yeah, you can use the "location" field in the users session information to see if they are on the chat page. I was thinking about doing this, but with the realtime nature of chat, that 15 minutes before their session timed out was bothersome. Users would get mighty pissed if they saw 15 people in a room and found out they were there 10 minutes ago but that was the last page they were on.

The Eggbot hack requires a cron job, so you do need root access to use it. The cron job restarts the bot every hour or so just to make sure it keeps running. I could always program a watcher program to see if its running and restart it if it stops, but a cron job does it nicely with minimal fuss.

But, on the bright side its worked like a charm this week and users really dig it.

Ethan

TigerLily
08-19-2001, 04:36 AM
Thanks, Ethan! I am probably going to go with the location field method- I want to keep it as simple as possible. My members are pretty chatty- there is usually someone in there anyhow! Thanks for illustrating the eggbot method (ROFL- I think of egg drop soup everytime I hear "eggbot") If I get really adventurous, I'll give it a whirl!
TigerLily:)

TigerLily
09-01-2001, 08:44 PM
The JPilot integration has been going really nicely, and I'm getting ready to launch it publicly. The problem is still making the people in the chat room show up.

I want the chatters to show up in Who's In Chat just like the $activeusers do in Who's Online, pulling the info from the location field. I can install other hacks fine, and do small hacks with html and variables, but I'm lost on this one. I know the answer has to be fairly simple!

I want to: determine if the user is on the chat forum, get the users name and stick it on the main page in Who's in Chat (like Who's Online. I've also added $chatusers to the forumhome_loggedinusers template.

Here is what I have so far. I know it's wrong, perhaps someone can show me what I am missing and doing wrong!

I edited index.php and right after this:

} else {
$username=$loggedin['username'];
}
$location=$loggedin['location'];


I put this:


if ($location['forum']==105) { //chatuser hack
$chatuser=$loggedin['username'];
}


105 is the number of my forum which I've converted to do chat in. Any help would be appreciated! I will also try the chat user hack a few posts up and see if that works. I don't have an egg bot, maybe there is a way to alter that code.
Thanks,
TigerLily:)

PS If you are trying to integrate Jpilot and you're having trouble with the smilies showing up, put them in their own table. I don't know why it makes a difference, but it works!

TigerLily
09-02-2001, 12:37 AM
I decided to go with the hack already posted and see if I could alter it enough to get it to work. I am showing "Nobody in the chat room at this time" which is correct, but I am pretty sure I still have something messed up.

Under this line (around line 143):


eval("\$activeusers .= \", ".gettemplate('forumhome_loggedinuser')."\";");
}
}


I put this:


// CHAT HACK
// Ok Get Users and Stats

$location=$loggedin['location'];
if ($location['forumid']==105) { //chatuser hack
$chatuser=$loggedin['username'];
}
if ($chatuser=$DB_site->fetch_array($loggedins))
{
$numchatusers = $DB_site->query("SELECT DISTINCT session.userid,username,invisible FROM session LEFT JOIN user ON (user.userid=session.userid) WHERE session.userid>0 AND forumid='$foruminfo[105] AND session.lastactivity>$datecut ORDER BY invisible ASC, username ASC");
$numchatuser = $numchatusers[chatcount];
$chatusername=$chatuser[username];
$activechatusers=$chatusername;
while ($chatuser=$DB_site->fetch_array($loggedins)) {
$chatusername=$chatuser[username];
$activechatusers.=", ".$chatusername;
}
if ($numchatuser == 1) {
$numchatuser = "There is ".$numchatuser." person in the chat room";
} else {
$numchatuser = "There are ".$numchatuser." people in the chat room";
}
$lightbulb = 'on';
} else {
$lightbulb='off';
$numchatuser = "Nobody is in the chat room at this time.";
}
eval("\$chatinfo .= \"".gettemplate("chatloggedin")."\";");

// END CHAT HACK


I made a simple template called chatloggedin:


<BR><BR>
<img src="images/$lightbulb.gif" border="0" alt=""><B>Who's in Chat:</b>
<BR>
$numchatuser
<BR> $activechatusers


Or a little fancier:


<tr id="cat">
<td bgcolor="{categorybackcolor}" colspan="6"><a href="online.php?s=$session[sessionhash]"><normalfont color="{categoryfontcolor}"><img src="{imagesfolder}/$lightbulb.gif" border="0" alt=""><b>Who's In Chat: </b></A></normalfont><smallfont>&nbsp;&nbsp;$numchatuser</td>
</tr>
<tr>
<td bgcolor="{firstaltcolor}" colspan="6"><smallfont>
<BR> $activechatusers


I will probably have to make the chat room live before I can tell if this is working, but it's a start. I think I need to majorly crack open some PHP books and start learning!

TigerLily:)

itzsnider
09-15-2001, 07:06 PM
I copied the template and changed things so it would make it connect to my server etc. Now when I try to connect I get this message

sometimes it gets ident response sometimes it doesnt

but I always get
***User Not enough parameters

any help would be appreciated


thanks


http://24.3.25.212/forums/forumdisplay.php?forumid=11

here is the link

itzsnider
09-17-2001, 02:28 AM
hello anyone know what I need to do to fix this problem?

ladyfire
09-20-2001, 06:11 AM
Just fyi....if you are looking at jpilot, there is an add-on i just found and implemented on my site that ROCKS for jpilot....

http://jirc.webt.dk there is the site for downloading it, and Here (http://reviews.aspd.net/index.php) is my implementation of it.

It is an outstanding front end, plus gives you the required code to let your users auto generate code to add chat room access to your chat to their own sites (great traffic builder).

Just thought i would throw that in, while everyone was discussing Jpilot :)