Giter Site home page Giter Site logo

kensanata / bitlbee-mastodon Goto Github PK

View Code? Open in Web Editor NEW
29.0 7.0 7.0 438 KB

A Mastodon plugin for Bitlbee

Home Page: https://alexschroeder.ch/software/Bitlbee_Mastodon

License: GNU General Public License v2.0

Makefile 0.87% Shell 0.35% M4 1.23% C 97.55%

bitlbee-mastodon's Introduction

Mastodon plugin for Bitlbee

This plugin allows Bitlbee to communicate with Mastodon instances. 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.

A screenshot of Emacs running the rcirc IRC client connected to a Mastodon instance via Bitlbee

Please report issues using the Software Wiki. For questions, ping kensanata on irc.oftc.net/#bitlbee.

Table of Contents

License

Most of the source code is distributed under the GNU Lesser Public License 2.1.

The build system is distributed under the GNU Public License 2.0 or any later version.

Anything without an obvious license in the file header also uses the GPL 2.0 or any later version.

Contributors

Usage

First, make sure the installation worked by checking the installed protocols using the plugins command in your &bitlbee control channel.

If this worked, create your account using the account command in your &bitlbee control channel.

In this example, we'll sign in as @[email protected]. This assumes an existing account on an instance! Replace username and Mastodon server when trying it.

In your &bitlbee channel, add a new account, change it's base_url to point at your instance, and switch it on:

<kensanata> account add mastodon @kensanata
<root> Account successfully added with tag mastodon
<kensanata> account mastodon set base_url https://mastodon.weaponvsac.space
<root> base_url = `https://mastodon.weaponvsac.space
<kensanata> account mastodon on
<root> mastodon - Logging in: Login
<root> mastodon - Logging in: Parsing application registration response
<root> mastodon - Logging in: Starting OAuth authentication

At this point, you'll get contacted by the user mastodon_oauth with a big URL that you need to visit using a browser. Visit the URL and authenticate the client. You'll get back another very long string. Copy and paste this string:

<mastodon_oauth> Open this URL in your browser to authenticate: https://.......
<mastodon_oauth> Respond to this message with the returned authorization token.
<kensanata> ****************************************************************

Once you do that, your login should complete in the &bitlbee channel:

<root> mastodon2 - Logging in: Requesting OAuth access token
<root> mastodon2 - Logging in: Connecting
<root> mastodon2 - Logging in: Verifying credentials
<root> mastodon2 - Logging in: Getting home timeline
<root> mastodon2 - Logging in: Logged in

You should now have a channel called #mastodon.weaponsvsac.space@localhost where all the status updates and notifications get shown. We'll call this your account channel. See help set name to change it's name.

Mastodon gives BitlBee a permanent authentication token, which is saved in your configuration.

You should probably save this configuration.

<kensanata> save
<root> Configuration saved

Adding the account and switching it on loads the Bitlbee Mastodon help file into the system, allowing you to use help mastodon in your &bitlbee control channel.

Alternatively, a snapshot of the entries added to the help system by this plugin are available on the help page.

Build dependencies

  • bitlbee and headers >= 3.5

    If you haven't built Bitlbee yourself you will need to install the dev package, usually bitlbee-dev or bitlbee-devel. If Bitlbee was built from source don't forget to do make install-dev.

    To NetBSD users: your Bitlbee doesn't include the devel files. One way to fix this is to build Bitlbee via pkgsrc. You'll need to add to the chat/bitlbee pkgsrc Makefile, in the post-build hook, this line:

    cd ${WRKSRC} && ${GMAKE} DESTDIR=${DESTDIR} install-dev
    

    Don't forget to regenerate your PLIST (plugindir is /usr/pkg/lib/bitlbee) with:

    make print-PLIST > PLIST
    
  • glib2 and headers => 2.32

    The library itself is usually installed as a dependency of Bitlbee but headers need to be installed separately. In Debian, the package containing them is libglib2.0-dev.

  • autotools (if building from git)

    A bit of an overkill, but it works. If you don't have this package, try looking for autoconf and libtool.

    *BSD users should install autoconf, automake and libtool, preferably the latest version available. FreeBSD will also need pkgconfig on top of that. GNU sed (gsed), GNU make (gmake), and the bash shell are also required -- BSD make cannot successfully build bitlbee-mastodon, and the build process uses GNU extensions to both the Bourne shell and sed.

Building and Installing

Check your distribution:

  • FreeBSD: irc/bitlbee-mastodon

Alternatively, build it from source. You need to generate the autotools configuration script and related files by executing the following command:

./autogen.sh

After that, you can build as usual:

./configure
make
sudo make install

๐Ÿ”ฅ If your Bitlbee's plugindir is in a non-standard location you need to specify it: ./configure with --with-plugindir=/path/to/plugindir

๐Ÿ”ฅ If you're installing this plugin in a system where you didn't build your own Bitlbee but installed revision 3.5.1 (e.g. on a Debian system around the end of 2017), you will run into a problem: the plugin will get installed into /usr/lib/bitlbee (plugindir) but the documentation wants to install into /usr/local/share/bitlbee instead of /usr/share/bitlbee (datadir). As you can tell from /usr/lib/pkgconfig/bitlbee.pc, there is no datadir for you. In this situation, try ./configure --prefix=/usr and build and install again.

Bugs

๐Ÿ”ฅ Crashing while running Twitter: there seems to be some sort of interaction between the Twitter code and the Mastodon plugin. If you get connected to Mastodon and then Bitlbee crashes, and you have a Twitter account set up, try this:

  1. take the Twitter account offline
  2. take the Mastodon account online
  3. take the Twitter account online

๐Ÿ”ฅ Cannot use Pleroma: there are two ways to do streaming for Mastodon: regular long-running HTTP requests, or a bunch of websockets that provides all the streaming info. Sadly, the Mastodon plugin only supports HTTP streaming and Pleroma only supports websockets. But we're working on it.

๐Ÿ”ฅ No support for 2FA: the Mastodon plugin knows about OAuth, which means it doesn't ask you for the password of your Mastodon account. Instead, it gives you an URL on your instance where you identify yourself and get back a token which you then give the Mastodon plugin. You can revoke this token from your instance by going to Preferences โ†’ Account โ†’ Authorized Apps and looking for Bitlbee. Sadly, the Mastodon plugin doesn't know about 2FA (two-factor auth).

Debugging

Before debugging Bitlbee, you probably need to stop the system from running Bitlbee. The problem is that systemd was instructed not to kill it (KillMode=process). Therefore I run the following:

sudo systemctl stop bitlbee
sudo killall bitlbee

You can enable extra debug output for bitlbee-mastodon by setting the BITLBEE_DEBUG environment variable. This will print all traffic it exchanges with Mastodon servers to STDOUT and there is a lot of it. You can see this output in the systemd journal:

sudo journalctl -fu bitlbee

Alternatively, run bitlbee in foreground mode:

BITLBEE_DEBUG=1 bitlbee -nvD

If you run this as a normal use, bitlbee cannot read its config file and thus won't know about your existing accounts. If you need to read your config file from the standard location, run it as the bitlbee user:

BITLBEE_DEBUG=1 sudo -u bitlbee bitlbee -nvD

If you need to use a debugger, make a copy of /etc/bitlbee/bitlbee.conf (or simply create an empty file) and /var/lib/bitlbee/. Then run gdb, set the breakpoints you want (answer yes to "Make breakpoint pending on future shared library load?"), and run it using the options shown:

touch bitlbee.conf
sudo cp /var/lib/bitlbee/*.xml .
gdb bitlbee
b mastodon_post_message
y
run -nvD -c bitlbee.conf -d .

Then connect with an IRC client as you usually do.

If you're getting error messages about the address being in use, you haven't managed to kill the existing Bitlbee.

Error: bind: Address already in use

Check who's listening on port 6667:

sudo lsof -i:6667

Then do what is necessary to kill it. ๐Ÿ˜ˆ

Note that perhaps you must remove the -O2 from CFLAGS in the src/Makefile and run make clean && make && sudo make install in the src directory in order to build and install the module without any compiler optimisation. If you run make in the top directory, src/Makefile will get regenerated and you'll get your optimized code again.

You know you're running optimized code when things seem to repeat themselves in strange ways:

(gdb) n
594		if (!mastodon_length_check(ic, message)) {
(gdb) 
583	{
(gdb) 
594		if (!mastodon_length_check(ic, message)) {
(gdb) 
584		struct mastodon_data *md = ic->proto_data;
(gdb) 
594		if (!mastodon_length_check(ic, message)) {
(gdb) 
584		struct mastodon_data *md = ic->proto_data;
(gdb) 
594		if (!mastodon_length_check(ic, message)) {
(gdb) 

Or when values can't be printed:

(gdb) p m->str
value has been optimized out

WARNING: there is sensitive information in this debug output, such as auth tokens, your plaintext password and, obviously, your incoming and outgoing messages. Be sure to remove any information you are not willing to share before posting it anywhere.

If you are experiencing crashes please refer to debugging crashes for information on how to get a meaningful backtrace.

bitlbee-mastodon's People

Contributors

alex-free avatar blabber avatar iguanaonmystack avatar julianaito avatar kensanata avatar oaknuggins avatar soniex2 avatar velartrill avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

bitlbee-mastodon's Issues

build process non-portable

the current build process relies on a number of GNU extensions, to GNU make, bash, and sed. the upshot is that it does not compile on FreeBSD (or presumably other BSDs, such as Mac OS X). this is a simple fix - references to sh need to be replaced with explicit references to bash (including implicit references - /bin/sh is the default shell used by BSD make; on linux /bin/sh is a link to bash but on FreeBSD is the bourne shell binary), references to sed need to be replaced with references to GNU sed, which may be gsed or sed โ€” this is automatically detected by autotools.

note when a makefile is built with gmake rather than BSD make, it appears to use bash as its default shell - if we can depend on the user installing and using gmake, we only need to worry about sed, a fix for which i'm including in an upcoming PR. however, it may be best to fix the build process to simply remove the GNU extensions, as they appear to have been involved accidentally and unnecessarily.

Release tarballs do not contain `configure`

During packaging I noticed that the release tarballs (from https://github.com/kensanata/bitlbee-mastodon/tags) seem to be just point-in-time snapshots of the git tree, and do not contain a configure binary.
Is this intentional? Running autotools during the build process is of course possible, but always a bit fraught as the build process might use a different autotools version than the source maintainer, leading to inconsistencies in the generated files.

Segfault loop after mastodon closes the stream

Hi, I am experiencing a problem similar to #7, but with version 1.4.1 of the plugin (debian stable). Could it be that this issue is not completely fixed?

In my case, bitlbee enters a segfault loop every time I reconnect, and I had to kill bitlbee completely and start it again to make it usable. I found that the start of the segfault loop is after getting a "Stream closed" error from Mastodon.

[17:17:35] <root> mastodon - Error: Stream closed (200 OK)
[17:17:35] <root> mastodon - Signing off..
[17:17:35] <root> mastodon - Logging in: Reconnecting in 5 seconds..
[17:17:40] <root> mastodon - Logging in: Login
[17:17:40] <root> mastodon - Logging in: Connecting
[17:17:40] <root> mastodon - Logging in: Verifying credentials
[17:17:40] <root> mastodon - Logging in: Getting home timeline
[17:17:40] <root> mastodon - Logging in: Logged in

[17:17:41] <*status> Error from Server [BitlBee crashed! (SIGSEGV received)]
[17:17:41] <*status> Disconnected from IRC. Reconnecting...
[17:17:43] <*status> Connected!
[17:17:46] <*status> Disconnected from IRC. Reconnecting...
[17:18:11] <*status> Connection Refused.  Reconnecting...
[17:18:42] <*status> Connection Refused.  Reconnecting...
[17:19:14] <*status> Connected!
[17:19:17] <*status> Error from Server [BitlBee crashed! (SIGSEGV received)]
[17:19:17] <*status> Disconnected from IRC. Reconnecting...

hardcodes default maximum tweet length

currently, bitlbee-mastodon simply assumes the maximum length of a tweet is 500 chars, and provides a setting to allow the user to set the maximum length to the correct value for their server. however, pleroma and glitchsoc (at the very least) provide a means to query an instance for its maximum character length - we should use this instead when it's available. this can be retrieved from the max_toot_chars field of the /api/v1/instance endpoint; if not present, it can be reasonably assumed that the user is accessing a vanilla mastodon server. i recommend that we query the API and check for the field during account creation, and preserve current behavior if the field is not found.

doesn't build on debian (fails to find bitlbee)

This is the output of the ./configure cmd:

..
checking for BITLBEE... no
configure: error: Package requirements (bitlbee >= 3.5) were not met:

No package 'bitlbee' found

Consider adjusting the PKG_CONFIG_PATH environment variable if you
installed software in a non-standard prefix.

Alternatively, you may set the environment variables BITLBEE_CFLAGS
and BITLBEE_LIBS to avoid the need to call pkg-config.
See the pkg-config man page for more details.

Is there an easier way to install this? Like a deb file, or perhaps a tarball that doesn't need to be built?

feature request: aliases or something, for more manageable account channel names

the length of a "#<instance>_<username>" channel name is pretty unwieldy / eats space (see attached screenshot).

it would be nice to have some means for the user to rename these channels (possibly through something like user-defined aliases for accounts? or just setting a channel name directly?)

or am i missing something obvious?

2018-1516681471

Configure fails in 12154 with syntax error near unexpected token `BITLBEE,'

Tried to build the package from source (checkout is tag/1.4.2) on a Ubuntu 18.04.2:

Using the following packages:

ii  bitlbee-common                       3.5.1-1build1                     all          IRC to other chat networks gateway (common files/docs)
ii  bitlbee-dev                          3.5.1-1build1                     all          IRC to other chat networks gateway (dev files)
ii  bitlbee-libpurple                    3.5.1-1build1                     amd64        IRC to other chat networks gateway (using libpurple)

results from autogen.sh:

autoreconf: Entering directory `.'
autoreconf: configure.ac: not using Gettext
autoreconf: running: aclocal --force -Im4
autoreconf: configure.ac: tracing
autoreconf: configure.ac: creating directory build-aux
autoreconf: running: libtoolize --copy --force
libtoolize: putting auxiliary files in AC_CONFIG_AUX_DIR, 'build-aux'.
libtoolize: copying file 'build-aux/ltmain.sh'
libtoolize: putting macros in AC_CONFIG_MACRO_DIRS, 'm4'.
libtoolize: copying file 'm4/libtool.m4'
libtoolize: copying file 'm4/ltoptions.m4'
libtoolize: copying file 'm4/ltsugar.m4'
libtoolize: copying file 'm4/ltversion.m4'
libtoolize: copying file 'm4/lt~obsolete.m4'
autoreconf: running: /usr/bin/autoconf --force
autoreconf: running: /usr/bin/autoheader --force
autoreconf: running: automake --add-missing --copy --force-missing
configure.ac:29: installing 'build-aux/compile'
configure.ac:33: installing 'build-aux/config.guess'
configure.ac:33: installing 'build-aux/config.sub'
configure.ac:27: installing 'build-aux/install-sh'
configure.ac:27: installing 'build-aux/missing'
src/Makefile.am: installing 'build-aux/depcomp'
autoreconf: Leaving directory `

Results from configure:

checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /bin/mkdir -p
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking whether make supports nested variables... yes
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables... 
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking whether gcc understands -c and -o together... yes
checking for style of include used by make... GNU
checking dependency style of gcc... gcc3
checking build system type... x86_64-pc-linux-gnu
checking host system type... x86_64-pc-linux-gnu
checking how to print strings... printf
checking for a sed that does not truncate output... /bin/sed
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
checking for fgrep... /bin/grep -F
checking for ld used by gcc... /usr/bin/ld
checking if the linker (/usr/bin/ld) is GNU ld... yes
checking for BSD- or MS-compatible name lister (nm)... /usr/bin/nm -B
checking the name lister (/usr/bin/nm -B) interface... BSD nm
checking whether ln -s works... yes
checking the maximum length of command line arguments... 1572864
checking how to convert x86_64-pc-linux-gnu file names to x86_64-pc-linux-gnu format... func_convert_file_noop
checking how to convert x86_64-pc-linux-gnu file names to toolchain format... func_convert_file_noop
checking for /usr/bin/ld option to reload object files... -r
checking for objdump... objdump
checking how to recognize dependent libraries... pass_all
checking for dlltool... no
checking how to associate runtime and link libraries... printf %s\n
checking for ar... ar
checking for archiver @FILE support... @
checking for strip... strip
checking for ranlib... ranlib
checking command to parse /usr/bin/nm -B output from gcc object... ok
checking for sysroot... no
checking for a working dd... /bin/dd
checking how to truncate binary pipes... /bin/dd bs=4096 count=1
checking for mt... mt
checking if mt is a manifest tool... no
checking how to run the C preprocessor... gcc -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking for dlfcn.h... yes
checking for objdir... .libs
checking if gcc supports -fno-rtti -fno-exceptions... no
checking for gcc option to produce PIC... -fPIC -DPIC
checking if gcc PIC flag -fPIC -DPIC works... yes
checking if gcc static flag -static works... yes
checking if gcc supports -c -o file.o... yes
checking if gcc supports -c -o file.o... (cached) yes
checking whether the gcc linker (/usr/bin/ld -m elf_x86_64) supports shared libraries... yes
checking whether -lc should be explicitly linked in... no
checking dynamic linker characteristics... GNU/Linux ld.so
checking how to hardcode library paths into programs... immediate
checking whether stripping libraries is possible... yes
checking if libtool supports shared libraries... yes
checking whether to build shared libraries... yes
checking whether to build static libraries... no
checking whether make supports nested variables... (cached) yes
checking for gcc option to accept ISO C99... none needed
./configure: line 12154: syntax error near unexpected token `BITLBEE,'
./configure: line 12154: `PKG_CHECK_MODULES(BITLBEE, bitlbee >= 3.5)'

Feature request: Prepopulate nick list with subscriptions

Hi! Thanks for this module :)

I see whenever a new message appears on the channel/timeline, the nick is added to the nicklist as if they joined the channel, allowing for nick completion. But if I want to write to someone that hasn't talked yet, I'd have to remember their full address, right?

Is it possible to fetch the subscriptions list and pre-populate the channel with them? I see you're open to patches, but I don't know any C :(

Feature request: Implement the content warning summary for posting

Currently there's no way (so far as I can tell) to use the content warning summary in Mastodon when posting a toot from bitlbee-mastodon. This is a particular problem when replying to toots that have a content warning as the summary gets dropped in the reply and the reply is displayed to everyone.

I think the easiest way to use it would be to copy the syntax used when displaying a toot with a summary: Have the user put [CW: Summary text here] before sending a new tweet with the flag enabled.

It would also be good if the CW summary text was retained when replying to a toot by default, as on Mastodon itself. It should also be possible to modify the use of a CW when replying to a toot, too, in the same way: reply 56 [CW: Summary text here] Reply text here should be able to turn on (or change the summary text of, if already enabled) the content warning with the chosen text.

I'm not sure of a good UI method for turning the default off for a toot with CWs enabled though; using [CW: ] should probably be supported for user expectation purposes but it's kind of ugly. (I'm having a hard time thinking of a reason why you'd want to turn it off, but being able to do so is important.)

I may give this a go myself but I'm not sure. Maybe I should work on smaller issues first, heh.

Pleroma and GoToSocial support

bitlbee-mastodon currently does not support pleroma, because pleroma requires the use of websockets to subscribe to its event stream, and bitlbee-mastodon uses the mastodon-style streaming API instead. we may want to look at bitlbee-discord, which already uses websocket - it might be possible to translate its implementation to the pleroma API.

support private messages

i know that private messages are explicitly unsupported in mastodon-lib.c, but it would still be an interesting feature to add.. What's missing to get that working? would this be a separate post command? or a server-side setting?

getting only new toot

When connecting to twitter using bitlbee, I receive only tweets that was posted when I was offline. With mastodon, I receive the last 20 toots even if I have already seen them.

To reproduce :

  1. account off
  2. account on
  3. account off
  4. account on

each time we get the last 20 toots even if we already seen them.

Is it possible to make it works like twitter, receive only "not seen yet" toot.

Segfault when mastodon closes the stream

I'm getting on really well with the mastodon plugin but unfortunately every time mastodon closes the stream (eg mastodon - Error: Stream closed (200 OK)) bitlbee segfaults.

BitlBee-3.5.1+20171123+master+30-g4a9c6b0-git

Mastodon from git at 4a02627 (HEAD of master at the time of writing)

My current workaround is running bitlbee in valgrind, which prevents the segfault.

sudo -u bitlbee valgrind --log-file=/tmp/valgrind.log /usr/sbin/bitlbee -Dnv 

Valgrind output:

==1262== Memcheck, a memory error detector
==1262== Copyright (C) 2002-2013, and GNU GPL'd, by Julian Seward et al.
==1262== Using Valgrind-3.10.0 and LibVEX; rerun with -h for copyright info
==1262== Command: /usr/sbin/bitlbee -Dnv
==1262== Parent PID: 1261
==1262== 
==1262== Invalid read of size 4
==1262==    at 0x13BE34: ssl_disconnect (ssl_gnutls.c:443)
==1262==    by 0x1359D2: http_close (http_client.c:700)
==1262==    by 0x13548C: http_incoming_data (http_client.c:304)
==1262==    by 0x1342DE: b_event_passthrough (events_libevent.c:143)
==1262==    by 0x57CB253: event_base_loop (in /usr/lib/x86_64-linux-gnu/libevent-2.0.so.5.1.7)
==1262==    by 0x133EFE: b_main_run (events_libevent.c:84)
==1262==    by 0x11D5DE: main (unix.c:182)
==1262==  Address 0x78323b8 is 24 bytes inside a block of size 56 free'd
==1262==    at 0x4C2987C: free (vg_replace_malloc.c:473)
==1262==    by 0x13543C: http_incoming_data (http_client.c:287)
==1262==    by 0x1342DE: b_event_passthrough (events_libevent.c:143)
==1262==    by 0x57CB253: event_base_loop (in /usr/lib/x86_64-linux-gnu/libevent-2.0.so.5.1.7)
==1262==    by 0x133EFE: b_main_run (events_libevent.c:84)
==1262==    by 0x11D5DE: main (unix.c:182)
==1262== 
[repeats]

Is there anything else I can provide to help debug this?

Replying to multiple people

One of the things that really bothers me about the bitlbee-mastodon plugin is that conversations with multiple participants are tricky. Help says: "The handle of the original author you are replying to will be prepended automatically. It is up to you to mention any of the other people mentioned in the original." The problem is that a. we need to list them and b. we need to use their fully qualified names when they're not on the same instance, and this is usually not visible in the UI. I mean, you can use info <id> to get the accounts, but that's overkill. It would be better to have a separate option to the reply command, i.e. reply all 77 foo or reply all @bar baz.

Building on Windows

Installing Bitlbee on Windows with Cygwin... I had to install the development packages of libglib2, gnutls and libgcrpyt using Cygwin:

$ ./configure --msn=0 --jabber=0 --oscar=0 --twitter=0
BitlBee configure
Architecture: CYGWIN_NT-6.1

Configuration done:
  Debugging disabled.
  AddressSanitizer (ASAN) disabled.
  Building non-PIE executable
  Binary stripping disabled.
  Off-the-Record (OTR) Messaging disabled.
  systemd disabled.
  Using event handler: glib
  Using SSL library: gnutls
  Building without IM-protocol support. We wish you a lot of fun...

I like how there is an extra comment if you disable all the protocols. All I want is the Mastodon plugin!

make
make install
make install-dev

No problems, so far.

For the Mastodon plugin, some more stuff was required. I already had autoconf installed but libtool and automake was missing. Notice how I had to set the environment variable. PKG_CONFIG_PATH. When I made install-dev above, I saw the output install -p -m 0644 bitlbee.pc /usr/local/lib/pkgconfig so I assumed everything had been installed correctly. I don't know why this is considered to be a non-standard location but here we are.

./autogen.sh
PKG_CONFIG_PATH=/usr/local/lib/pkgconfig/ ./configure

Sadly, linking still fails.

libtool:   error: can't build x86_64-unknown-cygwin shared library unless -no-undefined is specified

The solution to that is to change a line in src/Makefile. If you omit -no-undefined it won't compile. If you omit -lbitlbee it won't link. But I'm not actually sure what the name of the library ought to be.

LDFLAGS = -no-undefined -lbitlbee

If you proceed anyway, everything appears to work:

make
make install
libtool --finish /usr/local/lib/bitlbee/

And you can start it:

mkdir /usr/local/etc/bitlbee
touch /usr/local/etc/bitlbee/bitlbee.conf
mkdir /var/lib/bitlbee
/usr/local/sbin/bitlbee -nD

And connect using your favorite IRC client!

Sadly, the plugin isn't loaded:

12:15 <root> Plugin                          Version
12:15 <root>  

And thus:

12:15 <kensanata> account add mastodon [email protected]
12:15 <root> Unknown protocol

Plugin is in the right place:

$ ls /usr/local/lib/bitlbee/
mastodon.a  mastodon.la*
$ grep plugin src/Makefile
libdir = $(plugindir)
plugindir = /usr/local/lib/bitlbee/

feature request: "mpost s/original string/new string/" corrects a post

It would be useful to be able to correct typos by executing mpost s/original string/new string/, which could delete the previous post, and repost the new corrected message.

(note that I don't have bitlbee-mastodon working yet, but judging from the help docs this feature does not exist).

Add "quiet reply"

A "quiet reply" is a toot which is linked from the parent toot and also links back to the parent toot, but doesn't notify the parent tooter.

It's useful when making LB comments, or just adding a CW when the original lacks one.

Example:

qreply 26 LB: don't actually do this
<something about successful reply>
boost 26
boost 27

Then someone seeing the "LB" toot can find the parent toot, and vice-versa.

reuses oauth application IDs even after base_url property is changed

any attempt to connect to a pleroma instance will result in an "invalid user/password" error. this appears to be because bitlbee-mastodon does not properly register an application with the server, and seems to just use a fixed client ID with all servers. to register an application, bitlbee should send a POST request to https://$instance/api/v1/apps with header Content-Type: x-www-form-urlencoded and POST content

client_name=bitlbee&redirect_uris=$REDIRECTURL&scopes=read+write+follow&website=https://bitlbee.org

this will return a JSON-encoded response, containing the client ID bitlbee should connect with as well as the secret it should use to communicate with the server.

Improve search

Search should not dump debug information from the API. Instead, it should print nice things and then people can use info to get the debug info, if they really need it.

Client authentication failed due to unknown client

When navigating to the URL given by the mastodon_oauth bot, my Mastodon instance refuses to give an authentication key with the message:

Client authentication failed due to unknown client, no client authentication included, or unsupported authentication method.

"Following a Hashtag" is too limited. A "filter channel" would be ideal.

Filter channels are very powerful. This is the twitter docs:

https://wiki.bitlbee.org/HowtoTwitter#Filter_channels

IMO, the "Following a Hashtag" feature should be scrapped, and replaced with filter channels that work like the Twitter variation. You can list as many people or search terms as you want, and the search terms need not be hashtags.

Logical operators would also be useful. I might want to search for:

track:(#marchforourlives || #bluewave) && gun && control

for example.

Slower login

Perhaps we are pipelining the requests too quickly on login. So I figured we could move the code that depends on a successful login (and getting the account id) into the handler for the very first request, mastodon_verify_credentials. But now I'm getting segmentation faults. Any ideas?

diff --git a/src/mastodon-lib.c b/src/mastodon-lib.c
index a28eca6..fe61ba8 100644
--- a/src/mastodon-lib.c
+++ b/src/mastodon-lib.c
@@ -2562,6 +2562,17 @@ static void mastodon_http_verify_credentials(struct http_request *req)
 
 		json_value_free(parsed);
 	}
+
+	// Now that we have verified that the login worked, let's add our buddies (if we are in a group chat).
+	struct mastodon_data *md = ic->proto_data;
+	if (!(md->flags & MASTODON_MODE_ONE) &&
+	    !(md->flags & MASTODON_HAVE_FRIENDS)) {
+		mastodon_following(ic);
+	}
+
+	// And fill our timeline with some toots. And connect to the streams.
+	mastodon_initial_timeline(ic);
+	mastodon_open_user_stream(ic);
 }
 
 /**
diff --git a/src/mastodon-lib.h b/src/mastodon-lib.h
index 3a71bb1..747b979 100644
--- a/src/mastodon-lib.h
+++ b/src/mastodon-lib.h
@@ -80,12 +80,9 @@ typedef enum {
 
 void mastodon_register_app(struct im_connection *ic);
 void mastodon_verify_credentials(struct im_connection *ic);
-void mastodon_following(struct im_connection *ic);
-void mastodon_initial_timeline(struct im_connection *ic);
 void mastodon_hashtag_timeline(struct im_connection *ic, char *hashtag);
 void mastodon_local_timeline(struct im_connection *ic);
 void mastodon_federated_timeline(struct im_connection *ic);
-void mastodon_open_user_stream(struct im_connection *ic);
 struct http_request *mastodon_open_hashtag_stream(struct im_connection *ic, char *hashtag);
 struct http_request *mastodon_open_local_stream(struct im_connection *ic);
 struct http_request *mastodon_open_federated_stream(struct im_connection *ic);
diff --git a/src/mastodon.c b/src/mastodon.c
index 4dd4f5c..72601b3 100644
--- a/src/mastodon.c
+++ b/src/mastodon.c
@@ -320,21 +320,14 @@ static void mastodon_connect(struct im_connection *ic)
 		md->flags |= MASTODON_MODE_CHAT;
 	}
 
-	if (!(md->flags & MASTODON_MODE_ONE) &&
-	    !(md->flags & MASTODON_HAVE_FRIENDS)) {
-		// find our id
-		mastodon_verify_credentials(ic);
-		// add buddies for this id
-		mastodon_following(ic);
-	}
-
 	/* Create the room. */
 	if (md->flags & MASTODON_MODE_CHAT) {
 		mastodon_groupchat_init(ic);
 	}
 
-	mastodon_initial_timeline(ic);
-	mastodon_open_user_stream(ic);
+	/* find our id and finish login */
+	mastodon_verify_credentials(ic);
+
 	ic->flags |= OPT_PONGS;
 }

Adding lists for streaming

Any volunteers? The streaming API supports lists: GET /api/v1/streaming/list with query param list.

Surely the simplest solution would be to handle lists exactly like hashtags. Thus, we start by copying the code that creates streams based on the channels we join and we distribute incoming messages depending on channel topic. We'll start by assuming that if it starts with # it's a hashtag, if it starts with @ it's a person, otherwise it's a list, maybe?

  1. in mastodon_chat_join we need to examine room in order to decide whether we want to call existing mastodon_hashtag_timeline or the new mastodon_list_timeline

  2. also, whether to call the existing mastodon_open_hashtag_stream or the new mastodon_open_list_stream

  3. we need to implement some list management commands in mastodon_handle_command, maybe create a list, delete a list, list the people in a list, add a person to a list and remove a person from a list

(debian) help page not installed, but files are in correct places

The readme.md now contains:

If you're installing this plugin in a system where you didn't build
your own Bitlbee but installed revision 3.5.1 (e.g. on a Debian system
around the end of 2017), you will run into a problem: the plugin will
get installed into /usr/lib/bitlbee (plugindir) but the
documentation wants to install into /usr/local/share/bitlbee instead
of /usr/share/bitlbee (datadir). As you can tell from
/usr/lib/pkgconfig/bitlbee.pc, there is no datadir for you. In
this situation, try ./configure --prefix=/usr and build and install
again.

That text seems to be incorrect. That is, on debian stable (stretch) the file /usr/share/bitlbee/mastodon-help.txt is created even without changing the prefix. So I'm expecting it to work. After sudo make install I did systemctl restart bitlbee, then launched into irssi and ran help mastodon. It displayed the general top-level bitlbee help page (same as if I type help anynonsensehere). If I type help mregister, that too just gives the top-level help page with nothing that is particular to mastodon.

If I simply type mregister I get "Unknown command: mregister. Please use help commands to get a list of available commands."

It's as if no plugin was installed. Yet there exists /usr/lib/bitlbee/mastodon.(so|la)

My Mastodon account gets removed and I don't know why

I installed this plugin a few days ago and I added my Mastodon account and everything was fine for a day or so, until I noticed that I didn't recieve any updates from people. After some quick debugging I noticed that my account was completley gone from Bitlbee. I added it a second time and now about a day or so later, it's gone again.. :|

I have never had this issue before and I'm not sure how to debug it and can't see anything in the logs either.

What do I do?

Plugin tries to use the wrong account id when fetching followers

I noticed while moving to mastodon.social that the plugin uses the wrong account id while fetching followers.

The bug results in errors such as this: Error: /api/v1/accounts/1565424413/following returned status code 404 Not Found (Record not found)

My real account id (found at /api/v1/accounts/lookup is much longer.

The result is that the plugin reports connection timeout and a reconnect.

Feature Request - Manually specify Streaming URL

Hi folks! I'm using the mstdn.ca Mastodon server which made a change that involves having their Streaming API being accessible from an alternate domain (api.mstdn.ca) while all others appear to go to the bare domain (mstdn.ca).

After looking through the code and not finding any sort of setting we can use similar to "base_url", I'm hoping someone can come up with a patch to allow the specification of a different URL for the Streaming API (or the opposite, specifying a URL just for the login, and setting the base_url to the API that allows access to streaming).

Any takers or could someone point me toward a relevant piece of code I could hack at to get this working myself?

mastodon - Error: Stream closed

I'm getting this very frequently, what might the cause be? Mine or server's end?

11:44	<@root>	mastodon - Error: Stream closed (200 OK)
11:44	<@root>	mastodon - Signing off..
11:44	<@root>	mastodon - Logging in: Reconnecting in 5 seconds..
11:44	<@root>	mastodon - Logging in: Login
11:44	<@root>	mastodon - Logging in: Connecting
11:44	<@root>	mastodon - Logging in: Verifying credentials
11:44	<@root>	mastodon - Logging in: Getting home timeline
11:44	<@root>	mastodon - Logging in: Logged in
11:46	<@root>	mastodon - Error: Stream closed (200 OK)
11:46	<@root>	mastodon - Signing off..
11:46	<@root>	mastodon - Logging in: Reconnecting in 5 seconds..
11:46	<@root>	mastodon - Logging in: Login
11:46	<@root>	mastodon - Logging in: Connecting
11:46	<@root>	mastodon - Logging in: Verifying credentials
11:46	<@root>	mastodon - Logging in: Getting home timeline
11:46	<@root>	mastodon - Logging in: Logged in

Ubuntu Dependencies

Firstly, autotools is apparently called autoconf in Ubuntu, so to get around this error:

./autogen.sh: 18: ./autogen.sh: autoreconf: not found

I had to apt install autoconf.

Then to get around this error:

configure.ac:32: error: possibly undefined macro: AC_DISABLE_STATIC
      If this token and others are legitimate, please use m4_pattern_allow.
      See the Autoconf documentation.
configure.ac:33: error: possibly undefined macro: AC_PROG_LIBTOOL
autoreconf: /usr/bin/autoconf failed with exit status: 1

I had to apt install libtool

Just FYI in terms of actual Ubuntu dependencies.

Thanks for the plugin!

Direct messages don't stay in the same query

I noticed that private messages don't say in the same query.

For example my nick is foobar, bar sends me a direct message ->
a query with bar opens ->
I answer on that query ->
a query with my name opens.

How to find recent notifications

We don't need to subscribe to notifications but when we reconnect, it'd be nice if we could type notifications and get everything.

Join local and public timelines

I couldn't find this on the docs, is there a way to join the local and public timelines as new channels, besides the home timeline?

Borked bold on startup

When I connect, this is what I see:

09:36 *** NAMES @kensanata @root octodonsocial_kensanata
09:36 <privacylab> [^B**07:55:09] [00] boosted @[email protected]: As part of my research for my #LibrePlanet2018 talk:**

Thus, I see an extra ^B before the timestamp, and everything following it is bold. This only happens for the initial twenty toots that are used to populate the empty channel upon logging in.

Unable to connect to api

I have compiled and installed the bitlbee-mastodon plugin and restarted bitlbee. The plugin is active. However, having entered "acc mastodon set base_url "https://mastodon.org.uk/api/v1" and then "acc mastodon on" I get a " Error: /api/v1/apps returned status code Error while writing HTTP request". Is this related to the instance or am I misunderstand what needs to be done?
cheers
Greg

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.