Logo
~Sockets~
~Examples~
~Contact~


DChatHandler Class Reference

#include <DChatHandler.h>

List of all members.


Public Member Functions

 DChatHandler (const std::string &)
 ~DChatHandler ()
std::string GetVersion ()
unsigned char * GetKey_m2minion ()
void Who (ChatSocket *)
void Talk (const std::string &name, const std::string &prat)
void SendWho ()
void SendTalk (const std::string &name, const std::string &prat)
void ShowWho (const std::string &)

Detailed Description

File ......... DChatHandler.h Published .... 2004-04-19 Author ....... grymse@alhem.net

Definition at line 36 of file DChatHandler.h.


Constructor & Destructor Documentation

DChatHandler::DChatHandler ( const std::string &  f  ) 

File ......... DChatHandler.cpp Published .... 2004-04-19 Author ....... grymse@alhem.net

Definition at line 30 of file DChatHandler.cpp.

00031 :MinderHandler()
00032 {
00033 }

DChatHandler::~DChatHandler (  ) 

Definition at line 36 of file DChatHandler.cpp.

00037 {
00038 }


Member Function Documentation

std::string DChatHandler::GetVersion (  )  [inline]

Definition at line 42 of file DChatHandler.h.

00042 { return ""; }

unsigned char* DChatHandler::GetKey_m2minion (  )  [inline]

Definition at line 43 of file DChatHandler.h.

References k1.

00043 { return k1; }

void DChatHandler::Who ( ChatSocket  ) 

Definition at line 41 of file DChatHandler.cpp.

00042 {
00043         SendMessage(Utility::base64("who"));
00044 }

void DChatHandler::Talk ( const std::string &  name,
const std::string &  prat 
)

Definition at line 47 of file DChatHandler.cpp.

00048 {
00049         std::string msg = "talk:" + Utility::base64(name);
00050         msg += ":" + prat;
00051         SendMessage(Utility::base64(msg));
00052 }

void DChatHandler::SendWho (  ) 

Definition at line 55 of file DChatHandler.cpp.

00056 {
00057         for (socket_m::iterator it = m_sockets.begin(); it != m_sockets.end(); it++)
00058         {
00059                 Socket *p0 = (*it).second;
00060                 ChatSocket *p = dynamic_cast<ChatSocket *>(p0);
00061                 if (p)
00062                 {
00063                         std::string msg = "online:" + Utility::base64(p -> GetName());
00064                         SendMessage(Utility::base64(msg));
00065                 }
00066         }
00067 }

void DChatHandler::SendTalk ( const std::string &  name,
const std::string &  prat 
)

Definition at line 70 of file DChatHandler.cpp.

00071 {
00072         for (socket_m::iterator it = m_sockets.begin(); it != m_sockets.end(); it++)
00073         {
00074                 Socket *p0 = (*it).second;
00075                 ChatSocket *p = dynamic_cast<ChatSocket *>(p0);
00076                 if (p)
00077                 {
00078                         std::string str = who + " says '" + prat + "'\n";
00079                         p -> Send( "\n" + str);
00080                         p -> Send(">");
00081                 }
00082         }
00083 }

void DChatHandler::ShowWho ( const std::string &   ) 

Definition at line 86 of file DChatHandler.cpp.

00087 {
00088         for (socket_m::iterator it = m_sockets.begin(); it != m_sockets.end(); it++)
00089         {
00090                 Socket *p0 = (*it).second;
00091                 ChatSocket *p = dynamic_cast<ChatSocket *>(p0);
00092                 if (p)
00093                 {
00094                         std::string str = who + " is online.\n";
00095                         p -> Send( "\n" + str);
00096                         p -> Send(">");
00097                 }
00098         }
00099 }


The documentation for this class was generated from the following files:
Page, code, and content Copyright (C) 2006 by Anders Hedström
Generated on Mon Aug 29 20:21:47 2005 for C++ Sockets by  doxygen 1.4.4