ChatLog Class Reference

Handles chat-log operations for a single chat room on a server. More...

#include <chatlog.h>

Public Member Functions

 ChatLog (const wxString &server, const wxString &room)
 Constructor.
 ~ChatLog ()
 Destructor.
bool AddMessage (const wxString &text)
 Append a time-stamped message to the log file.
bool LogEnabled ()
 Check if chat logging is enabled.
wxString LogTime ()
 Get a string, representing the current time-of-day, suitable for prepending to messages.
void OpenInEditor ()
const wxArrayString & GetLastLines () const

Protected Member Functions

void CloseSession ()
 Closes the current "session" in the log file by appending a session-closed notice to end before closing the file.
wxString GetCurrentLogfilePath () const
 Get the path (filename) to the current log file.
bool WriteLine (const wxString &text)
 Write a line of text to the output file, without any further formatting.
bool CreateCurrentLogFolder ()
 Create the directory in which the current logfile is saved.
bool OpenLogFile ()
void FillLastLineArray ()

Protected Attributes

wxString m_server
wxString m_room
bool m_active
wxFile m_logfile
wxArrayString m_last_lines

Detailed Description

Handles chat-log operations for a single chat room on a server.

Definition at line 10 of file chatlog.h.


Constructor & Destructor Documentation

ChatLog::ChatLog ( const wxString server,
const wxString room 
)

Constructor.

Prepares the ChatLog to accept log messages for the given chat room or channel on the given server.

Parameters:
server Alias or hostname for the server on which the chat room or channel is located.
room Name of the chat room or channel this object will accept messages for.

Definition at line 25 of file chatlog.cpp.

ChatLog::~ChatLog (  ) 

Destructor.

Calls CloseSession if the log file is currently opened.

Definition at line 39 of file chatlog.cpp.


Member Function Documentation

bool ChatLog::AddMessage ( const wxString text  ) 

Append a time-stamped message to the log file.

Retrieves a time-stamp string from LogTime.

Note:
This does nothing, successfully, if chat logging is disabled.
Parameters:
text Message text to log.
Returns:
false if an error was encountered while writing to the log file, and true otherwise.
See also:
LogEnabled LogTime

Definition at line 55 of file chatlog.cpp.

void ChatLog::CloseSession (  )  [protected]

Closes the current "session" in the log file by appending a session-closed notice to end before closing the file.

Postcondition:
The file is closed, and any further calls to AddMessage will reopen the log file, starting a new session.

Definition at line 46 of file chatlog.cpp.

bool ChatLog::CreateCurrentLogFolder (  )  [protected]

Create the directory in which the current logfile is saved.

Returns:
true on success, false on failure.

Definition at line 71 of file chatlog.cpp.

void ChatLog::FillLastLineArray (  )  [protected]

Definition at line 287 of file chatlog.cpp.

wxString ChatLog::GetCurrentLogfilePath (  )  const [protected]

Get the path (filename) to the current log file.

Returns:
A platform-specific logfile path string.

Definition at line 144 of file chatlog.cpp.

const wxArrayString & ChatLog::GetLastLines (  )  const

Definition at line 138 of file chatlog.cpp.

bool ChatLog::LogEnabled (  ) 

Check if chat logging is enabled.

Returns:
true if chat logging is enabled, and false if it is not.

Definition at line 151 of file chatlog.cpp.

wxString ChatLog::LogTime (  ) 

Get a string, representing the current time-of-day, suitable for prepending to messages.

This is used by AddMessage.

Returns:
a string including hours and minutes.
See also:
AddMessage

Definition at line 127 of file chatlog.cpp.

void ChatLog::OpenInEditor (  ) 

Definition at line 133 of file chatlog.cpp.

bool ChatLog::OpenLogFile (  )  [protected]

Definition at line 100 of file chatlog.cpp.

bool ChatLog::WriteLine ( const wxString text  )  [protected]

Write a line of text to the output file, without any further formatting.

Parameters:
text The line to write.
Returns:
true if the line was successfully written, and false otherwise.

Definition at line 87 of file chatlog.cpp.


Field Documentation

bool ChatLog::m_active [protected]

Definition at line 100 of file chatlog.h.

wxArrayString ChatLog::m_last_lines [protected]

Definition at line 103 of file chatlog.h.

wxFile ChatLog::m_logfile [protected]

Definition at line 101 of file chatlog.h.

Definition at line 98 of file chatlog.h.

Definition at line 97 of file chatlog.h.


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

Generated on Thu Dec 29 00:11:43 2011 for SpringLobby by doxygen 1.6.3