• Forum
  • Doc
  • Screenshots
  • Download
  • Donate
  • Contributors
  • Contact
  • Follow @phpfreechat
  • DEMO
  • Board index ‹ Version 1.x branch ‹ Feature Requests (v1.x)
  • Change font size
  • FAQ
  • Register
  • Login

Connection with IRC server

This forum is now locked as we will no longer be developing the v1.x branch

Moderators: OldWolf, re*s.t.a.r.s.*2

Topic locked
29 posts • Page 2 of 2 • 1, 2

Postby Gilou » Thu Jul 26, 2007 11:33 pm

Well, this is only to connect an IRC client, now we should maybe bind this to a socket (or whatever else, maybe a dumb container here??) that will allow us to poll the data from the IRC server, and to send the commands coming from the interface.

I'm not sure SmartIRC will be "enough" as-is, because implementing all the events hooks might be complicated (though actually clean enough), and also because it works in a modular way, mainly firing methods on given IRC events (it was created to build bots mainly).

Maybe some pfc coders could look at this and give a piece of advice on how this could be worked seamlessly enough ;)
Gilou
New member
 
Posts: 4
Joined: Wed Jul 25, 2007 11:25 pm
Location: Nantes, France
  • Website
Top

Postby phpfreechat » Fri Jul 27, 2007 8:25 am

ljbuesch, I think your above code will not be ok because if the script is reloaded the connection will be closed and reopen.
On the IRC server the user (or bot) will leave and join again at each script reload.

Gilou, you seam to know better than me how sockets can be used, maybe you can answer to this simple question ?
If a first script initiate a socket (socket_create) and store the socket resource (what socket_create returns) in a simple file. Then is the same script or another script able to reuse the socket resource later (at the next reload) ?
Thank you for your help.
phpfreechat
Site Admin
 
Posts: 2657
Joined: Tue Feb 07, 2006 3:35 pm
Location: France
Top

Postby ljbuesch » Fri Jul 27, 2007 3:23 pm

kerphi wrote:ljbuesch, I think your above code will not be ok because if the script is reloaded the connection will be closed and reopen.
On the IRC server the user (or bot) will leave and join again at each script reload.

I see where you are getting at now, and I agree, it will try to re-open on each request.

Also, would there be a way to design the transport layer to be able to be used with a different protocol, such as Jabber? I was thinking it could work much the same way as you had designed the container to be used with different containers.
ljbuesch
New member
 
Posts: 9
Joined: Thu Jul 05, 2007 7:09 pm
Top

Postby Gilou » Sun Jul 29, 2007 9:08 pm

kerphi wrote:l
Gilou, you seam to know better than me how sockets can be used, maybe you can answer to this simple question ?
If a first script initiate a socket (socket_create) and store the socket resource (what socket_create returns) in a simple file. Then is the same script or another script able to reuse the socket resource later (at the next reload) ?
Thank you for your help.

You can't really do that, no. Sockets are more than handles to the system, and a TCP connection has to be always awake somehow. But here's what I had in mind, and what CGI:IRC uses if I'm not mistaken. Have a socket be your server, that you will connect to from the interface, this way you can send data to IRC and on the other side, the script can act as a JS callback when something comes back from the IRC server.

How to do that? Have an iframe or any other element that won't be reloaded through the chat session. This will be the proxy, it will mainly maintain the connection to the IRC server on its client part, and open a socket as a server on the other side. You will always communicate to the IRC server using this socket, with another script that will do nothing but connect to the socket, and send some data to it. You really should use a unix socket here, as you can refer to it using a filename, rather than a port or something hacky on the loopback interface for example.

Here is how (I think) CGI:IRC works, take what you can from it:
- irc.cgi is the main launcher for frames / iframes...
- nph-irc which is never reloaded, and always send data back (while(1) loop), it's in an iframe, and it opens a UNIX socket in /tmp/cgiirc-XXXXXXXXXXX/sock that will listen for commands, and an IRC connection on the other side. If something arrives from the IRC server, it's parsed and JS events are fired accordingly
- client.c (or client-perl.cgi) will receive input that it will forward to the unix socket, it's used as a method for the action of the CGI:IRC forms

Maybe you should read CGI:IRC code by yourself with those "lights", and see how it could fit.
Gilou
New member
 
Posts: 4
Joined: Wed Jul 25, 2007 11:25 pm
Location: Nantes, France
  • Website
Top

Postby phpfreechat » Mon Jul 30, 2007 10:59 am

Thank you Gilou for your clear explanations. I will think about such implementation. However I'd like pfc server side to be cross platform : basic unix socket could certainly not work on windows but maybe with cygwin tips we could workaround this problem ?
phpfreechat
Site Admin
 
Posts: 2657
Joined: Tue Feb 07, 2006 3:35 pm
Location: France
Top

Postby Gilou » Mon Jul 30, 2007 12:00 pm

Cygwin wouldn't be a solution (or more precisely: this would clearly be overkill), but you can implement this using a real client/server of any kind, listening over TCP rather than using an unix socket (it works in the same way in the end). Then you would have to store not a path on the filesystem, but rather a port on the loopback interface for example. This may somehow bring scalability issues, though you probably would encounter them also using UNIX sockets (you can have only 65535 ports opened on one interface, and you can't bind to ports < 1024 if not root on unix e.g.). But as far as scalability goes, you can use all the A Class 127.0.0.0/8 or even use a single daemon for proxying everyone, but maybe we shouldn't be focusing on that too much for now ;)

Be sure also to allow for a IP spoof possibility with the IRC server, so that users on the IRC server won't be stuck with the IP of your webserver, but rather appear to be connecting from their own connection. CGI:IRC does that by sending the information with the PASS command, and allows for a simple authentication, which is supported by the main IRCds around.
Gilou
New member
 
Posts: 4
Joined: Wed Jul 25, 2007 11:25 pm
Location: Nantes, France
  • Website
Top

Postby DinSoft » Fri Aug 10, 2007 3:23 am

from my point of vue, the fatest way of implementing this feature would be the following :

- When a chat session is created, launch a PHP script in the background (like with CGI:IRC) + PHPFreeChat
- Relay the PHPFreeChat storage (file or MySQL for instance) and the background PHP script.

Or i guess it would be better to extract only the GUI part of PHPFreeChat and start to work with that, but it looks like a lot of work.

At the moment I still don't get the project structure, expecially how to control the GUI part etc..
Last edited by DinSoft on Fri Aug 10, 2007 3:36 am, edited 1 time in total.
DinSoft
New member
 
Posts: 1
Joined: Fri Aug 10, 2007 3:20 am
Top

Postby GrosBedo » Thu Oct 04, 2007 11:51 pm

I'm not a pro in IRC protocol, but I have some fairly simple irc client script and, even if I'm not a php-guru, I think I can incorporate some IRC basic functions but I don't know how to create a container for your program. Is there a little explanation about this subject ?

I can provide the source of the IRC client (that isn't from me), it's only 16K.
GrosBedo
New member
 
Posts: 2
Joined: Thu Oct 04, 2007 11:43 pm
Top

Postby phpfreechat » Fri Oct 05, 2007 7:35 am

I will work on a COMET feature in phpfreechat. I've already done some investigations on how to implement comet in php and I think it's doable.
Thus it will be easier to start some work on an IRC container. It's too early to try implementing this container at the moment.
phpfreechat
Site Admin
 
Posts: 2657
Joined: Tue Feb 07, 2006 3:35 pm
Location: France
Top

Postby GrosBedo » Sun Oct 07, 2007 6:13 pm

Okay okay, glad to hear some news. But for COMET I don't think it will much change things about IRC since we can't change how IRC servers works, so COMET implementation won't work with IRC (or with great tweaking ! But then it won't be COMET, it will be the IRC protocol :p).

When you'll have done the new architecture of phpFreeChat don't forget to give us a release, even if it's alpha because you don't have implemented all the functions yet, to investigate the code and write an IRC container to be released with the final release.
Last edited by GrosBedo on Sun Oct 07, 2007 6:15 pm, edited 1 time in total.
GrosBedo
New member
 
Posts: 2
Joined: Thu Oct 04, 2007 11:43 pm
Top

Postby phpfreechat » Mon Oct 08, 2007 7:47 am

I agree, the COMET stuff will not solve the IRC container problem. It is just a step that will enable persistent connection which is very useful for socket connections.
phpfreechat
Site Admin
 
Posts: 2657
Joined: Tue Feb 07, 2006 3:35 pm
Location: France
Top

Postby NotteScura » Tue Feb 19, 2008 10:45 pm

Bumping. Anything resulting from this? I'm highly interested in integration of PFC and IRC. If nobody has attempted to get this started, I plan to, even if it's requiring a bit of a re-write of all the code.
NotteScura
New member
 
Posts: 1
Joined: Tue Feb 19, 2008 10:37 pm
Top

Postby phpfreechat » Mon Feb 25, 2008 8:11 pm

NotteScura, I started to work on the comet feature but as I'm out of time these days I cannot finish the work...
If you are motivated to work on it, please contact me by email, I'll send your my work.
phpfreechat
Site Admin
 
Posts: 2657
Joined: Tue Feb 07, 2006 3:35 pm
Location: France
Top

Postby shadzz1 » Fri May 28, 2010 9:59 am

hey im no web developer but im actually really keen on seeing the irc platform on version 2.0
so for all u experts out there...get your minds around these sites...
http://cristian.nexcess.net/ajax/chat/
http://ajaxian.com/archives/mibbit-ajax ... irc-client
http://www.phpbuilder.com/manual/en/ref.ircg.php

hope its a lil help... i see the last post was in 2007???? did u guys like give up ???
ill be waiting for the release. goodluck
shadzz1
New member
 
Posts: 3
Joined: Fri May 28, 2010 9:52 am
Top

Previous

Topic locked
29 posts • Page 2 of 2 • 1, 2

Return to Feature Requests (v1.x)

Who is online

Users browsing this forum: No registered users and 1 guest

  • Board index
  • The team • Delete all board cookies • All times are UTC + 1 hour
Powered by phpBB® Forum Software © phpBB Group
Sign in
Wrong credentials
Sign up I forgot my password
.
jeu-gratuit.net | more partners
Fork me on GitHub