Matrix client interface for high-level API.This interface is implemented by the high-level API classes. All high-level API classes implement this, no matter which low-level API is used (e.g. HTTP)
More...
#include <client.hh>
|
virtual void | login (const std::string &username, const std::string &password, const callback_t< const std::string &, const std::string &> &=noop_callback< const std::string &, const std::string &>)=0 |
| log in using username and password More...
|
|
virtual void | loginWith3PID (const std::string &medium, const std::string &address, const std::string &password, const callback_t< const std::string &, const std::string &> &=noop_callback< const std::string &, const std::string &>)=0 |
| log in using third party ID and pasword. More...
|
|
virtual void | logout (const callback_t<> &=noop_callback<>)=0 |
| log out. More...
|
|
virtual bool | isLoggedIn () const =0 |
| determine if the client is currently logged in.
|
|
virtual void | startClient ()=0 |
| start listening for new events.
|
|
virtual void | stopClient ()=0 |
| stop listening for new events.
|
|
virtual void | sendMessage (const Event::MessageEvent &message, const callback_t< const std::string &> &callback=noop_callback< const std::string &>)=0 |
| send a message event. More...
|
|
Room & | getRoom (const std::string &room_id) |
| return the room with the given ID. More...
|
|
const Room & | getRoom (const std::string &room_id) const throw (std::out_of_range) |
|
Room & | operator[] (const std::string &room_id) |
|
const Room & | operator[] (const std::string &room_id) const throw (std::out_of_range) |
|
void | on (const std::string &type, const callback_t< Room &, const Event::Event &> &callback) |
| register an event handler. More...
|
|
template<class T > |
void | on (const callback_t< Room &, const Event::Event &> &callback) |
| register an event handler. More...
|
|
|
void | trigger (const Event::Event &event) |
| call event handlers for the given event.
|
|
void | triggerError (const std::string &event_type, std::shared_ptr< Error::Error > error, const std::string &room_id="") |
|
void | _setRoomMembership (Room &room, Event::RoomMembership::membership_t membership) |
|
|
std::map< std::string, Room > | rooms |
|
Matrix client interface for high-level API.
This interface is implemented by the high-level API classes. All high-level API classes implement this, no matter which low-level API is used (e.g. HTTP)
- Examples:
- liboperator-glib/examples/echo.cc, and liboperator-qt/examples/echo.cc.
◆ getRoom()
Room& Operator::Client::Client::getRoom |
( |
const std::string & |
room_id | ) |
|
|
inline |
return the room with the given ID.
- Parameters
-
◆ login()
virtual void Operator::Client::Client::login |
( |
const std::string & |
username, |
|
|
const std::string & |
password, |
|
|
const callback_t< const std::string &, const std::string &> & |
= noop_callback< const std::string &, const std::string &> |
|
) |
| |
|
pure virtual |
log in using username and password
- Parameters
-
[in] | username | The username to log in as |
[in] | password | The password to use |
[out] | callback | The callback will receive the user's Matrix ID and the server name |
- See also
- (C-S r0.2.0 section 3.2.1)
Implemented in Operator::Client::HTTPClient.
◆ loginWith3PID()
virtual void Operator::Client::Client::loginWith3PID |
( |
const std::string & |
medium, |
|
|
const std::string & |
address, |
|
|
const std::string & |
password, |
|
|
const callback_t< const std::string &, const std::string &> & |
= noop_callback< const std::string &, const std::string &> |
|
) |
| |
|
pure virtual |
◆ logout()
virtual void Operator::Client::Client::logout |
( |
const callback_t<> & |
= noop_callback<> | ) |
|
|
pure virtual |
◆ on() [1/2]
register an event handler.
Register an event handler to be called when an event of the given type is received.
- Parameters
-
[in] | type | The event type, or "*" for all events. |
[out] | callback | The callback will receive the room that the event belongs to and the event. |
- Examples:
- liboperator-glib/examples/echo.cc, and liboperator-qt/examples/echo.cc.
◆ on() [2/2]
register an event handler.
Register an event handler to be called when an event of the given type is received.
- Note
- This is just syntactic sugar for on(T::TYPE, callback). That is, when determining which callbacks to call, it only compares the event's type field with T::TYPE, and does not check the actual class of the event generated. One consequence of this is that event passed to the callback may not necessarily be an object of class T.
- Template Parameters
-
- Parameters
-
[out] | callback | The callback will receive the room that the event belongs to and the event. |
◆ sendMessage()
virtual void Operator::Client::Client::sendMessage |
( |
const Event::MessageEvent & |
message, |
|
|
const callback_t< const std::string &> & |
callback = noop_callback< const std::string &> |
|
) |
| |
|
pure virtual |
The documentation for this interface was generated from the following files: