The matrix.eventable module/function returns a table with a pair of functions
which can be used to connect event handlers to events, and to generate them.
Basic usage is as follows:
obj = eventable()
obj.hook("event-name", print) -- Handle the event with "print"
obj.fire("event-name", "Hello, world") -- Prints "Hello, world"
This initial implementation has the following limitations:
* Event handlers are always invoked in the same order in which they have been
connected using the .hook() function.
* Individual event handlers cannot be disconnected. Only disconnecting all
handlers for en event at once is possible via .hook("event", nil).
The old prefix could be confusing if the homeserver URL used the https://
scheme, and the new one better conveys that it is matrix.api who is doing
the logging.
This introduces a get_http_factory() function which will try to load
a HTTP client library according to the following logic:
1. If the MATRIX_API_HTTP_CLIENT environment variable is defined, it is
taken as the name of a HTTP client library.
2. Otherwise, if the function paramter is non-nil it is used as the name
of the HTTP client library to load.
3. Otherwise, the available HTTP client libraries are tried in order,
and the first one which can be require()'d successfully will be
used. For now this has only the "chttp" client.
This avoids the potential issue in which the status code would be "nil" or
"false", which HTTP client libraries may choose to signal an error condition.
* The :quote and :unquote methods are now plain functions and no longer
receive the "self" parameter. This allows to directly use the utility
functions provided by the HTTP client library.
* Renamed CqHttpClient to plain "httclient". The variable itself is local
to the script so it does not need to be unique.