Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

ASC_PBEM Class Reference

#include <pbem-server-interaction.h>

Inheritance diagram for ASC_PBEM:

Inheritance graph
[legend]
List of all members.

Public Member Functions

 ASC_PBEM (ASCString serverBase)
 default constructor:
 ~ASC_PBEM ()
bool isUsable ()
 important: check this first after instantiation this class will be false after any
bool login (ASCString user, ASCString passwd)
bool createAccount (ASCString user, ASCString passwd, ASCString email)
bool activateAccount (ASCString user, ASCString code)
bool uploadFile (ASCString fileName, const char *data, const int size, const int gameID)
std::vector< TUserDatagetUserList (bool activeOnly=true)
bool createGame (ASCString fileName, const char *data, const int size, ASCString gameName, ASCString fileNamePattern, char *roles, int *players, int projectID=-1, int turn=1, int currentSlot=1)
std::vector< TGameInfogetCurrentGamesInfo (bool myTurnOnly)
TFileDatadownloadGame (TGameInfo game)
bool logout ()
bool isLoggedIn ()
ASCString getHeader ()
ASCString getBody ()
int getStatusCode ()
std::vector< ASCStringlistPlayers ()

Static Public Attributes

static const char ROLE_SUPERVISOR = 's'
static const char ROLE_PLAYER = 'p'
static const char ROLE_HIDDEN = 'h'

Constructor & Destructor Documentation

ASC_PBEM::ASC_PBEM ASCString  serverBase  ) 
 

default constructor:

Parameters:
serverBase,: default url syntax, example: http://localhost:8080/ascServer/ note: currently, the trailing slash is _required_ ??? todo: fix that ;)

Definition at line 150 of file pbem-server-interaction.cpp.

ASC_PBEM::~ASC_PBEM  ) 
 

Definition at line 180 of file pbem-server-interaction.cpp.


Member Function Documentation

bool ASC_PBEM::activateAccount ASCString  user,
ASCString  code
 

Returns:
true if the account could be activated false if anything went wrong, which is most likely due to one of these reasons:
  • wrong server
  • wrong code

Definition at line 417 of file pbem-server-interaction.cpp.

bool ASC_PBEM::createAccount ASCString  user,
ASCString  passwd,
ASCString  email
 

Returns:
true if the account could be created false if anything went wrong, which is most likely due to one of these reasons:
  • wrong server
  • username already taken
  • invalid characters for either username or password

Definition at line 398 of file pbem-server-interaction.cpp.

bool ASC_PBEM::createGame ASCString  fileName,
const char *  data,
const int  size,
ASCString  gameName,
ASCString  fileNamePattern,
char *  roles,
int *  players,
int  projectID = -1,
int  turn = 1,
int  currentSlot = 1
 

Returns:
true if game creation went ok, false on failure

Definition at line 455 of file pbem-server-interaction.cpp.

References ASC_PBEM_FileUploadControl::boundary, ASC_PBEM_FileUploadControl::fileName, ASC_PBEM_FileUploadControl::parameters, ASC_PBEM_FileUploadControl::sent_step, and ASC_PBEM_FileUploadControl::step.

TFileData * ASC_PBEM::downloadGame TGameInfo  game  ) 
 

Returns:
the file data of a ascpbm game, or NULL if not logged in or an error occured

Definition at line 610 of file pbem-server-interaction.cpp.

References ASC_PBEM_writeBuffer(), TGameInfo::currentSaveGameName, TFileData::fileData, TFileData::fileName, TFileData::fileSize, TGameInfo::gameID, and getBody().

ASCString ASC_PBEM::getBody  ) 
 

Definition at line 697 of file pbem-server-interaction.cpp.

Referenced by downloadGame(), getCurrentGamesInfo(), getUserList(), and nmain().

std::vector< TGameInfo > ASC_PBEM::getCurrentGamesInfo bool  myTurnOnly  ) 
 

Returns:
a vector of TGameInfo structs containing the current games of the logged in player
Parameters:
myTurnOnly if true, only return info about games where it's the turn of the currenty logged in player

Definition at line 511 of file pbem-server-interaction.cpp.

References getBody().

Referenced by nmain().

ASCString ASC_PBEM::getHeader  ) 
 

Definition at line 689 of file pbem-server-interaction.cpp.

Referenced by nmain().

int ASC_PBEM::getStatusCode  ) 
 

Definition at line 705 of file pbem-server-interaction.cpp.

Referenced by nmain().

std::vector< TUserData > ASC_PBEM::getUserList bool  activeOnly = true  ) 
 

Returns:
a vector of TUserData structs containing the ascpbem server accounts
Parameters:
activeOnly if true, only return data about active (activated) players

Definition at line 555 of file pbem-server-interaction.cpp.

References getBody().

Referenced by listPlayers().

bool ASC_PBEM::isLoggedIn  ) 
 

Definition at line 190 of file pbem-server-interaction.cpp.

bool ASC_PBEM::isUsable  ) 
 

important: check this first after instantiation this class will be false after any

See also:
request where anything went wrong if false, no request will be send out again, and this instance is basically done for

Definition at line 185 of file pbem-server-interaction.cpp.

Referenced by nmain().

std::vector< ASCString > ASC_PBEM::listPlayers  ) 
 

Reimplemented from ServerInterface.

Definition at line 597 of file pbem-server-interaction.cpp.

References getUserList().

bool ASC_PBEM::login ASCString  user,
ASCString  passwd
 

Returns:
true if login to pbem server procceded ok, false if anything went wrong (most likely wrong user/password, but could also be wrong server base or inactive account

Definition at line 381 of file pbem-server-interaction.cpp.

Referenced by PBEMServer::getSession(), and nmain().

bool ASC_PBEM::logout  ) 
 

Returns:
true if logout went ok, false on failure failure most likely means one of two things:
  • wrong server url
  • not logged in (session timeout?)

Definition at line 367 of file pbem-server-interaction.cpp.

Referenced by nmain().

bool ASC_PBEM::uploadFile ASCString  fileName,
const char *  data,
const int  size,
const int  gameID
 

Returns:
true if upload went ok, false on failure

Definition at line 432 of file pbem-server-interaction.cpp.

References ASC_PBEM_FileUploadControl::boundary, ASC_PBEM_FileUploadControl::fileName, ASC_PBEM_FileUploadControl::parameters, ASC_PBEM_FileUploadControl::sent_step, and ASC_PBEM_FileUploadControl::step.


Member Data Documentation

const char ASC_PBEM::ROLE_HIDDEN = 'h' [static]
 

Definition at line 132 of file pbem-server-interaction.h.

const char ASC_PBEM::ROLE_PLAYER = 'p' [static]
 

Definition at line 131 of file pbem-server-interaction.h.

const char ASC_PBEM::ROLE_SUPERVISOR = 's' [static]
 

Definition at line 130 of file pbem-server-interaction.h.


The documentation for this class was generated from the following files:
Generated on Tue Jun 24 02:16:07 2008 for Advanced Strategic Command by  doxygen 1.4.2