ircproxy  The Ultimate Cyborg

ISupport Class Reference

#include <ISupport.h>

List of all members.


Detailed Description

Stores the ISUPPORT reply (005) key/value pairs of the network.

Definition at line 26 of file ISupport.h.


Public Types

typedef std::map< std::string,
std::string > 
key_value_map_type
 The type of M_key_value_map.

Public Member Functions

void begin (void)
 This function is called when a new connection is initiated (when receiving numeric 004).
void end (void)
 This function is called as soon as possible after the last 005 message is received.
void add (std::string const &param)
 This function is called for every "key=value" pair in each 005 message.
bool get (std::string const &key, std::string &value)
 If key exists, returns true and writes the corresponding value to value, otherwise returns false.

Private Attributes

ServerConnectionM_server_connection
 Reference to the underlying server connection.
key_value_map_type M_key_value_map
 The map storing all numeric 005 key/value pairs.

Member Typedef Documentation

typedef std::map<std::string, std::string> ISupport::key_value_map_type

The type of M_key_value_map.

Definition at line 29 of file ISupport.h.


Member Function Documentation

void ISupport::begin ( void   ) 

This function is called when a new connection is initiated (when receiving numeric 004).

Definition at line 24 of file ISupport.cc.

References M_key_value_map.

Referenced by ServerSession::new_message_received().

00025 {
00026   M_key_value_map.clear();
00027 }

void ISupport::end ( void   ) 

This function is called as soon as possible after the last 005 message is received.

Definition at line 29 of file ISupport.cc.

References ServerSession::found_network_name(), M_server_connection, and ServerConnection::server_session().

Referenced by ServerSession::new_message_received().

void ISupport::add ( std::string const &  param  ) 

This function is called for every "key=value" pair in each 005 message.

Definition at line 34 of file ISupport.cc.

References DoutEntering, and M_key_value_map.

Referenced by ServerSession::new_message_received().

00035 {
00036   DoutEntering(dc::debug, "ISupport::add(" << param << ")");
00037   std::string::size_type pos = param.find('=');
00038   if (pos == std::string::npos)
00039     M_key_value_map.insert(key_value_map_type::value_type(param, std::string()));
00040   else
00041     M_key_value_map.insert(key_value_map_type::value_type(param.substr(0, pos), param.substr(pos + 1)));
00042 }

bool ISupport::get ( std::string const &  key,
std::string &  value 
)

If key exists, returns true and writes the corresponding value to value, otherwise returns false.

Definition at line 44 of file ISupport.cc.

References M_key_value_map.

Referenced by ServerSession::detected_network().

00045 {
00046   key_value_map_type::const_iterator iter = M_key_value_map.find(key);
00047   if (iter == M_key_value_map.end())
00048     return false;
00049   value = iter->second;
00050   return true;
00051 }


Member Data Documentation

Reference to the underlying server connection.

Definition at line 32 of file ISupport.h.

Referenced by end().

The map storing all numeric 005 key/value pairs.

Definition at line 33 of file ISupport.h.

Referenced by add(), begin(), and get().


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

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