31 : m_services(services)
40 sLog.Debug(
"APIServiceManager::ProcessCall()",
"EVEmu API - Default Service Manager");
145 AccountInfo account_info;
146 if( !
services().serviceDB().GetAccountInformation(
153 std::string passHash;
155 username, password, passHash ) )
159 return passHash == account_info.hash;
164 std::string apiFullKey;
165 std::string apiLimitedKey;
170 if( (apiKey.compare( apiFullKey )) && (status) )
178 std::string apiFullKey;
179 std::string apiLimitedKey;
184 if( (apiKey.compare( apiLimitedKey )) && (status) )
202 TiXmlDeclaration * decl =
new TiXmlDeclaration(
"1.0",
"UTF-8",
"" );
209 TiXmlElement *
currentTime =
new TiXmlElement(
"currentTime" );
235 TiXmlElement * rowset =
new TiXmlElement(
"rowset" );
237 std::vector<std::string>::const_iterator current, end;
238 rowset->SetAttribute(
"name", name.c_str() );
239 rowset->SetAttribute(
"key", key.c_str() );
240 current = columns->begin();
241 end = columns->end();
244 for(; current != end; ++current)
261 TiXmlElement * row =
new TiXmlElement(
"row" );
263 std::vector<std::string>::const_iterator current, end;
265 std::string column_name;
268 current = columns->begin();
269 end = columns->end();
270 for(; current != end; ++current)
272 pos = column_string.find_first_of(
",");
273 column_name = column_string.substr(0,pos);
274 column_string = column_string.substr(pos+1);
275 row->SetAttribute( column_name.c_str(), current->c_str() );
282 TiXmlElement * tag =
new TiXmlElement( name.c_str() );
288 TiXmlElement * tag =
new TiXmlElement( name.c_str() );
290 std::vector<std::pair<std::string, std::string> >::const_iterator current, end;
291 current = params->begin();
293 for(; current != end; ++current)
294 tag->SetAttribute( current->first.c_str(), current->second.c_str() );
307 TiXmlElement * tag =
new TiXmlElement( name.c_str() );
308 tag->LinkEndChild(
new TiXmlText( value.c_str() ));
318 TiXmlElement * error =
new TiXmlElement(
"error" );
319 error->SetAttribute(
"code", code.c_str() );
320 error->LinkEndChild(
new TiXmlText( param.c_str() ));
341 _pNextTopElement->LinkEndChild( _pTopElement );
347 TiXmlPrinter xmlPrinter;
350 return std::tr1::shared_ptr<std::string>(
new std::string(xmlPrinter.CStr()));
std::tr1::shared_ptr< std::string > BuildErrorXMLResponse(std::string errorCode, std::string errorMessage)
APIServiceManager(const PyServiceMgr &services)
std::stack< TiXmlElement * > * _pXmlElementStack
std::tr1::shared_ptr< std::string > _GetXMLDocumentString()
void _BuildSingleXMLTag(std::string name, std::string param)
std::map< std::string, std::string > APICommandCall
#define sLog
Evaluates to a NewLog instance.
bool _AuthenticateFullAPIQuery(std::string userID, std::string apiKey)
virtual std::tr1::shared_ptr< std::string > ProcessCall(const APICommandCall *pAPICommandCall)
bool GetApiAccountInfoUsingUserID(std::string userID, std::string *apiFullKey, std::string *apiLimitedKey, uint32 *apiRole)
?
static bool GeneratePassHash(const std::string &user, const std::string &pass, std::string &hash)
Generates a SHA-1 hash from a username and a password.
std::string _CurrentRowSetColumnString
bool _AuthenticateUserNamePassword(std::string userName, std::string password)
void _BuildXMLTag(std::string name)
TiXmlElement * _pXmlDocOuterTag
PyServiceMgr & services()
const int64 Win32Time_Minute
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)
void _BuildErrorXMLTag(std::string code, std::string param)
void _CloseXMLHeader(uint32 cacheStyle)
void _BuildXMLRowSet(std::string name, std::string key, const std::vector< std::string > *columns)
bool _AuthenticateLimitedAPIQuery(std::string userID, std::string apiKey)
static uint32 currentTime