Posted 2018-03-23 18:04:58 UTC

Series: libmatrix-client

Part 0

Seriously; check the date on this one

I realized I had made a number of mistakes in my sleep-deprived keyboard-smashing session at 05:00 the previous day while continuing to work on libmatrix-client. Thankfully, past me had decided not to push any of his commits, so I was able to go through everything to normalize and fix it to a reasonable degree.

In the process, I discovered that I'm probably using json-c rather inefficiently, if not completely incorrectly, and that I should probably consider switching to cURL's multi interface. My plan of attack here is to finish implementing mxHomeserverLogin() and mxHomeserverLogout() and their unit tests as past me had started to do, and then move on to fixing usage of json-c, cURL, and various other things.

After working for while, I realized that json-c does some reference counting and ownership stuff after reading through the docs enough times looking for functions. Because of this, I determined that I'll probably need to add some members to MxHomeserver and MxUser so that lifetimes work as expected and other code can be generally cleaner. Next up is the re-evaluation of my usage of cURL and take a look at its multi interface to see if that'll help me do things in a more correct way. Then it'll be time to rewrite the internals of functions and modularize things as sensibly as possible, and then to fix up all the documentation. Finally, after messing with seemingly stagnant code for probably far too long, it'll be time to go back to implementing more HTTP API endpoints.