#3 Ability to handle DCC requests

open
nobody
MAIN (1)
5
2003-11-27
2003-11-27
No

The ability to send files, and receive files as well as
handle other DCC requests would be a very nice addon to
an already useful IRC package.

Discussion

  • Nobody/Anonymous

    Logged In: NO

    I second that, I'd love this feature.

     
  • Nobody/Anonymous

    Logged In: NO

    Add DCC support as a module isn't that hard.

    You just have to read up on how DCC works.

    You need 2 handlers
    1 to handle CTCP
    registerActionhandler(SMARTIRC_TYPE_CTCP, '/.*DCC
    CHAT.*/', &$this, 'acceptConnection');

    and the other to chech the sockets for data
    registerTimehandler(750, &$this, 'checkSocket');

    and have a method to process all your sends and have it pull
    out DCC sends and pass them to your DCC module.

    send method:

    function sendMessage($Nick, $Message) {

    // See if we have socket for this user
    if(isset($this->_sessions[$Nick]))
    {// User has open socket
    $Result = socket_write($this->_sessions[$Nick]
    ['socket'], $Message."\r\n" , strlen($Message."\r\n"));

    // Check for error
    if($Result === false)
    {// There was a error so destroy socket/session
    socket_close($this->_sessions[$Nick]['socket']);
    unset($this->_sessions[$Nick]);
    }
    }

    }

     

Log in to post a comment.