I started work on a DCC Chat system for smartirc, and so far going great. Right now I am just working on getting the bot to process the input from DCC. I just want to know the best place to put the code to process the input from DCC. Right now it's just a function that grabs the most recent info. I was looking to put it in _rawreceive() but wasn't sure if that would be the BEST place.
Matt
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Quick Update: I have attempted to put the receive function in _rawreceive(). Works but does not work. When I say something in the channel it checks the socket, otherwise it doesn't. Any suggestions on how to get this working right?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
don't put it in the core API of SmartIRC, its breaks easily. Use the message handler API, its that messagehandler.php files, when you define your own handlering don't add the leading "_" like I am doing, that shows that its from original SmartIRC, so when version is updating its easy to copy the own defined messagehandler functions..
like _mode() can co-exists with mode()
both will be processed...
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I was thinking to do that. But the message handler handles chat on the main IRC socket, and DCC uses it's own socket. Maybe I am wrong, and messagehandler would work, I don't get how it would work though.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I dont know the DCC protocol very good but I think the connection initialition is done through IRC commands, the ports and the IP are sent through IRC. If this is the case then you have to do it in messagehandler like I said, and create the socket there and make the DCC session in the messagehandler, or call from there another function..
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
It's accually alot easier than I thought after I did some research. Once I finish all the functions I would be willing to share the code to anyone who wants to see it. Right now it can receive a DCC Chat request and connect, send text, and respond to text.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
did you ever get anywhere with this dcc stuff? Asking because I'm thinking about writing something that handles dcc chats (more of a toy than anything serious)..
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I was going to start adding DCC support but got sidetracked by C# :) Now I am working on a C# port of SmartIRC, I will maintain both versions though....
you can upload your code and paste the link, then I may take a look at it and maybe it's usable enough for adding it to the CVS version... 0.6.0 is still in work :)
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hey,
I started work on a DCC Chat system for smartirc, and so far going great. Right now I am just working on getting the bot to process the input from DCC. I just want to know the best place to put the code to process the input from DCC. Right now it's just a function that grabs the most recent info. I was looking to put it in _rawreceive() but wasn't sure if that would be the BEST place.
Matt
Quick Update: I have attempted to put the receive function in _rawreceive(). Works but does not work. When I say something in the channel it checks the socket, otherwise it doesn't. Any suggestions on how to get this working right?
don't put it in the core API of SmartIRC, its breaks easily. Use the message handler API, its that messagehandler.php files, when you define your own handlering don't add the leading "_" like I am doing, that shows that its from original SmartIRC, so when version is updating its easy to copy the own defined messagehandler functions..
like _mode() can co-exists with mode()
both will be processed...
I was thinking to do that. But the message handler handles chat on the main IRC socket, and DCC uses it's own socket. Maybe I am wrong, and messagehandler would work, I don't get how it would work though.
here is the part of the code I am trying to get working right:
foreach ($dccfp as $key => $value)
{
dcc_rawrecieve($key);
}
^^ That code I put in _rawrecieve
function dcc_rawrecieve($id)
{
global $dccfp;
$message = @fread($dccfp[$id], 10240);
if ($message !== null && !empty($message))
{
dcc_rawsend($id, "You just said: ".$message);
}
}
^^ that is the beginning of that funcion, for testing.
I believe I got it working. I just made a timer to execute the function.
I dont know the DCC protocol very good but I think the connection initialition is done through IRC commands, the ports and the IP are sent through IRC. If this is the case then you have to do it in messagehandler like I said, and create the socket there and make the DCC session in the messagehandler, or call from there another function..
It's accually alot easier than I thought after I did some research. Once I finish all the functions I would be willing to share the code to anyone who wants to see it. Right now it can receive a DCC Chat request and connect, send text, and respond to text.
did you ever get anywhere with this dcc stuff? Asking because I'm thinking about writing something that handles dcc chats (more of a toy than anything serious)..
I was going to start adding DCC support but got sidetracked by C# :) Now I am working on a C# port of SmartIRC, I will maintain both versions though....
you can upload your code and paste the link, then I may take a look at it and maybe it's usable enough for adding it to the CVS version... 0.6.0 is still in work :)