mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-10-01 02:35:48 -04:00
73a6ca8af6
- added api client which reads the password from stdin. This allows to login from the webinterface and from the terminal at the same time. git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@8103 b45a01b8-16f6-495d-af2f-9b41ad6348cc
28 lines
797 B
C++
28 lines
797 B
C++
#pragma once
|
|
#include <api/ApiServer.h>
|
|
#include <util/rsthreads.h>
|
|
|
|
namespace resource_api {
|
|
|
|
// allows basic control from stdin/stdout
|
|
// - account selection
|
|
// - login
|
|
// - shutdown
|
|
class TerminalApiClient: private RsThread{
|
|
public:
|
|
// zero setup: create an instance of this class and destroy it when not needed anymore
|
|
// no need to call start or stop or something
|
|
// parameter api must not be null
|
|
TerminalApiClient(ApiServer* api);
|
|
~TerminalApiClient();
|
|
protected:
|
|
// from RsThread
|
|
virtual void run(); /* called once the thread is started. Should be overloaded by subclasses. */
|
|
private:
|
|
void waitForResponse(ApiServer::RequestId id);
|
|
bool isTokenValid(StateToken st);
|
|
ApiServer* mApiServer;
|
|
};
|
|
|
|
} // namespace resource_api
|