Commit initial: GNUWorld servicii IRC cu README.md complet in limba romana - Analiza arhitecturala completa a proiectului - Documentatie ierarhie clase, bucla de evenimente, protocol P10 - Identificare probleme memorie si recomandari modernizare
This commit is contained in:
commit
fcb24f6de9
870 files changed
+311128
No files matched your search
@@ -0,0 +1 @@
|
||||
precious ^gnuworld$
|
||||
@@ -0,0 +1,7 @@
|
||||
.deps
|
||||
.libs
|
||||
*.la
|
||||
*.lo
|
||||
Makefile
|
||||
gnuworld
|
||||
.arch-ids
|
||||
+638
@@ -0,0 +1,638 @@
|
||||
/*
|
||||
* Channel.cc
|
||||
* Author: Daniel Karrels (dan@karrels.com)
|
||||
* Copyright (C) 2002 Daniel Karrels <dan@karrels.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
|
||||
* USA.
|
||||
*
|
||||
* $Id: Channel.cc,v 1.55 2008/04/16 20:29:37 danielaustin Exp $
|
||||
*/
|
||||
|
||||
#include <new>
|
||||
#include <map>
|
||||
#include <string>
|
||||
#include <iostream>
|
||||
#include <sstream>
|
||||
|
||||
#include "Channel.h"
|
||||
#include "iClient.h"
|
||||
#include "ChannelUser.h"
|
||||
#include "Network.h"
|
||||
#include "xparameters.h"
|
||||
#include "StringTokenizer.h"
|
||||
#include "ELog.h"
|
||||
#include "match.h"
|
||||
#include "server.h"
|
||||
#include "ConnectionManager.h"
|
||||
|
||||
RCSTAG("$Id: Channel.cc,v 1.55 2008/04/16 20:29:37 danielaustin Exp $") ;
|
||||
|
||||
namespace gnuworld
|
||||
{
|
||||
|
||||
using std::vector ;
|
||||
using std::string ;
|
||||
using std::endl ;
|
||||
using std::stringstream ;
|
||||
|
||||
const Channel::modeType Channel::MODE_T = 0x01 ;
|
||||
const Channel::modeType Channel::MODE_N = 0x02 ;
|
||||
const Channel::modeType Channel::MODE_S = 0x04 ;
|
||||
const Channel::modeType Channel::MODE_P = 0x08 ;
|
||||
const Channel::modeType Channel::MODE_K = 0x10 ;
|
||||
const Channel::modeType Channel::MODE_L = 0x20 ;
|
||||
const Channel::modeType Channel::MODE_M = 0x40 ;
|
||||
const Channel::modeType Channel::MODE_I = 0x80 ;
|
||||
const Channel::modeType Channel::MODE_R = 0x100 ;
|
||||
const Channel::modeType Channel::MODE_D = 0x200 ;
|
||||
const Channel::modeType Channel::MODE_A = 0x400 ;
|
||||
const Channel::modeType Channel::MODE_U = 0x800 ;
|
||||
const Channel::modeType Channel::MODE_REG = 0x1000 ;
|
||||
|
||||
Channel::Channel( const string& _name,
|
||||
const time_t& _creationTime )
|
||||
: name( _name ),
|
||||
creationTime( _creationTime ),
|
||||
modes( 0 ),
|
||||
limit( 0 )
|
||||
{}
|
||||
|
||||
Channel::~Channel()
|
||||
{
|
||||
// Deallocate all ChannelUser's that are left
|
||||
userIterator currentPtr = userList_begin() ;
|
||||
userIterator endPtr = userList_end() ;
|
||||
for( ; currentPtr != endPtr ; ++currentPtr )
|
||||
{
|
||||
delete currentPtr->second ;
|
||||
}
|
||||
userList.clear() ;
|
||||
}
|
||||
|
||||
bool Channel::addUser( ChannelUser* newUser )
|
||||
{
|
||||
assert( newUser != 0 ) ;
|
||||
|
||||
//elog << "Channel::addUser> ("
|
||||
// << getName()
|
||||
// << ") Number of users: "
|
||||
// << userList.size()
|
||||
// << endl ;
|
||||
|
||||
if( !userList.insert(
|
||||
userListType::value_type( newUser->getIntYYXXX(), newUser ) ).second )
|
||||
{
|
||||
elog << "Channel::addUser> ("
|
||||
<< getName()
|
||||
<< "): "
|
||||
<< "Unable to add user: "
|
||||
<< *newUser
|
||||
<< endl ;
|
||||
return false ;
|
||||
}
|
||||
|
||||
//elog << "Channel::addUser> " << name << " added user: "
|
||||
// << *newUser << endl ;
|
||||
|
||||
return true ;
|
||||
}
|
||||
|
||||
bool Channel::addUser( iClient* theClient )
|
||||
{
|
||||
ChannelUser* addMe = new (std::nothrow) ChannelUser( theClient ) ;
|
||||
|
||||
// The signature of addUser() here will verify the pointer
|
||||
return addUser( addMe ) ;
|
||||
}
|
||||
|
||||
ChannelUser* Channel::removeUser( ChannelUser* theUser )
|
||||
{
|
||||
assert( theUser != 0 ) ;
|
||||
|
||||
return removeUser( theUser->getClient()->getIntYYXXX() ) ;
|
||||
}
|
||||
|
||||
ChannelUser* Channel::removeUser( iClient* theClient )
|
||||
{
|
||||
// This method is public, so the pointer must be validated
|
||||
assert( theClient != 0 ) ;
|
||||
|
||||
return removeUser( theClient->getIntYYXXX() ) ;
|
||||
}
|
||||
|
||||
ChannelUser* Channel::removeUser( const unsigned int& intYYXXX )
|
||||
{
|
||||
ChannelUser* tmpUser;
|
||||
|
||||
// Attempt to find the user in question
|
||||
userIterator ptr = userList.find( intYYXXX ) ;
|
||||
|
||||
// Was the user found?
|
||||
if( ptr != userList.end() )
|
||||
{
|
||||
// Yup, go ahead and remove the user from the userList
|
||||
tmpUser = ptr->second;
|
||||
|
||||
userList.erase( ptr ) ;
|
||||
|
||||
// Return a pointer to the ChannelUser
|
||||
return tmpUser;
|
||||
}
|
||||
|
||||
// Otherwise, the user was NOT found
|
||||
// Log the error
|
||||
// Happens when not handling zombies
|
||||
//elog << "Channel::removeUser> ("
|
||||
// << getName() << ") "
|
||||
// << "Unable to find user: "
|
||||
// << intYYXXX
|
||||
// << std::endl ;
|
||||
|
||||
// Return error state
|
||||
return 0 ;
|
||||
}
|
||||
|
||||
ChannelUser* Channel::findUser( const iClient* theClient ) const
|
||||
{
|
||||
assert( theClient != 0 ) ;
|
||||
|
||||
const_userIterator ptr = userList.find( theClient->getIntYYXXX() ) ;
|
||||
if( ptr == userList_end() )
|
||||
{
|
||||
// User not found
|
||||
return 0 ;
|
||||
}
|
||||
return ptr->second ;
|
||||
}
|
||||
|
||||
bool Channel::removeUserMode( const ChannelUser::modeType& whichMode,
|
||||
iClient* theClient )
|
||||
{
|
||||
ChannelUser* theChanUser = findUser( theClient ) ;
|
||||
if( NULL == theChanUser )
|
||||
{
|
||||
elog << "Channel::removeUserMode> ("
|
||||
<< getName()
|
||||
<< ") "
|
||||
<< "Unable to find user: "
|
||||
<< theClient->getCharYYXXX()
|
||||
<< endl ;
|
||||
return false ;
|
||||
}
|
||||
theChanUser->removeMode( whichMode ) ;
|
||||
return true ;
|
||||
}
|
||||
|
||||
bool Channel::setUserMode( const ChannelUser::modeType& whichMode,
|
||||
iClient* theClient )
|
||||
{
|
||||
// findUser() is also public, and so will verify theClient's pointer
|
||||
ChannelUser* theChanUser = findUser( theClient ) ;
|
||||
if( NULL == theChanUser )
|
||||
{
|
||||
elog << "Channel::setUserMode> ("
|
||||
<< getName()
|
||||
<< ") "
|
||||
<< "Unable to find user: "
|
||||
<< theClient->getCharYYXXX()
|
||||
<< endl ;
|
||||
return false ;
|
||||
}
|
||||
theChanUser->setMode( whichMode ) ;
|
||||
return true ;
|
||||
}
|
||||
|
||||
bool Channel::getUserMode( const ChannelUser::modeType& whichMode,
|
||||
iClient* theClient ) const
|
||||
{
|
||||
// findUser() is also public, and so will verify theClient's pointer
|
||||
ChannelUser* theChanUser = findUser( theClient ) ;
|
||||
if( NULL == theChanUser )
|
||||
{
|
||||
elog << "Channel::getUserMode> ("
|
||||
<< getName()
|
||||
<< ") "
|
||||
<< "Unable to find user: "
|
||||
<< theClient->getCharYYXXX()
|
||||
<< endl ;
|
||||
return false ;
|
||||
}
|
||||
return theChanUser->getMode( whichMode ) ;
|
||||
}
|
||||
|
||||
void Channel::setBan( const string& newBan )
|
||||
{
|
||||
// xServer will worry about removing conflicting bans
|
||||
banList.push_front( newBan ) ;
|
||||
}
|
||||
|
||||
bool Channel::removeBan( const string& banMask )
|
||||
{
|
||||
for( banIterator ptr = banList_begin(), end = banList_end() ;
|
||||
ptr != end ; ++ptr )
|
||||
{
|
||||
if( !strcasecmp( *ptr, banMask ) )
|
||||
{
|
||||
banList.erase( ptr ) ;
|
||||
// Ban found, return true
|
||||
return true ;
|
||||
}
|
||||
}
|
||||
// Ban not found
|
||||
return false ;
|
||||
}
|
||||
|
||||
bool Channel::findBan( const string& banMask ) const
|
||||
{
|
||||
for( const_banIterator ptr = banList_begin(),
|
||||
end = banList_end() ; ptr != end ; ++ptr )
|
||||
{
|
||||
if( !strcasecmp( *ptr, banMask ) )
|
||||
{
|
||||
return true ;
|
||||
}
|
||||
}
|
||||
return false ;
|
||||
}
|
||||
|
||||
bool Channel::matchBan( const string& banMask ) const
|
||||
{
|
||||
for( const_banIterator ptr = banList_begin(),
|
||||
end = banList_end() ; ptr != end ; ++ptr )
|
||||
{
|
||||
if( !match( banMask, *ptr ) )
|
||||
{
|
||||
// Found a match
|
||||
return true ;
|
||||
}
|
||||
}
|
||||
return false ;
|
||||
}
|
||||
|
||||
bool Channel::getMatchingBan( const string& banMask,
|
||||
string& matchingBan ) const
|
||||
{
|
||||
for( const_banIterator ptr = banList_begin(),
|
||||
end = banList_end() ; ptr != end ; ++ptr )
|
||||
{
|
||||
if( !match( banMask, *ptr ) )
|
||||
{
|
||||
matchingBan = *ptr ;
|
||||
return true ;
|
||||
}
|
||||
}
|
||||
return false ;
|
||||
}
|
||||
|
||||
void Channel::onMode(
|
||||
const vector< std::pair< bool, Channel::modeType > >& modeVector )
|
||||
{
|
||||
typedef vector< std::pair< bool, Channel::modeType > > modeVectorType ;
|
||||
for( modeVectorType::const_iterator mItr = modeVector.begin() ;
|
||||
mItr != modeVector.end() ; ++mItr )
|
||||
{
|
||||
bool polarity = (*mItr).first ;
|
||||
|
||||
if( polarity ) setMode( (*mItr).second ) ;
|
||||
else removeMode( (*mItr).second ) ;
|
||||
} // for()
|
||||
}
|
||||
|
||||
void Channel::onModeL( bool polarity, const unsigned int& newLimit )
|
||||
{
|
||||
if( polarity )
|
||||
{
|
||||
setMode( MODE_L ) ;
|
||||
setLimit( newLimit ) ;
|
||||
}
|
||||
else
|
||||
{
|
||||
removeMode( MODE_L ) ;
|
||||
setLimit( 0 ) ;
|
||||
}
|
||||
}
|
||||
|
||||
void Channel::onModeK( bool polarity, const string& newKey )
|
||||
{
|
||||
if( polarity )
|
||||
{
|
||||
setMode( MODE_K ) ;
|
||||
setKey( newKey ) ;
|
||||
}
|
||||
else
|
||||
{
|
||||
removeMode( MODE_K ) ;
|
||||
setKey( string() ) ;
|
||||
}
|
||||
}
|
||||
|
||||
void Channel::onModeA( bool polarity, const string& newApass )
|
||||
{
|
||||
if( polarity )
|
||||
{
|
||||
setMode( MODE_A ) ;
|
||||
setApass( newApass ) ;
|
||||
}
|
||||
else
|
||||
{
|
||||
removeMode( MODE_K ) ;
|
||||
setApass( string() ) ;
|
||||
}
|
||||
}
|
||||
|
||||
void Channel::onModeU( bool polarity, const string& newUpass )
|
||||
{
|
||||
if( polarity )
|
||||
{
|
||||
setMode( MODE_U ) ;
|
||||
setUpass( newUpass ) ;
|
||||
}
|
||||
else
|
||||
{
|
||||
removeMode( MODE_U ) ;
|
||||
setUpass( string() ) ;
|
||||
}
|
||||
}
|
||||
|
||||
void Channel::onModeO( const vector< std::pair< bool, ChannelUser* > >&
|
||||
opVector )
|
||||
{
|
||||
typedef vector< std::pair< bool, ChannelUser* > > opVectorType ;
|
||||
for( opVectorType::const_iterator ptr = opVector.begin() ;
|
||||
ptr != opVector.end() ; ++ptr )
|
||||
{
|
||||
if( ptr->first )
|
||||
{
|
||||
ptr->second->setModeO() ;
|
||||
}
|
||||
else
|
||||
{
|
||||
ptr->second->removeModeO() ;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Channel::onModeH( const vector< std::pair< bool, ChannelUser* > >&
|
||||
opVector )
|
||||
{
|
||||
typedef vector< std::pair< bool, ChannelUser* > > opVectorType ;
|
||||
for( opVectorType::const_iterator ptr = opVector.begin() ;
|
||||
ptr != opVector.end() ; ++ptr )
|
||||
{
|
||||
if( ptr->first )
|
||||
{
|
||||
ptr->second->setModeH() ;
|
||||
}
|
||||
else
|
||||
{
|
||||
ptr->second->removeModeH() ;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Channel::onModeV( const vector< std::pair< bool, ChannelUser* > >&
|
||||
voiceVector )
|
||||
{
|
||||
typedef vector< std::pair< bool, ChannelUser* > > voiceVectorType ;
|
||||
for( voiceVectorType::const_iterator ptr = voiceVector.begin() ;
|
||||
ptr != voiceVector.end() ; ++ptr )
|
||||
{
|
||||
if( ptr->first )
|
||||
{
|
||||
ptr->second->setModeV() ;
|
||||
}
|
||||
else
|
||||
{
|
||||
ptr->second->removeModeV() ;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* The banVector passed to this method will be updated to
|
||||
* include any bans that have been removed as a result
|
||||
* of overlapping bans being added.
|
||||
* The order of these additions will be as expected:
|
||||
* an overlapping ban will be put into the banVector,
|
||||
* followed by all bans that it overrides.
|
||||
*/
|
||||
void Channel::onModeB( xServer::banVectorType& banVector )
|
||||
{
|
||||
typedef xServer::banVectorType banVectorType ;
|
||||
|
||||
banVectorType origBans( banVector ) ;
|
||||
banVector.clear() ;
|
||||
|
||||
// Walk through the list of bans being removed/added
|
||||
for( banVectorType::const_iterator newBanPtr = origBans.begin() ;
|
||||
newBanPtr != origBans.end() ; ++newBanPtr )
|
||||
{
|
||||
banVector.push_back( *newBanPtr ) ;
|
||||
|
||||
// Is the ban being set or removed?
|
||||
if( !newBanPtr->first )
|
||||
{
|
||||
// Removing a ban
|
||||
removeBan( newBanPtr->second ) ;
|
||||
continue ;
|
||||
}
|
||||
|
||||
// Setting a ban
|
||||
// Need to check the list of current bans for overlaps
|
||||
// This is grossly inefficient, Im open to suggestions
|
||||
|
||||
// Next, search for overlaps
|
||||
banIterator currentBanPtr = banList_begin() ;
|
||||
for( ; currentBanPtr != banList_end() ; )
|
||||
{
|
||||
if( !match( newBanPtr->second, *currentBanPtr ) )
|
||||
{
|
||||
// Add the removed ban to the banVector
|
||||
// so that the caller can notify the rest
|
||||
// of the system of the removal
|
||||
banVector.push_back( banVectorType::value_type(
|
||||
false, *currentBanPtr ) ) ;
|
||||
|
||||
// elog << "Channel::onModeB> Removing "
|
||||
// << "overlapping ban: "
|
||||
// << *currentBanPtr
|
||||
// << endl ;
|
||||
|
||||
// Overlap, remove the old ban
|
||||
currentBanPtr = banList.erase( currentBanPtr ) ;
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
// Update the iterator
|
||||
++currentBanPtr ;
|
||||
}
|
||||
} // inner for()
|
||||
|
||||
// Now set the new ban
|
||||
// Setting this ban will add the ban into
|
||||
// later comparisons, but not this comparison,
|
||||
// which is what we want.
|
||||
setBan( newBanPtr->second ) ;
|
||||
|
||||
} // outer for()
|
||||
}
|
||||
|
||||
const string Channel::getModeString() const
|
||||
{
|
||||
string modeString( "+" ) ;
|
||||
string argString ;
|
||||
|
||||
if( modes & MODE_T ) modeString += 't' ;
|
||||
if( modes & MODE_N ) modeString += 'n' ;
|
||||
if( modes & MODE_S ) modeString += 's' ;
|
||||
if( modes & MODE_P ) modeString += 'p' ;
|
||||
if( modes & MODE_M ) modeString += 'm' ;
|
||||
if( modes & MODE_I ) modeString += 'i' ;
|
||||
if( modes & MODE_R ) modeString += 'r' ;
|
||||
if( modes & MODE_REG ) modeString += 'R' ;
|
||||
if( modes & MODE_D ) modeString += 'D' ;
|
||||
|
||||
if( modes & MODE_K )
|
||||
{
|
||||
modeString += 'k' ;
|
||||
argString += getKey() + ' ' ;
|
||||
}
|
||||
|
||||
if( modes & MODE_L )
|
||||
{
|
||||
modeString += 'l' ;
|
||||
|
||||
// Can't put numerical variables into a string
|
||||
stringstream s ;
|
||||
s << getLimit() ;
|
||||
|
||||
argString += s.str() ;
|
||||
}
|
||||
|
||||
if( modes & MODE_A )
|
||||
{
|
||||
modeString += 'A' ;
|
||||
argString += getApass() + ' ' ;
|
||||
}
|
||||
|
||||
if( modes & MODE_U )
|
||||
{
|
||||
modeString += 'U' ;
|
||||
argString += getUpass() + ' ' ;
|
||||
}
|
||||
|
||||
|
||||
return (modeString + ' ' + argString) ;
|
||||
}
|
||||
|
||||
string Channel::createBan( const iClient* theClient )
|
||||
{
|
||||
assert( theClient != 0 ) ;
|
||||
|
||||
string theBan = "*!*" ;
|
||||
|
||||
// If we're +x, don't bother with the user name either.
|
||||
if(!theClient->isModeX())
|
||||
{
|
||||
// Don't include the '~'
|
||||
if( (theClient->getUserName().size() >= 2) &&
|
||||
('~' == theClient->getUserName()[ 0 ]) )
|
||||
{
|
||||
theBan += theClient->getUserName().c_str() + 1 ;
|
||||
}
|
||||
else if( !theClient->getUserName().empty() )
|
||||
{
|
||||
theBan += theClient->getUserName() ;
|
||||
}
|
||||
}
|
||||
|
||||
theBan += '@' ;
|
||||
|
||||
StringTokenizer st( theClient->getInsecureHost(), '.' ) ;
|
||||
if( ConnectionManager::isIpAddress( theClient->getInsecureHost() ) )
|
||||
{
|
||||
theBan += st[ 0 ] + '.' ;
|
||||
theBan += st[ 1 ] + '.' ;
|
||||
theBan += st[ 2 ] + ".*" ;
|
||||
}
|
||||
else
|
||||
{
|
||||
if( (2 == st.size()) || theClient->isModeX() )
|
||||
{
|
||||
theBan += theClient->getInsecureHost() ;
|
||||
}
|
||||
else
|
||||
{
|
||||
theBan += "*." + st.assemble( 1 ) ;
|
||||
}
|
||||
}
|
||||
|
||||
return theBan ;
|
||||
}
|
||||
|
||||
string Channel::createUniformBan( const iClient* theClient )
|
||||
{
|
||||
assert( theClient != 0 ) ;
|
||||
|
||||
string theBan;
|
||||
if (theClient->isModeX())
|
||||
{
|
||||
if (theClient->isModeR())
|
||||
theBan = "*!*@" + theClient->getAccount() + theClient->getHiddenHostSuffix();
|
||||
else if ((!theClient->getCloakIP().empty()) || (!theClient->getCloakHost().empty()))
|
||||
{
|
||||
if (!theClient->getCloakIP().empty())
|
||||
theBan = "*!*@" + theClient->getCloakIP();
|
||||
if (!theClient->getCloakHost().empty())
|
||||
theBan = "*!*@" + theClient->getCloakHost();
|
||||
}
|
||||
else
|
||||
theBan = "*!*@" + theClient->getAccount() + theClient->getHiddenHostSuffix();
|
||||
}
|
||||
else
|
||||
{
|
||||
theBan = "*!*@" + theClient->getInsecureHost();
|
||||
}
|
||||
|
||||
return theBan ;
|
||||
}
|
||||
|
||||
void Channel::removeAllModes()
|
||||
{
|
||||
for( userIterator uItr = userList_begin() ; uItr != userList_end() ;
|
||||
++uItr )
|
||||
{
|
||||
ChannelUser* theUser = uItr->second ;
|
||||
assert( theUser != 0 ) ;
|
||||
|
||||
theUser->removeModeO() ;
|
||||
theUser->removeModeV() ;
|
||||
}
|
||||
modes = 0 ;
|
||||
limit = 0 ;
|
||||
#if __GNUC__ == 2
|
||||
key = "";
|
||||
Apass = "";
|
||||
Upass = "";
|
||||
#else
|
||||
key.clear();
|
||||
Apass.clear();
|
||||
Upass.clear();
|
||||
#endif
|
||||
}
|
||||
|
||||
} // namespace gnuworld
|
||||
@@ -0,0 +1,144 @@
|
||||
/**
|
||||
* ChannelUser.cc
|
||||
* Copyright (C) 2002 Daniel Karrels <dan@karrels.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
|
||||
* USA.
|
||||
*
|
||||
* $Id: ChannelUser.cc,v 1.10 2009/07/26 18:30:37 mrbean_ Exp $
|
||||
*/
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include <cassert>
|
||||
|
||||
#include "iClient.h"
|
||||
#include "ChannelUser.h"
|
||||
|
||||
RCSTAG("$Id: ChannelUser.cc,v 1.10 2009/07/26 18:30:37 mrbean_ Exp $" ) ;
|
||||
|
||||
namespace gnuworld
|
||||
{
|
||||
|
||||
using std::string ;
|
||||
|
||||
const ChannelUser::modeType ChannelUser::MODE_O = 0x01 ;
|
||||
const ChannelUser::modeType ChannelUser::MODE_H = 0x02 ;
|
||||
//const ChannelUser::modeType ChannelUser::ZOMBIE = 0x04 ;
|
||||
const ChannelUser::modeType ChannelUser::MODE_V = 0x04 ;
|
||||
|
||||
ChannelUser::ChannelUser( iClient* _theClient )
|
||||
: theClient( _theClient ),
|
||||
modes( 0 ),
|
||||
madeOpMode(false)
|
||||
{
|
||||
assert( theClient != 0 ) ;
|
||||
}
|
||||
|
||||
ChannelUser::~ChannelUser()
|
||||
{}
|
||||
|
||||
const string& ChannelUser::getNickName() const
|
||||
{
|
||||
return theClient->getNickName() ;
|
||||
}
|
||||
|
||||
const string& ChannelUser::getUserName() const
|
||||
{
|
||||
return theClient->getUserName() ;
|
||||
}
|
||||
|
||||
const string& ChannelUser::getHostName() const
|
||||
{
|
||||
return theClient->getInsecureHost() ;
|
||||
}
|
||||
|
||||
const unsigned int& ChannelUser::getIP() const
|
||||
{
|
||||
return theClient->getIP() ;
|
||||
}
|
||||
|
||||
const string ChannelUser::getCharYYXXX() const
|
||||
{
|
||||
return theClient->getCharYYXXX() ;
|
||||
}
|
||||
|
||||
unsigned int ChannelUser::getIntYY() const
|
||||
{
|
||||
return theClient->getIntYY() ;
|
||||
}
|
||||
|
||||
unsigned int ChannelUser::getIntXXX() const
|
||||
{
|
||||
return theClient->getIntXXX() ;
|
||||
}
|
||||
|
||||
unsigned int ChannelUser::getIntYYXXX() const
|
||||
{
|
||||
return theClient->getIntYYXXX() ;
|
||||
}
|
||||
|
||||
bool ChannelUser::isOper() const
|
||||
{
|
||||
return theClient->isOper() ;
|
||||
}
|
||||
|
||||
void ChannelUser::setMadeOpMode()
|
||||
{
|
||||
madeOpMode = true;
|
||||
return;
|
||||
}
|
||||
|
||||
void ChannelUser::removeMadeOpMode()
|
||||
{
|
||||
madeOpMode = false;
|
||||
return;
|
||||
}
|
||||
|
||||
string ChannelUser::getModeString() const
|
||||
{
|
||||
std::vector< string > modes ;
|
||||
|
||||
if( isOper() )
|
||||
{
|
||||
modes.push_back( "oper" ) ;
|
||||
}
|
||||
if( isModeV() )
|
||||
{
|
||||
modes.push_back( "voice" ) ;
|
||||
}
|
||||
if( isModeH() )
|
||||
{
|
||||
modes.push_back( "halfop" ) ;
|
||||
}
|
||||
if( isModeO() )
|
||||
{
|
||||
modes.push_back( "op" ) ;
|
||||
}
|
||||
|
||||
string retMe ;
|
||||
for( std::vector< string >::size_type i = 0 ; i < modes.size() ; ++i )
|
||||
{
|
||||
retMe += modes[ i ] ;
|
||||
if( (i + 1) < modes.size() )
|
||||
{
|
||||
retMe += "," ;
|
||||
}
|
||||
}
|
||||
return retMe ;
|
||||
}
|
||||
|
||||
} // namespace gnuworld
|
||||
@@ -0,0 +1,57 @@
|
||||
/**
|
||||
* LoadClientTimerHandler.cc
|
||||
* Copyright (C) 2002 Daniel Karrels <dan@karrels.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
|
||||
* USA.
|
||||
*
|
||||
* $Id: LoadClientTimerHandler.cc,v 1.11 2005/01/12 03:50:37 dan_karrels Exp $
|
||||
*/
|
||||
|
||||
#include <iostream>
|
||||
|
||||
#include "LoadClientTimerHandler.h"
|
||||
#include "server.h"
|
||||
#include "ELog.h"
|
||||
#include "gnuworld_config.h"
|
||||
|
||||
RCSTAG( "$Id: LoadClientTimerHandler.cc,v 1.11 2005/01/12 03:50:37 dan_karrels Exp $" ) ;
|
||||
|
||||
namespace gnuworld
|
||||
{
|
||||
|
||||
void LoadClientTimerHandler::OnTimer( const timerID&, void* )
|
||||
{
|
||||
//elog << "LoadClientTimerHandler::OnTimer("
|
||||
// << moduleName
|
||||
// << ", "
|
||||
// << configFileName
|
||||
// << ")"
|
||||
// << std::endl ;
|
||||
|
||||
// Load the client from the module, attach it to the server, and
|
||||
// burst it onto the network
|
||||
if( !theServer->AttachClient( moduleName, configFileName, true ) )
|
||||
{
|
||||
elog << "LoadClientTimer> Failed to load client module: "
|
||||
<< moduleName
|
||||
<< std::endl ;
|
||||
return ;
|
||||
}
|
||||
|
||||
delete this ;
|
||||
}
|
||||
|
||||
} // namespace gnuworld
|
||||
@@ -0,0 +1,33 @@
|
||||
## Process this file with automake to produce Makefile.in
|
||||
## $Id: Makefile.am,v 1.31 2009/06/24 17:39:44 mrbean_ Exp $
|
||||
|
||||
lib_LTLIBRARIES = libgnuworldcore.la
|
||||
libgnuworldcore_la_SOURCES = Channel.cc \
|
||||
ChannelUser.cc \
|
||||
LoadClientTimerHandler.cc \
|
||||
Network.cc \
|
||||
ServerTimerHandlers.cc \
|
||||
UnloadClientTimerHandler.cc \
|
||||
cidr.cc \
|
||||
client.cc \
|
||||
iClient.cc \
|
||||
iServer.cc \
|
||||
ip.cc \
|
||||
nickUserCidr.cc \
|
||||
server.cc \
|
||||
server_connection.cc \
|
||||
server_events.cc \
|
||||
server_glines.cc \
|
||||
server_timers.cc
|
||||
libgnuworldcore_la_CXXFLAGS = -I${top_srcdir}/include \
|
||||
-I${top_srcdir}/libgnuworld
|
||||
libgnuworldcore_la_DEPENDENCIES = $(LIBGNUWORLD) $(LIBLTDL)
|
||||
libgnuworldcore_la_LDFLAGS = $(LIBGNUWORLD) $(LIBLTDL) -export-dynamic
|
||||
|
||||
bin_PROGRAMS = gnuworld
|
||||
gnuworld_SOURCES = main.cc
|
||||
|
||||
gnuworld_CXXFLAGS = -I${top_srcdir}/include -I${top_srcdir}/libgnuworld
|
||||
gnuworld_LDFLAGS = libgnuworldcore.la $(LIBLTDL) -export-dynamic \
|
||||
$(threadLib) $(LIBGNUWORLD)
|
||||
gnuworld_DEPENDENCIES = $(LIBGNUWORLD) $(LIBLTDL) libgnuworldcore.la
|
||||
+785
@@ -0,0 +1,785 @@
|
||||
# Makefile.in generated by automake 1.11.1 from Makefile.am.
|
||||
# @configure_input@
|
||||
|
||||
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
|
||||
# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation,
|
||||
# Inc.
|
||||
# This Makefile.in is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
|
||||
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||
# PARTICULAR PURPOSE.
|
||||
|
||||
@SET_MAKE@
|
||||
|
||||
|
||||
VPATH = @srcdir@
|
||||
pkgdatadir = $(datadir)/@PACKAGE@
|
||||
pkgincludedir = $(includedir)/@PACKAGE@
|
||||
pkglibdir = $(libdir)/@PACKAGE@
|
||||
pkglibexecdir = $(libexecdir)/@PACKAGE@
|
||||
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
|
||||
install_sh_DATA = $(install_sh) -c -m 644
|
||||
install_sh_PROGRAM = $(install_sh) -c
|
||||
install_sh_SCRIPT = $(install_sh) -c
|
||||
INSTALL_HEADER = $(INSTALL_DATA)
|
||||
transform = $(program_transform_name)
|
||||
NORMAL_INSTALL = :
|
||||
PRE_INSTALL = :
|
||||
POST_INSTALL = :
|
||||
NORMAL_UNINSTALL = :
|
||||
PRE_UNINSTALL = :
|
||||
POST_UNINSTALL = :
|
||||
build_triplet = @build@
|
||||
host_triplet = @host@
|
||||
bin_PROGRAMS = gnuworld$(EXEEXT)
|
||||
subdir = src
|
||||
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
|
||||
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
|
||||
am__aclocal_m4_deps = $(top_srcdir)/ac_cxx_namespaces.m4 \
|
||||
$(top_srcdir)/ax_boost_thread.m4 $(top_srcdir)/configure.ac
|
||||
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
|
||||
$(ACLOCAL_M4)
|
||||
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
|
||||
CONFIG_HEADER = $(top_builddir)/include/defs.h
|
||||
CONFIG_CLEAN_FILES =
|
||||
CONFIG_CLEAN_VPATH_FILES =
|
||||
am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
|
||||
am__vpath_adj = case $$p in \
|
||||
$(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
|
||||
*) f=$$p;; \
|
||||
esac;
|
||||
am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`;
|
||||
am__install_max = 40
|
||||
am__nobase_strip_setup = \
|
||||
srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'`
|
||||
am__nobase_strip = \
|
||||
for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||"
|
||||
am__nobase_list = $(am__nobase_strip_setup); \
|
||||
for p in $$list; do echo "$$p $$p"; done | \
|
||||
sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \
|
||||
$(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \
|
||||
if (++n[$$2] == $(am__install_max)) \
|
||||
{ print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \
|
||||
END { for (dir in files) print dir, files[dir] }'
|
||||
am__base_list = \
|
||||
sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
|
||||
sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
|
||||
am__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(bindir)"
|
||||
LTLIBRARIES = $(lib_LTLIBRARIES)
|
||||
libgnuworldcore_la_LIBADD =
|
||||
am_libgnuworldcore_la_OBJECTS = libgnuworldcore_la-Channel.lo \
|
||||
libgnuworldcore_la-ChannelUser.lo \
|
||||
libgnuworldcore_la-LoadClientTimerHandler.lo \
|
||||
libgnuworldcore_la-Network.lo \
|
||||
libgnuworldcore_la-ServerTimerHandlers.lo \
|
||||
libgnuworldcore_la-UnloadClientTimerHandler.lo \
|
||||
libgnuworldcore_la-cidr.lo libgnuworldcore_la-client.lo \
|
||||
libgnuworldcore_la-iClient.lo libgnuworldcore_la-iServer.lo \
|
||||
libgnuworldcore_la-ip.lo libgnuworldcore_la-nickUserCidr.lo \
|
||||
libgnuworldcore_la-server.lo \
|
||||
libgnuworldcore_la-server_connection.lo \
|
||||
libgnuworldcore_la-server_events.lo \
|
||||
libgnuworldcore_la-server_glines.lo \
|
||||
libgnuworldcore_la-server_timers.lo
|
||||
libgnuworldcore_la_OBJECTS = $(am_libgnuworldcore_la_OBJECTS)
|
||||
libgnuworldcore_la_LINK = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) \
|
||||
$(LIBTOOLFLAGS) --mode=link $(CXXLD) \
|
||||
$(libgnuworldcore_la_CXXFLAGS) $(CXXFLAGS) \
|
||||
$(libgnuworldcore_la_LDFLAGS) $(LDFLAGS) -o $@
|
||||
PROGRAMS = $(bin_PROGRAMS)
|
||||
am_gnuworld_OBJECTS = gnuworld-main.$(OBJEXT)
|
||||
gnuworld_OBJECTS = $(am_gnuworld_OBJECTS)
|
||||
gnuworld_LDADD = $(LDADD)
|
||||
gnuworld_LINK = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) \
|
||||
$(LIBTOOLFLAGS) --mode=link $(CXXLD) $(gnuworld_CXXFLAGS) \
|
||||
$(CXXFLAGS) $(gnuworld_LDFLAGS) $(LDFLAGS) -o $@
|
||||
DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/include
|
||||
depcomp = $(SHELL) $(top_srcdir)/depcomp
|
||||
am__depfiles_maybe = depfiles
|
||||
am__mv = mv -f
|
||||
CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
|
||||
$(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
|
||||
LTCXXCOMPILE = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
|
||||
--mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
|
||||
$(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
|
||||
CXXLD = $(CXX)
|
||||
CXXLINK = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
|
||||
--mode=link $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) \
|
||||
$(LDFLAGS) -o $@
|
||||
SOURCES = $(libgnuworldcore_la_SOURCES) $(gnuworld_SOURCES)
|
||||
DIST_SOURCES = $(libgnuworldcore_la_SOURCES) $(gnuworld_SOURCES)
|
||||
ETAGS = etags
|
||||
CTAGS = ctags
|
||||
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
|
||||
ACLOCAL = @ACLOCAL@
|
||||
AMTAR = @AMTAR@
|
||||
AR = @AR@
|
||||
AUTOCONF = @AUTOCONF@
|
||||
AUTOHEADER = @AUTOHEADER@
|
||||
AUTOMAKE = @AUTOMAKE@
|
||||
AWK = @AWK@
|
||||
BOOST_THREAD_LIB = @BOOST_THREAD_LIB@
|
||||
CC = @CC@
|
||||
CCDEPMODE = @CCDEPMODE@
|
||||
CFLAGS = @CFLAGS@
|
||||
CPP = @CPP@
|
||||
CPPFLAGS = @CPPFLAGS@
|
||||
CXX = @CXX@
|
||||
CXXCPP = @CXXCPP@
|
||||
CXXDEPMODE = @CXXDEPMODE@
|
||||
CXXFLAGS = @CXXFLAGS@
|
||||
CYGPATH_W = @CYGPATH_W@
|
||||
DEFS = @DEFS@
|
||||
DEPDIR = @DEPDIR@
|
||||
DLLTOOL = @DLLTOOL@
|
||||
DSYMUTIL = @DSYMUTIL@
|
||||
DUMPBIN = @DUMPBIN@
|
||||
ECHO_C = @ECHO_C@
|
||||
ECHO_N = @ECHO_N@
|
||||
ECHO_T = @ECHO_T@
|
||||
EGREP = @EGREP@
|
||||
EXEEXT = @EXEEXT@
|
||||
FGREP = @FGREP@
|
||||
GREP = @GREP@
|
||||
INCLTDL = @INCLTDL@
|
||||
INSTALL = @INSTALL@
|
||||
INSTALL_DATA = @INSTALL_DATA@
|
||||
INSTALL_PROGRAM = @INSTALL_PROGRAM@
|
||||
INSTALL_SCRIPT = @INSTALL_SCRIPT@
|
||||
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
|
||||
LD = @LD@
|
||||
LDFLAGS = @LDFLAGS@
|
||||
LIBGNUWORLD = @LIBGNUWORLD@
|
||||
LIBLTDL = @LIBLTDL@
|
||||
LIBOBJS = @LIBOBJS@
|
||||
LIBS = @LIBS@
|
||||
LIBTOOL = @LIBTOOL@
|
||||
LIBTOOL_DEPS = @LIBTOOL_DEPS@
|
||||
LIPO = @LIPO@
|
||||
LN_S = @LN_S@
|
||||
LTDLDEPS = @LTDLDEPS@
|
||||
LTDLINCL = @LTDLINCL@
|
||||
LTLIBOBJS = @LTLIBOBJS@
|
||||
MAINT = @MAINT@
|
||||
MAKEINFO = @MAKEINFO@
|
||||
MANIFEST_TOOL = @MANIFEST_TOOL@
|
||||
MKDIR_P = @MKDIR_P@
|
||||
NEW_MODS = @NEW_MODS@
|
||||
NM = @NM@
|
||||
NMEDIT = @NMEDIT@
|
||||
OBJDUMP = @OBJDUMP@
|
||||
OBJEXT = @OBJEXT@
|
||||
OTOOL = @OTOOL@
|
||||
OTOOL64 = @OTOOL64@
|
||||
PACKAGE = @PACKAGE@
|
||||
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
|
||||
PACKAGE_NAME = @PACKAGE_NAME@
|
||||
PACKAGE_STRING = @PACKAGE_STRING@
|
||||
PACKAGE_TARNAME = @PACKAGE_TARNAME@
|
||||
PACKAGE_URL = @PACKAGE_URL@
|
||||
PACKAGE_VERSION = @PACKAGE_VERSION@
|
||||
PATH_SEPARATOR = @PATH_SEPARATOR@
|
||||
RANLIB = @RANLIB@
|
||||
SED = @SED@
|
||||
SET_MAKE = @SET_MAKE@
|
||||
SHELL = @SHELL@
|
||||
STRIP = @STRIP@
|
||||
VERSION = @VERSION@
|
||||
abs_builddir = @abs_builddir@
|
||||
abs_srcdir = @abs_srcdir@
|
||||
abs_top_builddir = @abs_top_builddir@
|
||||
abs_top_srcdir = @abs_top_srcdir@
|
||||
ac_ct_AR = @ac_ct_AR@
|
||||
ac_ct_CC = @ac_ct_CC@
|
||||
ac_ct_CXX = @ac_ct_CXX@
|
||||
ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
|
||||
am__include = @am__include@
|
||||
am__leading_dot = @am__leading_dot@
|
||||
am__quote = @am__quote@
|
||||
am__tar = @am__tar@
|
||||
am__untar = @am__untar@
|
||||
bindir = @bindir@
|
||||
build = @build@
|
||||
build_alias = @build_alias@
|
||||
build_cpu = @build_cpu@
|
||||
build_os = @build_os@
|
||||
build_vendor = @build_vendor@
|
||||
builddir = @builddir@
|
||||
datadir = @datadir@
|
||||
datarootdir = @datarootdir@
|
||||
docdir = @docdir@
|
||||
dvidir = @dvidir@
|
||||
exec_prefix = @exec_prefix@
|
||||
host = @host@
|
||||
host_alias = @host_alias@
|
||||
host_cpu = @host_cpu@
|
||||
host_os = @host_os@
|
||||
host_vendor = @host_vendor@
|
||||
htmldir = @htmldir@
|
||||
includedir = @includedir@
|
||||
infodir = @infodir@
|
||||
install_sh = @install_sh@
|
||||
libdir = @libdir@
|
||||
libexecdir = @libexecdir@
|
||||
localedir = @localedir@
|
||||
localstatedir = @localstatedir@
|
||||
mandir = @mandir@
|
||||
mkdir_p = @mkdir_p@
|
||||
oldincludedir = @oldincludedir@
|
||||
pdfdir = @pdfdir@
|
||||
pgsql_includedir = @pgsql_includedir@
|
||||
pgsql_libdir = @pgsql_libdir@
|
||||
prefix = @prefix@
|
||||
program_transform_name = @program_transform_name@
|
||||
psdir = @psdir@
|
||||
sbindir = @sbindir@
|
||||
sharedstatedir = @sharedstatedir@
|
||||
srcdir = @srcdir@
|
||||
subdirs = @subdirs@
|
||||
sysconfdir = @sysconfdir@
|
||||
target_alias = @target_alias@
|
||||
threadLib = @threadLib@
|
||||
top_build_prefix = @top_build_prefix@
|
||||
top_builddir = @top_builddir@
|
||||
top_srcdir = @top_srcdir@
|
||||
lib_LTLIBRARIES = libgnuworldcore.la
|
||||
libgnuworldcore_la_SOURCES = Channel.cc \
|
||||
ChannelUser.cc \
|
||||
LoadClientTimerHandler.cc \
|
||||
Network.cc \
|
||||
ServerTimerHandlers.cc \
|
||||
UnloadClientTimerHandler.cc \
|
||||
cidr.cc \
|
||||
client.cc \
|
||||
iClient.cc \
|
||||
iServer.cc \
|
||||
ip.cc \
|
||||
nickUserCidr.cc \
|
||||
server.cc \
|
||||
server_connection.cc \
|
||||
server_events.cc \
|
||||
server_glines.cc \
|
||||
server_timers.cc
|
||||
|
||||
libgnuworldcore_la_CXXFLAGS = -I${top_srcdir}/include \
|
||||
-I${top_srcdir}/libgnuworld
|
||||
|
||||
libgnuworldcore_la_DEPENDENCIES = $(LIBGNUWORLD) $(LIBLTDL)
|
||||
libgnuworldcore_la_LDFLAGS = $(LIBGNUWORLD) $(LIBLTDL) -export-dynamic
|
||||
gnuworld_SOURCES = main.cc
|
||||
gnuworld_CXXFLAGS = -I${top_srcdir}/include -I${top_srcdir}/libgnuworld
|
||||
gnuworld_LDFLAGS = libgnuworldcore.la $(LIBLTDL) -export-dynamic \
|
||||
$(threadLib) $(LIBGNUWORLD)
|
||||
|
||||
gnuworld_DEPENDENCIES = $(LIBGNUWORLD) $(LIBLTDL) libgnuworldcore.la
|
||||
all: all-am
|
||||
|
||||
.SUFFIXES:
|
||||
.SUFFIXES: .cc .lo .o .obj
|
||||
$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps)
|
||||
@for dep in $?; do \
|
||||
case '$(am__configure_deps)' in \
|
||||
*$$dep*) \
|
||||
( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
|
||||
&& { if test -f $@; then exit 0; else break; fi; }; \
|
||||
exit 1;; \
|
||||
esac; \
|
||||
done; \
|
||||
echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/Makefile'; \
|
||||
$(am__cd) $(top_srcdir) && \
|
||||
$(AUTOMAKE) --gnu src/Makefile
|
||||
.PRECIOUS: Makefile
|
||||
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
|
||||
@case '$?' in \
|
||||
*config.status*) \
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
|
||||
*) \
|
||||
echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
|
||||
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
|
||||
esac;
|
||||
|
||||
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
|
||||
|
||||
$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
|
||||
$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
|
||||
$(am__aclocal_m4_deps):
|
||||
install-libLTLIBRARIES: $(lib_LTLIBRARIES)
|
||||
@$(NORMAL_INSTALL)
|
||||
test -z "$(libdir)" || $(MKDIR_P) "$(DESTDIR)$(libdir)"
|
||||
@list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \
|
||||
list2=; for p in $$list; do \
|
||||
if test -f $$p; then \
|
||||
list2="$$list2 $$p"; \
|
||||
else :; fi; \
|
||||
done; \
|
||||
test -z "$$list2" || { \
|
||||
echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(libdir)'"; \
|
||||
$(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(libdir)"; \
|
||||
}
|
||||
|
||||
uninstall-libLTLIBRARIES:
|
||||
@$(NORMAL_UNINSTALL)
|
||||
@list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \
|
||||
for p in $$list; do \
|
||||
$(am__strip_dir) \
|
||||
echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$f'"; \
|
||||
$(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/$$f"; \
|
||||
done
|
||||
|
||||
clean-libLTLIBRARIES:
|
||||
-test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES)
|
||||
@list='$(lib_LTLIBRARIES)'; for p in $$list; do \
|
||||
dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \
|
||||
test "$$dir" != "$$p" || dir=.; \
|
||||
echo "rm -f \"$${dir}/so_locations\""; \
|
||||
rm -f "$${dir}/so_locations"; \
|
||||
done
|
||||
libgnuworldcore.la: $(libgnuworldcore_la_OBJECTS) $(libgnuworldcore_la_DEPENDENCIES)
|
||||
$(libgnuworldcore_la_LINK) -rpath $(libdir) $(libgnuworldcore_la_OBJECTS) $(libgnuworldcore_la_LIBADD) $(LIBS)
|
||||
install-binPROGRAMS: $(bin_PROGRAMS)
|
||||
@$(NORMAL_INSTALL)
|
||||
test -z "$(bindir)" || $(MKDIR_P) "$(DESTDIR)$(bindir)"
|
||||
@list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \
|
||||
for p in $$list; do echo "$$p $$p"; done | \
|
||||
sed 's/$(EXEEXT)$$//' | \
|
||||
while read p p1; do if test -f $$p || test -f $$p1; \
|
||||
then echo "$$p"; echo "$$p"; else :; fi; \
|
||||
done | \
|
||||
sed -e 'p;s,.*/,,;n;h' -e 's|.*|.|' \
|
||||
-e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \
|
||||
sed 'N;N;N;s,\n, ,g' | \
|
||||
$(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \
|
||||
{ d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \
|
||||
if ($$2 == $$4) files[d] = files[d] " " $$1; \
|
||||
else { print "f", $$3 "/" $$4, $$1; } } \
|
||||
END { for (d in files) print "f", d, files[d] }' | \
|
||||
while read type dir files; do \
|
||||
if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \
|
||||
test -z "$$files" || { \
|
||||
echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(bindir)$$dir'"; \
|
||||
$(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(bindir)$$dir" || exit $$?; \
|
||||
} \
|
||||
; done
|
||||
|
||||
uninstall-binPROGRAMS:
|
||||
@$(NORMAL_UNINSTALL)
|
||||
@list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \
|
||||
files=`for p in $$list; do echo "$$p"; done | \
|
||||
sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \
|
||||
-e 's/$$/$(EXEEXT)/' `; \
|
||||
test -n "$$list" || exit 0; \
|
||||
echo " ( cd '$(DESTDIR)$(bindir)' && rm -f" $$files ")"; \
|
||||
cd "$(DESTDIR)$(bindir)" && rm -f $$files
|
||||
|
||||
clean-binPROGRAMS:
|
||||
@list='$(bin_PROGRAMS)'; test -n "$$list" || exit 0; \
|
||||
echo " rm -f" $$list; \
|
||||
rm -f $$list || exit $$?; \
|
||||
test -n "$(EXEEXT)" || exit 0; \
|
||||
list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \
|
||||
echo " rm -f" $$list; \
|
||||
rm -f $$list
|
||||
gnuworld$(EXEEXT): $(gnuworld_OBJECTS) $(gnuworld_DEPENDENCIES)
|
||||
@rm -f gnuworld$(EXEEXT)
|
||||
$(gnuworld_LINK) $(gnuworld_OBJECTS) $(gnuworld_LDADD) $(LIBS)
|
||||
|
||||
mostlyclean-compile:
|
||||
-rm -f *.$(OBJEXT)
|
||||
|
||||
distclean-compile:
|
||||
-rm -f *.tab.c
|
||||
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gnuworld-main.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgnuworldcore_la-Channel.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgnuworldcore_la-ChannelUser.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgnuworldcore_la-LoadClientTimerHandler.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgnuworldcore_la-Network.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgnuworldcore_la-ServerTimerHandlers.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgnuworldcore_la-UnloadClientTimerHandler.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgnuworldcore_la-cidr.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgnuworldcore_la-client.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgnuworldcore_la-iClient.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgnuworldcore_la-iServer.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgnuworldcore_la-ip.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgnuworldcore_la-nickUserCidr.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgnuworldcore_la-server.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgnuworldcore_la-server_connection.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgnuworldcore_la-server_events.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgnuworldcore_la-server_glines.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgnuworldcore_la-server_timers.Plo@am__quote@
|
||||
|
||||
.cc.o:
|
||||
@am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
|
||||
@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
|
||||
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ $<
|
||||
|
||||
.cc.obj:
|
||||
@am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
|
||||
@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
|
||||
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
|
||||
|
||||
.cc.lo:
|
||||
@am__fastdepCXX_TRUE@ $(LTCXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
|
||||
@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
|
||||
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCXX_FALSE@ $(LTCXXCOMPILE) -c -o $@ $<
|
||||
|
||||
libgnuworldcore_la-Channel.lo: Channel.cc
|
||||
@am__fastdepCXX_TRUE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgnuworldcore_la_CXXFLAGS) $(CXXFLAGS) -MT libgnuworldcore_la-Channel.lo -MD -MP -MF $(DEPDIR)/libgnuworldcore_la-Channel.Tpo -c -o libgnuworldcore_la-Channel.lo `test -f 'Channel.cc' || echo '$(srcdir)/'`Channel.cc
|
||||
@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libgnuworldcore_la-Channel.Tpo $(DEPDIR)/libgnuworldcore_la-Channel.Plo
|
||||
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='Channel.cc' object='libgnuworldcore_la-Channel.lo' libtool=yes @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgnuworldcore_la_CXXFLAGS) $(CXXFLAGS) -c -o libgnuworldcore_la-Channel.lo `test -f 'Channel.cc' || echo '$(srcdir)/'`Channel.cc
|
||||
|
||||
libgnuworldcore_la-ChannelUser.lo: ChannelUser.cc
|
||||
@am__fastdepCXX_TRUE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgnuworldcore_la_CXXFLAGS) $(CXXFLAGS) -MT libgnuworldcore_la-ChannelUser.lo -MD -MP -MF $(DEPDIR)/libgnuworldcore_la-ChannelUser.Tpo -c -o libgnuworldcore_la-ChannelUser.lo `test -f 'ChannelUser.cc' || echo '$(srcdir)/'`ChannelUser.cc
|
||||
@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libgnuworldcore_la-ChannelUser.Tpo $(DEPDIR)/libgnuworldcore_la-ChannelUser.Plo
|
||||
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='ChannelUser.cc' object='libgnuworldcore_la-ChannelUser.lo' libtool=yes @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgnuworldcore_la_CXXFLAGS) $(CXXFLAGS) -c -o libgnuworldcore_la-ChannelUser.lo `test -f 'ChannelUser.cc' || echo '$(srcdir)/'`ChannelUser.cc
|
||||
|
||||
libgnuworldcore_la-LoadClientTimerHandler.lo: LoadClientTimerHandler.cc
|
||||
@am__fastdepCXX_TRUE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgnuworldcore_la_CXXFLAGS) $(CXXFLAGS) -MT libgnuworldcore_la-LoadClientTimerHandler.lo -MD -MP -MF $(DEPDIR)/libgnuworldcore_la-LoadClientTimerHandler.Tpo -c -o libgnuworldcore_la-LoadClientTimerHandler.lo `test -f 'LoadClientTimerHandler.cc' || echo '$(srcdir)/'`LoadClientTimerHandler.cc
|
||||
@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libgnuworldcore_la-LoadClientTimerHandler.Tpo $(DEPDIR)/libgnuworldcore_la-LoadClientTimerHandler.Plo
|
||||
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='LoadClientTimerHandler.cc' object='libgnuworldcore_la-LoadClientTimerHandler.lo' libtool=yes @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgnuworldcore_la_CXXFLAGS) $(CXXFLAGS) -c -o libgnuworldcore_la-LoadClientTimerHandler.lo `test -f 'LoadClientTimerHandler.cc' || echo '$(srcdir)/'`LoadClientTimerHandler.cc
|
||||
|
||||
libgnuworldcore_la-Network.lo: Network.cc
|
||||
@am__fastdepCXX_TRUE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgnuworldcore_la_CXXFLAGS) $(CXXFLAGS) -MT libgnuworldcore_la-Network.lo -MD -MP -MF $(DEPDIR)/libgnuworldcore_la-Network.Tpo -c -o libgnuworldcore_la-Network.lo `test -f 'Network.cc' || echo '$(srcdir)/'`Network.cc
|
||||
@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libgnuworldcore_la-Network.Tpo $(DEPDIR)/libgnuworldcore_la-Network.Plo
|
||||
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='Network.cc' object='libgnuworldcore_la-Network.lo' libtool=yes @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgnuworldcore_la_CXXFLAGS) $(CXXFLAGS) -c -o libgnuworldcore_la-Network.lo `test -f 'Network.cc' || echo '$(srcdir)/'`Network.cc
|
||||
|
||||
libgnuworldcore_la-ServerTimerHandlers.lo: ServerTimerHandlers.cc
|
||||
@am__fastdepCXX_TRUE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgnuworldcore_la_CXXFLAGS) $(CXXFLAGS) -MT libgnuworldcore_la-ServerTimerHandlers.lo -MD -MP -MF $(DEPDIR)/libgnuworldcore_la-ServerTimerHandlers.Tpo -c -o libgnuworldcore_la-ServerTimerHandlers.lo `test -f 'ServerTimerHandlers.cc' || echo '$(srcdir)/'`ServerTimerHandlers.cc
|
||||
@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libgnuworldcore_la-ServerTimerHandlers.Tpo $(DEPDIR)/libgnuworldcore_la-ServerTimerHandlers.Plo
|
||||
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='ServerTimerHandlers.cc' object='libgnuworldcore_la-ServerTimerHandlers.lo' libtool=yes @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgnuworldcore_la_CXXFLAGS) $(CXXFLAGS) -c -o libgnuworldcore_la-ServerTimerHandlers.lo `test -f 'ServerTimerHandlers.cc' || echo '$(srcdir)/'`ServerTimerHandlers.cc
|
||||
|
||||
libgnuworldcore_la-UnloadClientTimerHandler.lo: UnloadClientTimerHandler.cc
|
||||
@am__fastdepCXX_TRUE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgnuworldcore_la_CXXFLAGS) $(CXXFLAGS) -MT libgnuworldcore_la-UnloadClientTimerHandler.lo -MD -MP -MF $(DEPDIR)/libgnuworldcore_la-UnloadClientTimerHandler.Tpo -c -o libgnuworldcore_la-UnloadClientTimerHandler.lo `test -f 'UnloadClientTimerHandler.cc' || echo '$(srcdir)/'`UnloadClientTimerHandler.cc
|
||||
@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libgnuworldcore_la-UnloadClientTimerHandler.Tpo $(DEPDIR)/libgnuworldcore_la-UnloadClientTimerHandler.Plo
|
||||
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='UnloadClientTimerHandler.cc' object='libgnuworldcore_la-UnloadClientTimerHandler.lo' libtool=yes @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgnuworldcore_la_CXXFLAGS) $(CXXFLAGS) -c -o libgnuworldcore_la-UnloadClientTimerHandler.lo `test -f 'UnloadClientTimerHandler.cc' || echo '$(srcdir)/'`UnloadClientTimerHandler.cc
|
||||
|
||||
libgnuworldcore_la-cidr.lo: cidr.cc
|
||||
@am__fastdepCXX_TRUE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgnuworldcore_la_CXXFLAGS) $(CXXFLAGS) -MT libgnuworldcore_la-cidr.lo -MD -MP -MF $(DEPDIR)/libgnuworldcore_la-cidr.Tpo -c -o libgnuworldcore_la-cidr.lo `test -f 'cidr.cc' || echo '$(srcdir)/'`cidr.cc
|
||||
@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libgnuworldcore_la-cidr.Tpo $(DEPDIR)/libgnuworldcore_la-cidr.Plo
|
||||
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='cidr.cc' object='libgnuworldcore_la-cidr.lo' libtool=yes @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgnuworldcore_la_CXXFLAGS) $(CXXFLAGS) -c -o libgnuworldcore_la-cidr.lo `test -f 'cidr.cc' || echo '$(srcdir)/'`cidr.cc
|
||||
|
||||
libgnuworldcore_la-client.lo: client.cc
|
||||
@am__fastdepCXX_TRUE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgnuworldcore_la_CXXFLAGS) $(CXXFLAGS) -MT libgnuworldcore_la-client.lo -MD -MP -MF $(DEPDIR)/libgnuworldcore_la-client.Tpo -c -o libgnuworldcore_la-client.lo `test -f 'client.cc' || echo '$(srcdir)/'`client.cc
|
||||
@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libgnuworldcore_la-client.Tpo $(DEPDIR)/libgnuworldcore_la-client.Plo
|
||||
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='client.cc' object='libgnuworldcore_la-client.lo' libtool=yes @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgnuworldcore_la_CXXFLAGS) $(CXXFLAGS) -c -o libgnuworldcore_la-client.lo `test -f 'client.cc' || echo '$(srcdir)/'`client.cc
|
||||
|
||||
libgnuworldcore_la-iClient.lo: iClient.cc
|
||||
@am__fastdepCXX_TRUE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgnuworldcore_la_CXXFLAGS) $(CXXFLAGS) -MT libgnuworldcore_la-iClient.lo -MD -MP -MF $(DEPDIR)/libgnuworldcore_la-iClient.Tpo -c -o libgnuworldcore_la-iClient.lo `test -f 'iClient.cc' || echo '$(srcdir)/'`iClient.cc
|
||||
@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libgnuworldcore_la-iClient.Tpo $(DEPDIR)/libgnuworldcore_la-iClient.Plo
|
||||
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='iClient.cc' object='libgnuworldcore_la-iClient.lo' libtool=yes @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgnuworldcore_la_CXXFLAGS) $(CXXFLAGS) -c -o libgnuworldcore_la-iClient.lo `test -f 'iClient.cc' || echo '$(srcdir)/'`iClient.cc
|
||||
|
||||
libgnuworldcore_la-iServer.lo: iServer.cc
|
||||
@am__fastdepCXX_TRUE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgnuworldcore_la_CXXFLAGS) $(CXXFLAGS) -MT libgnuworldcore_la-iServer.lo -MD -MP -MF $(DEPDIR)/libgnuworldcore_la-iServer.Tpo -c -o libgnuworldcore_la-iServer.lo `test -f 'iServer.cc' || echo '$(srcdir)/'`iServer.cc
|
||||
@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libgnuworldcore_la-iServer.Tpo $(DEPDIR)/libgnuworldcore_la-iServer.Plo
|
||||
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='iServer.cc' object='libgnuworldcore_la-iServer.lo' libtool=yes @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgnuworldcore_la_CXXFLAGS) $(CXXFLAGS) -c -o libgnuworldcore_la-iServer.lo `test -f 'iServer.cc' || echo '$(srcdir)/'`iServer.cc
|
||||
|
||||
libgnuworldcore_la-ip.lo: ip.cc
|
||||
@am__fastdepCXX_TRUE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgnuworldcore_la_CXXFLAGS) $(CXXFLAGS) -MT libgnuworldcore_la-ip.lo -MD -MP -MF $(DEPDIR)/libgnuworldcore_la-ip.Tpo -c -o libgnuworldcore_la-ip.lo `test -f 'ip.cc' || echo '$(srcdir)/'`ip.cc
|
||||
@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libgnuworldcore_la-ip.Tpo $(DEPDIR)/libgnuworldcore_la-ip.Plo
|
||||
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='ip.cc' object='libgnuworldcore_la-ip.lo' libtool=yes @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgnuworldcore_la_CXXFLAGS) $(CXXFLAGS) -c -o libgnuworldcore_la-ip.lo `test -f 'ip.cc' || echo '$(srcdir)/'`ip.cc
|
||||
|
||||
libgnuworldcore_la-nickUserCidr.lo: nickUserCidr.cc
|
||||
@am__fastdepCXX_TRUE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgnuworldcore_la_CXXFLAGS) $(CXXFLAGS) -MT libgnuworldcore_la-nickUserCidr.lo -MD -MP -MF $(DEPDIR)/libgnuworldcore_la-nickUserCidr.Tpo -c -o libgnuworldcore_la-nickUserCidr.lo `test -f 'nickUserCidr.cc' || echo '$(srcdir)/'`nickUserCidr.cc
|
||||
@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libgnuworldcore_la-nickUserCidr.Tpo $(DEPDIR)/libgnuworldcore_la-nickUserCidr.Plo
|
||||
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='nickUserCidr.cc' object='libgnuworldcore_la-nickUserCidr.lo' libtool=yes @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgnuworldcore_la_CXXFLAGS) $(CXXFLAGS) -c -o libgnuworldcore_la-nickUserCidr.lo `test -f 'nickUserCidr.cc' || echo '$(srcdir)/'`nickUserCidr.cc
|
||||
|
||||
libgnuworldcore_la-server.lo: server.cc
|
||||
@am__fastdepCXX_TRUE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgnuworldcore_la_CXXFLAGS) $(CXXFLAGS) -MT libgnuworldcore_la-server.lo -MD -MP -MF $(DEPDIR)/libgnuworldcore_la-server.Tpo -c -o libgnuworldcore_la-server.lo `test -f 'server.cc' || echo '$(srcdir)/'`server.cc
|
||||
@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libgnuworldcore_la-server.Tpo $(DEPDIR)/libgnuworldcore_la-server.Plo
|
||||
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='server.cc' object='libgnuworldcore_la-server.lo' libtool=yes @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgnuworldcore_la_CXXFLAGS) $(CXXFLAGS) -c -o libgnuworldcore_la-server.lo `test -f 'server.cc' || echo '$(srcdir)/'`server.cc
|
||||
|
||||
libgnuworldcore_la-server_connection.lo: server_connection.cc
|
||||
@am__fastdepCXX_TRUE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgnuworldcore_la_CXXFLAGS) $(CXXFLAGS) -MT libgnuworldcore_la-server_connection.lo -MD -MP -MF $(DEPDIR)/libgnuworldcore_la-server_connection.Tpo -c -o libgnuworldcore_la-server_connection.lo `test -f 'server_connection.cc' || echo '$(srcdir)/'`server_connection.cc
|
||||
@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libgnuworldcore_la-server_connection.Tpo $(DEPDIR)/libgnuworldcore_la-server_connection.Plo
|
||||
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='server_connection.cc' object='libgnuworldcore_la-server_connection.lo' libtool=yes @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgnuworldcore_la_CXXFLAGS) $(CXXFLAGS) -c -o libgnuworldcore_la-server_connection.lo `test -f 'server_connection.cc' || echo '$(srcdir)/'`server_connection.cc
|
||||
|
||||
libgnuworldcore_la-server_events.lo: server_events.cc
|
||||
@am__fastdepCXX_TRUE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgnuworldcore_la_CXXFLAGS) $(CXXFLAGS) -MT libgnuworldcore_la-server_events.lo -MD -MP -MF $(DEPDIR)/libgnuworldcore_la-server_events.Tpo -c -o libgnuworldcore_la-server_events.lo `test -f 'server_events.cc' || echo '$(srcdir)/'`server_events.cc
|
||||
@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libgnuworldcore_la-server_events.Tpo $(DEPDIR)/libgnuworldcore_la-server_events.Plo
|
||||
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='server_events.cc' object='libgnuworldcore_la-server_events.lo' libtool=yes @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgnuworldcore_la_CXXFLAGS) $(CXXFLAGS) -c -o libgnuworldcore_la-server_events.lo `test -f 'server_events.cc' || echo '$(srcdir)/'`server_events.cc
|
||||
|
||||
libgnuworldcore_la-server_glines.lo: server_glines.cc
|
||||
@am__fastdepCXX_TRUE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgnuworldcore_la_CXXFLAGS) $(CXXFLAGS) -MT libgnuworldcore_la-server_glines.lo -MD -MP -MF $(DEPDIR)/libgnuworldcore_la-server_glines.Tpo -c -o libgnuworldcore_la-server_glines.lo `test -f 'server_glines.cc' || echo '$(srcdir)/'`server_glines.cc
|
||||
@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libgnuworldcore_la-server_glines.Tpo $(DEPDIR)/libgnuworldcore_la-server_glines.Plo
|
||||
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='server_glines.cc' object='libgnuworldcore_la-server_glines.lo' libtool=yes @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgnuworldcore_la_CXXFLAGS) $(CXXFLAGS) -c -o libgnuworldcore_la-server_glines.lo `test -f 'server_glines.cc' || echo '$(srcdir)/'`server_glines.cc
|
||||
|
||||
libgnuworldcore_la-server_timers.lo: server_timers.cc
|
||||
@am__fastdepCXX_TRUE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgnuworldcore_la_CXXFLAGS) $(CXXFLAGS) -MT libgnuworldcore_la-server_timers.lo -MD -MP -MF $(DEPDIR)/libgnuworldcore_la-server_timers.Tpo -c -o libgnuworldcore_la-server_timers.lo `test -f 'server_timers.cc' || echo '$(srcdir)/'`server_timers.cc
|
||||
@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libgnuworldcore_la-server_timers.Tpo $(DEPDIR)/libgnuworldcore_la-server_timers.Plo
|
||||
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='server_timers.cc' object='libgnuworldcore_la-server_timers.lo' libtool=yes @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgnuworldcore_la_CXXFLAGS) $(CXXFLAGS) -c -o libgnuworldcore_la-server_timers.lo `test -f 'server_timers.cc' || echo '$(srcdir)/'`server_timers.cc
|
||||
|
||||
gnuworld-main.o: main.cc
|
||||
@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(gnuworld_CXXFLAGS) $(CXXFLAGS) -MT gnuworld-main.o -MD -MP -MF $(DEPDIR)/gnuworld-main.Tpo -c -o gnuworld-main.o `test -f 'main.cc' || echo '$(srcdir)/'`main.cc
|
||||
@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/gnuworld-main.Tpo $(DEPDIR)/gnuworld-main.Po
|
||||
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='main.cc' object='gnuworld-main.o' libtool=no @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(gnuworld_CXXFLAGS) $(CXXFLAGS) -c -o gnuworld-main.o `test -f 'main.cc' || echo '$(srcdir)/'`main.cc
|
||||
|
||||
gnuworld-main.obj: main.cc
|
||||
@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(gnuworld_CXXFLAGS) $(CXXFLAGS) -MT gnuworld-main.obj -MD -MP -MF $(DEPDIR)/gnuworld-main.Tpo -c -o gnuworld-main.obj `if test -f 'main.cc'; then $(CYGPATH_W) 'main.cc'; else $(CYGPATH_W) '$(srcdir)/main.cc'; fi`
|
||||
@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/gnuworld-main.Tpo $(DEPDIR)/gnuworld-main.Po
|
||||
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='main.cc' object='gnuworld-main.obj' libtool=no @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(gnuworld_CXXFLAGS) $(CXXFLAGS) -c -o gnuworld-main.obj `if test -f 'main.cc'; then $(CYGPATH_W) 'main.cc'; else $(CYGPATH_W) '$(srcdir)/main.cc'; fi`
|
||||
|
||||
mostlyclean-libtool:
|
||||
-rm -f *.lo
|
||||
|
||||
clean-libtool:
|
||||
-rm -rf .libs _libs
|
||||
|
||||
ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
|
||||
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
|
||||
unique=`for i in $$list; do \
|
||||
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
|
||||
done | \
|
||||
$(AWK) '{ files[$$0] = 1; nonempty = 1; } \
|
||||
END { if (nonempty) { for (i in files) print i; }; }'`; \
|
||||
mkid -fID $$unique
|
||||
tags: TAGS
|
||||
|
||||
TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
|
||||
$(TAGS_FILES) $(LISP)
|
||||
set x; \
|
||||
here=`pwd`; \
|
||||
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
|
||||
unique=`for i in $$list; do \
|
||||
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
|
||||
done | \
|
||||
$(AWK) '{ files[$$0] = 1; nonempty = 1; } \
|
||||
END { if (nonempty) { for (i in files) print i; }; }'`; \
|
||||
shift; \
|
||||
if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
|
||||
test -n "$$unique" || unique=$$empty_fix; \
|
||||
if test $$# -gt 0; then \
|
||||
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
|
||||
"$$@" $$unique; \
|
||||
else \
|
||||
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
|
||||
$$unique; \
|
||||
fi; \
|
||||
fi
|
||||
ctags: CTAGS
|
||||
CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
|
||||
$(TAGS_FILES) $(LISP)
|
||||
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
|
||||
unique=`for i in $$list; do \
|
||||
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
|
||||
done | \
|
||||
$(AWK) '{ files[$$0] = 1; nonempty = 1; } \
|
||||
END { if (nonempty) { for (i in files) print i; }; }'`; \
|
||||
test -z "$(CTAGS_ARGS)$$unique" \
|
||||
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
|
||||
$$unique
|
||||
|
||||
GTAGS:
|
||||
here=`$(am__cd) $(top_builddir) && pwd` \
|
||||
&& $(am__cd) $(top_srcdir) \
|
||||
&& gtags -i $(GTAGS_ARGS) "$$here"
|
||||
|
||||
distclean-tags:
|
||||
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
|
||||
|
||||
distdir: $(DISTFILES)
|
||||
@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
|
||||
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
|
||||
list='$(DISTFILES)'; \
|
||||
dist_files=`for file in $$list; do echo $$file; done | \
|
||||
sed -e "s|^$$srcdirstrip/||;t" \
|
||||
-e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
|
||||
case $$dist_files in \
|
||||
*/*) $(MKDIR_P) `echo "$$dist_files" | \
|
||||
sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
|
||||
sort -u` ;; \
|
||||
esac; \
|
||||
for file in $$dist_files; do \
|
||||
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
|
||||
if test -d $$d/$$file; then \
|
||||
dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
|
||||
if test -d "$(distdir)/$$file"; then \
|
||||
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
|
||||
fi; \
|
||||
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
|
||||
cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
|
||||
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
|
||||
fi; \
|
||||
cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
|
||||
else \
|
||||
test -f "$(distdir)/$$file" \
|
||||
|| cp -p $$d/$$file "$(distdir)/$$file" \
|
||||
|| exit 1; \
|
||||
fi; \
|
||||
done
|
||||
check-am: all-am
|
||||
check: check-am
|
||||
all-am: Makefile $(LTLIBRARIES) $(PROGRAMS)
|
||||
install-binPROGRAMS: install-libLTLIBRARIES
|
||||
|
||||
installdirs:
|
||||
for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(bindir)"; do \
|
||||
test -z "$$dir" || $(MKDIR_P) "$$dir"; \
|
||||
done
|
||||
install: install-am
|
||||
install-exec: install-exec-am
|
||||
install-data: install-data-am
|
||||
uninstall: uninstall-am
|
||||
|
||||
install-am: all-am
|
||||
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
|
||||
|
||||
installcheck: installcheck-am
|
||||
install-strip:
|
||||
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
|
||||
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
|
||||
`test -z '$(STRIP)' || \
|
||||
echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
|
||||
mostlyclean-generic:
|
||||
|
||||
clean-generic:
|
||||
|
||||
distclean-generic:
|
||||
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
|
||||
-test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
|
||||
|
||||
maintainer-clean-generic:
|
||||
@echo "This command is intended for maintainers to use"
|
||||
@echo "it deletes files that may require special tools to rebuild."
|
||||
clean: clean-am
|
||||
|
||||
clean-am: clean-binPROGRAMS clean-generic clean-libLTLIBRARIES \
|
||||
clean-libtool mostlyclean-am
|
||||
|
||||
distclean: distclean-am
|
||||
-rm -rf ./$(DEPDIR)
|
||||
-rm -f Makefile
|
||||
distclean-am: clean-am distclean-compile distclean-generic \
|
||||
distclean-tags
|
||||
|
||||
dvi: dvi-am
|
||||
|
||||
dvi-am:
|
||||
|
||||
html: html-am
|
||||
|
||||
html-am:
|
||||
|
||||
info: info-am
|
||||
|
||||
info-am:
|
||||
|
||||
install-data-am:
|
||||
|
||||
install-dvi: install-dvi-am
|
||||
|
||||
install-dvi-am:
|
||||
|
||||
install-exec-am: install-binPROGRAMS install-libLTLIBRARIES
|
||||
|
||||
install-html: install-html-am
|
||||
|
||||
install-html-am:
|
||||
|
||||
install-info: install-info-am
|
||||
|
||||
install-info-am:
|
||||
|
||||
install-man:
|
||||
|
||||
install-pdf: install-pdf-am
|
||||
|
||||
install-pdf-am:
|
||||
|
||||
install-ps: install-ps-am
|
||||
|
||||
install-ps-am:
|
||||
|
||||
installcheck-am:
|
||||
|
||||
maintainer-clean: maintainer-clean-am
|
||||
-rm -rf ./$(DEPDIR)
|
||||
-rm -f Makefile
|
||||
maintainer-clean-am: distclean-am maintainer-clean-generic
|
||||
|
||||
mostlyclean: mostlyclean-am
|
||||
|
||||
mostlyclean-am: mostlyclean-compile mostlyclean-generic \
|
||||
mostlyclean-libtool
|
||||
|
||||
pdf: pdf-am
|
||||
|
||||
pdf-am:
|
||||
|
||||
ps: ps-am
|
||||
|
||||
ps-am:
|
||||
|
||||
uninstall-am: uninstall-binPROGRAMS uninstall-libLTLIBRARIES
|
||||
|
||||
.MAKE: install-am install-strip
|
||||
|
||||
.PHONY: CTAGS GTAGS all all-am check check-am clean clean-binPROGRAMS \
|
||||
clean-generic clean-libLTLIBRARIES clean-libtool ctags \
|
||||
distclean distclean-compile distclean-generic \
|
||||
distclean-libtool distclean-tags distdir dvi dvi-am html \
|
||||
html-am info info-am install install-am install-binPROGRAMS \
|
||||
install-data install-data-am install-dvi install-dvi-am \
|
||||
install-exec install-exec-am install-html install-html-am \
|
||||
install-info install-info-am install-libLTLIBRARIES \
|
||||
install-man install-pdf install-pdf-am install-ps \
|
||||
install-ps-am install-strip installcheck installcheck-am \
|
||||
installdirs maintainer-clean maintainer-clean-generic \
|
||||
mostlyclean mostlyclean-compile mostlyclean-generic \
|
||||
mostlyclean-libtool pdf pdf-am ps ps-am tags uninstall \
|
||||
uninstall-am uninstall-binPROGRAMS uninstall-libLTLIBRARIES
|
||||
|
||||
|
||||
# Tell versions [3.59,3.63) of GNU make to not export all variables.
|
||||
# Otherwise a system limit (for SysV at least) may be exceeded.
|
||||
.NOEXPORT:
|
||||
+1781
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,59 @@
|
||||
/**
|
||||
* ServerTimerHandlers.cc
|
||||
* Copyright (C) 2002 Daniel Karrels <dan@karrels.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
|
||||
* USA.
|
||||
*
|
||||
* $Id: ServerTimerHandlers.cc,v 1.11 2005/01/12 03:50:38 dan_karrels Exp $
|
||||
*/
|
||||
|
||||
#include <string>
|
||||
|
||||
#include <ctime>
|
||||
|
||||
#include "ServerTimerHandlers.h"
|
||||
#include "server.h"
|
||||
#include "ELog.h"
|
||||
#include "gnuworld_config.h"
|
||||
|
||||
RCSTAG( "$Id: ServerTimerHandlers.cc,v 1.11 2005/01/12 03:50:38 dan_karrels Exp $" ) ;
|
||||
|
||||
namespace gnuworld
|
||||
{
|
||||
|
||||
using std::string ;
|
||||
|
||||
void GlineUpdateTimer::OnTimer( const timerID& , void* )
|
||||
{
|
||||
// Remove any expired glines
|
||||
theServer->updateGlines() ;
|
||||
|
||||
// Re-register this timer
|
||||
theServer->RegisterTimer( ::time( 0 ) + updateInterval, this, 0 ) ;
|
||||
}
|
||||
|
||||
void PINGTimer::OnTimer( const timerID& , void* )
|
||||
{
|
||||
string writeMe( theServer->getCharYY() ) ;
|
||||
writeMe += " G :I am the King, bow before me!\n" ;
|
||||
|
||||
theServer->RegisterTimer( ::time( 0 ) + updateInterval, this, 0 ) ;
|
||||
|
||||
// Write to the network, even during bursting
|
||||
theServer->WriteDuringBurst( writeMe ) ;
|
||||
}
|
||||
|
||||
} // namespace gnuworld
|
||||
@@ -0,0 +1,47 @@
|
||||
/**
|
||||
* UnloadClientTiemrHandler.cc
|
||||
* Copyright (C) 2002 Daniel Karrels <dan@karrels.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
|
||||
* USA.
|
||||
*
|
||||
* $Id: UnloadClientTimerHandler.cc,v 1.9 2005/01/12 03:50:38 dan_karrels Exp $
|
||||
*/
|
||||
|
||||
#include <iostream>
|
||||
|
||||
#include "UnloadClientTimerHandler.h"
|
||||
#include "server.h"
|
||||
#include "ELog.h"
|
||||
#include "gnuworld_config.h"
|
||||
|
||||
RCSTAG( "$Id: UnloadClientTimerHandler.cc,v 1.9 2005/01/12 03:50:38 dan_karrels Exp $" ) ;
|
||||
|
||||
namespace gnuworld
|
||||
{
|
||||
|
||||
void UnloadClientTimerHandler::OnTimer( const timerID& , void* )
|
||||
{
|
||||
//elog << "UnloadClientTimerHandler::OnTimer("
|
||||
// << moduleName
|
||||
// << ")"
|
||||
// << std::endl ;
|
||||
|
||||
theServer->DetachClient( moduleName, reason ) ;
|
||||
|
||||
delete this ;
|
||||
}
|
||||
|
||||
} // namespace gnuworld
|
||||
@@ -0,0 +1 @@
|
||||
.arch-ids
|
||||
+125
@@ -0,0 +1,125 @@
|
||||
/**
|
||||
* cidr.cc
|
||||
* Copyright (C) 2002 Daniel Karrels <dan@karrels.com>
|
||||
* Orlando Bassotto
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
|
||||
* USA.
|
||||
*
|
||||
* $Id: cidr.cc,v 1.3 2009/07/26 18:30:37 mrbean_ Exp $
|
||||
*/
|
||||
|
||||
#include <string>
|
||||
#include <sstream>
|
||||
|
||||
#include <cstdio>
|
||||
#include <cstdlib>
|
||||
#include <cstring>
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
#include <netinet/in.h>
|
||||
#include <netdb.h>
|
||||
#include <arpa/inet.h>
|
||||
|
||||
|
||||
#include "cidr.h"
|
||||
#include "misc.h"
|
||||
#include "StringTokenizer.h"
|
||||
#include "gnuworld_config.h"
|
||||
|
||||
RCSTAG( "$Id: cidr.cc,v 1.3 2009/07/26 18:30:37 mrbean_ Exp $" ) ;
|
||||
|
||||
namespace gnuworld
|
||||
{
|
||||
|
||||
using std::string ;
|
||||
|
||||
xCIDR::xCIDR( const std::string& IP ) : str(IP), prefix(0)
|
||||
{
|
||||
std::size_t pos = IP.find_first_of("/");
|
||||
if(pos == string::npos || pos == IP.length()) //Failed to find / or its at the end of the string
|
||||
{
|
||||
valid = false;
|
||||
return;
|
||||
}
|
||||
if(!(valid = ExtractMask(IP.substr(pos+1))))
|
||||
{
|
||||
return;
|
||||
}
|
||||
unsigned int pref;
|
||||
|
||||
if(ExtractPrefix(IP.substr(0,pos),mask,pref) == 0)
|
||||
{
|
||||
valid = false;
|
||||
return;
|
||||
}
|
||||
prefix = xIP(ntohl(pref));
|
||||
valid = true;
|
||||
}
|
||||
|
||||
bool xCIDR::ExtractMask(const std::string& Mask)
|
||||
{
|
||||
if(Mask.length() ==0 || Mask.length() > 2) //Mask is maximum of 2 chars
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if(!IsNumeric(Mask))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
mask = atoi(Mask.c_str());
|
||||
return mask >=0 && mask <= 32; //Verify its in range
|
||||
}
|
||||
|
||||
bool xCIDR::ExtractPrefix(const std::string& Prefix,const unsigned int& Mask,unsigned int& pref)
|
||||
{
|
||||
StringTokenizer st(Prefix,'.');
|
||||
if(st.size() != 4) //Must have 4 parts
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
in_addr addr;
|
||||
|
||||
if(inet_aton(Prefix.c_str(),&addr) > 0)
|
||||
{
|
||||
unsigned int tAddr = htonl(addr.s_addr);
|
||||
int tMask = 0;
|
||||
for(unsigned int i=0; i < 32-Mask;i++) { //Build the mask
|
||||
tMask = tMask << 1;
|
||||
tMask = tMask + 1;
|
||||
}
|
||||
pref = tAddr & ~tMask; //extract the prefix
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool xCIDR::matches(const std::string& IP)
|
||||
{
|
||||
if(!valid)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
unsigned int clientIp;
|
||||
if(ExtractPrefix(IP,mask,clientIp) > 0)
|
||||
{
|
||||
return clientIp == prefix.GetLongIP();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
} // namespace gnuworld
|
||||
+2849
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1 @@
|
||||
.arch-ids
|
||||
+397
@@ -0,0 +1,397 @@
|
||||
/**
|
||||
* iClient.cc
|
||||
* Copyright (C) 2002 Daniel Karrels <dan@karrels.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
|
||||
* USA.
|
||||
*
|
||||
* $Id: iClient.cc,v 1.38 2007/05/26 09:41:24 mrbean_ Exp $
|
||||
*/
|
||||
|
||||
#include <new>
|
||||
#include <string>
|
||||
#include <iostream>
|
||||
#include <ctime>
|
||||
#include <map>
|
||||
#include <algorithm>
|
||||
|
||||
#include <cassert>
|
||||
|
||||
#include "iClient.h"
|
||||
#include "client.h"
|
||||
#include "ip.h"
|
||||
#include "gnuworld_config.h"
|
||||
#include "Network.h"
|
||||
|
||||
RCSTAG( "$Id: iClient.cc,v 1.38 2007/05/26 09:41:24 mrbean_ Exp $" ) ;
|
||||
|
||||
namespace gnuworld
|
||||
{
|
||||
|
||||
using std::string ;
|
||||
using std::map ;
|
||||
|
||||
const iClient::modeType iClient::MODE_OPER = 0x0001 ;
|
||||
const iClient::modeType iClient::MODE_WALLOPS = 0x0002 ;
|
||||
const iClient::modeType iClient::MODE_INVISIBLE = 0x0004 ;
|
||||
const iClient::modeType iClient::MODE_DEAF = 0x0008 ;
|
||||
const iClient::modeType iClient::MODE_SERVICES = 0x0010 ;
|
||||
const iClient::modeType iClient::MODE_REGISTERED = 0x0020 ;
|
||||
const iClient::modeType iClient::MODE_HIDDEN_HOST = 0x0040 ;
|
||||
const iClient::modeType iClient::MODE_G = 0x0080 ;
|
||||
const iClient::modeType iClient::MODE_SERVNOTICES = 0x0100 ;
|
||||
const iClient::modeType iClient::MODE_FAKE = 0x0200 ;
|
||||
const iClient::modeType iClient::MODE_FAKE_HOST = 0x0400 ;
|
||||
const iClient::modeType iClient::MODE_CLOAK_HOST = 0x0800 ;
|
||||
const iClient::modeType iClient::MODE_CLOAK_IP = 0x1000 ;
|
||||
|
||||
string iClient::hiddenHostSuffix( "we.all.worship.mrbean.org" ) ;
|
||||
|
||||
iClient::iClient( const unsigned int& /* _uplink */,
|
||||
const string& _yyxxx,
|
||||
const string& _nickName,
|
||||
const string& _userName,
|
||||
const string& _hostBase64,
|
||||
const string& _insecureHost,
|
||||
const string& _realInsecureHost,
|
||||
const string& _mode,
|
||||
const string& _account,
|
||||
const time_t _account_ts,
|
||||
const string& _description,
|
||||
const time_t& _connectTime )
|
||||
: NetworkTarget( _yyxxx ),
|
||||
nickName( _nickName ),
|
||||
userName( _userName ),
|
||||
IP( xIP( _hostBase64, true ).GetLongIP() ),
|
||||
insecureHost( _insecureHost ),
|
||||
realInsecureHost( _realInsecureHost ),
|
||||
description( _description),
|
||||
connectTime( _connectTime ),
|
||||
mode( 0 ),
|
||||
account( _account ),
|
||||
account_ts( _account_ts )
|
||||
{
|
||||
setModes( _mode ) ;
|
||||
customDataMap = 0 ;
|
||||
}
|
||||
|
||||
iClient::iClient( const unsigned int& /* _uplink */,
|
||||
const string& _yyxxx,
|
||||
const string& _nickName,
|
||||
const string& _userName,
|
||||
const string& _hostBase64,
|
||||
const string& _insecureHost,
|
||||
const string& _realInsecureHost,
|
||||
const string& _mode,
|
||||
const string& _account,
|
||||
const time_t _account_ts,
|
||||
const string& _setHost,
|
||||
const string& _fakeHost,
|
||||
const string& _description,
|
||||
const time_t& _connectTime )
|
||||
: NetworkTarget( _yyxxx ),
|
||||
nickName( _nickName ),
|
||||
userName( _userName ),
|
||||
IP( xIP( _hostBase64, true ).GetLongIP() ),
|
||||
insecureHost( _insecureHost ),
|
||||
realInsecureHost( _realInsecureHost ),
|
||||
description( _description),
|
||||
connectTime( _connectTime ),
|
||||
mode( 0 ),
|
||||
account( _account ),
|
||||
account_ts( _account_ts )
|
||||
#ifdef ASUKA
|
||||
,setHost( _setHost )
|
||||
#endif
|
||||
#ifdef SRVX
|
||||
,fakeHost( _fakeHost )
|
||||
#endif
|
||||
{
|
||||
#ifndef ASUKA
|
||||
(void) _setHost ;
|
||||
#endif
|
||||
#ifndef SRVX
|
||||
(void) _fakeHost ;
|
||||
#endif
|
||||
setModes( _mode ) ;
|
||||
customDataMap = 0 ;
|
||||
}
|
||||
|
||||
//Nefarios2 cloakedHost/IP case construction
|
||||
iClient::iClient( const unsigned int& /* _uplink */,
|
||||
const string& _yyxxx,
|
||||
const string& _nickName,
|
||||
const string& _userName,
|
||||
const string& _hostBase64,
|
||||
const string& _insecureHost,
|
||||
const string& _realInsecureHost,
|
||||
const string& _mode,
|
||||
const string& _account,
|
||||
const time_t _account_ts,
|
||||
const string& _description,
|
||||
const time_t& _connectTime,
|
||||
const std::string& _cloakHost,
|
||||
const std::string& _cloakIP,
|
||||
const string& _setHost,
|
||||
const string& _fakeHost)
|
||||
: NetworkTarget( _yyxxx ),
|
||||
nickName( _nickName ),
|
||||
userName( _userName ),
|
||||
IP( xIP( _hostBase64, true ).GetLongIP() ),
|
||||
insecureHost( _insecureHost ),
|
||||
realInsecureHost( _realInsecureHost ),
|
||||
description( _description),
|
||||
connectTime( _connectTime ),
|
||||
mode( 0 ),
|
||||
account( _account ),
|
||||
account_ts( _account_ts ),
|
||||
cloakHost(_cloakHost),
|
||||
cloakIP(_cloakIP),
|
||||
setHost( _setHost ),
|
||||
fakeHost( _fakeHost )
|
||||
{
|
||||
setModes( _mode ) ;
|
||||
customDataMap = 0 ;
|
||||
}
|
||||
|
||||
iClient::~iClient()
|
||||
{
|
||||
delete customDataMap ;
|
||||
customDataMap = 0 ;
|
||||
}
|
||||
|
||||
const iServer* iClient::getServer()
|
||||
{
|
||||
return Network->findServer(getIntYY());
|
||||
}
|
||||
void iClient::setModes( const string& newModes )
|
||||
{
|
||||
for( string::size_type i = 0 ; i < newModes.size() ; i++ )
|
||||
{
|
||||
switch( newModes[ i ] )
|
||||
{
|
||||
case 'o':
|
||||
case 'O':
|
||||
setModeO() ;
|
||||
break ;
|
||||
case 'i':
|
||||
case 'I':
|
||||
setModeI() ;
|
||||
break ;
|
||||
case 'w':
|
||||
case 'W':
|
||||
setModeW() ;
|
||||
break ;
|
||||
case 'k':
|
||||
case 'K':
|
||||
setModeK() ;
|
||||
break ;
|
||||
case 'd':
|
||||
case 'D':
|
||||
setModeD() ;
|
||||
break ;
|
||||
case 'g':
|
||||
setModeG() ;
|
||||
break ;
|
||||
case 'r':
|
||||
case 'R':
|
||||
setModeR() ;
|
||||
if (isModeR() && isModeX()) setHiddenHost();
|
||||
break ;
|
||||
case 'x':
|
||||
case 'X':
|
||||
setModeX() ;
|
||||
if (isModeR() && isModeX()) setHiddenHost();
|
||||
break ;
|
||||
case 'n':
|
||||
//TODO ?
|
||||
elog << "iClient::setModes> +n" << std::endl;
|
||||
break;
|
||||
case 'h':
|
||||
setModeH();
|
||||
break ;
|
||||
case 'f':
|
||||
setFakeHost(fakeHost);
|
||||
break ;
|
||||
case 'C':
|
||||
setModeC();
|
||||
break ;
|
||||
case 'c':
|
||||
setModec();
|
||||
break ;
|
||||
case '+':
|
||||
break ;
|
||||
default:
|
||||
// Unknown mode
|
||||
elog << "iClient> Unknown user mode: "
|
||||
<< newModes[ i ]
|
||||
<< ", in modes string: "
|
||||
<< newModes
|
||||
<< std::endl ;
|
||||
break ;
|
||||
} // switch
|
||||
} // for
|
||||
} // setModes()
|
||||
|
||||
bool iClient::removeChannel( Channel* theChan )
|
||||
{
|
||||
// No need to remove all duplicate channel instances, since
|
||||
// addChannel() guarantees that none exist
|
||||
for( channelIterator ptr = channelList.begin() ;
|
||||
ptr != channelList.end() ; ++ptr )
|
||||
{
|
||||
if( *ptr == theChan )
|
||||
{
|
||||
channelList.erase( ptr ) ;
|
||||
return true ;
|
||||
}
|
||||
}
|
||||
|
||||
// Channel not found
|
||||
return false ;
|
||||
}
|
||||
|
||||
const string iClient::getStringModes() const
|
||||
{
|
||||
string retMe( "+" ) ;
|
||||
|
||||
if( isModeO() ) retMe += 'o' ;
|
||||
if( isModeW() ) retMe += 'w' ;
|
||||
if( isModeI() ) retMe += 'i' ;
|
||||
if( isModeD() ) retMe += 'd' ;
|
||||
if( isModeK() ) retMe += 'k' ;
|
||||
if( isModeR() ) retMe += 'r' ;
|
||||
if( isModeX() ) retMe += 'x' ;
|
||||
if( isModeG() ) retMe += 'g' ;
|
||||
if( isModeF() ) retMe += 'f' ;
|
||||
if( isModeH() ) retMe += 'h' ;
|
||||
if( isModeC() ) retMe += 'C' ;
|
||||
if( isModec() ) retMe += 'c' ;
|
||||
|
||||
return retMe ;
|
||||
}
|
||||
|
||||
bool iClient::setCustomData( xClient* theClient, void* data )
|
||||
{
|
||||
assert( theClient != 0 ) ;
|
||||
|
||||
// Is the customDataMap empty?
|
||||
if( NULL == customDataMap )
|
||||
{
|
||||
// Yes, go ahead and allocate it
|
||||
customDataMap = new (std::nothrow) customDataMapType ;
|
||||
assert( customDataMap != 0 ) ;
|
||||
}
|
||||
|
||||
// Is this xClient already using its customDataMap slot?
|
||||
if( customDataMap->find( theClient ) != customDataMap->end() )
|
||||
{
|
||||
// Yes, return failure
|
||||
return false ;
|
||||
}
|
||||
|
||||
// Attempt to add this data into the customDataMap. Return the
|
||||
// success/failure of the operation
|
||||
return customDataMap->insert( customDataMapType::value_type(
|
||||
theClient, data ) ).second ;
|
||||
}
|
||||
|
||||
void* iClient::getCustomData( xClient* theClient ) const
|
||||
{
|
||||
assert( theClient != 0 ) ;
|
||||
|
||||
// Has the customDataMap been allocated?
|
||||
if( NULL == customDataMap )
|
||||
{
|
||||
// Nope, return NULL
|
||||
return 0 ;
|
||||
}
|
||||
|
||||
// Attempt to find this xClient's data element
|
||||
customDataMapType::const_iterator ptr =
|
||||
customDataMap->find( theClient ) ;
|
||||
|
||||
// Did we find the element?
|
||||
if( ptr == customDataMap->end() )
|
||||
{
|
||||
// Nope, return NULL
|
||||
return 0 ;
|
||||
}
|
||||
|
||||
// Found it, go ahead and return this xClient's data element
|
||||
return ptr->second ;
|
||||
}
|
||||
|
||||
void* iClient::removeCustomData( xClient* theClient )
|
||||
{
|
||||
assert( theClient != 0 ) ;
|
||||
|
||||
// Has the customDataMap been allocated?
|
||||
if( NULL == customDataMap )
|
||||
{
|
||||
// No, return NULL
|
||||
return 0 ;
|
||||
}
|
||||
|
||||
// Attempt to find this xClient's data element
|
||||
customDataMapType::iterator ptr = customDataMap->find( theClient ) ;
|
||||
|
||||
// Did we find it?
|
||||
if( ptr == customDataMap->end() )
|
||||
{
|
||||
// Nope, return NULL
|
||||
return 0 ;
|
||||
}
|
||||
|
||||
// Yes, we found this xClient's data element. Remove it from
|
||||
// the customDataMap
|
||||
customDataMap->erase( ptr ) ;
|
||||
|
||||
// The customDataMap may now be empty, but let it remain allocated.
|
||||
// Return the data element
|
||||
return ptr->second ;
|
||||
}
|
||||
|
||||
bool iClient::addChannel( Channel* theChan )
|
||||
{
|
||||
// This method is public, make sure the pointer is valid
|
||||
assert( theChan != 0 ) ;
|
||||
|
||||
if( std::find( channelList.begin(), channelList.end(), theChan )
|
||||
!= channelList.end() )
|
||||
{
|
||||
// Channel already found
|
||||
return false ;
|
||||
}
|
||||
|
||||
// Add the channel to the channelList
|
||||
channelList.push_front( theChan ) ;
|
||||
#ifdef TOPIC_TRACK
|
||||
/* initialise the topic data if topic_track is enabled */
|
||||
theChan->setTopicTS(0);
|
||||
theChan->setTopicWhoSet("");
|
||||
theChan->setTopic("");
|
||||
#endif
|
||||
return true ;
|
||||
}
|
||||
|
||||
bool iClient::findChannel( const Channel* theChan ) const
|
||||
{
|
||||
// Doesn't matter if theChan is NULL, it is never dereferenced
|
||||
return std::find( channelList.begin(), channelList.end(),
|
||||
theChan ) != channelList.end() ;
|
||||
}
|
||||
|
||||
} // namespace gnuworld
|
||||
@@ -0,0 +1,96 @@
|
||||
/**
|
||||
* iServer.cc
|
||||
* Copyright (C) 2002 Daniel Karrels <dan@karrels.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
|
||||
* USA.
|
||||
*
|
||||
* $Id: iServer.cc,v 1.11 2006/12/22 06:41:45 kewlio Exp $
|
||||
*/
|
||||
|
||||
#include <string>
|
||||
#include <ctime>
|
||||
|
||||
#include <cstring>
|
||||
|
||||
#include "iServer.h"
|
||||
#include "Numeric.h"
|
||||
#include "gnuworld_config.h"
|
||||
#include "NetworkTarget.h"
|
||||
|
||||
RCSTAG( "$Id: iServer.cc,v 1.11 2006/12/22 06:41:45 kewlio Exp $" ) ;
|
||||
|
||||
namespace gnuworld
|
||||
{
|
||||
|
||||
using std::string ;
|
||||
|
||||
const iServer::flagType iServer::FLAG_JUPE = 0x01 ;
|
||||
const iServer::flagType iServer::FLAG_HUB = 0x02 ;
|
||||
const iServer::flagType iServer::FLAG_SERVICE = 0x04 ;
|
||||
const iServer::flagType iServer::FLAG_IPV6 = 0x08 ;
|
||||
|
||||
iServer::iServer( const unsigned int& _uplink,
|
||||
const string& _yyxxx,
|
||||
const string& _name,
|
||||
const time_t& _connectTime,
|
||||
const string& _description )
|
||||
: NetworkTarget( _yyxxx ),
|
||||
uplinkIntYY( _uplink ),
|
||||
name( _name ),
|
||||
connectTime( _connectTime ),
|
||||
startTime( _connectTime ),
|
||||
description( _description ),
|
||||
bursting( false ),
|
||||
flags( 0 )
|
||||
{}
|
||||
|
||||
iServer::~iServer()
|
||||
{}
|
||||
|
||||
/**
|
||||
* Interpret a server's flags.
|
||||
*
|
||||
* @Param[in] newFlags String listing server's P10 flags.
|
||||
*/
|
||||
void iServer::setFlags( const string& newFlags )
|
||||
{
|
||||
for( string::size_type i = 0 ; i < newFlags.size() ; i++ )
|
||||
{
|
||||
switch( newFlags[ i ] )
|
||||
{
|
||||
case 'h':
|
||||
setHub() ;
|
||||
break ;
|
||||
case 's':
|
||||
setService() ;
|
||||
break ;
|
||||
case '6':
|
||||
setIPv6() ;
|
||||
break ;
|
||||
case '+': break ;
|
||||
default:
|
||||
// Unknown flag
|
||||
elog << "iServer> Unknown server flag: "
|
||||
<< newFlags[ i ]
|
||||
<< ", in flags string: "
|
||||
<< newFlags
|
||||
<< std::endl ;
|
||||
break ;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace gnuworld
|
||||
@@ -0,0 +1,151 @@
|
||||
/**
|
||||
* ip.cc
|
||||
* Copyright (C) 2002 Daniel Karrels <dan@karrels.com>
|
||||
* Orlando Bassotto
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
|
||||
* USA.
|
||||
*
|
||||
* $Id: ip.cc,v 1.11 2005/01/12 03:50:38 dan_karrels Exp $
|
||||
*/
|
||||
|
||||
#include <string>
|
||||
#include <sstream>
|
||||
|
||||
#include <cstdio>
|
||||
#include <cstdlib>
|
||||
#include <cstring>
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
#include <netinet/in.h>
|
||||
#include <netdb.h>
|
||||
#include <arpa/inet.h>
|
||||
|
||||
#include "ip.h"
|
||||
#include "Numeric.h"
|
||||
#include "gnuworld_config.h"
|
||||
|
||||
RCSTAG( "$Id: ip.cc,v 1.11 2005/01/12 03:50:38 dan_karrels Exp $" ) ;
|
||||
|
||||
namespace gnuworld
|
||||
{
|
||||
|
||||
using std::string ;
|
||||
|
||||
xIP::xIP( const unsigned int& IP )
|
||||
{
|
||||
this->IP = ntohl( IP ) ;
|
||||
}
|
||||
|
||||
xIP::xIP( const unsigned int& a,
|
||||
const unsigned int& b,
|
||||
const unsigned int& c,
|
||||
const unsigned int& d )
|
||||
{
|
||||
IP = ntohl( (a << 24) | (b << 16) | (c << 8) | d ) ;
|
||||
}
|
||||
|
||||
xIP::xIP( const xIP& rhs )
|
||||
: IP( rhs.IP )
|
||||
{}
|
||||
|
||||
xIP::xIP( const string& IP, bool Base64 )
|
||||
{
|
||||
if( Base64 )
|
||||
{
|
||||
// 30 24 18 12 6
|
||||
this->IP = (convert2n[ static_cast< size_t >( IP[ 0 ] ) ] << 30) +
|
||||
(convert2n[ static_cast< size_t >( IP[ 1 ] ) ] << 24) +
|
||||
(convert2n[ static_cast< size_t >( IP[ 2 ] ) ] << 18) +
|
||||
(convert2n[ static_cast< size_t >( IP[ 3 ] ) ] << 12) +
|
||||
(convert2n[ static_cast< size_t >( IP[ 4 ] ) ] << 6) +
|
||||
(convert2n[ static_cast< size_t >( IP[ 5 ] ) ] ) ;
|
||||
|
||||
this->IP = ntohl( this->IP ) ;
|
||||
return ;
|
||||
}
|
||||
|
||||
struct hostent* hp = ::gethostbyname( IP.c_str() ) ;
|
||||
if( NULL == hp )
|
||||
{
|
||||
this->IP = ntohl( inet_addr( IP.c_str() ) ) ;
|
||||
}
|
||||
else
|
||||
{
|
||||
struct
|
||||
{
|
||||
unsigned char a, b, c, d;
|
||||
} ip ;
|
||||
::memcpy( &ip, hp->h_addr, sizeof( unsigned int ) ) ;
|
||||
|
||||
this->IP = ntohl(
|
||||
((ip.a << 24) |
|
||||
(ip.b << 16) |
|
||||
(ip.c << 8) |
|
||||
ip.d) ) ;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
string xIP::GetIP() const
|
||||
{
|
||||
struct hostent* hp = ::gethostbyaddr(
|
||||
reinterpret_cast< const char* >( &IP ),
|
||||
sizeof( unsigned int ), AF_INET ) ;
|
||||
|
||||
return (hp ? string( hp->h_name ) : GetNumericIP()) ;
|
||||
}
|
||||
|
||||
string xIP::GetNumericIP() const
|
||||
{
|
||||
std::stringstream s ;
|
||||
s << static_cast< int >( (IP >> 24) & 0xff ) << '.'
|
||||
<< static_cast< int >( (IP >> 16) & 0xff ) << '.'
|
||||
<< static_cast< int >( (IP >> 8) & 0xff ) << '.'
|
||||
<< static_cast< int >( (IP & 0xff) ) ;
|
||||
return s.str() ;
|
||||
}
|
||||
|
||||
const unsigned int& xIP::GetLongIP() const
|
||||
{
|
||||
return IP ;
|
||||
}
|
||||
|
||||
void xIP::GetIP( unsigned int& a,
|
||||
unsigned int& b,
|
||||
unsigned int& c,
|
||||
unsigned int& d ) const
|
||||
{
|
||||
a = (IP >> 24) & 0xff ;
|
||||
b = (IP >> 16) & 0xff ;
|
||||
c = (IP >> 8) & 0xff ;
|
||||
d = IP & 0xff ;
|
||||
}
|
||||
|
||||
string xIP::GetBase64IP() const
|
||||
{
|
||||
std::stringstream s ;
|
||||
s << convert2y[ ((IP >> 30) & 0x3f) ]
|
||||
<< convert2y[ ((IP >> 24) & 0x3f) ]
|
||||
<< convert2y[ ((IP >> 18) & 0x3f) ]
|
||||
<< convert2y[ ((IP >> 12) & 0x3f) ]
|
||||
<< convert2y[ ((IP >> 6 ) & 0x3f) ]
|
||||
<< convert2y[ (IP & 0x3f) ] ;
|
||||
|
||||
return s.str() ;
|
||||
}
|
||||
|
||||
} // namespace gnuworld
|
||||
+489
@@ -0,0 +1,489 @@
|
||||
/**
|
||||
* main.cc
|
||||
* Copyright (C) 2002 Daniel Karrels <dan@karrels.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
|
||||
* USA.
|
||||
*
|
||||
* $Id: main.cc,v 1.67 2007/09/01 20:16:56 mrbean_ Exp $
|
||||
*/
|
||||
|
||||
#include <sys/time.h>
|
||||
#include <sys/types.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include <new>
|
||||
#include <fstream>
|
||||
#include <iostream>
|
||||
|
||||
#include <cstdio>
|
||||
#include <cassert>
|
||||
#include <cstdlib>
|
||||
#include <cstring>
|
||||
|
||||
#include "gnuworld_config.h"
|
||||
|
||||
/*
|
||||
#ifdef HAVE_GETOPT_H
|
||||
#include <getopt.h>
|
||||
#endif
|
||||
*/
|
||||
|
||||
#include "ELog.h"
|
||||
#include "server.h"
|
||||
#include "moduleLoader.h"
|
||||
#include "md5hash.h"
|
||||
#include "Signal.h"
|
||||
|
||||
#ifdef ENABLE_LOG4CPLUS
|
||||
#include <log4cplus/configurator.h>
|
||||
#include <log4cplus/logger.h>
|
||||
#endif
|
||||
|
||||
RCSTAG( "$Id: main.cc,v 1.67 2007/09/01 20:16:56 mrbean_ Exp $" ) ;
|
||||
|
||||
// main() must be in the global namespace
|
||||
using namespace gnuworld ;
|
||||
|
||||
using std::cerr ;
|
||||
using std::clog ;
|
||||
using std::endl ;
|
||||
using std::string ;
|
||||
|
||||
// Output the GNU greeting
|
||||
void gnu() ;
|
||||
|
||||
/// Output the command line arguments for gnuworld
|
||||
void usage( const string& progName )
|
||||
{
|
||||
clog << "Usage: " << progName << " [options]"
|
||||
<< endl ;
|
||||
clog << endl
|
||||
<< "Options:"
|
||||
<< endl ;
|
||||
clog << " -c\t\t\tVerbose output"
|
||||
<< endl ;
|
||||
clog << " -d <debug filename>\tSpecify the debug output file"
|
||||
<< endl ;
|
||||
clog << " -D\t\t\tDisable debug logging"
|
||||
<< endl ;
|
||||
clog << " -f <conf filename>\tSpecify the config file name"
|
||||
<< endl ;
|
||||
clog << " -h\t\t\tPrint this help menu"
|
||||
<< endl ;
|
||||
clog << " -l <log file>\t\tCapture raw socket data to log file"
|
||||
<< endl ;
|
||||
clog << " -L\t\t\tDisable logging of socket data to file"
|
||||
<< endl ;
|
||||
clog << " -s <socket file>\tRun in simulation mode"
|
||||
<< endl ;
|
||||
clog << endl ;
|
||||
}
|
||||
|
||||
/// Output the GNUWorld/GNU welcome message
|
||||
void gnu()
|
||||
{
|
||||
clog << endl ;
|
||||
clog << "GNUWorld version " << VERSION << endl ;
|
||||
clog << "Copyright (C) 2002 Free Software Foundation, Inc." << endl ;
|
||||
clog << "GNUWorld comes with NO WARRANTY," << endl ;
|
||||
clog << "to the extent permitted by law." << endl ;
|
||||
clog << "You may redistribute copies of GNUWorld" << endl ;
|
||||
clog << "under the terms of the GNU General Public License." << endl ;
|
||||
clog << "For more information about these matters," << endl ;
|
||||
clog << "see the files named COPYING." << endl ;
|
||||
clog << endl ;
|
||||
}
|
||||
|
||||
// These functions are used to duplicate/free
|
||||
// argv for reconnection of the server.
|
||||
// For some reason gcc 3.3 won't let me declare
|
||||
// argv as const char**
|
||||
char** dupArray( int argc, char** argv )
|
||||
{
|
||||
assert( argc >= 1 ) ;
|
||||
|
||||
// Put a trailing NULL as the last element of the array
|
||||
char** retMe = new char*[ argc + 1 ] ;
|
||||
for( int i = 0 ; i < argc ; ++i )
|
||||
{
|
||||
retMe[ i ] = new char[ strlen( argv[ i ] ) + 1 ] ;
|
||||
strcpy( retMe[ i ], argv[ i ] ) ;
|
||||
}
|
||||
retMe[ argc ] = 0 ;
|
||||
return retMe ;
|
||||
}
|
||||
|
||||
void releaseDup( int argc, char** releaseMe )
|
||||
{
|
||||
assert( argc >= 1 ) ;
|
||||
assert( releaseMe != 0 ) ;
|
||||
|
||||
for( int i = 0 ; i < argc ; ++i )
|
||||
{
|
||||
delete[] releaseMe[ i ] ;
|
||||
}
|
||||
delete[] releaseMe ;
|
||||
}
|
||||
|
||||
int main( int argc, char** argv )
|
||||
{
|
||||
// output gnu information
|
||||
gnu() ;
|
||||
|
||||
// This is done to intialize the hasher
|
||||
md5 dummy ;
|
||||
|
||||
// Load signal handlers. This need only be done once
|
||||
// for the entire system, no matter if the xServer is reloaded.
|
||||
if( 0 == Signal::getInstance() )
|
||||
{
|
||||
clog << "Unable to initialize signal handlers"
|
||||
<< endl ;
|
||||
return -1 ;
|
||||
}
|
||||
|
||||
// Seed the random number generator
|
||||
::srand( ::time( 0 ) ) ;
|
||||
|
||||
#ifdef DAEMON
|
||||
/* fork into background here */
|
||||
if (fork())
|
||||
{
|
||||
fprintf(stdout, "%s: forked into background\n", argv[0]);
|
||||
exit(0);
|
||||
}
|
||||
setsid();
|
||||
if (fork())
|
||||
exit(0);
|
||||
/* redirect stdin, stdout, stderr to null */
|
||||
freopen("/dev/null", "r", stdin);
|
||||
freopen("/dev/null", "w", stdout);
|
||||
freopen("/dev/null", "w", stderr);
|
||||
#endif
|
||||
|
||||
bool autoConnect = true ;
|
||||
while( autoConnect )
|
||||
{
|
||||
// getopt() mutates argv, so only pass a copy so
|
||||
// we can call getopt() again with the same option set
|
||||
char** dupArgv = dupArray( argc, argv ) ;
|
||||
|
||||
// Allocate a new instance of the xServer
|
||||
gnuworld::xServer* theServer =
|
||||
new (std::nothrow) gnuworld::xServer( argc, dupArgv ) ;
|
||||
assert( theServer != 0 ) ;
|
||||
|
||||
// Write out the pid
|
||||
// TODO: This will have to be updated when running
|
||||
// in background.
|
||||
{
|
||||
std::ofstream pidFile( "gnuworld.pid", std::ios::trunc |
|
||||
std::ios::out ) ;
|
||||
if( !pidFile )
|
||||
{
|
||||
clog << "Unable to open pid file: gnuworld.pid"
|
||||
<< endl ;
|
||||
|
||||
delete theServer ; theServer = 0 ;
|
||||
return -1 ;
|
||||
}
|
||||
|
||||
pidFile << getpid()
|
||||
<< endl ;
|
||||
|
||||
pidFile.close() ;
|
||||
} // pidFile
|
||||
|
||||
theServer->run() ;
|
||||
|
||||
// update autoConnect here so we can tell how the server
|
||||
// terminated.
|
||||
autoConnect = theServer->getAutoConnect() ;
|
||||
|
||||
delete theServer ; theServer = 0 ;
|
||||
|
||||
releaseDup( argc, dupArgv ) ;
|
||||
dupArgv = 0 ;
|
||||
|
||||
::sleep( 10 ) ;
|
||||
} // while( autoConnect )
|
||||
|
||||
return 0 ;
|
||||
}
|
||||
|
||||
xServer::xServer( int argc, char** argv )
|
||||
: eventList( EVT_NOOP ),
|
||||
elogFileName( "debug.log" ),
|
||||
configFileName( CONFFILE )
|
||||
{
|
||||
logSocket = true ;
|
||||
verbose = false ;
|
||||
bool doDebug = true ;
|
||||
string socketFileName( "socket.log" ) ;
|
||||
|
||||
std::cout << "Before configuration" << endl;
|
||||
#ifdef ENABLE_LOG4CPLUS
|
||||
log4cplus::PropertyConfigurator::doConfigure("logging.properties");
|
||||
#endif
|
||||
|
||||
optind = 0 ;
|
||||
int c = EOF ;
|
||||
while( (c = getopt( argc, argv, "cd:Df:l:Lhs:")) != -1 )
|
||||
{
|
||||
switch( c )
|
||||
{
|
||||
case 0:
|
||||
case 'c':
|
||||
verbose = true ;
|
||||
break ;
|
||||
case 1:
|
||||
case 'd':
|
||||
doDebug = true ;
|
||||
elogFileName = optarg ;
|
||||
break ;
|
||||
case 'D':
|
||||
doDebug = false ;
|
||||
break ;
|
||||
case 2:
|
||||
case 'f':
|
||||
configFileName = optarg ;
|
||||
break ;
|
||||
case 3:
|
||||
case 'h':
|
||||
usage( argv[ 0 ] ) ;
|
||||
::exit( 0 ) ;
|
||||
case 'l':
|
||||
logSocket = true ;
|
||||
socketFileName = optarg ;
|
||||
break ;
|
||||
case 'L':
|
||||
logSocket = false ;
|
||||
break ;
|
||||
case 4:
|
||||
case 's':
|
||||
simFileName = optarg ;
|
||||
clog << "*** Running in simulation mode..."
|
||||
<< endl ;
|
||||
break ;
|
||||
case ':':
|
||||
clog << "*** Missing parameter\n" ;
|
||||
usage( argv[ 0 ] ) ;
|
||||
::exit( 0 ) ;
|
||||
case '?':
|
||||
break ;
|
||||
default:
|
||||
clog << "Unknown option " << (char) c << endl ;
|
||||
usage( argv[ 0 ] ) ;
|
||||
::exit( 0 ) ;
|
||||
} // close switch
|
||||
} // close while
|
||||
|
||||
if( doDebug )
|
||||
{
|
||||
elog.openFile( elogFileName ) ;
|
||||
if( !elog.isOpen() )
|
||||
{
|
||||
clog << "*** Unable to open elog file: "
|
||||
<< elogFileName
|
||||
<< endl ;
|
||||
::exit( 0 ) ;
|
||||
}
|
||||
clog << "*** Running in debug mode..."
|
||||
<< endl ;
|
||||
}
|
||||
|
||||
if( verbose )
|
||||
{
|
||||
elog.setStream( &clog ) ;
|
||||
elog << "*** Running in verbose mode..."
|
||||
<< endl ;
|
||||
}
|
||||
|
||||
if( logSocket )
|
||||
{
|
||||
socketFile.open( socketFileName.c_str(), std::ios::out ) ;
|
||||
if( !socketFile.is_open() )
|
||||
{
|
||||
clog << "*** Unable to open socket log file: "
|
||||
<< socketFileName
|
||||
<< endl ;
|
||||
::exit( -1 ) ;
|
||||
}
|
||||
clog << "*** Logging raw data to "
|
||||
<< socketFileName
|
||||
<< "..."
|
||||
<< endl ;
|
||||
}
|
||||
|
||||
// Sets up the server internals
|
||||
initializeSystem() ;
|
||||
}
|
||||
|
||||
void xServer::mainLoop()
|
||||
{
|
||||
// If this variable is true, check for a signal
|
||||
// Otherwise, there was a critical failure in the signal
|
||||
// subsystem, and do not check for new signals.
|
||||
bool checkSignals = true ;
|
||||
|
||||
// When this method is first invoked, the server is not connected
|
||||
while( keepRunning )
|
||||
{
|
||||
// Check if a reconnection is necessary
|
||||
// Do not reconnect if the server is in the process of
|
||||
// shutting down.
|
||||
if( !isConnected() && !isLastLoop() )
|
||||
{
|
||||
// Connect to the server/file
|
||||
clog << "*** Connecting " ;
|
||||
|
||||
// Not connected
|
||||
if( !simFileName.empty() )
|
||||
{
|
||||
// Run in simulation mode
|
||||
clog << "to file "
|
||||
<< simFileName
|
||||
<< "... "
|
||||
<< endl ;
|
||||
|
||||
serverConnection = ConnectToFile( this, simFileName ) ;
|
||||
if( NULL == serverConnection )
|
||||
{
|
||||
// Failed to connect to file, quit
|
||||
keepRunning = false ;
|
||||
|
||||
continue ;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Run in real mode
|
||||
clog << "to "
|
||||
<< UplinkName
|
||||
<< "... "
|
||||
<< endl ;
|
||||
|
||||
serverConnection = Connect( this, UplinkName, Port ) ;
|
||||
}
|
||||
} // if( NULL == serverConnection )
|
||||
|
||||
// Check if this is the last iteration of the main processing
|
||||
// loop. If so, set keepRunning to false.
|
||||
// The server Shutdown() (setting lastLoop to true) can occur
|
||||
// in the timers or during the processing of network
|
||||
// connections (Poll()), or possibly in a signal handler.
|
||||
// That means that is lastLoop is already true at this point,
|
||||
// then it was set thus on the last iteration, and this is indeed
|
||||
// the final iteration of the processing loop.
|
||||
if( isLastLoop() )
|
||||
{
|
||||
keepRunning = false ;
|
||||
|
||||
// All output for the xClients should be in the
|
||||
// output buffer by now, go ahead and put the
|
||||
// server's SQ message there as well
|
||||
Write( "%s SQ %s :%s",
|
||||
getCharYY().c_str(),
|
||||
getCharYY().c_str(),
|
||||
getShutDownReason().c_str() ) ;
|
||||
|
||||
// Make sure the SQ and all previous data are flushed
|
||||
// to the network before disconnecting.
|
||||
FlushData() ;
|
||||
}
|
||||
|
||||
// Check for pending timers before calling Poll()
|
||||
// If timers are pending, then set the duration until the next
|
||||
// arriving timer expiration to be the maximum wait time
|
||||
// for Poll()
|
||||
|
||||
// If there are timers waiting, this variable will be set to
|
||||
// true. A value of false means that no timers are pending,
|
||||
// and that Poll() can block indefinitely.
|
||||
bool setTimers = false ;
|
||||
|
||||
long seconds = -1 ;
|
||||
time_t now = ::time( 0 ) ;
|
||||
|
||||
if( !timerQueue.empty() )
|
||||
{
|
||||
// elog << "mainLoop> Found a timer"
|
||||
// << endl ;
|
||||
|
||||
// Yes, set select() timeout to time at which
|
||||
// the nearest timer will expire
|
||||
setTimers = true ;
|
||||
|
||||
// Set tv.tv_sec to the duration (in seconds) until
|
||||
// the first timer will expire.
|
||||
seconds = timerQueue.top().second->absTime - now ;
|
||||
|
||||
if( seconds < 0 )
|
||||
{
|
||||
// A negative value here will result
|
||||
// in inifinite blocking in Poll(),
|
||||
// which is exactly opposite of what is needed here
|
||||
seconds = 0 ;
|
||||
}
|
||||
} // if( !timerQueue.empty() )
|
||||
|
||||
// Process all available data
|
||||
ConnectionManager::Poll( seconds ) ;
|
||||
|
||||
// Poll() will call all appropriate data handlers
|
||||
// Check the timers
|
||||
CheckTimers() ;
|
||||
|
||||
if( !checkSignals )
|
||||
{
|
||||
// There was a critical failure in the Signal handling
|
||||
// system, do not check for new signals.
|
||||
continue ;
|
||||
}
|
||||
|
||||
// Did we catch a signal?
|
||||
int theSignal = -1 ;
|
||||
while( Signal::getSignal( theSignal ) )
|
||||
{
|
||||
if( -1 == theSignal )
|
||||
{
|
||||
elog << "xServer::mainLoop> Criticial failure "
|
||||
<< "in the signal handling system"
|
||||
<< endl ;
|
||||
checkSignals = false ;
|
||||
break ;
|
||||
}
|
||||
|
||||
elog << "xServer::mainLoop> Received signal: "
|
||||
<< theSignal
|
||||
<< endl ;
|
||||
|
||||
if( !PostSignal( theSignal ) )
|
||||
{
|
||||
keepRunning = false ;
|
||||
// No need to set checkSignals to false here,
|
||||
// since this big while() loop will not be
|
||||
// executed again.
|
||||
break ;
|
||||
}
|
||||
} // while( Signal::getSignal() )
|
||||
|
||||
} // while( keepRunning )
|
||||
|
||||
// We are shutting down
|
||||
doShutdown() ;
|
||||
|
||||
} // mainLoop()
|
||||
@@ -0,0 +1,99 @@
|
||||
/**
|
||||
* nickUserCidr.cc
|
||||
* Copyright (C) 2002 Daniel Karrels <dan@karrels.com>
|
||||
* Orlando Bassotto
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
|
||||
* USA.
|
||||
*
|
||||
* $Id: nickUserCidr.cc,v 1.2 2009/06/25 19:00:40 mrbean_ Exp $
|
||||
*/
|
||||
|
||||
#include <string>
|
||||
#include <sstream>
|
||||
|
||||
#include <cstdio>
|
||||
#include <cstdlib>
|
||||
#include <cstring>
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
#include <netinet/in.h>
|
||||
#include <netdb.h>
|
||||
#include <arpa/inet.h>
|
||||
|
||||
|
||||
#include "nickUserCidr.h"
|
||||
#include "misc.h"
|
||||
#include "StringTokenizer.h"
|
||||
#include "gnuworld_config.h"
|
||||
#include "match.h"
|
||||
|
||||
RCSTAG( "$Id: nickUserCidr.cc,v 1.2 2009/06/25 19:00:40 mrbean_ Exp $" ) ;
|
||||
|
||||
namespace gnuworld
|
||||
{
|
||||
|
||||
using std::string ;
|
||||
|
||||
xNickUserCIDR::xNickUserCIDR( const std::string& nickUserCidr ) : cidr(""), nick("*"),user("*"),str("")
|
||||
{
|
||||
StringTokenizer st = StringTokenizer(nickUserCidr,'@');
|
||||
if(st.size() == 1) //No @ , consider everything as a cidr
|
||||
{
|
||||
cidr = xCIDR(nickUserCidr);
|
||||
valid = cidr.GetValid();
|
||||
} else if(st.size() == 2) {
|
||||
ExtractNickUser(st[0]);
|
||||
cidr = xCIDR(st[1]);
|
||||
valid = cidr.GetValid();
|
||||
|
||||
}
|
||||
str = nick + "!" + user + "@" + cidr.AsString();
|
||||
|
||||
}
|
||||
|
||||
bool xNickUserCIDR::ExtractNickUser(const std::string& nickUser)
|
||||
{
|
||||
if(nickUser[0] == '!') //Starts with ! ? user = everything after the !
|
||||
{
|
||||
user = nickUser.substr(1);
|
||||
return true;
|
||||
}
|
||||
StringTokenizer st = StringTokenizer(nickUser,'!');
|
||||
if(st.size() == 1)
|
||||
{ //No ! user = everything
|
||||
user = st[0];
|
||||
} else {
|
||||
//We have ! - nick = up til !, user = rest
|
||||
nick = st[0];
|
||||
user = st.assemble(1);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
bool xNickUserCIDR::matches(const std::string& IP)
|
||||
{
|
||||
StringTokenizer st = StringTokenizer(IP,'@');
|
||||
if(st.size() == 1)
|
||||
{ // WTF No @ ?!
|
||||
return false;
|
||||
}
|
||||
if(!match(nick+"!"+user,st[0]))
|
||||
{ //User and nick match
|
||||
return cidr.matches(st[1]);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
} // namespace gnuworld
|
||||
+3428
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,457 @@
|
||||
/**
|
||||
* server_connection.cc
|
||||
* This is the implementation file for the xServer class.
|
||||
* This class is the entity which is the GNUWorld server
|
||||
* proper. It manages network I/O, parsing and distributing
|
||||
* incoming messages, notifying attached clients of
|
||||
* system events, on, and on, and on.
|
||||
*
|
||||
* Copyright (C) 2002 Daniel Karrels <dan@karrels.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
|
||||
* USA.
|
||||
*
|
||||
* $Id: server_connection.cc,v 1.4 2006/12/22 06:41:45 kewlio Exp $
|
||||
*/
|
||||
|
||||
#include <new>
|
||||
#include <string>
|
||||
//#include <list>
|
||||
//#include <vector>
|
||||
//#include <algorithm>
|
||||
#include <sstream>
|
||||
//#include <fstream>
|
||||
//#include <stack>
|
||||
//#include <iostream>
|
||||
//#include <utility>
|
||||
|
||||
//#include <cstdlib>
|
||||
#include <cstdio>
|
||||
#include <cstdarg>
|
||||
//#include <cstring>
|
||||
//#include <cassert>
|
||||
//#include <cerrno>
|
||||
//#include <csignal>
|
||||
|
||||
#include "gnuworld_config.h"
|
||||
//#include "misc.h"
|
||||
//#include "events.h"
|
||||
//#include "ip.h"
|
||||
|
||||
#include "server.h"
|
||||
#include "Network.h"
|
||||
//#include "iServer.h"
|
||||
//#include "iClient.h"
|
||||
//#include "EConfig.h"
|
||||
//#include "match.h"
|
||||
#include "ELog.h"
|
||||
//#include "StringTokenizer.h"
|
||||
//#include "xparameters.h"
|
||||
//#include "moduleLoader.h"
|
||||
//#include "ServerTimerHandlers.h"
|
||||
//#include "LoadClientTimerHandler.h"
|
||||
//#include "UnloadClientTimerHandler.h"
|
||||
#include "ConnectionManager.h"
|
||||
#include "ConnectionHandler.h"
|
||||
#include "Connection.h"
|
||||
|
||||
RCSTAG( "$Id: server_connection.cc,v 1.4 2006/12/22 06:41:45 kewlio Exp $" ) ;
|
||||
|
||||
namespace gnuworld
|
||||
{
|
||||
|
||||
//using std::pair ;
|
||||
//using std::make_pair ;
|
||||
using std::string ;
|
||||
//using std::vector ;
|
||||
//using std::list ;
|
||||
using std::clog ;
|
||||
using std::endl ;
|
||||
using std::stringstream ;
|
||||
//using std::stack ;
|
||||
//using std::unary_function ;
|
||||
|
||||
void xServer::OnConnect( Connection* theConn )
|
||||
{
|
||||
// Just connected to our uplink
|
||||
serverConnection = theConn ;
|
||||
|
||||
// P10 version information, bogus.
|
||||
Version = 10 ;
|
||||
|
||||
// Set ourselves as a service.
|
||||
me->setService() ;
|
||||
|
||||
// Initialize the connection time variable to current time.
|
||||
ConnectionTime = ::time( NULL ) ;
|
||||
|
||||
clog << "*** Connected!"
|
||||
<< endl ;
|
||||
|
||||
elog << "*** Connected to "
|
||||
<< serverConnection->getHostname()
|
||||
<< ", port "
|
||||
<< serverConnection->getRemotePort()
|
||||
<< endl ;
|
||||
|
||||
// Login to the uplink.
|
||||
WriteDuringBurst( "PASS :%s\n", Password.c_str() ) ;
|
||||
|
||||
// Send our server information.
|
||||
WriteDuringBurst( "SERVER %s %d %d %d J%02d %s +s :%s\n",
|
||||
ServerName.c_str(),
|
||||
1,
|
||||
StartTime,
|
||||
ConnectionTime,
|
||||
Version,
|
||||
(string( getCharYY() ) + "]]]").c_str(),
|
||||
ServerDescription.c_str() ) ;
|
||||
}
|
||||
|
||||
void xServer::OnConnectFail( Connection* theConn )
|
||||
{
|
||||
elog << "xServer::OnConnectFail> Failed to establish connection "
|
||||
<< "to "
|
||||
<< theConn->getHostname()
|
||||
<< ":"
|
||||
<< theConn->getRemotePort()
|
||||
<< endl ;
|
||||
|
||||
serverConnection = 0 ;
|
||||
keepRunning = false ;
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle a disconnect from our uplink. This method is
|
||||
* responsible for deallocating variables mostly.
|
||||
*/
|
||||
void xServer::OnDisconnect( Connection* theConn )
|
||||
{
|
||||
if( theConn != serverConnection )
|
||||
{
|
||||
elog << "xServer::OnDisconnect> Unknown connection"
|
||||
<< endl ;
|
||||
return ;
|
||||
}
|
||||
|
||||
// Disconnected from uplink
|
||||
// The ConnectionManager will deallocate the memory associated with
|
||||
// the Connection object
|
||||
serverConnection = 0 ;
|
||||
|
||||
elog << "xServer::OnDisconnect> Disconnected :("
|
||||
<< endl ;
|
||||
|
||||
keepRunning = false ;
|
||||
|
||||
// doShutdown() will be called at the bottom of the main for loop,
|
||||
// which will perform a proper shutdown.
|
||||
for( xNetwork::localClientIterator cItr = Network->localClient_begin() ;
|
||||
cItr != Network->localClient_end() ; ++cItr )
|
||||
{
|
||||
cItr->second->OnDisconnect() ;
|
||||
}
|
||||
}
|
||||
|
||||
void xServer::OnRead( Connection* theConn, const string& line )
|
||||
{
|
||||
if( theConn != serverConnection )
|
||||
{
|
||||
elog << "xServer::OnRead> Unknown connection"
|
||||
<< endl ;
|
||||
return ;
|
||||
}
|
||||
|
||||
// Don't process any incoming data on the last iteration of
|
||||
// the main control loop.
|
||||
if( !keepRunning || lastLoop )
|
||||
{
|
||||
// Part of the shutdown process includes flushing any
|
||||
// data in the output buffer, and closing connections.
|
||||
// This requires calling Poll(), which will also
|
||||
// recv() and perform any distribution of messages to
|
||||
// handlers, including OnRead().
|
||||
// Therefore, only handle data if the server is still
|
||||
// in a running state.
|
||||
return ;
|
||||
}
|
||||
|
||||
burstLines++ ;
|
||||
burstBytes += line.size() ;
|
||||
|
||||
size_t len = line.size() - 1 ;
|
||||
while( ('\n' == line[ len ]) || ('\r' == line[ len ]) )
|
||||
{
|
||||
--len ;
|
||||
}
|
||||
|
||||
memset( inputCharBuffer, 0, sizeof( inputCharBuffer ) ) ;
|
||||
strncpy( inputCharBuffer, line.c_str(), len + 1 ) ;
|
||||
|
||||
if( verbose )
|
||||
{
|
||||
clog << "[IN ]: "
|
||||
<< line ;
|
||||
}
|
||||
|
||||
if( logSocket )
|
||||
{
|
||||
socketFile << line ;
|
||||
}
|
||||
|
||||
Process( inputCharBuffer ) ;
|
||||
|
||||
// Post the RAW read event
|
||||
PostEvent( EVT_RAW, static_cast< void* >(
|
||||
const_cast< string* >( &line ) ) ) ;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method will append a string to the output
|
||||
* buffer.
|
||||
* Returns false if there is no valid connection,
|
||||
* true otherwise.
|
||||
*/
|
||||
bool xServer::Write( const string& buf )
|
||||
{
|
||||
// Is there a valid connection?
|
||||
if( !isConnected() )
|
||||
{
|
||||
return false ;
|
||||
}
|
||||
|
||||
if( verbose )
|
||||
{
|
||||
// Output the debugging information
|
||||
// to the console.
|
||||
clog << "[OUT]: " << buf ;
|
||||
|
||||
// Should we output a trailing newline
|
||||
// character?
|
||||
if( buf[ buf.size() - 1 ] != '\n' )
|
||||
{
|
||||
clog << endl ;
|
||||
}
|
||||
}
|
||||
|
||||
// Newline terminate the string if it's
|
||||
// not already done and append it to
|
||||
// the output buffer.
|
||||
//
|
||||
if( buf[ buf.size() - 1 ] != '\n' )
|
||||
{
|
||||
if( useHoldBuffer )
|
||||
{
|
||||
burstHoldBuffer += buf + '\n' ;
|
||||
}
|
||||
else
|
||||
{
|
||||
serverConnection->Write( buf + '\n' ) ;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if( useHoldBuffer )
|
||||
{
|
||||
burstHoldBuffer += buf ;
|
||||
}
|
||||
else
|
||||
{
|
||||
serverConnection->Write( buf ) ;
|
||||
}
|
||||
}
|
||||
|
||||
// Return success.
|
||||
return true ;
|
||||
}
|
||||
|
||||
bool xServer::WriteDuringBurst( const string& buf )
|
||||
{
|
||||
// Is there a valid connection?
|
||||
if( !isConnected() )
|
||||
{
|
||||
elog << "xServer::WriteDuringBurst> Not connected"
|
||||
<< endl ;
|
||||
return 0 ;
|
||||
}
|
||||
|
||||
if( verbose )
|
||||
{
|
||||
// Output the debugging information
|
||||
// to the console.
|
||||
clog << "[OUT]: " << buf ;
|
||||
|
||||
// Should we output a trailing newline
|
||||
// character?
|
||||
if( buf[ buf.size() - 1 ] != '\n' )
|
||||
{
|
||||
clog << endl ;
|
||||
}
|
||||
}
|
||||
|
||||
// Newline terminate the string if it's
|
||||
// not already done and append it to
|
||||
// the output buffer.
|
||||
//
|
||||
serverConnection->Write( buf ) ;
|
||||
|
||||
if( buf[ buf.size() - 1 ] != '\n' )
|
||||
{
|
||||
serverConnection->Write( string( "\n" ) ) ;
|
||||
}
|
||||
return true ;
|
||||
}
|
||||
|
||||
/**
|
||||
* Write the contents of a std::stringstream to the uplink connection.
|
||||
*/
|
||||
bool xServer::Write( const stringstream& s )
|
||||
{
|
||||
return Write( string( s.str() ) ) ;
|
||||
}
|
||||
|
||||
bool xServer::WriteDuringBurst( const stringstream& s )
|
||||
{
|
||||
return WriteDuringBurst( string( s.str() ) ) ;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method appends the variable sized argument
|
||||
* list buffer to the output buffer.
|
||||
* Returns false if no valid connection available,
|
||||
* true otherwise.
|
||||
* I despise this function. --dan
|
||||
*/
|
||||
bool xServer::Write( const char* format, ... )
|
||||
{
|
||||
// Is there a valid connection?
|
||||
if( !isConnected() )
|
||||
{
|
||||
// Nope, return false.
|
||||
return false ;
|
||||
}
|
||||
|
||||
// Go through the motions of putting the
|
||||
// string into a buffer.
|
||||
char buffer[ 4096 ] = { 0 } ;
|
||||
va_list _list ;
|
||||
|
||||
va_start( _list, format ) ;
|
||||
vsnprintf( buffer, 4096, format, _list ) ;
|
||||
va_end( _list ) ;
|
||||
|
||||
if( verbose )
|
||||
{
|
||||
// Output the string to the console.
|
||||
clog << "[OUT]: " << buffer ;
|
||||
|
||||
// Do we need to newline terminate it?
|
||||
if( buffer[ strlen( buffer ) - 1 ] != '\n' )
|
||||
{
|
||||
clog << endl ;
|
||||
}
|
||||
}
|
||||
|
||||
if( buffer[ strlen( buffer ) - 1 ] != '\n' )
|
||||
{
|
||||
if( useHoldBuffer )
|
||||
{
|
||||
burstHoldBuffer += buffer ;
|
||||
burstHoldBuffer += "\n" ;
|
||||
}
|
||||
else
|
||||
{
|
||||
serverConnection->Write( buffer ) ;
|
||||
serverConnection->Write( string( "\n" ) ) ;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if( useHoldBuffer )
|
||||
{
|
||||
burstHoldBuffer += buffer ;
|
||||
}
|
||||
else
|
||||
{
|
||||
serverConnection->Write( buffer ) ;
|
||||
}
|
||||
}
|
||||
|
||||
return true ;
|
||||
}
|
||||
|
||||
bool xServer::WriteDuringBurst( const char* format, ... )
|
||||
{
|
||||
|
||||
// Is there a valid connection?
|
||||
if( !isConnected() )
|
||||
{
|
||||
// Nope, return false.
|
||||
return false ;
|
||||
}
|
||||
|
||||
// Go through the motions of putting the
|
||||
// string into a buffer.
|
||||
char buffer[ 4096 ] = { 0 } ;
|
||||
va_list _list ;
|
||||
|
||||
va_start( _list, format ) ;
|
||||
vsnprintf( buffer, 4096, format, _list ) ;
|
||||
va_end( _list ) ;
|
||||
|
||||
if( verbose )
|
||||
{
|
||||
// Output the string to the console.
|
||||
clog << "[OUT]: " << buffer ;
|
||||
|
||||
// Do we need to newline terminate it?
|
||||
if( buffer[ strlen( buffer ) - 1 ] != '\n' )
|
||||
{
|
||||
clog << endl ;
|
||||
}
|
||||
}
|
||||
|
||||
// Append the line to the output buffer.
|
||||
serverConnection->Write( buffer ) ;
|
||||
if( buffer[ strlen( buffer ) - 1 ] != '\n' )
|
||||
{
|
||||
serverConnection->Write( string( "\n" ) ) ;
|
||||
}
|
||||
|
||||
// Return success
|
||||
return true ;
|
||||
}
|
||||
|
||||
void xServer::WriteBurstBuffer()
|
||||
{
|
||||
if( !isConnected() )
|
||||
{
|
||||
return ;
|
||||
}
|
||||
|
||||
serverConnection->Write( burstHoldBuffer.data() ) ;
|
||||
burstHoldBuffer.clear() ;
|
||||
}
|
||||
|
||||
void xServer::FlushData()
|
||||
{
|
||||
if( !isConnected() )
|
||||
{
|
||||
return ;
|
||||
}
|
||||
serverConnection->Flush() ;
|
||||
}
|
||||
|
||||
} // namespace gnuworld
|
||||
@@ -0,0 +1,765 @@
|
||||
/**
|
||||
* server_events.cc
|
||||
* This is the implementation file for the xServer class.
|
||||
* This class is the entity which is the GNUWorld server
|
||||
* proper. It manages network I/O, parsing and distributing
|
||||
* incoming messages, notifying attached clients of
|
||||
* system events, on, and on, and on.
|
||||
*
|
||||
* Copyright (C) 2002 Daniel Karrels <dan@karrels.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
|
||||
* USA.
|
||||
*
|
||||
* $Id: server_events.cc,v 1.3 2005/09/29 17:40:06 kewlio Exp $
|
||||
*/
|
||||
|
||||
#include <new>
|
||||
#include <string>
|
||||
#include <list>
|
||||
#include <stack>
|
||||
#include <iostream>
|
||||
|
||||
#include <csignal>
|
||||
|
||||
#include "server.h"
|
||||
#include "Network.h"
|
||||
#include "iClient.h"
|
||||
#include "ELog.h"
|
||||
|
||||
RCSTAG( "$Id: server_events.cc,v 1.3 2005/09/29 17:40:06 kewlio Exp $" ) ;
|
||||
|
||||
namespace gnuworld
|
||||
{
|
||||
|
||||
using std::list ;
|
||||
using std::endl ;
|
||||
using std::stack ;
|
||||
using std::string ;
|
||||
|
||||
/**
|
||||
* This method will register the given xClient to receive
|
||||
* all events of the given type.
|
||||
* Available events are listed in include/events.h
|
||||
*/
|
||||
bool xServer::RegisterEvent( const eventType& theEvent,
|
||||
xClient* theClient )
|
||||
{
|
||||
assert( theClient != NULL ) ;
|
||||
|
||||
// Make sure that the given event is valid
|
||||
// (in the interval of possible events).
|
||||
if( !validEvent( theEvent ) )
|
||||
{
|
||||
return false ;
|
||||
}
|
||||
|
||||
// Make sure not to add a client more than once
|
||||
UnRegisterEvent( theEvent, theClient ) ;
|
||||
|
||||
// Add this client as listener for this event
|
||||
eventList[ theEvent ].push_back( theClient ) ;
|
||||
|
||||
// Registration succeeded
|
||||
return true ;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method will register the given xClient for any
|
||||
* channel event that occurs in channel chanName, case
|
||||
* insensitive.
|
||||
*/
|
||||
bool xServer::RegisterChannelEvent( const string& chanName,
|
||||
xClient* theClient )
|
||||
{
|
||||
assert( theClient != NULL ) ;
|
||||
|
||||
// Prevent duplicates of the same channel/client pair
|
||||
UnRegisterChannelEvent( chanName, theClient ) ;
|
||||
|
||||
// Obtain a pointer to the list of xClient's registered for events
|
||||
// on the given channel.
|
||||
channelEventMapType::iterator chanPtr = channelEventMap.find( chanName ) ;
|
||||
if( chanPtr == channelEventMap.end() )
|
||||
{
|
||||
// Channel event list doesn't exist yet
|
||||
channelEventMap.insert( channelEventMapType::value_type( chanName,
|
||||
new list< xClient* > ) ) ;
|
||||
chanPtr = channelEventMap.find( chanName ) ;
|
||||
}
|
||||
|
||||
// Add the xClient as a listener for events in this channel.
|
||||
chanPtr->second->push_back( theClient ) ;
|
||||
|
||||
// Addition successful
|
||||
return true ;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method will attempt to unregister the given client
|
||||
* from receiving events of type theEvent.
|
||||
* It will fail (return false) when theEvent is not valid, or
|
||||
* the xClient is not found as being registered for
|
||||
* event theEvent.
|
||||
*/
|
||||
bool xServer::UnRegisterEvent( const eventType& theEvent, xClient* theClient )
|
||||
{
|
||||
assert( theClient != NULL ) ;
|
||||
|
||||
// Make sure this is a valid event.
|
||||
if( !validEvent( theEvent ) )
|
||||
{
|
||||
return false ;
|
||||
}
|
||||
|
||||
// Iterate through the list of registered listeners for
|
||||
// this event and attempt to find the xClient wishing to be removed.
|
||||
//
|
||||
list< xClient* >::iterator ptr = eventList[ theEvent ].begin(),
|
||||
end = eventList[ theEvent ].end() ;
|
||||
|
||||
// Continue until we find the xClient.
|
||||
// Since each xClient may only be registered for any given
|
||||
// we may return as soon as we find the client.
|
||||
while( ptr != end )
|
||||
{
|
||||
// Is this the one?
|
||||
if( (*ptr) == theClient )
|
||||
{
|
||||
// Yup, remove it and return true
|
||||
eventList[ theEvent ].erase( ptr ) ;
|
||||
return true ;
|
||||
}
|
||||
++ptr ;
|
||||
}
|
||||
|
||||
// Unable to find the client in the list of registered
|
||||
// listeners for this event. *shrug*
|
||||
return false ;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method will stop the given xClient from receiving any
|
||||
* events in the channel chanName, case insensitive.
|
||||
*/
|
||||
bool xServer::UnRegisterChannelEvent( const string& chanName,
|
||||
xClient* theClient )
|
||||
{
|
||||
assert( theClient != NULL ) ;
|
||||
|
||||
channelEventMapType::iterator chanPtr = channelEventMap.find( chanName ) ;
|
||||
if( chanPtr == channelEventMap.end() )
|
||||
{
|
||||
// Channel has no xClient's registered for channel events
|
||||
// No big deal.
|
||||
return true ;
|
||||
}
|
||||
|
||||
list< xClient* >* listPtr = chanPtr->second ;
|
||||
for( list< xClient* >::iterator ptr = listPtr->begin(), end = listPtr->end() ;
|
||||
ptr != end ; ++ptr )
|
||||
{
|
||||
if( *ptr == theClient )
|
||||
{
|
||||
listPtr->erase( ptr ) ;
|
||||
|
||||
// Are there any listeners remaining for this channel?
|
||||
if( listPtr->empty() )
|
||||
{
|
||||
// Nope, remove the listener list from the
|
||||
// channelEventMap and deallocat the list.
|
||||
channelEventMap.erase( chanName ) ;
|
||||
delete listPtr ;
|
||||
}
|
||||
|
||||
return true ;
|
||||
}
|
||||
}
|
||||
|
||||
// Unable to find the key/xClient pair.
|
||||
return false ;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method will distribute to each xClient listening
|
||||
* for the given event (theEvent) an event with the proper
|
||||
* arguments.
|
||||
* Events are not guaranteed to be distributed in any
|
||||
* particular order.
|
||||
*/
|
||||
void xServer::PostEvent( const eventType& theEvent,
|
||||
void* Data1, void* Data2,
|
||||
void* Data3, void* Data4,
|
||||
const xClient* excludeMe )
|
||||
{
|
||||
// Make sure the event is valid.
|
||||
if( !validEvent( theEvent ) )
|
||||
{
|
||||
elog << "xServer::PostEvent> Invalid event number: "
|
||||
<< theEvent
|
||||
<< endl ;
|
||||
return ;
|
||||
}
|
||||
|
||||
// Iterate through the list of listeners for this event.
|
||||
list< xClient* >::iterator ptr = eventList[ theEvent ].begin(),
|
||||
end = eventList[ theEvent ].end() ;
|
||||
|
||||
// Continue while there are more listeners for this event.
|
||||
for( ; ptr != end ; ++ptr )
|
||||
{
|
||||
// Notify this client of the event
|
||||
// if he didnt cause the event to trigger
|
||||
if( (*ptr) != excludeMe )
|
||||
{
|
||||
(*ptr)->OnEvent( theEvent, Data1, Data2, Data3, Data4 ) ;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* This method will distribute to any xClient registered to
|
||||
* receive events for the given channel (chanName), case
|
||||
* insensitive, an event with the proper arguments.
|
||||
* Events are not guaranteed to be distributed in any
|
||||
* particular order.
|
||||
*/
|
||||
void xServer::PostChannelEvent( const channelEventType& theEvent,
|
||||
Channel* theChan,
|
||||
void* Data1, void* Data2,
|
||||
void* Data3, void* Data4 )
|
||||
{
|
||||
assert( theChan != 0 ) ;
|
||||
|
||||
// First deliver this channel event to any listeners for all channel
|
||||
// events.
|
||||
channelEventMapType::iterator allChanPtr =
|
||||
channelEventMap.find( CHANNEL_ALL ) ;
|
||||
if( allChanPtr != channelEventMap.end() )
|
||||
{
|
||||
for( list< xClient* >::iterator ptr = allChanPtr->second->begin(),
|
||||
endPtr = allChanPtr->second->end() ; ptr != endPtr ; ++ptr )
|
||||
{
|
||||
(*ptr)->OnChannelEvent( theEvent, theChan,
|
||||
Data1, Data2, Data3, Data4 ) ;
|
||||
}
|
||||
}
|
||||
|
||||
// Find listeners for this specific channel
|
||||
channelEventMapType::iterator chanPtr =
|
||||
channelEventMap.find( theChan->getName() ) ;
|
||||
if( chanPtr == channelEventMap.end() )
|
||||
{
|
||||
// No listeners for this channel's events
|
||||
return ;
|
||||
}
|
||||
|
||||
// Iterate through the listeners for this channel's events
|
||||
// and notify each listener of the event
|
||||
list< xClient* >* listPtr = chanPtr->second ;
|
||||
for( list< xClient* >::iterator ptr = listPtr->begin(), end = listPtr->end() ;
|
||||
ptr != end ; ++ptr )
|
||||
{
|
||||
(*ptr)->OnChannelEvent( theEvent, theChan,
|
||||
Data1, Data2, Data3, Data4 ) ;
|
||||
}
|
||||
}
|
||||
|
||||
// srcClient may be NULL, when the source is a server
|
||||
void xServer::PostChannelKick( Channel* theChan,
|
||||
iClient* srcClient,
|
||||
iClient* destClient,
|
||||
const string& kickMessage,
|
||||
bool authoritative )
|
||||
{
|
||||
// Public method, verify arguments
|
||||
assert( theChan != 0 ) ;
|
||||
assert( destClient != 0 ) ;
|
||||
|
||||
// First deliver this channel event to any listeners for all channel
|
||||
// events.
|
||||
channelEventMapType::iterator allChanPtr =
|
||||
channelEventMap.find( CHANNEL_ALL ) ;
|
||||
if( allChanPtr != channelEventMap.end() )
|
||||
{
|
||||
for( list< xClient* >::iterator ptr = allChanPtr->second->begin(),
|
||||
endPtr = allChanPtr->second->end() ; ptr != endPtr ; ++ptr )
|
||||
{
|
||||
(*ptr)->OnNetworkKick( theChan,
|
||||
srcClient,
|
||||
destClient,
|
||||
kickMessage,
|
||||
authoritative ) ;
|
||||
}
|
||||
}
|
||||
|
||||
// Find listeners for this specific channel
|
||||
channelEventMapType::iterator chanPtr =
|
||||
channelEventMap.find( theChan->getName() ) ;
|
||||
if( chanPtr == channelEventMap.end() )
|
||||
{
|
||||
// No listeners for this channel's events
|
||||
return ;
|
||||
}
|
||||
|
||||
// Iterate through the listeners for this channel's events
|
||||
// and notify each listener of the event
|
||||
list< xClient* >* listPtr = chanPtr->second ;
|
||||
for( list< xClient* >::iterator ptr = listPtr->begin(), end = listPtr->end() ;
|
||||
ptr != end ; ++ptr )
|
||||
{
|
||||
(*ptr)->OnNetworkKick( theChan,
|
||||
srcClient,
|
||||
destClient,
|
||||
kickMessage,
|
||||
authoritative ) ;
|
||||
}
|
||||
}
|
||||
|
||||
bool xServer::PostSignal( int whichSig )
|
||||
{
|
||||
// First, notify the server signal handler
|
||||
bool handledSignal = OnSignal( whichSig ) ;
|
||||
|
||||
// Pass this signal on to each xClient.
|
||||
xNetwork::localClientIterator ptr = Network->localClient_begin() ;
|
||||
for( ; ptr != Network->localClient_end() ; ++ptr )
|
||||
{
|
||||
// if( NULL == *ptr )
|
||||
// {
|
||||
// continue ;
|
||||
// }
|
||||
ptr->second->OnSignal( whichSig ) ;
|
||||
}
|
||||
|
||||
return handledSignal ;
|
||||
}
|
||||
|
||||
bool xServer::OnSignal( int whichSig )
|
||||
{
|
||||
bool retMe = false ;
|
||||
switch( whichSig )
|
||||
{
|
||||
case SIGUSR1:
|
||||
dumpStats() ;
|
||||
retMe = true ;
|
||||
break ;
|
||||
case SIGHUP:
|
||||
retMe = true ;
|
||||
break ;
|
||||
case SIGUSR2:
|
||||
retMe = true;
|
||||
break ;
|
||||
case SIGINT:
|
||||
case SIGTERM:
|
||||
Shutdown() ;
|
||||
retMe = true ;
|
||||
break ;
|
||||
default:
|
||||
break ;
|
||||
}
|
||||
return retMe ;
|
||||
}
|
||||
|
||||
// Handle a channel mode change
|
||||
// theChan is the channel on which the mode change occured
|
||||
// sourceUser is the source of the mode change; this variable
|
||||
// may be NULL if a server is setting the mode
|
||||
// modeVector contains pairs of bool (polarity) and Channel::modeType
|
||||
// (which mode).
|
||||
// This method is invoked only for simple (no argument) modes.
|
||||
void xServer::OnChannelMode( Channel* theChan, ChannelUser* sourceUser,
|
||||
const xServer::modeVectorType& modeVector )
|
||||
{
|
||||
theChan->onMode( modeVector ) ;
|
||||
|
||||
// First deliver this channel event to any listeners for all channel
|
||||
// events.
|
||||
channelEventMapType::iterator allChanPtr =
|
||||
channelEventMap.find( CHANNEL_ALL ) ;
|
||||
if( allChanPtr != channelEventMap.end() )
|
||||
{
|
||||
for( list< xClient* >::iterator ptr = allChanPtr->second->begin(),
|
||||
endPtr = allChanPtr->second->end() ; ptr != endPtr ; ++ptr )
|
||||
{
|
||||
(*ptr)->OnChannelMode( theChan, sourceUser, modeVector ) ;
|
||||
}
|
||||
}
|
||||
|
||||
// Find listeners for this specific channel
|
||||
channelEventMapType::iterator chanPtr =
|
||||
channelEventMap.find( theChan->getName() ) ;
|
||||
if( chanPtr == channelEventMap.end() )
|
||||
{
|
||||
// No listeners for this channel's events
|
||||
return ;
|
||||
}
|
||||
|
||||
// Iterate through the listeners for this channel's events
|
||||
// and notify each listener of the event
|
||||
list< xClient* >* listPtr = chanPtr->second ;
|
||||
for( list< xClient* >::iterator ptr = listPtr->begin(), end = listPtr->end() ;
|
||||
ptr != end ; ++ptr )
|
||||
{
|
||||
(*ptr)->OnChannelMode( theChan, sourceUser, modeVector ) ;
|
||||
}
|
||||
}
|
||||
|
||||
// Handle a channel mode change
|
||||
// theChan is the channel on which the mode change occured
|
||||
// polarity is true if the mode is being set, false otherwise
|
||||
// sourceUser is the source of the mode change; this variable
|
||||
// may be NULL if a server is setting the mode
|
||||
void xServer::OnChannelModeL( Channel* theChan, bool polarity,
|
||||
ChannelUser* sourceUser, unsigned int limit )
|
||||
{
|
||||
theChan->onModeL( polarity, limit ) ;
|
||||
|
||||
// First deliver this channel event to any listeners for all channel
|
||||
// events.
|
||||
channelEventMapType::iterator allChanPtr =
|
||||
channelEventMap.find( CHANNEL_ALL ) ;
|
||||
if( allChanPtr != channelEventMap.end() )
|
||||
{
|
||||
for( list< xClient* >::iterator ptr = allChanPtr->second->begin(),
|
||||
endPtr = allChanPtr->second->end() ; ptr != endPtr ; ++ptr )
|
||||
{
|
||||
(*ptr)->OnChannelModeL( theChan, polarity,
|
||||
sourceUser, limit ) ;
|
||||
}
|
||||
}
|
||||
|
||||
// Find listeners for this specific channel
|
||||
channelEventMapType::iterator chanPtr =
|
||||
channelEventMap.find( theChan->getName() ) ;
|
||||
if( chanPtr == channelEventMap.end() )
|
||||
{
|
||||
// No listeners for this channel's events
|
||||
return ;
|
||||
}
|
||||
|
||||
// Iterate through the listeners for this channel's events
|
||||
// and notify each listener of the event
|
||||
list< xClient* >* listPtr = chanPtr->second ;
|
||||
for( list< xClient* >::iterator ptr = listPtr->begin(), end = listPtr->end() ;
|
||||
ptr != end ; ++ptr )
|
||||
{
|
||||
(*ptr)->OnChannelModeL( theChan, polarity, sourceUser, limit ) ;
|
||||
}
|
||||
}
|
||||
|
||||
// Handle a channel mode change
|
||||
// theChan is the channel on which the mode change occured
|
||||
// polarity is true if the mode is being set, false otherwise
|
||||
// sourceUser is the source of the mode change; this variable
|
||||
// may be NULL if a server is setting the mode
|
||||
void xServer::OnChannelModeK( Channel* theChan, bool polarity,
|
||||
ChannelUser* sourceUser, const string& key )
|
||||
{
|
||||
theChan->onModeK( polarity, key ) ;
|
||||
|
||||
// First deliver this channel event to any listeners for all channel
|
||||
// events.
|
||||
channelEventMapType::iterator allChanPtr =
|
||||
channelEventMap.find( CHANNEL_ALL ) ;
|
||||
if( allChanPtr != channelEventMap.end() )
|
||||
{
|
||||
for( list< xClient* >::iterator ptr = allChanPtr->second->begin(),
|
||||
endPtr = allChanPtr->second->end() ; ptr != endPtr ; ++ptr )
|
||||
{
|
||||
(*ptr)->OnChannelModeK( theChan, polarity,
|
||||
sourceUser, key ) ;
|
||||
}
|
||||
}
|
||||
|
||||
// Find listeners for this specific channel
|
||||
channelEventMapType::iterator chanPtr =
|
||||
channelEventMap.find( theChan->getName() ) ;
|
||||
if( chanPtr == channelEventMap.end() )
|
||||
{
|
||||
// No listeners for this channel's events
|
||||
return ;
|
||||
}
|
||||
|
||||
// Iterate through the listeners for this channel's events
|
||||
// and notify each listener of the event
|
||||
list< xClient* >* listPtr = chanPtr->second ;
|
||||
for( list< xClient* >::iterator ptr = listPtr->begin(), end = listPtr->end() ;
|
||||
ptr != end ; ++ptr )
|
||||
{
|
||||
(*ptr)->OnChannelModeK( theChan, polarity, sourceUser, key ) ;
|
||||
}
|
||||
}
|
||||
|
||||
// Handle a channel mode change
|
||||
// theChan is the channel on which the mode change occured
|
||||
// polarity is true if the mode is being set, false otherwise
|
||||
// sourceUser is the source of the mode change; this variable
|
||||
// may be NULL if a server is setting the mode
|
||||
void xServer::OnChannelModeA( Channel* theChan, bool polarity,
|
||||
ChannelUser* sourceUser, const string& Apass )
|
||||
{
|
||||
theChan->onModeA( polarity, Apass ) ;
|
||||
|
||||
// First delivery this channel event to any listeners for all channel
|
||||
// events.
|
||||
channelEventMapType::iterator allChanPtr =
|
||||
channelEventMap.find( CHANNEL_ALL ) ;
|
||||
if( allChanPtr != channelEventMap.end() )
|
||||
{
|
||||
for( list< xClient* >::iterator ptr = allChanPtr->second->begin(),
|
||||
endPtr = allChanPtr->second->end() ; ptr != endPtr ; ++ptr )
|
||||
{
|
||||
(*ptr)->OnChannelModeA( theChan, polarity,
|
||||
sourceUser, Apass ) ;
|
||||
}
|
||||
}
|
||||
|
||||
// Find listeners for this specific channel
|
||||
channelEventMapType::iterator chanPtr =
|
||||
channelEventMap.find( theChan->getName() ) ;
|
||||
if( chanPtr == channelEventMap.end() )
|
||||
{
|
||||
// No listeners for this channel's events
|
||||
return ;
|
||||
}
|
||||
|
||||
// Iterate through the listeners fort his channel's events
|
||||
// and notify each listener of the event
|
||||
list< xClient* >* listPtr = chanPtr->second;
|
||||
for( list< xClient* >::iterator ptr = listPtr->begin(), end = listPtr->end() ;
|
||||
ptr != end ; ++ ptr )
|
||||
{
|
||||
(*ptr)->OnChannelModeA( theChan, polarity, sourceUser, Apass ) ;
|
||||
}
|
||||
}
|
||||
|
||||
// Handle a channel mode change
|
||||
// theChan is the channel on which the mode change occured
|
||||
// polarity is true if the mode is being set, false otherwise
|
||||
// sourceUser is the source of the mode change; this variable
|
||||
// may be NULL if a server is setting the mode
|
||||
void xServer::OnChannelModeU( Channel* theChan, bool polarity,
|
||||
ChannelUser* sourceUser, const string& Upass )
|
||||
{
|
||||
theChan->onModeU( polarity, Upass ) ;
|
||||
|
||||
// First deliver this channel event to any listeners for all channel
|
||||
// events.
|
||||
channelEventMapType::iterator allChanPtr =
|
||||
channelEventMap.find( CHANNEL_ALL ) ;
|
||||
if( allChanPtr != channelEventMap.end() )
|
||||
{
|
||||
for( list< xClient* >::iterator ptr = allChanPtr->second->begin(),
|
||||
endPtr = allChanPtr->second->end() ; ptr != endPtr ; ++ptr )
|
||||
{
|
||||
(*ptr)->OnChannelModeU( theChan, polarity,
|
||||
sourceUser, Upass ) ;
|
||||
}
|
||||
}
|
||||
|
||||
// Find listeners for this specific channel
|
||||
channelEventMapType::iterator chanPtr =
|
||||
channelEventMap.find( theChan->getName() ) ;
|
||||
if( chanPtr == channelEventMap.end() )
|
||||
{
|
||||
// No listeners for this channel's events
|
||||
return ;
|
||||
}
|
||||
|
||||
// Iterate through the listenersfor this channel's events
|
||||
// and notify each listener of the event
|
||||
list< xClient* >* listPtr = chanPtr->second ;
|
||||
for( list< xClient* >::iterator ptr = listPtr->begin(), end = listPtr->end() ;
|
||||
ptr != end ; ++ptr )
|
||||
{
|
||||
(*ptr)->OnChannelModeU( theChan, polarity, sourceUser, Upass ) ;
|
||||
}
|
||||
}
|
||||
|
||||
// Handle a channel mode change
|
||||
// theChan is the channel on which the mode change occurs
|
||||
// polarity is true if the mode is being set, false otherwise
|
||||
// sourceUser is the source of the mode change; this variable
|
||||
// may be NULL if a server is setting the mode
|
||||
void xServer::OnChannelModeO( Channel* theChan, ChannelUser* sourceUser,
|
||||
const xServer::opVectorType& opVector )
|
||||
{
|
||||
theChan->onModeO( opVector ) ;
|
||||
|
||||
// First deliver this channel event to any listeners for all channel
|
||||
// events.
|
||||
channelEventMapType::iterator allChanPtr =
|
||||
channelEventMap.find( CHANNEL_ALL ) ;
|
||||
if( allChanPtr != channelEventMap.end() )
|
||||
{
|
||||
for( list< xClient* >::iterator ptr = allChanPtr->second->begin(),
|
||||
endPtr = allChanPtr->second->end() ; ptr != endPtr ; ++ptr )
|
||||
{
|
||||
(*ptr)->OnChannelModeO( theChan, sourceUser, opVector ) ;
|
||||
}
|
||||
}
|
||||
|
||||
// Find listeners for this specific channel
|
||||
channelEventMapType::iterator chanPtr =
|
||||
channelEventMap.find( theChan->getName() ) ;
|
||||
if( chanPtr == channelEventMap.end() )
|
||||
{
|
||||
// No listeners for this channel's events
|
||||
return ;
|
||||
}
|
||||
|
||||
// Iterate through the listeners for this channel's events
|
||||
// and notify each listener of the event
|
||||
list< xClient* >* listPtr = chanPtr->second ;
|
||||
for( list< xClient* >::iterator ptr = listPtr->begin(), end = listPtr->end() ;
|
||||
ptr != end ; ++ptr )
|
||||
{
|
||||
(*ptr)->OnChannelModeO( theChan, sourceUser, opVector ) ;
|
||||
}
|
||||
}
|
||||
|
||||
// Handle a channel mode change
|
||||
// theChan is the channel on which the mode change occurs
|
||||
// polarity is true if the mode is being set, false otherwise
|
||||
// sourceUser is the source of the mode change; this variable
|
||||
// may be NULL if a server is setting the mode
|
||||
void xServer::OnChannelModeH( Channel* theChan, ChannelUser* sourceUser,
|
||||
const xServer::opVectorType& opVector )
|
||||
{
|
||||
theChan->onModeH( opVector ) ;
|
||||
|
||||
// First deliver this channel event to any listeners for all channel
|
||||
// events.
|
||||
channelEventMapType::iterator allChanPtr =
|
||||
channelEventMap.find( CHANNEL_ALL ) ;
|
||||
if( allChanPtr != channelEventMap.end() )
|
||||
{
|
||||
for( list< xClient* >::iterator ptr = allChanPtr->second->begin(),
|
||||
endPtr = allChanPtr->second->end() ; ptr != endPtr ; ++ptr )
|
||||
{
|
||||
(*ptr)->OnChannelModeH( theChan, sourceUser, opVector ) ;
|
||||
}
|
||||
}
|
||||
|
||||
// Find listeners for this specific channel
|
||||
channelEventMapType::iterator chanPtr =
|
||||
channelEventMap.find( theChan->getName() ) ;
|
||||
if( chanPtr == channelEventMap.end() )
|
||||
{
|
||||
// No listeners for this channel's events
|
||||
return ;
|
||||
}
|
||||
|
||||
// Iterate through the listeners for this channel's events
|
||||
// and notify each listener of the event
|
||||
list< xClient* >* listPtr = chanPtr->second ;
|
||||
for( list< xClient* >::iterator ptr = listPtr->begin(), end = listPtr->end() ;
|
||||
ptr != end ; ++ptr )
|
||||
{
|
||||
(*ptr)->OnChannelModeH( theChan, sourceUser, opVector ) ;
|
||||
}
|
||||
}
|
||||
|
||||
// Handle a channel mode change
|
||||
// theChan is the channel on which the mode change occured
|
||||
// polarity is true if the mode is being set, false otherwise
|
||||
// sourceUser is the source of the mode change; this variable
|
||||
// may be NULL if a server is setting the mode
|
||||
void xServer::OnChannelModeV( Channel* theChan, ChannelUser* sourceUser,
|
||||
const xServer::voiceVectorType& voiceVector )
|
||||
{
|
||||
theChan->onModeV( voiceVector ) ;
|
||||
|
||||
// First deliver this channel event to any listeners for all channel
|
||||
// events.
|
||||
channelEventMapType::iterator allChanPtr =
|
||||
channelEventMap.find( CHANNEL_ALL ) ;
|
||||
if( allChanPtr != channelEventMap.end() )
|
||||
{
|
||||
for( list< xClient* >::iterator ptr = allChanPtr->second->begin(),
|
||||
endPtr = allChanPtr->second->end() ; ptr != endPtr ; ++ptr )
|
||||
{
|
||||
(*ptr)->OnChannelModeV( theChan, sourceUser,
|
||||
voiceVector ) ;
|
||||
}
|
||||
}
|
||||
|
||||
// Find listeners for this specific channel
|
||||
channelEventMapType::iterator chanPtr =
|
||||
channelEventMap.find( theChan->getName() ) ;
|
||||
if( chanPtr == channelEventMap.end() )
|
||||
{
|
||||
// No listeners for this channel's events
|
||||
return ;
|
||||
}
|
||||
|
||||
// Iterate through the listeners for this channel's events
|
||||
// and notify each listener of the event
|
||||
list< xClient* >* listPtr = chanPtr->second ;
|
||||
for( list< xClient* >::iterator ptr = listPtr->begin(), end = listPtr->end() ;
|
||||
ptr != end ; ++ptr )
|
||||
{
|
||||
(*ptr)->OnChannelModeV( theChan, sourceUser, voiceVector ) ;
|
||||
}
|
||||
}
|
||||
|
||||
// Handle a channel mode change
|
||||
// theChan is the channel on which the mode change occured
|
||||
// polarity is true if the mode is being set, false otherwise
|
||||
// sourceUser is the source of the mode change; this variable
|
||||
// may be NULL if a server is setting the mode
|
||||
void xServer::OnChannelModeB( Channel* theChan, ChannelUser* sourceUser,
|
||||
xServer::banVectorType& banVector )
|
||||
{
|
||||
|
||||
// Channel::onModeB() may modify banVector with the extra bans
|
||||
// that have been removed due to overlaps
|
||||
theChan->onModeB( banVector ) ;
|
||||
|
||||
// First deliver this channel event to any listeners for all channel
|
||||
// events.
|
||||
channelEventMapType::iterator allChanPtr =
|
||||
channelEventMap.find( CHANNEL_ALL ) ;
|
||||
if( allChanPtr != channelEventMap.end() )
|
||||
{
|
||||
for( list< xClient* >::iterator ptr = allChanPtr->second->begin(),
|
||||
endPtr = allChanPtr->second->end() ; ptr != endPtr ; ++ptr )
|
||||
{
|
||||
(*ptr)->OnChannelModeB( theChan, sourceUser,
|
||||
banVector ) ;
|
||||
}
|
||||
}
|
||||
|
||||
// Find listeners for this specific channel
|
||||
channelEventMapType::iterator chanPtr =
|
||||
channelEventMap.find( theChan->getName() ) ;
|
||||
if( chanPtr == channelEventMap.end() )
|
||||
{
|
||||
// No listeners for this channel's events
|
||||
return ;
|
||||
}
|
||||
|
||||
// Iterate through the listeners for this channel's events
|
||||
// and notify each listener of the event
|
||||
list< xClient* >* listPtr = chanPtr->second ;
|
||||
for( list< xClient* >::iterator ptr = listPtr->begin(), end = listPtr->end() ;
|
||||
ptr != end ; ++ptr )
|
||||
{
|
||||
(*ptr)->OnChannelModeB( theChan, sourceUser, banVector ) ;
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace gnuworld
|
||||
@@ -0,0 +1,285 @@
|
||||
/**
|
||||
* server_glines.cc
|
||||
* This is the implementation file for the xServer class.
|
||||
* This class is the entity which is the GNUWorld server
|
||||
* proper. It manages network I/O, parsing and distributing
|
||||
* incoming messages, notifying attached clients of
|
||||
* system events, on, and on, and on.
|
||||
*
|
||||
* Copyright (C) 2002 Daniel Karrels <dan@karrels.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
|
||||
* USA.
|
||||
*
|
||||
* $Id: server_glines.cc,v 1.3 2007/12/14 03:06:10 isomer Exp $
|
||||
*/
|
||||
|
||||
#include <new>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <sstream>
|
||||
#include <iostream>
|
||||
|
||||
#include "server.h"
|
||||
#include "Network.h"
|
||||
#include "Gline.h"
|
||||
#include "ELog.h"
|
||||
|
||||
RCSTAG( "$Id: server_glines.cc,v 1.3 2007/12/14 03:06:10 isomer Exp $" ) ;
|
||||
|
||||
namespace gnuworld
|
||||
{
|
||||
|
||||
using std::string ;
|
||||
using std::vector ;
|
||||
using std::endl ;
|
||||
using std::stringstream ;
|
||||
|
||||
bool xServer::removeGline( const string& userHost, const xClient* remClient )
|
||||
{
|
||||
// This method is true if we find the gline in our internal
|
||||
// structure of glines.
|
||||
bool foundGline = false ;
|
||||
|
||||
// Perform a search for the gline
|
||||
glineIterator gItr = findGlineIterator( userHost ) ;
|
||||
if( gItr != glines_end() )
|
||||
{
|
||||
foundGline = true ;
|
||||
}
|
||||
|
||||
// Notify the network that we are removing it
|
||||
stringstream s ;
|
||||
if ( foundGline ) {
|
||||
s << getCharYY()
|
||||
<< " GL * -"
|
||||
<< userHost
|
||||
<< " "
|
||||
<< gItr->second->getExpiration() // expiration
|
||||
<< " "
|
||||
<< ::time(0) // lastmod
|
||||
<< " "
|
||||
<< gItr->second->getExpiration() // expiration
|
||||
<< " :"
|
||||
<< gItr->second->getReason();
|
||||
}
|
||||
else {
|
||||
// Even if we didn't find the gline here, it may be present
|
||||
// to someone on the network *shrug*
|
||||
s << getCharYY()
|
||||
<< " GL * -"
|
||||
<< userHost
|
||||
<< " "
|
||||
<< ::time(0) + 60 // expire
|
||||
<< " "
|
||||
<< ::time(0) // lastmod
|
||||
<< " "
|
||||
<< ::time(0) + 60 // lifetime
|
||||
<< " "
|
||||
<< ":Unknown G-Line";
|
||||
}
|
||||
|
||||
// Write the data to the network output buffer(s)
|
||||
Write( s ) ;
|
||||
|
||||
// Did we find the gline in the interal gline structure?
|
||||
if( foundGline )
|
||||
{
|
||||
// Let all clients know that the gline has been removed
|
||||
if( remClient )
|
||||
{
|
||||
PostEvent( EVT_REMGLINE,
|
||||
static_cast< void* >( gItr->second ),
|
||||
0,0,0,remClient ) ;
|
||||
}
|
||||
else
|
||||
{
|
||||
PostEvent( EVT_REMGLINE,
|
||||
static_cast< void* >( gItr->second ) ) ;
|
||||
}
|
||||
// Deallocate the gline
|
||||
delete gItr->second ;
|
||||
|
||||
// Remove the gline from the internal gline structure
|
||||
eraseGline( gItr ) ;
|
||||
}
|
||||
|
||||
// Return success
|
||||
return foundGline ;
|
||||
}
|
||||
|
||||
// C GL * +~*@209.9.117.131 180 :Banned (~*@209.9.117.131) until 957235403 (On Mon May 1
|
||||
// 22:40:23 2000 GMT from SE5 for 180 seconds: remgline test.. [0])
|
||||
bool xServer::setGline(
|
||||
const string& setBy,
|
||||
const string& userHost,
|
||||
const string& reason,
|
||||
const time_t& duration,
|
||||
const time_t& lastmod,
|
||||
const xClient* setClient,
|
||||
const string& server )
|
||||
{
|
||||
// Remove any old matches
|
||||
{
|
||||
xServer::glineIterator gItr = findGlineIterator( userHost ) ;
|
||||
if( gItr != glines_end() )
|
||||
{
|
||||
// This gline is already present
|
||||
delete gItr->second ;
|
||||
eraseGline( gItr ) ;
|
||||
}
|
||||
}
|
||||
|
||||
Gline* newGline =
|
||||
new (std::nothrow) Gline( setBy,
|
||||
userHost,
|
||||
reason,
|
||||
duration ,
|
||||
lastmod) ;
|
||||
assert( newGline != 0 ) ;
|
||||
|
||||
// Notify the rest of the network
|
||||
stringstream s ;
|
||||
s << getCharYY() << " GL "
|
||||
<< server << " !+"
|
||||
<< userHost << ' '
|
||||
<< duration << ' '
|
||||
<< lastmod << " :"
|
||||
<< reason ;
|
||||
Write( s ) ;
|
||||
|
||||
glineList.insert( glineListType::value_type(
|
||||
newGline->getUserHost(), newGline ) ) ;
|
||||
if(setClient)
|
||||
{
|
||||
PostEvent( EVT_GLINE,
|
||||
static_cast< void* >( newGline ), 0,0,0,setClient ) ;
|
||||
}
|
||||
else
|
||||
{
|
||||
PostEvent( EVT_GLINE,
|
||||
static_cast< void* >( newGline ) ) ;
|
||||
}
|
||||
|
||||
return true ;
|
||||
}
|
||||
|
||||
vector< const Gline* > xServer::matchGline( const string& userHost ) const
|
||||
{
|
||||
vector< const Gline* > retMe ;
|
||||
|
||||
for( const_glineIterator ptr = glines_begin() ;
|
||||
ptr != glines_end() ; ++ptr )
|
||||
{
|
||||
if( !match( ptr->second->getUserHost(), userHost ) )
|
||||
{
|
||||
retMe.push_back( ptr->second ) ;
|
||||
}
|
||||
}
|
||||
|
||||
return retMe ;
|
||||
}
|
||||
|
||||
const Gline* xServer::findGline( const string& userHost ) const
|
||||
{
|
||||
const_glineIterator gItr = glineList.find( userHost ) ;
|
||||
if( gItr == glineList.end() )
|
||||
{
|
||||
return 0 ;
|
||||
}
|
||||
return gItr->second ;
|
||||
}
|
||||
|
||||
xServer::glineIterator xServer::findGlineIterator(
|
||||
const string& userHost )
|
||||
{
|
||||
return glineList.find( userHost ) ;
|
||||
}
|
||||
|
||||
void xServer::addGline( Gline* newGline )
|
||||
{
|
||||
assert( newGline != 0 ) ;
|
||||
glineList.insert( glineListType::value_type( newGline->getUserHost(),
|
||||
newGline ) ) ;
|
||||
}
|
||||
|
||||
void xServer::sendGlinesToNetwork()
|
||||
{
|
||||
time_t now = ::time( 0 ) ;
|
||||
|
||||
for( const_glineIterator ptr = glines_begin() ;
|
||||
ptr != glines_end() ; ++ptr )
|
||||
{
|
||||
stringstream s ;
|
||||
s << getCharYY() << " GL * +"
|
||||
<< ptr->second->getUserHost() << ' '
|
||||
<< (ptr->second->getExpiration() - now) << ' '
|
||||
<< ptr->second->getLastmod() << " :"
|
||||
<< ptr->second->getReason() ;
|
||||
|
||||
Write( s ) ;
|
||||
}
|
||||
}
|
||||
|
||||
void xServer::removeMatchingGlines( const string& wildHost )
|
||||
{
|
||||
for( glineIterator ptr = glines_begin() ; ptr != glines_end() ;
|
||||
++ptr )
|
||||
{
|
||||
// TODO: Does this work with two wildHost's?
|
||||
if( !match( wildHost, ptr->second->getUserHost() ) )
|
||||
{
|
||||
PostEvent( EVT_REMGLINE,
|
||||
static_cast< void* >( ptr->second ) ) ;
|
||||
|
||||
delete ptr->second ;
|
||||
glineList.erase( ptr ) ;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void xServer::BurstGlines()
|
||||
{
|
||||
xNetwork::localClientIterator ptr = Network->localClient_begin() ;
|
||||
while( ptr != Network->localClient_end() )
|
||||
{
|
||||
ptr->second->BurstGlines() ;
|
||||
++ptr ;
|
||||
}
|
||||
}
|
||||
|
||||
void xServer::updateGlines()
|
||||
{
|
||||
time_t now = ::time( 0 ) ;
|
||||
|
||||
glineIterator ptr = glines_begin();
|
||||
|
||||
while (ptr != glines_end())
|
||||
{
|
||||
if( ptr->second->getExpiration() <= now )
|
||||
{
|
||||
// Expire the gline
|
||||
PostEvent( EVT_REMGLINE,
|
||||
static_cast< void* >( ptr->second ) ) ;
|
||||
|
||||
delete ptr->second ;
|
||||
glineList.erase( ptr++ ) ;
|
||||
} else {
|
||||
ptr++;
|
||||
}
|
||||
}
|
||||
} // updateGlines()
|
||||
|
||||
} // namespace gnuworld
|
||||
@@ -0,0 +1,239 @@
|
||||
/**
|
||||
* server_timers.cc
|
||||
* This is the implementation file for the xServer class.
|
||||
* This class is the entity which is the GNUWorld server
|
||||
* proper. It manages network I/O, parsing and distributing
|
||||
* incoming messages, notifying attached clients of
|
||||
* system events, on, and on, and on.
|
||||
*
|
||||
* Copyright (C) 2002 Daniel Karrels <dan@karrels.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
|
||||
* USA.
|
||||
*
|
||||
* $Id: server_timers.cc,v 1.1 2005/01/07 00:10:46 dan_karrels Exp $
|
||||
*/
|
||||
|
||||
#include <stack>
|
||||
#include <map>
|
||||
#include <iostream>
|
||||
|
||||
#include "server.h"
|
||||
#include "ELog.h"
|
||||
#include "ServerTimerHandlers.h"
|
||||
|
||||
RCSTAG( "$Id: server_timers.cc,v 1.1 2005/01/07 00:10:46 dan_karrels Exp $" ) ;
|
||||
|
||||
namespace gnuworld
|
||||
{
|
||||
|
||||
using std::pair ;
|
||||
using std::endl ;
|
||||
using std::stack ;
|
||||
|
||||
void xServer::registerServerTimers()
|
||||
{
|
||||
RegisterTimer( ::time( 0 ) + glineUpdateInterval,
|
||||
new GlineUpdateTimer( this, glineUpdateInterval ),
|
||||
static_cast< void* >( this ) ) ;
|
||||
RegisterTimer( ::time( 0 ) + pingUpdateInterval,
|
||||
new PINGTimer( this, pingUpdateInterval ),
|
||||
static_cast< void* >( this ) ) ;
|
||||
}
|
||||
|
||||
xServer::timerID xServer::RegisterTimer( const time_t& absTime,
|
||||
TimerHandler* theHandler,
|
||||
void* data )
|
||||
{
|
||||
assert( theHandler != 0 ) ;
|
||||
|
||||
// Allow registration of timers which are requesting to be executed
|
||||
// at times which are <= now.
|
||||
// This will just allow the timer to run on the next iteration
|
||||
|
||||
// Retrieve a unique timerID
|
||||
timerID ID = getUniqueTimerID() ;
|
||||
|
||||
// Allocate a timerInfo structure to represent this timer
|
||||
timerInfo* ti =
|
||||
new (std::nothrow) timerInfo( ID, absTime, theHandler, data ) ;
|
||||
assert( ti != 0 ) ;
|
||||
|
||||
// Add this timerInfo structure to the timerQueue
|
||||
timerQueue.push( timerQueueType::value_type( absTime, ti ) ) ;
|
||||
|
||||
// Add the unique timerID to the timerID map
|
||||
uniqueTimerMap.insert( uniqueTimerMapType::value_type( ID, true ) ) ;
|
||||
|
||||
// Return the valid timerID of this timer
|
||||
return ID ;
|
||||
}
|
||||
|
||||
bool xServer::UnRegisterTimer( const xServer::timerID& ID,
|
||||
void* data )
|
||||
{
|
||||
// Make sure there are timers in the queue
|
||||
if( timerQueue.empty() )
|
||||
{
|
||||
// The timerQueue is empty -- the timerID specified
|
||||
// is invalid at best.
|
||||
return true ;
|
||||
}
|
||||
|
||||
// Create a local stack to store elements popped from the timerQueue
|
||||
// in searching for the timer in question (could also have used
|
||||
// another priority queue)
|
||||
stack< timerQueueType::value_type > localStack ;
|
||||
|
||||
// Continue while the timerQueue is not empty, and we have not
|
||||
// found the timerID in question.
|
||||
while( !timerQueue.empty() && (timerQueue.top().second->ID != ID) )
|
||||
{
|
||||
// Add this timer to the local stack
|
||||
localStack.push( timerQueue.top() ) ;
|
||||
|
||||
// Remove this timer from the timerQueue
|
||||
timerQueue.pop() ;
|
||||
}
|
||||
|
||||
// This variable will represent the case that we found
|
||||
// the timer in question
|
||||
bool foundTimer = false ;
|
||||
|
||||
// timerQueue is now empty, or its top element has the timer
|
||||
// we are interested in.
|
||||
if( !timerQueue.empty() )
|
||||
{
|
||||
// Find was successful
|
||||
foundTimer = true ;
|
||||
|
||||
// Assign the timer argument back to "data"
|
||||
if( data != 0 )
|
||||
{
|
||||
data = timerQueue.top().second->data ;
|
||||
}
|
||||
|
||||
// Remove this timerID from the uniqueTimerMap
|
||||
uniqueTimerMap.erase( timerQueue.top().second->ID ) ;
|
||||
|
||||
// Deallocate the timerInfo structure for this timer
|
||||
delete timerQueue.top().second ;
|
||||
|
||||
// Remove the timerInfo from the timerQueue
|
||||
timerQueue.pop() ;
|
||||
}
|
||||
|
||||
// Put the rest of the timers back onto the timerQueue.
|
||||
while( !localStack.empty() )
|
||||
{
|
||||
timerQueue.push( localStack.top() ) ;
|
||||
localStack.pop() ;
|
||||
}
|
||||
|
||||
return foundTimer ;
|
||||
}
|
||||
|
||||
unsigned int xServer::CheckTimers()
|
||||
{
|
||||
// Make sure the timerQueue is not empty
|
||||
if( timerQueue.empty() )
|
||||
{
|
||||
return 0 ;
|
||||
}
|
||||
|
||||
// Create a variable to count the number of timers executed
|
||||
unsigned int numTimers = 0 ;
|
||||
|
||||
// What time is this method being invoked?
|
||||
time_t now = ::time( 0 ) ;
|
||||
|
||||
while( !timerQueue.empty() && (timerQueue.top().second->absTime <= now) )
|
||||
{
|
||||
// Grab a timerInfo structure
|
||||
timerInfo* info = timerQueue.top().second ;
|
||||
|
||||
// Remove the structure from the timerQueue
|
||||
timerQueue.pop() ;
|
||||
|
||||
// Call the timer handler method for the client
|
||||
info->theHandler->OnTimer( info->ID, info->data ) ;
|
||||
|
||||
// Remove the timerID from the uniqueTimerMap
|
||||
uniqueTimerMap.erase( info->ID ) ;
|
||||
|
||||
// Deallocate the timerInfo structure for this timer
|
||||
delete info ;
|
||||
|
||||
// Increment the counter for number of timers executed
|
||||
++numTimers ;
|
||||
}
|
||||
|
||||
// Return the number of timers executed
|
||||
return numTimers ;
|
||||
}
|
||||
|
||||
xServer::timerID xServer::getUniqueTimerID()
|
||||
{
|
||||
timerID retMe = lastTimerID++ ;
|
||||
while( uniqueTimerMap.find( retMe ) != uniqueTimerMap.end() )
|
||||
{
|
||||
retMe = lastTimerID++ ;
|
||||
}
|
||||
return retMe ;
|
||||
}
|
||||
|
||||
void xServer::removeAllTimers( TimerHandler* theHandler )
|
||||
{
|
||||
// Stack all timerInfo structures that do not correspond
|
||||
// to the given TimerHandler.
|
||||
std::stack< pair< time_t, timerInfo* > > theStack ;
|
||||
|
||||
while( !timerQueue.empty() )
|
||||
{
|
||||
pair< time_t, timerInfo* > thePair = timerQueue.top() ;
|
||||
timerQueue.pop() ;
|
||||
|
||||
if( thePair.second->theHandler == theHandler )
|
||||
{
|
||||
// This timerInfo belongs to the TimerHandler in
|
||||
// question.
|
||||
// elog << "xServer::removeAllTimers> Found "
|
||||
// << "a timer that was not unregistered"
|
||||
// << endl ;
|
||||
|
||||
// Since the TimerHandler has little or no access
|
||||
// to the timer system internals here, it is safe
|
||||
// to simply call its OnTimerDestroy() method, even
|
||||
// though that method may call other xServer methods.
|
||||
theHandler->OnTimerDestroy( thePair.first, thePair.second ) ;
|
||||
|
||||
delete thePair.second ;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Add it to the stack
|
||||
theStack.push( thePair ) ;
|
||||
}
|
||||
} // while( !empty )
|
||||
|
||||
// All done, now put the timers back into the timerQueue
|
||||
while( !theStack.empty() )
|
||||
{
|
||||
timerQueue.push( theStack.top() ) ;
|
||||
theStack.pop() ;
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace gnuworld
|
||||
+40
@@ -0,0 +1,40 @@
|
||||
const char *sys_siglist[] = {
|
||||
"ZERO",
|
||||
"HUP",
|
||||
"INT",
|
||||
"QUIT",
|
||||
"ILL",
|
||||
"TRAP",
|
||||
"ABRT",
|
||||
"EMT",
|
||||
"FPE",
|
||||
"KILL",
|
||||
"BUS",
|
||||
"SEGV",
|
||||
"SYS",
|
||||
"PIPE",
|
||||
"ALRM",
|
||||
"TERM",
|
||||
"USR1",
|
||||
"USR2",
|
||||
"CHLD",
|
||||
"PWR",
|
||||
"WINCH",
|
||||
"URG",
|
||||
"POLL",
|
||||
"STOP",
|
||||
"TSTP",
|
||||
"CONT",
|
||||
"TTIN",
|
||||
"TTOU",
|
||||
"VTALRM",
|
||||
"PROF",
|
||||
"XCPU",
|
||||
"XFSZ",
|
||||
"WAITING",
|
||||
"LWP",
|
||||
"FREEZE",
|
||||
"THAW",
|
||||
"CANCEL",
|
||||
"LOST"
|
||||
} ;
|
||||
Reference in new issue
Block a user