Logo Search packages:      
Sourcecode: znc version File versions

void Csock::PushBuff ( const char *  data,
int  len,
bool  bStartAtZero = false 
) [virtual]

pushes data up on the buffer, if a line is ready it calls the ReadLine event

Definition at line 1338 of file Csocket.cpp.

References ReachedMaxBuffer(), and ReadLine().

{
      if ( !m_bEnableReadLine )
            return;     // If the ReadLine event is disabled, just ditch here

      u_int iStartPos = ( m_sbuffer.empty() || bStartAtZero ? 0 : m_sbuffer.length() - 1 );

      if ( data )
            m_sbuffer.append( data, len );

      while( !m_bPauseRead )
      {
            CS_STRING::size_type iFind = m_sbuffer.find( "\n", iStartPos );

            if ( iFind != CS_STRING::npos )
            {
                  CS_STRING sBuff = m_sbuffer.substr( 0, iFind + 1 );   // read up to(including) the newline
                  m_sbuffer.erase( 0, iFind + 1 );                            // erase past the newline
                  ReadLine( sBuff );
                  iStartPos = 0; // reset this back to 0, since we need to look for the next newline here.

            } else
                  break;
      }

      if ( ( m_iMaxStoredBufferLength > 0 ) && ( m_sbuffer.length() > m_iMaxStoredBufferLength ) )
            ReachedMaxBuffer(); // call the max read buffer event

}


Generated by  Doxygen 1.6.0   Back to index