39 sLog.Debug(
"APIAccountManager::ProcessCall()",
"EVEmu API - Account Service Manager");
41 if( pAPICommandCall->find(
"servicehandler" ) == pAPICommandCall->end() )
43 sLog.Error(
"APIAccountManager::ProcessCall()",
"Cannot find 'servicehandler' specifier in pAPICommandCall packet" );
44 return std::tr1::shared_ptr<std::string>(
new std::string(
""));
47 if( pAPICommandCall->find(
"servicehandler" )->second ==
"APIKeyRequest.xml.aspx" )
49 else if( pAPICommandCall->find(
"servicehandler" )->second ==
"Characters.xml.aspx" )
51 else if( pAPICommandCall->find(
"servicehandler" )->second ==
"AccountStatus.xml.aspx" )
57 sLog.Error(
"APIAccountManager::ProcessCall()",
"EVEmu API - Account Service Manager - ERROR: Cannot resolve '%s' as a valid service query for Admin Service Manager",
58 pAPICommandCall->find(
"servicehandler")->second.c_str() );
59 return std::tr1::shared_ptr<std::string>(
new std::string(
""));
73 std::string apiLimitedKey;
74 std::string apiFullKey;
75 std::string accountID;
78 sLog.Debug(
"APIAccountManager::_APIKeyRequest()",
"EVEmu API - Account Service Manager - CALL: APIKeyRequest.xml.aspx");
81 if( pAPICommandCall->find(
"username" ) != pAPICommandCall->end() )
82 username = pAPICommandCall->find(
"username" )->second;
85 sLog.Error(
"APIAccountManager::_APIKeyRequest()",
"ERROR: No 'username' parameter found in call argument list - exiting with error" );
89 if( pAPICommandCall->find(
"password" ) != pAPICommandCall->end() )
90 password = pAPICommandCall->find(
"password" )->second;
93 sLog.Error(
"APIAccountManager::_APIKeyRequest()",
"ERROR: No 'password' parameter found in call argument list - exiting with error" );
97 if( pAPICommandCall->find(
"keytype" ) != pAPICommandCall->end() )
98 keyType = pAPICommandCall->find(
"keytype" )->second;
101 sLog.Error(
"APIAccountManager::_APIKeyRequest()",
"ERROR: No 'keytype' parameter found in call argument list - exiting with error" );
105 if( keyType !=
"full" )
106 if( keyType !=
"limited" )
108 sLog.Error(
"APIAccountManager::_APIKeyRequest()",
"ERROR: 'keytype' parameter has invalid value '%s' - exiting with error", keyType.c_str() );
112 if( pAPICommandCall->find(
"action" ) != pAPICommandCall->end() )
113 action = pAPICommandCall->find(
"action" )->second;
116 sLog.Error(
"APIAccountManager::_APIKeyRequest()",
"ERROR: No 'action' parameter found in call argument list - exiting with error" );
120 if( action !=
"new" )
121 if( action !=
"get" )
123 sLog.Error(
"APIAccountManager::_APIKeyRequest()",
"ERROR: 'action' parameter has invalid value '%s' - exiting with error", action.c_str() );
131 sLog.Error(
"APIAccountManager::_APIKeyRequest()",
"ERROR: username='%s' password='%s' does not authenticate.", username.c_str(), password.c_str() );
138 sLog.Error(
"APIAccountManager::_APIKeyRequest()",
"ERROR: username='%s' cannot be found in 'account' table.", username.c_str() );
155 if( action ==
"new" )
156 if( keyType ==
"limited" )
161 if( action ==
"new" )
178 sLog.Error(
"APIAccountManager::_APIKeyRequest()",
"ERROR: username='%s' cannot be found in 'account' table.", username.c_str() );
186 if( keyType ==
"full" )
188 keyTag =
"apiFullKey";
193 keyTag =
"apiLimitedKey";
206 sLog.Error(
"APIAccountManager::_Characters()",
"TODO: Insert code to validate userID and apiKey" );
208 sLog.Debug(
"APIAccountManager::_Characters()",
"EVEmu API - Account Service Manager - CALL: Characters.xml.aspx");
210 if( pAPICommandCall->find(
"userid" ) == pAPICommandCall->end() )
212 sLog.Error(
"APIAccountManager::_Characters()",
"ERROR: No 'userID' parameter found in call argument list - exiting with error" );
218 std::vector<std::string> charIDList;
219 std::vector<std::string> charNameList;
220 std::vector<std::string> charCorpIDList;
221 std::vector<std::string> charCorpNameList;
223 std::string userID = pAPICommandCall->find(
"userid" )->second;
228 sLog.Error(
"APIAccountManager::_Characters()",
"ERROR: userID='%s' cannot be found in 'accountApi' table.", userID.c_str() );
234 sLog.Error(
"APIAccountManager::_Characters()",
"ERROR: m_accountDB.GetCharactersList() call failed for unknown reason - exiting with error" );
238 std::vector<std::string> rowset;
243 rowset.push_back(
"name");
244 rowset.push_back(
"characterID");
245 rowset.push_back(
"corporationName");
246 rowset.push_back(
"corporationID");
249 for(
uint32 i=0; i<charIDList.size(); i++)
252 rowset.push_back(charNameList.at(i));
253 rowset.push_back(charIDList.at(i));
254 rowset.push_back(charCorpNameList.at(i));
255 rowset.push_back(charCorpIDList.at(i));
270 sLog.Error(
"APIAccountManager::_AccountStatus()",
"TODO: Insert code to validate userID and apiKey" );
272 if( pAPICommandCall->find(
"userid" ) == pAPICommandCall->end() )
274 sLog.Error(
"APIAccountManager::_AccountStatus()",
"ERROR: No 'userID' parameter found in call argument list - exiting with error" );
279 std::vector<std::string> accountInfoList;
283 sLog.Error(
"APIAccountManager::_AccountStatus()",
"ERROR: Could not find 'accountID' in 'accountApi' table - exiting with error" );
289 sLog.Error(
"APIAccountManager::_AccountStatus()",
"ERROR: Could not find 'accountID' in 'account' table; there is an invalid 'accountID' referenced by api account 'userID' = %s - exiting with error", pAPICommandCall->find(
"userid" )->second.c_str() );
311 std::string
key =
"";
313 for(
int i=0; i<64; i++ )
std::tr1::shared_ptr< std::string > BuildErrorXMLResponse(std::string errorCode, std::string errorMessage)
bool GetAccountIdFromUsername(std::string username, std::string *accountID)
?
std::tr1::shared_ptr< std::string > _GetXMLDocumentString()
std::tr1::shared_ptr< std::string > _APIKeyRequest(const APICommandCall *pAPICommandCall)
std::tr1::shared_ptr< std::string > ProcessCall(const APICommandCall *pAPICommandCall)
void _BuildSingleXMLTag(std::string name, std::string param)
bool InsertNewUserIdApiKeyInfoToDatabase(uint32 accountID, std::string apiFullKey, std::string apiLimitedKey, uint32 apiRole)
?
std::tr1::shared_ptr< std::string > _AccountStatus(const APICommandCall *pAPICommandCall)
static std::string m_hexCharMap
std::map< std::string, std::string > APICommandCall
#define sLog
Evaluates to a NewLog instance.
const int64 Win32Time_Day
std::string _GenerateAPIKey()
bool GetAccountIdFromUserID(std::string userID, uint32 *accountID)
?
APIAccountManager(const PyServiceMgr &services)
bool GetAccountInfo(uint32 accountID, std::vector< std::string > &accountInfoList)
?
Generic Base Class used to derive classes for specific service handlers (character, corporation, etc)
bool GetCharactersList(uint32 accountID, std::vector< std::string > &charIDList, std::vector< std::string > &charNameList, std::vector< std::string > &charCorpIDList, std::vector< std::string > &charCorpNameList)
?
bool _AuthenticateUserNamePassword(std::string userName, std::string password)
int64 MakeRandomInt(int64 low, int64 high)
Generates random integer from interval [low; high].
void _BuildXMLTag(std::string name)
std::tr1::shared_ptr< std::string > _Characters(const APICommandCall *pAPICommandCall)
std::string Win32TimeToString(int64 win32t)
typeID Spawn an NPC with the specified type text Search for items matching the specified query() type() key(value)-Send an OnRemoteMessage" ) COMMAND( setbpattr
void _BuildXMLRow(const std::vector< std::string > *columns)
bool GetApiAccountInfoUsingAccountID(std::string accountID, uint32 *userID, std::string *apiFullKey, std::string *apiLimitedKey, uint32 *apiRole)
?
void _CloseXMLHeader(uint32 cacheStyle)
void _BuildXMLRowSet(std::string name, std::string key, const std::vector< std::string > *columns)
const char * itoa(int64 num)
Convers num to string.
bool UpdateUserIdApiKeyDatabaseRow(uint32 userID, std::string apiFullKey, std::string apiLimitedKey)
?