Bitlbee Mastodon Plugin

This age collects all pages tagged Bitlbee and Mastodon. Most of them are probably related to the Mastodon plugin for Bitlbee.

2018-09-04 Bitlbee Mastodon Plugin 1.4.0

I tagged a new release of the Bitlbee Mastodon plugin!

New features for 1.4.0:

  • new filter command
  • new list command
  • new settings to hide notifications by type

Incompatible change in 1.4.0:

If you have subscribed to a hashtag, you need to change your channel settings and prepend the hash. Without the hash, the plugin gets confused and things the channel is for a list of the same name. Do this from the control channel (&bitlbee). Let’s assume you have a channel called #hashtag. It’s room setting should be #hashtag. If it’s lacking the initial hash:

kensanata
channel #hashtag set room
root
room = ’hashtag’
kensanata
channel #hashtag set room #hashtag
root
room = ’#hashtag’

Tags:

Add Comment

2018-08-31 Mastodon Bitlbee

So... brainstorming about things I’d like to look at.

  1. Look at issues, of course
  2. Considering better filtering: I’m interested in expiration of filters; using phrases as regular expression; applying filters to usernames too (use them as temporary muting)
  3. I think I’d like to support a tiny bit of rich text: bold and italic, maybe underline. Don’t know about colors! But with Pleroma now doing rich text, we should at least support what IRC supports!

Tags:

Add Comment

2018-08-27 Mastodon and rcirc

If you use rcirc (one of the two Emacs IRC clients) and the Bitlbee Mastodon plugin to communicate with a Mastodon instance via Bitlbee, and you want to “dim” the notifications of follows, boosts and favourites:

(eval-after-load 'rcirc
  '(add-to-list 'rcirc-markup-text-functions 'asc:rcirc-dim-keywords))

(defvar asc:rcirc-dim-keywords
  '("favourited your status: "
    "boosted your status: "
    " followed you")
  "Keywords which result in the entire message being dimmed.")

(defun asc:rcirc-dim-keywords (_senders _response)
  "Dim message if it contains particular phrases.
Phrases to take are from `asc:rcirc-dim-keywords'.
Each function takes two arguments, SENDER, and RESPONSE.  The
buffer is narrowed with the text to be printed and the point is
at the beginning of the ‘rcirc-text’ propertized text."
  (dolist (str asc:rcirc-dim-keywords)
    (goto-char (point-min))
    (when (search-forward str nil t)
      (rcirc-add-face (point-min) (point-max) 'rcirc-dim-nick))))

(Mastodon is a free, open-source, decentralized microblogging network. Bitlbee is an IRC server connecting to various other text messaging services. You run Bitlbee and connect to it using an IRC client, then configure Bitlbee to connect to other services, such as a Mastodon instance where you already have an account. The benefit is that you can now use any IRC client you want to connect to Mastodon.)

Tags:

Add Comment

2018-07-19 Bitlbee Mastodon More

I’ve added a more command to the Mastodon plugin for Bitlbee, and I fixed the timeline command.

You should be able to use more after any timeline command, now. The timeline command takes a user account, a hash tag, or one of the named timelines, local and federated.

timeline kensanata
timeline #kensanata
timeline local
timeline federated

Currently, this code is on the develop branch, but it should move into master soon.

Tags:

Comments on 2018-07-19 Bitlbee Mastodon More

And now I added pin and unpin commands. Any pair of commands with an API that follows this structure is super easy to add. It works exactly like favourite and unfavourite. I finished editing the issue at 13:53 and I checked in changes to the code and the documentation and closed the ticket at 14:08. This is perfect.

– Alex Schroeder 2018-07-23 14:12 UTC


And now I added a notifications command and I changed the more command to show more notifications, too.

– Alex Schroeder 2018-07-25 09:05 UTC


And I decided to tag this 1.3.0! New features are thus:

  • new notifications command
  • new more command
  • new pin and unpin commands
  • fixed client name

The client name was mispelled. It is now fixed: “bitlbee” instead of “biltbee”. This only gets used when you register, however. Thus, you would need to reset the hidden settings consumer_key and consumer_secret for your account from the command channel &bitlbee.

New features for 1.2.0 were:

  • format search results
  • new bio command
  • new pinned command
  • add all the accounts when replying
  • fixed list of accounts in the channel when connecting

New features for 1.1.0 were:

  • new hide_sensitive setting

– Alex Schroeder 2018-07-25 20:56 UTC


I tagged 1.3.1! New features:

  • new visibility command
  • new cw command
  • removed support for posting a content warning using CW1

Please enjoy. :)

– Alex Schroeder

Add Comment

2017-10-22 Mastodon and Bitlbee

OK, so you want to test the Mastodon implementation for Bitlbee like I do after a long break?

Well, let’s say you did a ./configure --debug=1 --asan=1 --msn=0 --jabber=0 --oscar=0 --twitter=0 && make in your directory and stuff crashes immediately. You want to debug. How does that work on macOS?

You try using gdb, and use the BITLBEE_DEBUG environment variable to have HTTP headers printed as you go:

alex@Megabombus:~/src/bitlbee (kensanata/develop %=)$ BITLBEE_DEBUG=1 gdb --args ~/src/bitlbee/bitlbee -D -n -F -v -d /Users/alex/.bitlbee -c /Users/alex/.bitlbee/bitlbee.conf
GNU gdb (GDB) 8.0.1
Copyright (C) 2017 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-apple-darwin16.7.0".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from /Users/alex/src/bitlbee/bitlbee...done.
.gdbinit:1: Error in sourced command file:
Disabling randomization of debuggee's virtual address space is unsupported on
this platform.
(gdb) run
Starting program: /Users/alex/Source/bitlbee/bitlbee 
Unable to find Mach task port for process-id 43768: (os/kern) failure (0x5).
 (please check gdb is codesigned - see taskgated(8))

OK, so the randomisation error is due to a line in .gdbinit and you can ignore it. You may also delete the file.

If you have used plugins such as bitlbee-facebook or bitlbee-discord, now would be a good time to delete them from /usr/local/lib/bitlbee until your issues are resolved.

You can’t ignore the part about codesigning, though. Luckily, the answer is simple:

alex@Megabombus:~/src/bitlbee (kensanata/develop %=)$ ls -l /usr/local/bin/gdb
lrwxr-xr-x 1 alex admin 27 Oct 22 09:46 /usr/local/bin/gdb -> ../Cellar/gdb/8.0.1/bin/gdb
alex@Megabombus:~/src/bitlbee (kensanata/develop %=)$ codesign -fs gdb-cert /usr/local/bin/gdb
alex@Megabombus:~/src/bitlbee (kensanata/develop %=)$ codesign -fs gdb-cert /usr/local/bin/../Cellar/gdb/8.0.1/bin/gdb
/usr/local/bin/../Cellar/gdb/8.0.1/bin/gdb: replacing existing signature

You will have to provide your username and password, twice.

Now, when you issue the run command, you will have to provide your username and password, again, but now it works:

(gdb) run
Starting program: Starting program: /Users/alex/Source/bitlbee/bitlbee -D -n -F -v -d /Users/alex/.bitlbee -c /Users/alex/.bitlbee/bitlbee.conf
[New Thread 0x1403 of process 43950]
warning: unhandled dyld version (15)
Warning: Warning: Couldn't write PID to `/var/run/bitlbee.pid'

You should now be able to connect to your local server (in my case, megabombus.local) using an IRC client.

And you’ll probably get an error like the following:

ASAN:DEADLYSIGNAL
=================================================================
==48642==ERROR: AddressSanitizer: SEGV on unknown address 0x00000000b8f0 (pc 0x0001000ccf00 bp 0x7fff5fbfdaf0 sp 0x7fff5fbfda50 T0)
==48642==The signal is caused by a READ memory access.
    #0 0x1000cceff in mastodon_http_timeline (bitlbee:x86_64+0x1000cceff)
    #1 0x1000c2fc9 in mastodon_http_hashtag_timeline (bitlbee:x86_64+0x1000c2fc9)
    #2 0x100078b80 in http_incoming_data (bitlbee:x86_64+0x100078b80)
    #3 0x100074587 in gaim_io_invoke (bitlbee:x86_64+0x100074587)
    #4 0x100251e63 in g_main_context_dispatch (libglib-2.0.0.dylib:x86_64+0x2ce63)
    #5 0x100252161 in g_main_context_iterate (libglib-2.0.0.dylib:x86_64+0x2d161)
    #6 0x1002523b6 in g_main_loop_run (libglib-2.0.0.dylib:x86_64+0x2d3b6)
    #7 0x1000742af in b_main_run (bitlbee:x86_64+0x1000742af)
    #8 0x100069e7f in main unix.c:182
    #9 0x7fffe946e234 in start (libdyld.dylib:x86_64+0x5234)

And now you know where to look. Well, more or less. You need to convert that address to a line number:

(gdb) info line *0x1000cceff
Line 1054 of "mastodon_lib.c" starts at address 0x1000ccebc <mastodon_http_timeline+28>
   and ends at 0x1000ccf07 <mastodon_http_timeline+103>.

Strangely enough, setting a breakpoint does not help. Hit C-c to break, b mastodon_http_timeline to set a breakpoint, c to continue, and try again – and you run into the same error without reaching a GDB prompt. This also happens if you run without ASAN. I’m not sure what the problem is, but in this situation you’re basically back to print statements and the like. Uagh!

Oh, and Mastodon 2.0 changed all their ids from integers to string in their API and so everything is broken.

Tags:

Comments on 2017-10-22 Mastodon and Bitlbee

Also, I’m working on my branch, kensanata/develop. I have the remote upstream configured. So when I’m done and I have committed, I fetch from upstream, rebase onto upstream/develop, and force push that.

Later, when I’m ready to upgrade my Pull Request, I switch to my master branch. And then what? To be answered. :)

– Alex 2017-10-23 05:17 UTC


Looks like my PR is not going to get merged. It’s a big chunk of code and tricky to review thoroughly, unfortunately. :(

– Alex 2017-10-23 14:53 UTC


Then again, based on the example of bitlbee-discord it was easy to turn my code into a plugin: bitlbee-mastodon!

– Alex 2017-10-24 06:55 UTC

Add Comment

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!

Tags:

Comments on 2017-07-25 Bitlbee, Mastodon, and C

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

Add Comment

Comments


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.