Page MenuHomePhorge

Add necessary features to Implement handle matrix uri in kazv
Changes PlannedPublic

Authored by nannanko on Aug 23 2025, 6:44 AM.
Tags
None
Referenced Files
F7771271: D226.1758719067.diff
Tue, Sep 23, 6:04 AM
F7771250: D226.1758718690.diff
Tue, Sep 23, 5:58 AM
F7769832: D226.1758686592.diff
Mon, Sep 22, 9:03 PM
F7768850: D226.1758659290.diff
Mon, Sep 22, 1:28 PM
F7768280: D226.1758635473.diff
Mon, Sep 22, 6:51 AM
Subscribers
None

Details

Reviewers
tusooa
Group Reviewers
O1: the Kazv Project
Maniphest Tasks
T29: Parse matrix links
Summary

Add roomId for CreateRoomResponse.

Add Client::addDirectRoom().

Type: add

Test Plan

verify unit tests pass.

Diff Detail

Repository
rL libkazv
Branch
nannanko/create-room-response
Lint
No Lint Coverage
Unit
No Test Coverage
Build Status
Buildable 435
Build 853: GitLab CI for libkazv
Build 852: arc lint + arc unit

Event Timeline

Please add a changelog type to the summary, using the following format:

Type: (add|remove|skip|security|fix)

nannanko removed a reviewer: servant.

Add addDirectRoom() function

nannanko retitled this revision from Add data json for CreateRoomResponse to Add necessary features to Implement handle matrix uri in kazv.
nannanko edited the summary of this revision. (Show Details)

Tests has not been written yet.

tusooa requested changes to this revision.Mon, Sep 8, 4:25 PM
tusooa added inline comments.
src/client/client.cpp
475–489

You should be reusing the content json of the original account data event, not directRoomMap(). directRoomMap is intended to be used as a way to quickly find which user a direct room is associated with. Your code here just convert things back and forth, and is inefficient and error-prone.

This revision now requires changes to proceed.Mon, Sep 8, 4:25 PM

Reusing the content json of the original account data event instead of directRoomMap()

Add comments of param for Client::addDirectRoom()

tusooa requested changes to this revision.Sat, Sep 13, 7:16 PM
tusooa added inline comments.
src/client/client.cpp
476

did not check whether userId is contained in content, can cause UB.

477

did not check whether rooms is a json array

src/tests/client/account-data-test.cpp
471

Add test cases where:

  • the m.direct content contains other users' rooms, then these rooms should be kept.
  • the m.direct content contains the user id but another room, then the new room should be added while keeping existing room(s).
This revision now requires changes to proceed.Sat, Sep 13, 7:16 PM

Check whether userId is contained in content, whether rooms is a json array, and add more test case.

Add GetRoomIdByAliasAction and Client::getRoomIdByAlias()

tusooa requested changes to this revision.Sat, Sep 20, 3:28 PM
tusooa added inline comments.
src/client/actions/alias.cpp
24

refer to the matrix spec for a better grammar for alias.

also, the regex should be static const and the isValidAlias function should be global and static

28

This line is not covered

src/client/actions/alias.hpp
15–19

Should this really be an Action in the ClientModel?

The problem with it being an action is that it cannot happen at the same time with other actions -- this is useful to avoid race conditions when the reducer needs to access the model and change it based on the current. But your reducer does not actually need to access the model except server url and access token (which we consider to be unlikely to change).

This means that it might have to wait for the potential heavy computing in another reducer before it can give you back the results.

Maybe a function that returns a BaseJob + a function that parses a Response will be a better idea.

BaseJob getRoomIdByAliasJob(std::string alias) const;
static std::string parseGetRoomIdByAliasResponse(...) const;
This revision now requires changes to proceed.Sat, Sep 20, 3:28 PM
nannanko marked 2 inline comments as done.