#include "porting.h"
#include "map.h"
#include "inventory.h"
+#include "auth.h"
/*
Some random functions
// Envlock and conlock should be locked when calling this
void SendMovePlayer(Player *player);
+
+ u64 getPlayerAuthPrivs(const std::string &name)
+ {
+ try{
+ return m_authmanager.getPrivs(name);
+ }
+ catch(AuthNotFoundException &e)
+ {
+ dstream<<"WARNING: Auth not found for "<<name<<std::endl;
+ return 0;
+ }
+ }
+ void setPlayerAuthPrivs(const std::string &name, u64 privs)
+ {
+ try{
+ return m_authmanager.setPrivs(name, privs);
+ }
+ catch(AuthNotFoundException &e)
+ {
+ dstream<<"WARNING: Auth not found for "<<name<<std::endl;
+ }
+ }
private:
*/
static void SendHP(con::Connection &con, u16 peer_id, u8 hp);
- static void SendAccessDenied(con::Connection &con, u16 peer_id);
+ static void SendAccessDenied(con::Connection &con, u16 peer_id,
+ const std::wstring &reason);
/*
Non-static send methods
void handlePeerChange(PeerChange &c);
void handlePeerChanges();
+ u64 getPlayerPrivs(Player *player);
+
/*
Variables
*/
JMutex m_con_mutex;
// Connected clients (behind the con mutex)
core::map<u16, RemoteClient*> m_clients;
+
+ // User authentication
+ AuthManager m_authmanager;
/*
Threads