2019-01-23 Slack via Bitlbee on Windows

Using Windows and Cygwin. I already had a working Bitlbee installation.

I used the Cygwin installer to install `libpurple` and `libpurple-dev`.

I rebuilt `bitlbee` with `libpurple` support:

./configure --purple=1 --twitter=0
make && make install

If you now restart `bitlbee` and use `plugins` you won’t see Slack:

Plugin                          Version
icq                             2.13.0
irc                             2.13.0
jabber                          2.13.0
novell                          2.13.0
oscar                           2.13.0
simple                          2.13.0
zephyr                          2.13.0

Then I cloned slack-libpurple and built it. This required some changes to the Makefile. I removed all the code that was about Windows but retained the `LIBNAME`.

slack-libpurple

diff --git a/Makefile b/Makefile
index 9874d94..7eb4bd0 100644
--- a/Makefile
+++ b/Makefile
@@ -18,35 +18,7 @@ C_OBJS = $(C_SRCS:.c=.o)

 PURPLE_MOD=purple

-ifeq ($(OS),Windows_NT)
-
 LIBNAME=libslack.dll
-PIDGIN_TREE_TOP ?= ../pidgin-2.10.11
-WIN32_DEV_TOP ?= $(PIDGIN_TREE_TOP)/../win32-dev
-WIN32_CC ?= $(WIN32_DEV_TOP)/mingw-4.7.2/bin/gcc
-
-PROGFILES32=${ProgramFiles(x86)}
-ifndef PROGFILES32
-PROGFILES32=$(PROGRAMFILES)
-endif
-
-CC = $(WIN32_DEV_TOP)/mingw-4.7.2/bin/gcc
-
-DATA_ROOT_DIR_PURPLE:="$(PROGFILES32)/Pidgin"
-PLUGIN_DIR_PURPLE:="$(DATA_ROOT_DIR_PURPLE)/plugins"
-CFLAGS = \
-    -g \
-    -O2 \
-    -Wall \
-    -D_DEFAULT_SOURCE=1 \
-    -std=c99 \
-       -I$(PIDGIN_TREE_TOP)/libpurple \
-       -I$(WIN32_DEV_TOP)/glib-2.28.8/include -I$(WIN32_DEV_TOP)/glib-2.28.8/include/glib-2.0 -I$(WIN32_DEV_TOP)/glib-2.28.8/lib/glib-2.0/include
-LIBS = -L$(WIN32_DEV_TOP)/glib-2.28.8/lib -L$(PIDGIN_TREE_TOP)/libpurple -lpurple -lintl -lglib-2.0 -lgobject-2.0 -g -ggdb -static-libgcc -lz -lws2_32
-
-else
-
-LIBNAME=libslack.so

 CC=gcc
 PLUGIN_DIR_PURPLE:=$(DESTDIR)$(shell pkg-config --variable=plugindir $(PURPLE_MOD))
@@ -66,8 +38,6 @@ CFLAGS = \

 LIBS = $(shell pkg-config --libs $(PKGS))

-endif
-
 .PHONY: all
 all: $(LIBNAME)

And now I was ready to build:

make && make install

And now `plugins` prints:

Plugin                          Version
icq                             2.13.0
irc                             2.13.0
jabber                          2.13.0
novell                          2.13.0
oscar                           2.13.0
simple                          2.13.0
slack                           0.1
zephyr                          2.13.0

Enabled Protocols: aim, discord, icq, irc,
jabber, mastodon, novell, oscar, simple, slack, zephyr

Get a legacy token. You can enter your token as the account password, says the README.

a legacy token

However, `account add slack <email> <token>` gives me the warning `Note: this account doesn't use password for login`. Hm.

But worse, when I then use `account slack on` I get the error `Login error: Daemon mode detected. Do *not* try to use libpurple in daemon mode! Please use inetd or ForkDaemon mode instead.`

Ouch. Changing the way I’m starting Bitlbee, now:

`c:/cygwin64/usr/local/sbin/bitlbee.exe -n -F -v -d c:/Users/asc/AppData/Roaming/.bitlbee`

And now it works!

1. make sure your `username` is set to `<something>@<slack server>` (and not your email address)

2. make sure your `password` is set to the token you generated on the website

If you know the name of a Slack room, you can create it in Bitlbee, too:

chat add slack general #general
/join #general

Note that if the channel name contains non-ASCII characters, you need to translate that into an ASCII-only channel name for Bitlbee:

chat add slack zufällig #zufaellig
/join #zufaellig

​#Bitlbee ​#Slack ​#Windows ​#Cygwin