2017-07-25 Bitlbee, Mastodon, and C

These days, I’ve been struggling to get back into C.

Wow, C! I had forgotten about the edit, compile, debug cycle. Also, no hot code replacement in running processes. And no printing of interesting structures. It all comes back to me now.

Current status: I have a bitlbee fork that will log me into my Mastodon account using OAuth2 and display my home timeline. Nothing else works but this looks like magic because it’s written in C.

It’s also supposed to add all the people you’re following by that doesn’t seem to work: I’m using GET /api/v1/accounts/:id/followers and since_id seems to have no effect, getting accounts with id lower than what I specified, so now it’s looping forever since we never seem to get to the end of the list. Sad.

I don’t know why I’m spending my summer break on writing C to write a gateway between Mastodon and Bitlbee in order to get an Internet Relay Chat gateway from Emacs to Mastodon. This is crazy!



Fixed that issue with following accounts. I think I’m getting the hang of it!

The streaming API also works. I get new statuses (”updates”) but no notification (mentions, favorites, boosts). I think it should be easy to add, though.

I have a TODO list, now.

– Alex Schroeder 2017-07-26 13:42 UTC

Notifications implemented. Some refactoring and trimming. Now looking at details like HTML text conversion problems. And soon: posting! Hashtag tracking! It’s going to be great!

– Alex 2017-07-27 21:21 UTC

Fixed the disappearing paragraph breaks problem.

Expect no updates for the next few days.

– Alex 2017-07-28 08:58 UTC

I don’t know why I’m spending my summer break on writing C to write a gateway between Mastodon and Bitlbee in order to get an Internet Relay Chat gateway from Emacs to Mastodon. This is crazy!

If it’s any help, this is something I’d absolutely love. Being able to use Mastodon from Bitlbee is something I’ve been interested in for a while.

If I can help at all, please let me know! I’m a coder myself but haven’t any experience with the Bitlbee codebase.

(First-time commenter here! I don’t believe we know each other.)

– Sophira 2017-07-29 10:33 UTC

Welcome! I guess the first thing to do is to build and run it. See whether the code we have actually works. If you already use Bitlbee, then I suggest you keep your existing Bitlbee as-is and run the new Bitlbee on a different port. My IRC client then connects to both.

Next is setup: I wrote Howto Mastodon on the Bitlbee wiki. Sadly the Bitlbee help files are still missing. I’m interested to see how far other people get.

If it works, you should have basic read-only access.

Then you can start creating issues on GitHub, or write help files, or look at the C code. :)

– Alex 2017-07-31 05:38 UTC

Now that I’m writing C code I should change the tagline in our company’s intranet from “Code Monkey” to “Programmer-at-Arms”. Or is that “Programmer-Archaeologist”.

(cf. A Deepness in the Sky)

– Alex 2017-08-04 06:01 UTC

Hah, pretty much done! All the commands implemented. Todo:

  • subscribing to hashtags
  • clean up of Twitter code
  • better in-app documentation
  • merge request
  • - Alex 2017-08-05 16:24 UTC

I think it’s done! I’m running it now. Every now and then I implement new commands, like context for a status or timeline for a nick, but that’s basically it.

The version I compiled I configured with ./configure --debug=1 --asan=1 and I already found two memory issues which I fixed.

And thus, with everything done, I guess I’m open to the creation of issues. I only take Mastodon issues, of course.

Now that I know how the Twitter code works, I might also take Twitter issues, but that’s now my main focus.

– Alex 2017-08-09 09:54 UTC

As my master branch is under review by the Bitlbee folks, and I still find things to do, I started working on a new branch. Just in case you want to join me living on the bleeding edge.

– Alex 2017-08-10 13:22 UTC

When compiling using Emacs, use _SRCDIR_=~/src/bitlbee/ make -k. The _SRCDIR_ environment variable is only set if you run ./configure in a different directory, which you wouldn’t usually do. If it is set, however, the compiler will output fully qualified filenames, which Compile Mode then knows.

– Alex 2017-08-11 16:51 UTC

I feel like a real hacker because I implemented undo and redo for posts. Now to extend it to favourites, follows, mutes.

– Alex 2017-08-11 21:43 UTC

This is too cool for words. I think you can update your tagline to Senior Code Monkey :)

AlokSingh 2017-08-24 06:55 UTC

Hahaha! :)

– Alex 2017-08-24 08:17 UTC

Please make sure you contribute only your own work, or work licensed under the GNU Free Documentation License. Note: in order to facilitate peer review and fight vandalism, we will store your IP number for a number of days. See Privacy Policy for more information. See Info for text formatting rules. You can edit the comment page if you need to fix typos. You can subscribe to new comments by email without leaving a comment.

To save this page you must answer this question:

Please say HELLO.