Planeshift
AdviceManager Class Reference

AdviceManager keeps track of all the invitations of any kind that are pending, using a collection of PendingAdvice objects. More...

#include <advicemanager.h>

Public Member Functions

void AddAdvisor (Client *client)
 Adds a new advisor available to answer questions. More...
 
 AdviceManager (psDatabase *db)
 
void AdviceRequestTimeout (AdviceSession *adviceSession)
 Resend request for advice due to timeout. More...
 
void CancelAdvisorSession (gemActor *who, AdviceSession *adviceSession, const char *msg)
 Remove advise session due to timeout. More...
 
bool GetAdvisorMode (int id, int connectionId)
 Retrieve the clients advisor mode. More...
 
void HandleAdviceMessage (MsgEntry *pMsg, Client *client)
 
void RemoveAdvisor (uint32_t id, int connectionId)
 Remove advisor available to answer questions. More...
 
void RemoveSession (AdviceSession *adviceSession)
 
virtual ~AdviceManager ()
 
- Public Member Functions inherited from MessageManager< AdviceManager >
void HandleMessage (MsgEntry *msg, Client *client)
 Transfers the message to the manager specific function. More...
 
void Subscribe (FunctionPointer fpt, msgtype type, uint32_t flags=0x01)
 Subscribes this manager to a specific message type with a custom callback. More...
 
bool Unsubscribe (msgtype type)
 Unsubscribes this manager from a specific message type. More...
 
bool Unsubscribe (FunctionPointer handler, msgtype type)
 Unsubscribes a specific handler from a specific message type. More...
 
bool UnsubscribeAll ()
 Unsubscribes this manager from all message types. More...
 
virtual ~MessageManager ()
 Unsubscribes all messages then destroys this object. More...
 
- Public Member Functions inherited from MessageManagerBase
csArray< csString > DecodeCommandArea (Client *client, csString target)
 Decodes an area: expression. More...
 
gemObjectFindObjectByString (const csString &str, gemActor *me) const
 Find the object we are referring to in str. More...
 
ClientFindPlayerClient (const char *name)
 Finds Client* of character with given name. More...
 
virtual bool Verify (MsgEntry *pMsg, unsigned int flags, Client *&client)
 

Protected Member Functions

bool FloodControl (csString &newmessage, Client *client)
 
void HandleAdviceList (Client *advisor)
 
void HandleAdviceRequest (Client *advisee, csString message)
 
void HandleAdviceResponse (Client *advisee, csString sAdvisee, csString message)
 
void HandleAdviseeList (Client *advisor)
 
void HandleListAdvisors (Client *advisor)
 

Protected Attributes

csHash< AdviceSession * > AdviseeList
 
size_t advisorPos
 
csArray< AdvisorStructadvisors
 
psDatabasedatabase
 

Additional Inherited Members

- Public Types inherited from MessageManager< AdviceManager >
typedef void(AdviceManager::* FunctionPointer) (MsgEntry *, Client *)
 

Detailed Description

AdviceManager keeps track of all the invitations of any kind that are pending, using a collection of PendingAdvice objects.

An invitation is pending between the time that the Noob sends the invitation and when an Advisor sends a response.

Definition at line 77 of file advicemanager.h.

Constructor & Destructor Documentation

AdviceManager::AdviceManager ( psDatabase db)
virtual AdviceManager::~AdviceManager ( )
virtual

Member Function Documentation

void AdviceManager::AddAdvisor ( Client client)

Adds a new advisor available to answer questions.

Parameters
clientThe player client.
void AdviceManager::AdviceRequestTimeout ( AdviceSession *  adviceSession)

Resend request for advice due to timeout.

Parameters
adviceSessionThe session that has expired
void AdviceManager::CancelAdvisorSession ( gemActor who,
AdviceSession *  adviceSession,
const char *  msg 
)

Remove advise session due to timeout.

Parameters
whoThe actor.
adviceSessionThe session that has expired.
msgA message for the player.
bool AdviceManager::FloodControl ( csString &  newmessage,
Client client 
)
protected
bool AdviceManager::GetAdvisorMode ( int  id,
int  connectionId 
)

Retrieve the clients advisor mode.

Parameters
idThe id of the advisor to remove ( same as player ID )
connectionIdThe client id that client dropping advisor role.
void AdviceManager::HandleAdviceList ( Client advisor)
protected
void AdviceManager::HandleAdviceMessage ( MsgEntry pMsg,
Client client 
)
void AdviceManager::HandleAdviceRequest ( Client advisee,
csString  message 
)
protected
void AdviceManager::HandleAdviceResponse ( Client advisee,
csString  sAdvisee,
csString  message 
)
protected
void AdviceManager::HandleAdviseeList ( Client advisor)
protected
void AdviceManager::HandleListAdvisors ( Client advisor)
protected
void AdviceManager::RemoveAdvisor ( uint32_t  id,
int  connectionId 
)

Remove advisor available to answer questions.

Parameters
idThe id of the advisor to remove ( same as player ID )
connectionIdThe client id that client dropping advisor role.
void AdviceManager::RemoveSession ( AdviceSession *  adviceSession)

Member Data Documentation

csHash<AdviceSession*> AdviceManager::AdviseeList
protected

Definition at line 137 of file advicemanager.h.

size_t AdviceManager::advisorPos
protected

Definition at line 139 of file advicemanager.h.

csArray<AdvisorStruct> AdviceManager::advisors
protected

Definition at line 138 of file advicemanager.h.

psDatabase* AdviceManager::database
protected

Definition at line 140 of file advicemanager.h.


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