mirror of
https://github.com/znc/znc.git
synced 2026-08-08 18:03:22 +02:00
bring Csocket up to date, includes new needed function GetSockByFD()
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@332 726aef4b-f618-498e-8847-2d620e286838
This commit is contained in:
@@ -5,6 +5,7 @@
|
||||
#include "Modules.h"
|
||||
#include "Chan.h"
|
||||
#include "FileUtils.h"
|
||||
#include "Csocket.h"
|
||||
|
||||
// perl stuff
|
||||
#include <EXTERN.h>
|
||||
@@ -103,6 +104,44 @@ typedef vector< PString > VPString;
|
||||
class CModPerl;
|
||||
static CModPerl *g_ModPerl = NULL;
|
||||
|
||||
class CPerlSock : public Csock
|
||||
{
|
||||
public:
|
||||
CPerlSock() : Csock()
|
||||
{
|
||||
m_pModule = NULL;
|
||||
}
|
||||
CPerlSock( const CS_STRING & sHost, int iPort, int iTimeout = 60 )
|
||||
: Csock( sHost, iPort, iTimeout )
|
||||
{
|
||||
m_pModule = NULL;
|
||||
}
|
||||
|
||||
virtual Csock *GetSockObj( const CS_STRING & sHostname, int iPort )
|
||||
{
|
||||
CPerlSock *p = new CPerlSock( sHostname, iPort );
|
||||
p->SetModule( m_pModule );
|
||||
return( p );
|
||||
}
|
||||
|
||||
void SetModule( CModPerl *pModule ) { m_pModule = pModule; }
|
||||
|
||||
//
|
||||
// # OnConnect( $sockhandle, $parentsockhandle )
|
||||
// # OnConnectionFrom( $sockhandle, $remotehost, $remoteport )
|
||||
// # OnError( $sockhandle, $errno )
|
||||
// # OnConnectionRefused( $sockhandle )
|
||||
// # OnTimeout( $sockhandle )
|
||||
// # OnDisconnect( $sockhandle )
|
||||
// # OnData( $sockhandle, $bytes, $length )
|
||||
// # OnReadLine( $sockhandle, $bytes, $length )
|
||||
|
||||
private:
|
||||
CModPerl *m_pModule;
|
||||
CString m_sModuleName;
|
||||
CString m_sUsername; // NEED these so we can send the signal to the right guy
|
||||
};
|
||||
|
||||
class CPerlTimer : public CTimer
|
||||
{
|
||||
public:
|
||||
|
||||
+10
-3
@@ -1,6 +1,13 @@
|
||||
#
|
||||
# TODO need to add socket support
|
||||
# OnConnect( $sockhandle )
|
||||
# OnConnect( $sockhandle, $parentsockhandle )
|
||||
# in the event this is comming in from a listener, the $sockhandle will be different from the others, so need to
|
||||
# register it in the socket class like the others
|
||||
# socket will register as $self = { "$sockhandle" => 1 }
|
||||
#
|
||||
# For Listeners
|
||||
# OnConnectionFrom( $sockhandle, $remotehost, $remoteport )
|
||||
#
|
||||
# OnError( $sockhandle, $errno )
|
||||
# OnConnectionRefused( $sockhandle )
|
||||
# OnTimeout( $sockhandle )
|
||||
@@ -10,8 +17,8 @@
|
||||
# ZNC::WriteSock( $sockhandle, $bytes, $length )
|
||||
# my $sockhandle = ZNC::ConnectSock( $host, $port, $timeout, $enablereadline )
|
||||
# my $sockhandle = ZNC::ConnectSockSSL( $host, $port, $timeout, $enablereadline )
|
||||
#
|
||||
# $sockhandle = 'Csock::GetSockName()'
|
||||
# my $sockhandle = ZNC::ListenSock( $port, $bindhostname, $enablereadline )
|
||||
# my $sockhandle = ZNC::ListenSockSSL( $port, $bindhostname, $enablereadline )
|
||||
#
|
||||
# store the sockhandle in their class, before every action call 'TestSock', if its true then call the event
|
||||
# otherwise close the socket
|
||||
|
||||
@@ -11,11 +11,16 @@
|
||||
#include <pwd.h>
|
||||
#include <sstream>
|
||||
|
||||
using std::pair;
|
||||
|
||||
/*
|
||||
* Secure chat system
|
||||
* Author: imaginos <imaginos@imaginos.net>
|
||||
*
|
||||
* $Log$
|
||||
* Revision 1.14 2005/05/18 03:22:52 imaginos
|
||||
* bring Csocket up to date, includes new needed function GetSockByFD()
|
||||
*
|
||||
* Revision 1.13 2005/05/15 08:27:27 prozacx
|
||||
* Changed return value from bool to EModRet on most hooks
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user