What is it?: An add on to add Jpilot chat to your Threads install.
Why would I care?: This mod uses a template, and only allows registered users to chat.
Who gets the props?: Dave_L for the code to convert spaces to underscores. JoshPet for letting me use his popup script and omegatron for allowing me to see his chat script.
How do I install it?:
1) Copy jchat.php and chatpopup.php script to your ubbthreads directory.
2) Edit the jchat.tmpl file and change "dachat" to the name of the chat channel you want to use.
<param name="Channel1" value="dachat" />
3) Copy the jchat.tmpl file to your ubbthreads/templates/default/ directory.
4) Add
Code
$ubbt_lang['jchat'] = "In the Chat Room";
to the online.php file in all of your language directories.
5) Download a copy of Jpilot and copy it to a directory named chat under your ubbthreads directory (mine is in ubbthreads/chat).
I could have easily named this add on "How to add something to Threads using a "Threads like" template file". My challenge to all future mods for Threads is that if you create a new php script that you also make that script use a template file. It's a lot easier for most people to edit a template than it is for them to edit a php script. Plus we might just start seeing some of these add ons in the addons folder of a future Threads release.
Just something i want to run by you guys before I install this. My site uses Jpilot, and IIRC, it logs you onto irc.webchat.org? (correct me if i'm wrong). The only problem I forsee myself having is with usernames. Because I have a channel registered on irc.webchat.org, if someone from my site comes into the room and someone else on the server is using that name, and has it protected (aggresively or not) they get renamed as guest in the chatroom. how would this affect threads? I'm a bit confused as to how this works at the monent tbh!
No effect at all on Threads. The user name is passed to Jpilot as the user's nickname for the chat session, but that's all. It just makes it easy for the IRC newbies on your site to log into the IRC server.
Look at the comments in my script and you'll understand what it's doing a lot better.
I'm trying to find info on admin commands for the chatroom stuff...I've never really gotten into it, but figured now would be a good time to start. I have it all set up on my board, and it works very well. However, before I let people know about it, I figured I should make the other admins admins of the chat too (is it possible?) I'm looking for administrator commands for the chatroom on jpilot.com but their forums are down and the command section doesn't deal with it...
I think people show up as "private" even though the chat script is in the Threads directory, and I'm not realy sure how to make them show up as being in the chat. Can anyone point me in the right direction for making it work?
Perfect! Thank you muchly! Do you know if it's possible or how to now add how many people are in the chatroom? Almost like another WOL completely, for the chat?
The way that you are tracked by Threads is when you click on a link (to load a list of posts in a forum, for example). Because the chat page is static, and Who's Online updates every 10 minutes, people have a tendancy to "fall off" of who's online when they are in the chat.
JoshPet solved this problem by creating a java script that updates your online status every 9 minutes, but I don't use it in my hack.
The odd thing that I've noticed is that sometimes I'll show up on a different page in the who's online display, even though the only page I have open is the chat. Unfortunately I don't know enough about how the who's online script works and I haven't had time to sit down and figure it out.
There is a section of code in the jchat.php script that's unnecessary. After reviewing the main.inc.php file (and the ubbt.inc.php file) the table wrappers are defined when you call the library, so you can remove:
and the chat script will work just fine. I actually wrote that section incorrectly anyway (I should have put [:"purple"] $html = new html;[/] on the line above the list statement). Live and learn...
I'll update the zip file later
Update: I should either drink more coffee or get more sleep. The script is OK as is. I'll update the original zip file, but you do need to grab the table wrapper otherwisw tbopen and tbclose are empty.
[:"red"] <script language="javascript" type="text/javascript"> window.blur();</script> <meta http-equiv="refresh" content="500"> <div align="center"><b><font size="2">Please leave this window open while you are in the Chat Room.</font></b></div>[/]
I also added the language [:"red"]$ubbt_lang['jchat'] = "In Chat Room"; [/] to online.php.
The popup opens and refreshes but Who's Online doesn't update my status every 9 minutes.
<div align="center"><b><font face="ariel" size="2"> Please leave this window open while you are in the Chat Room.</b> </font></b></div>"; ?> [/]
My "jchat.tpl" inludes this line, to call-up the "chatpopup.php": [:"blue"] <script language="javascript" type="text/javascript"> window.open('http://www.mysite.com/threads/chatpopup.php?Cat=&Username=$Username&Usernumber=$Usernumber', 'chatpopup','width=800,height=300,top=000,left=000, screenX=1,screenY=1,scrollbars=yes,resizable=yes'); </script> [/]
The one snaglette is my chatpopup.php brings up my header, which is an unecessary bandwidth-user, especially given that it refreshes every (nearly) 10 minutes. And of course it also makes the chatpopup window unecessarily wide. So I'd love to find a way around THAT.
Dal, I've finally gotten this working perfectly, and am really enjoying it. It's all ready to be opened on my board, but I have a weird question. I feel super stupid, so forgive me! lol
Is there a way for me to register the channel I make and have me always an admin? I've looked through the info but am having a hard time....
Let me just review a bit: My chatpopup does (as I had it) do the job -- it does keep my Who's Online up-to-date with those who are in the Chat Room, as planned.
The only problem is that it causes my regular Threads header.tmpl to appear in the chatpopup, which looks dumb and causes confusion to users.
If I could just find a way to not have the header.tmpl appear, I'd be laughing.
This line in my chatpopup seems to be needed and seems to work except for the header thang: $html -> send_header("Updater",$Cat,0,0,0,0,"");. Note that I'm clueless and have no clue what I'm doing.
Not sure. The problem with a traditional "chat" page is that once the java applet loads, it doesn't refresh the page. If the page doesn't refresh, they drop off the list after 10 minutes.
I can't really see any way around this. It'd be great if it were.
I saw something somewhere (I guess it was your DigiChat mod)? Where it opened the chatroom in a frame. Could you have a tiny "iframe" that refreshed - although my browser doesn't support iframes. Many do not. But I guess you could do the page in frames and have one of the frames refresh.
Just thinking out loud. So in theory it works.... but my theorys are sometimes wrong.
Might need to add modifying that on my threads to do list.
I have a tendancy to stay away from iframes as well, they just don't work across all browser platforms. I only recently went back to using DHTML because support for it is strong enough now.
You're right, refreshing the page would cause them to drop off line. I noticed that the who's online page will auto refresh. I wonder if there is a way to make an element on the chat page (say just a one pixel transperant gif) refresh so that the entire page does not reload, but the who's online mechanism "sees" the refresh?
Yeah, me too... I hate popups too.. but my users wanted to see who was in chat.
On my site... I use the who's online box at the top of every page.... and I made it say below that, in bold: "There are 5 users in chat. Join them!" so that has really helped chat traffic.
I don't know of many browsers that don't support iframes. I have IE, Netscape, and Mozilla and they all support it. I had an iframe on my site for a long time. Then again I am always getting latest versions etc.
[]On my site... I use the who's online box at the top of every page.... and I made it say below that, in bold: "There are 5 users in chat. Join them!" so that has really helped chat traffic. [/]
Josh that would be just brilliant. My users have also been begging for that.
It would make a pretty neat package -- Dalantech's integrated Chat with your mod's -- for those of us who are trying to make chat a serious aspect of our sites.
I really appreciate the work you all are doing. Personally, I just learned that PHP isn't a steak sauce, so I'm a ways off from being able to contribute much!
OK - let me post this mod here until it's ready for "prime time". I pulled the code from my site.... but I've got some other things going on. So I haven't tested it.
It should work fine... but somebody test it and let me know.
For this to work, the chat page must be named "chat.php" as it looks for the entry of "chat" in the online table.
If the chat page is named 'chatroom.php' then you will need to modify my code to search for 'chatroom' instead.
This adds the number of users chatting to the top of each page on your site, and offers a link to the chatroom (chat.php) - again, if your chat file is named something else, you'll need to edit the link in the nav bar templates.
I have modified this slightly. See changes below..
I changed this part of the ubbt.inc.php (2 places)
$ChatNumber .= "$tbopen<tr><td class="lighttable"><br /><div align="center"><b>There is also $ChatOnline User in the <a href="{$config['phpurl']}/jchat.php">Chat Room</a>. Go and Join Them!</b></div></td></tr>$tbclose<br />";
to this...
$ChatNumber .= "[$ChatOnline]";
and the ubbt_resg and unregistered.tmpl to this...
This will SIMPLY toss a number of chatters that are in the chat room via the page next to the chat link for simplicity. And nothing when none. Be aware that if they are using an outside client, this will not count those people.
Example at www.theddz.com, click on chat. But you need to be registered to watch it change.
Ahh, I also ran into this.. You have to change it in the config file AND the html I think. Email me and I can arrange a time to go over this with you in person individually.
I've changed it now in EVERY file where irc.black... is included. I deleted also ALL other server information so that only my wanted is in.
Within the archives in p.class the serverinfo was also in. I changed it also but same effect.
The applet is still trying to reach this %§"&$#§" server and not the one I want...
Then I found out that there is a small failure in the attachment here.
OPEN JCHAT.TMPL and you will see this <param name="ServerName1" value="irc.dal.net"> <param name="ServerName2" value="liberty.nj.us.dal.net"> <param name="ServerName3" value="typhoon.va.us.dal.net">
[]JoshPet said: Yeah, me too... I hate popups too.. but my users wanted to see who was in chat.
On my site... I use the who's online box at the top of every page.... and I made it say below that, in bold: "There are 5 users in chat. Join them!" so that has really helped chat traffic. [/]
Hey Josh, I would also like to have it. Can you send to me how you made this cause I finally managed to include the chat into my forum. (50$ )
I opened the chat window in one of my registered channels on irc.quakenet.org and now all the people who have a registered nick there can't connect if the nick is the same the use in the forum. Can I add a suffix to the Forumnames that this is working?
You get the same error when the nick used in the forum is too long for the irc. Any way to cut things?
I've updated the zip file in the first post to include the chatpopup.php file and a new jchat.php file that includes the script to call the popup window.
They should be able to connect, provided they are not already logged into the channel from another IRC application and they login to the channel once they connect.
[]Dalantech said: I've updated the zip file in the first post to include the chatpopup.php file and a new jchat.php file that includes the script to call the popup window. [/]
You've forgotten to delete the failure with the template file and the server names. See my above posting!!!
If it is trying to connect to any other IRC server it's because you've added it to the script. If it's only attempting to connect to one server then you've modified the script incorrectly. Go to the Jpilot home page and follow the instructions for adding additional IRC servers closely...
Some servers do not allow [ type characters and some do not allow multiple connects. JPilot might see them as from the same source, I forgot if it really does.
Jpilot is just a client side IRC program (like Mirc) and it does not control what options you have available once you connect to an IRC server. Most IRC servers will not allow multiple logins by the same nickname.
IRC servers will also not allow spaces in a nickname, but the jchat.php script converts spaces to underscores in user names automaticly.
[]Dalantech said: I've fixed the template, but what did the error have to do with you connecting to irc.blackened.com? [/]
The parameters from the template are not send to the jchat and then it is using a default server (irc.black.....) After removing the " and making a " out of it the template worked correct for me. I am sure that this will also solve it for the others which had the same problem.
It's the way you explained it. I had know idea what you meant.
The escaped quotes in the template were there from me cutting and pasting from another chat.php script that didn't use a template (that's why the quotes were escaped). I don't use the default IRC server, so I had to have something to put in the chat template for the mod here. The only problem was that I forgot to remove the back slashes -doh!
Okay seems you have dachat somewhere in the template. Save the following code as jchat.tmpl and place in the template directory. Remember to change the name of the chat room you want to where it says so in the room name variable. I have it listed in CAPITALS.
OK, I am so sorry that I am making this difficult! I am sure that you wish you had never replied to my post
I have done what you have stated to do, atleast I think I have and now I have a greyed out box where the chat window should be. To me, it seems like it's not connecting to the chat server
That's an odd error. I just checked the zip file and there are no references to my chat page in any of the files. Where did you get the files that you used for this mod?
[]Dalantech said: That's an odd error. I just checked the zip file and there are no references to my chat page in any of the files. Where did you get the files that you used for this mod? [/] Great job putting this together !!!
[] dachat Cannot join channel (This channel has been closed by DALnet)" [/]
dachat is the name of the chat channel that I use on a private IRC server, so it looks like you used wget (or some other program) to pull the chat files from my web server instead of using the files included in the attachment on the first post of this thread...
Yes Josh is right if you have the chat directory under Threads you would not have needed to edit the template to do chat/jirc.php either. That Template I posted for you I modified for a MOCK room name for you and a MOCK title. It works fine under the scheme it is suppose to be. All chat files go in the chat subdirectory and then the template file in the template/default directory.
[]Dalantech said: This is the part that caught my attention:
[] dachat Cannot join channel (This channel has been closed by DALnet)" [/]
dachat is the name of the chat channel that I use on a private IRC server, so it looks like you used wget (or some other program) to pull the chat files from my web server instead of using the files included in the attachment on the first post of this thread... [/] Here is the code:
JUST KIDDING. Glad you got it working. Although I do not see personally why irc.dal.net does not work that is their base server which will load any one of those other channels that are open at the time.
if you type irc.dal.net in a chat program you may end up somewhere like munich.de.dal.net
It would have to use a port that your firewall can proxy. Since port 80 is used for HTTP (web surfing) you might try searching for chat scripts that use it (all firewalls proxy port 80).
Thought I would post this: I modified my jchat.php to change special characters in usernames.. I might not have gotten them, all, but did get the common ones my users have..
I think Dave_L gave me the script line to convert spaces to underscores. I wrote the jpilot chat script when I was first learning php. Now the more books I have the fewer questions I ask...
There is one problem with the way you wrote it: The value of $irc_nick will be the last line ( $irc_nick = str_replace('â„¢', '(TM)', $Username); ), all the others will be over written. Try changing it to this:
Hmm. Okay, this didn't do what I thought it would do. It logs users on with their board username, etc., but then they get renamed to guest because those nicks are already in use on dalnet or whatever. Is that what's supposed to happen or did I do something wrong? I'm not sure I get the point of using the board nicknames in that case, since virtually all of them are in use.
Yes that's supposed to happen. Otherwise they wouldn't be able to log onto the chat server. You'll need to install and run your own IRCd and services (if you want to offer control of the nicknames on the chat server) and have your jpilot applet connect to it so that this will not happen.
I think it's really best if you have at least your own channel.... but there are infinate number of channels and chat servers to choose from.
You might also try the Raidersoft chat mod.... for free, they allow you to setup your own room (www.raidersoft.com) and then you won't have to worry about other people's nicknames.
But I think we made this work. We registered a channel, but then to make our username/nicknames more unique, we had the chat login append a unique designator at the end of each username. Like this, in jchat.php:
// Append TUS designator to username $irc_nick_suffix = "TUS"; $irc_nick = "$irc_nick$irc_nick_suffix";
("TUS" is the initials of our board and it's what everyone calls it for short.)
And I'm encouraging users to register that nickname so they don't have to worry about getting changed to "guest."
I've updated the first post in this thread with instructions on how to change the chat channel that you use. Odd that I missed it the last time I went looking through the file
As for the user names already existing on Dalnet or some other IRC service: That's normal behavior for IRC chat, so I didn't include it in the instructions.
PJirc's interface is MUCH nicer, it's FREE and it comes with source code so it could be modified to update "who's online".
It also solves the problem of duplicate nicknames. If a nickname is already in use you can have it automatically append a random number to the end of the nickname to make it unique.
The primary reason I first looked at it is it can be called from anywhere, the license doesn't lock it down to one domain, so you could set up a chat portal for other sites.
Thanks. I took a look at PJIRC, and tried to install it (version 1.84) on my server. It looks like it has a couple of limitations:
1) The web server on which it's installed also has to be the IRC server to which it connects. 2) It doesn't include a security certificate, which might disturb users.
I may be wrong about these two issues. I spent some time reading the FAQ, looking through posts on their forum, and using trial and error, but was unable to get it to work on my server.
I will give it a try myself. However looking at the screenshots and trying their demo on their server I higly doubt I would be able to say that it is more feature rich. JPilot is a stable reliable cheap as well as proven application.
I've been running it for several weeks (switched from Jpilot because I moved to a different domain name and couldn't transfer the license to the new domain) and have had a lot of users tell me they think it's better than Jpilot.
You can always get your own certificate to sign it. freessl.com has certificates as low as $35/year. I just run my own irc server.
It also supports being on multiple channels simultaniously, dcc, ctcp and more. There's better control over what channels a user can, or can't, access and even if they can leave specific channels.
I modified the scripts to work with it on my site. You can check it out at www.moparpages.com.
I was in the chat room here, but when I tried to go back to the main index, it left me in the chat room. To get out of it I had to go to another site and come back.
I thought I did everything right, but all I get is a blank gray applet when I start the progie. What am I missing? I'm running jIRC v2.8.4 (Registered) on UBB.Threads v6.4 ....
Donate to UBBDev today to help aid in Operational, Server and Script Maintenance, and Development costs.
Please also see our parent organization VNC Web Services if you're in the need of a new UBB.threads Install or Upgrade, Site/Server Migrations, or Security and Coding Services.