• 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 1 of 2 • 1, 2

Postby Rubke » Tue Aug 15, 2006 9:13 pm

a nice addition would be a connection to an IRC server
phpFreeChat has a lot in common with irc so this backend should be possible
gonna give it a look the comming next weeks
Rubke
New member
 
Posts: 5
Joined: Wed Aug 09, 2006 10:39 pm
Top

Postby phpfreechat » Tue Aug 15, 2006 10:41 pm

This topic could answer your request ? http://www.phpfreechat.net/forum/viewtopic.php?id=496
phpfreechat
Site Admin
 
Posts: 2657
Joined: Tue Feb 07, 2006 3:35 pm
Location: France
Top

Postby Rubke » Tue Aug 15, 2006 10:45 pm

can you fix the links to the 2 demo files.. in the section : Write your own container (@todo : to write)
that could help me.. i know the're php irc libs
Rubke
New member
 
Posts: 5
Joined: Wed Aug 09, 2006 10:39 pm
Top

Postby phpfreechat » Wed Aug 16, 2006 8:55 am

The link is fixed, thank you for the report.

I think the difficulty is to keep the IRC socket connection open. The container function will recived periodic update (each 5 secondes for example) and I don't know how to keep the IRC socket connection open permanantly.
phpfreechat
Site Admin
 
Posts: 2657
Joined: Tue Feb 07, 2006 3:35 pm
Location: France
Top

Postby Rubke » Wed Aug 16, 2006 10:05 pm

we can use smartirc (http://freshmeat.net/projects/smartirc/)
or Net_SmartIRC (http://pear.php.net/package/Net_SmartIRC)
haven't give it a look.. but there others that have done it in php
Last edited by Rubke on Wed Aug 16, 2006 10:14 pm, edited 1 time in total.
Rubke
New member
 
Posts: 5
Joined: Wed Aug 09, 2006 10:39 pm
Top

Postby Steve_pd » Thu Feb 08, 2007 4:00 pm

I would very, very much love to see how an IRC container would be implemented. Looking at the current container structure I don't see how it would be possible..

I've seen tonnes of forum posts / blog entries crying out for a PHP/AJAX -> IRC gateway. Something like this would be amazing!
Steve_pd
New member
 
Posts: 1
Joined: Thu Feb 08, 2007 3:49 pm
Top

Postby phpfreechat » Thu Feb 08, 2007 5:23 pm

It should be possible to keep a socket connexion open using pfsockopen. So it should be possible to keep N socket connections to the IRC server for each N phpfrechat users.

Maybe this container is writable...
phpfreechat
Site Admin
 
Posts: 2657
Joined: Tue Feb 07, 2006 3:35 pm
Location: France
Top

Postby ljbuesch » Thu Jul 05, 2007 7:20 pm

I have recently been hacking away at trying to create a container for an IRC connection, but I have been having a little bit of trouble and would like some advice before continuing.

I have tried to write a simple container which simply connects to a channel and that's all, but there have been some problems.

I feel that writing the IRC layer as a container doesn't work because IRC is not a container of chat text, rather it is a method of delivering the chat text. There would have to be a lot of work to make the commands turn from the meta data to IRC commands.

Has there been any previous work or any work that is currently being done by anybody to make this happen? If so, I would be interested in seeing how this problem has been approached.
ljbuesch
New member
 
Posts: 9
Joined: Thu Jul 05, 2007 7:09 pm
Top

Postby phpfreechat » Thu Jul 05, 2007 9:12 pm

This problem has not been really reached.
However I would be happy to participate. Maybe it's time to build a development team around this feature ?
phpfreechat
Site Admin
 
Posts: 2657
Joined: Tue Feb 07, 2006 3:35 pm
Location: France
Top

Postby ljbuesch » Fri Jul 06, 2007 1:49 am

I wouldn't mind helping out with some of the development, I'm just unsure of which direction you would want to go with it.

I haven't really looked deep into the code, just enough to have a basic understanding of what is going on. What I would think would happen to make the IRC layer a container is some type of mapping from meta to IRC commands, but I don't know what all the mappings are and if this is a viable solution.
ljbuesch
New member
 
Posts: 9
Joined: Thu Jul 05, 2007 7:09 pm
Top

Postby phpfreechat » Tue Jul 17, 2007 12:24 pm

I think we have to start with basic IRC commands mapping then we will see what is missing in pfc.
Do you know IRC specifications ? Which commands are mandatory to have a working basic chat ?
phpfreechat
Site Admin
 
Posts: 2657
Joined: Tue Feb 07, 2006 3:35 pm
Location: France
Top

Postby ljbuesch » Sat Jul 21, 2007 12:06 am

I know the basic specification, I had to implement an IRC client about two years ago. The full text can be found at http://www.irchelp.org/irchelp/text/rfc1459.txt

Mandatory commands would be just sending and receiving messages and a ping/pong implementation. The thing about it, is that everything else would be icing on the cake as far as I'm concerned. SmartIRC implements all of this, so we would essentially either borrow their implementation or use totally use it as a library.
ljbuesch
New member
 
Posts: 9
Joined: Thu Jul 05, 2007 7:09 pm
Top

Postby phpfreechat » Tue Jul 24, 2007 3:40 pm

You are right using SmartIRC lib should help use to speed up command implementations.
However before starting to work on the protocol implementation I think we have to find a way to keep the connexion open between periodical ajax requests and irc server daemon.

Do you have an idea about that ?
A basic php example could be :
1- call a script that initiate a socket connection to an irc server and leave open the connection (but how?)
2- call this script periodically and reuse the above socket connexion
If we find a technical way to accomplish this example, I think we can start working serenely on IRC backend implementation.
phpfreechat
Site Admin
 
Posts: 2657
Joined: Tue Feb 07, 2006 3:35 pm
Location: France
Top

Postby Gilou » Thu Jul 26, 2007 12:24 am

Hi,

I really think your project is quite cool, AJAX is "the way" for GUI by now. And truly enough, we also need to get rid of those horrible IRC java applets, and CGI:IRC sometimes just doesn't fit.

I went quickly through your code, and the container way to implement an IRC module is clearly not enough. Maybe because it was poorly designed, or probably because it's not the way you thought someone would tweak it. IRC can not be a container for your app, because it needs to get hooked into your own events, not only can it be called when the interface sends one or need to retrieve history. It has to trigger events, otherwise you'll end with something weird. This is to get rid of the common "just tweak the container class to do so" that seems to be a prompt answer, don't hang me for this little flame..

I'm thinking about a way to implement it. I haven't got too far yet, just reading about the quickest way to do so (yeah, I'm lazy, but that's why libraries exist ;))

As for your question, have a look at the way CGI:IRC does the thing, it has pretty much the same problematic. Each client will call a CGI client (can be PHP for us) that will open the connection to the IRC server, and open a UNIX domain socket to make the i/o. It returns the ID of the given socket (CGI:IRC uses something like /tmp/cgiirc-XXXXXX/sock for the socket e.g.) that shall be put in a cookie to remember it through the HTTP sessions. My client reports everything to this unix socket, and I shall poll it and use it to send data whenever I want to use the IRC connection with my own HTTP PHP client (yeah, that's twisted :)).

This would lead to such communications (You spawn the php proxy once, then just talk to your IRC server through your local socket, or whatever else):
HTTP Client <==> UNIX Socket (or any similar mechanism) <==> PHP Proxy <==> IRC Server

I don't know how portable this would be, but in fact, it may be implemented in any other way than a unix domain socket. It's just a matter of having a proxy for us that will connect to IRC that we could be able to call back given a given ID, so this could even may be dealt with "php layer socket", if we don't want to rely on system sockets (though it could prove useful to be able to use select() and other nice functions to deal with sockets ;)).

My 0.02 €, though this thread seems rather forgotten :'(
Last edited by Gilou on Thu Jul 26, 2007 12:30 am, edited 1 time in total.
Gilou
New member
 
Posts: 4
Joined: Wed Jul 25, 2007 11:25 pm
Location: Nantes, France
  • Website
Top

Postby ljbuesch » Thu Jul 26, 2007 10:51 pm

kerphi wrote:1- call a script that initiate a socket connection to an irc server and leave open the connection (but how?)
2- call this script periodically and reuse the above socket connexion
If we find a technical way to accomplish this example, I think we can start working serenely on IRC backend implementation.

Here is one code example taken from the Net_SmartIRC package. When using sockets, it basically does what the previous post suggested an implementation would be used for with sockets.
Code: Select all
$irc = &new Net_SmartIRC();
$irc->setDebug(SMARTIRC_DEBUG_ALL);
$irc->setUseSockets(TRUE);
$irc->registerActionhandler(SMARTIRC_TYPE_QUERY|SMARTIRC_TYPE_NOTICE, '^test', $bot, 'query_test');
$irc->registerActionhandler(SMARTIRC_TYPE_CHANNEL, '^test', $bot, 'channel_test');
$irc->connect('irc.freenet.de', 6667);
$irc->login('Net_SmartIRC', 'Net_SmartIRC Client '.SMARTIRC_VERSION.' (example.php)', 0, 'Net_SmartIRC');
$irc->join(array('#smartirc-test','#test'));
$irc->listen();
$irc->disconnect();

(There are about 7 examples total in the NET_SmartIRC pear package)

The handlers will just create some IRC bot to do something on certain requests.
ljbuesch
New member
 
Posts: 9
Joined: Thu Jul 05, 2007 7:09 pm
Top

Next

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

Return to Feature Requests (v1.x)

Who is online

Users browsing this forum: No registered users and 8 guests

  • 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