ircproxy  The Ultimate Cyborg

ClientSessionInput Class Reference

#include <ClientSessionInput.h>

Inheritance diagram for ClientSessionInput:

List of all members.


Detailed Description

Client session input decoder.

This class is responsible for decoding messages received from a client.

Definition at line 31 of file ClientSessionInput.h.


Public Member Functions

 ClientSessionInput (input_buffer_ct *ibuf)
 Constructor (see libcw).

Protected Member Functions

void decode (msg_block_ct msg_block)
 Decode message msg_block as received from client.

Private Attributes

ClientMessageIn M_current_msg
 The IRC message currently being decoded.

Constructor & Destructor Documentation

ClientSessionInput::ClientSessionInput ( input_buffer_ct *  ibuf  ) 

Constructor (see libcw).

Definition at line 26 of file ClientSessionInput.cc.

00026                                                             : read_input_tct<text>(ibuf), M_current_msg(static_cast<ClientSession*>(this))
00027 {
00028 }


Member Function Documentation

void ClientSessionInput::decode ( msg_block_ct  msg_block  )  [protected]

Decode message msg_block as received from client.

This function is called when a new, complete IRC message has been received from the IRC client connected to the associated socket.

Definition at line 36 of file ClientSessionInput.cc.

References debug::channels::dc::clientinput, MessageIn::init(), and M_current_msg.

00037 {
00038 #ifdef CWDEBUG
00039   // Suppress even xchat lag ping/pong if requested.
00040   bool is_xchat_ping = (strncmp(msg_block.get_start(), "PING LAG", 5) == 0 && Application::instance().suppress_ping());
00041   // Always suppress OPER messages in order to protect the password.
00042   bool is_oper = (msg_block.get_size() >= 5 && strncasecmp(msg_block.get_start(), "OPER ", 5) == 0);
00043 
00044   if (is_oper)
00045     Dout(dc::clientinput|continued_cf|flush_cf, "ClientSessionInput::decode: Passing OPER message from client to server. Debug output will be turned off... ");
00046 
00047   if (is_xchat_ping || is_oper) Debug(libcw_do.off());
00048 #endif
00049     
00050   Dout(dc::clientinput, "ClientSessionInput::decode(\"" << buf2str(msg_block.get_start(), msg_block.get_size()) << "\")");
00051 
00052   // Initialize M_current_msg for decoding purposes.
00053   M_current_msg.init(msg_block);
00054 
00055   // Pass it on.
00056   new_message_received(M_current_msg);
00057 
00058   // Turn debug output back on, if needed.
00059   Debug(if (is_xchat_ping || is_oper) libcw_do.on());
00060 
00061 #ifdef CWDEBUG
00062   if (is_oper)
00063     Dout(dc::finish, "done");
00064 #endif
00065 }


Member Data Documentation

The IRC message currently being decoded.

Definition at line 33 of file ClientSessionInput.h.

Referenced by decode().


The documentation for this class was generated from the following files:

Copyright © 2005-2007 Carlo Wood.  All rights reserved.