diff --git a/src/matrix-http-api.c b/src/matrix-http-api.c index 4a21041..80d491e 100644 --- a/src/matrix-http-api.c +++ b/src/matrix-http-api.c @@ -430,6 +430,12 @@ response_callback(SoupSession *session, } } +static void +update_query_params(gchar *key, gchar *value, SoupURI *uri) +{ + soup_uri_set_query_from_fields(uri, key, value, NULL); +} + static void matrix_http_api_send(MatrixHTTPAPI *api, MatrixAPICallback callback, @@ -472,6 +478,15 @@ matrix_http_api_send(MatrixHTTPAPI *api, } uri = soup_uri_new_with_base(priv->uri, path); + + if (params) { + g_hash_table_foreach(params, (GHFunc)update_query_params, uri); + } + + if (priv->token) { + update_query_params("access_token", priv->token, uri); + } + url = soup_uri_to_string(uri, FALSE); soup_uri_free(uri); g_debug("Sending %s to %s", method, url); diff --git a/src/test-client.c b/src/test-client.c index 3ad7bdd..5c2bc2d 100644 --- a/src/test-client.c +++ b/src/test-client.c @@ -95,6 +95,12 @@ main(int argc, char *argv[]) g_info("Starting up: %s with %s:%s", url, user, password); + /* + * [ ] register + * [X] login + * [ ] create_room + * [ ] join_room + */ api = matrix_http_api_new(url, NULL); params = matrix_http_api_gen_parameters( "user", user,