KernelMessenger Class Reference

This class provides the interface between the GUI and the program itself. More...

#include <kernelmessenger.h>

List of all members.

Public Types

enum  MessageBoxTypes { InformationBox, SorryBox, ErrorBox, QuestionBox }
 Message box types. More...

Public Member Functions

void closeConnection ()
 Closes the connection.
void addContact (const Contact &contact)
 Adds a contact to the list.
void removeContact (const Contact &contact)
 Removes a contact from the list.
void removeContact (const int ID)
 Removes a contact from the list.
void setUser (const Contact &contact)
 Sets the User.
const ContactgetUser () const
 Returns the program user.
void setContactList (const ContactList &list)
 Sets the user contact list.
void writeMessage (const BaseMessage &message)
 Writes a message to the socket.
void newMessage (const int fromID, const std::string message)
 Method called when a new messge is received.
void connectionEstablished (const bool bResult, const Contact &contact)
 Method called when the authentification to the server is established.
void contactListReceived (const bool bResult, const ContactList &list)
 Method called when the contact list is received.
void newConnection (const std::string &username, const std::string &password)
 Starts a new connection process.
void setConnectionOptions (const std::string &hostname, const int port)
 Changes connection parameters.
void stopDiscussion (const int contactID)
 Stops the discussion with a contact.
void newDiscussion (const Contact &contact)
 Starts a new discussion with the Contact contact.
void changeContactStatus (const int contactID, const Contact::Status newStatus)
 Changes the status of a contact.
void changeUserStatus (Contact::Status newStatus)
 Changes the user status.
const Contact *const getContact (int contactID) const
 Returns contact whose ID is contactID.
virtual ~KernelMessenger ()
 Destructor.
void errorReceived (const std::string &sDescription)
 Method to call when an error is received.
int popup (const MessageBoxTypes type, const std::string &message, const std::string &title) const
 Popups a Message box.
void parsingError (const SAXParseException *e)
 It reports a error during parsing XML.

Static Public Member Functions

static KernelMessengergetInstance ()
 Returns a reference to the KernelMessenger singleton.
static std::auto_ptr< KernelMessengercreateKernelMessenger (ListeWidget *pWidget)
 Builds a new KernelMessenger object.

Friends

class ConnectionManager
class Socket


Detailed Description

This class provides the interface between the GUI and the program itself.

Author:
Sylvain Archenault <sylvain.archenault@laposte.net>

Yves Houpert <yves.houpert@insa-rouen.fr>


Member Enumeration Documentation

enum KernelMessenger::MessageBoxTypes
 

Message box types.

Enumerator:
InformationBox  Information message box : Informs the user something fine happens
SorryBox  Sorry message box : the user did something wrong.
ErrorBox  Error message box : An error has occured.
QuestionBox  Question box : User answer needed.


Member Function Documentation

void KernelMessenger::addContact const Contact contact  ) 
 

Adds a contact to the list.

Parameters:
contact Contact to add.

void KernelMessenger::changeContactStatus const int  contactID,
const Contact::Status  newStatus
 

Changes the status of a contact.

Parameters:
contactID Contact to change status.
newStatus New contact status.

void KernelMessenger::changeUserStatus Contact::Status  newStatus  ) 
 

Changes the user status.

Parameters:
newStatus New contact status

void KernelMessenger::connectionEstablished const bool  bResult,
const Contact contact
 

Method called when the authentification to the server is established.

If the authentificatoin failed, bResult is false and contact is not a valid reference and should not be access.

Parameters:
bResult Result of authentification.
contact If bResult is true, it's a reference to a contact object representing the application user.

void KernelMessenger::contactListReceived const bool  bResult,
const ContactList list
 

Method called when the contact list is received.

If an error has occured, bResult is false and list is not a valid reference.

Parameters:
bResult Result of the contact list request.
list If bResult is true, reference to the user contact list.

std::auto_ptr< KernelMessenger > KernelMessenger::createKernelMessenger ListeWidget pWidget  )  [static]
 

Builds a new KernelMessenger object.

Parameters:
pWidget Pointer to the main widget.
Returns:
smart pointer to the KernelMessenger singleton created.

void KernelMessenger::errorReceived const std::string &  sDescription  ) 
 

Method to call when an error is received.

Parameters:
sDescription Error description.

const Contact *const KernelMessenger::getContact int  contactID  )  const
 

Returns contact whose ID is contactID.

Returns:
A Contact.

static KernelMessenger& KernelMessenger::getInstance  )  [inline, static]
 

Returns a reference to the KernelMessenger singleton.

Returns:
KernelMessenger singleton.

const Contact& KernelMessenger::getUser  )  const [inline]
 

Returns the program user.

Returns:
Contact user.

void KernelMessenger::newConnection const std::string &  username,
const std::string &  password
 

Starts a new connection process.

Parameters:
username Username to use for the connection.
passwword Password to use with the username, should be md5 hashed

void KernelMessenger::newDiscussion const Contact contact  ) 
 

Starts a new discussion with the Contact contact.

Parameters:
contact Contact to start discussion with.

void KernelMessenger::newMessage const int  fromID,
const std::string  message
 

Method called when a new messge is received.

Parameters:
fromID Message sender.
message Message content.

void KernelMessenger::parsingError const SAXParseException *  e  ) 
 

It reports a error during parsing XML.

Parameters:
e Exception caught.

int KernelMessenger::popup const MessageBoxTypes  type,
const std::string &  message,
const std::string &  title
const
 

Popups a Message box.

Parameters:
type Type of message box.
message Message box content.
title Message box title.
Returns:
Result KMessageBox::Yes if user answers 'Yes', KMessageBox::No in all other cases.

void KernelMessenger::removeContact const int  ID  ) 
 

Removes a contact from the list.

Parameters:
ID Contact ID to remove.

void KernelMessenger::removeContact const Contact contact  ) 
 

Removes a contact from the list.

Parameters:
contact Contact to remove

void KernelMessenger::setConnectionOptions const std::string &  hostname,
const int  port
 

Changes connection parameters.

Parameters:
hostanme Hostname to connect.
port Port to use for the connection.

void KernelMessenger::setContactList const ContactList list  ) 
 

Sets the user contact list.

Parameters:
list Contact list to set.

void KernelMessenger::setUser const Contact contact  ) 
 

Sets the User.

It's the contact object representing the contact user.

Parameters:
contact User.

void KernelMessenger::stopDiscussion const int  contactID  ) 
 

Stops the discussion with a contact.

Parameters:
contactID Contact to stop discussion with.

void KernelMessenger::writeMessage const BaseMessage message  ) 
 

Writes a message to the socket.

Parameters:
message BaseMessage to write.


The documentation for this class was generated from the following files:
Generated on Fri May 19 12:15:55 2006 for Bamboo Ch@t by  doxygen 1.4.6