]> pere.pagekite.me Git - homepage.git/commitdiff
New post.
authorPetter Reinholdtsen <pere@hungry.com>
Tue, 12 Jan 2021 15:58:43 +0000 (16:58 +0100)
committerPetter Reinholdtsen <pere@hungry.com>
Tue, 12 Jan 2021 15:58:43 +0000 (16:58 +0100)
blog/data/2021-01-12-ring-jami-debian.txt [new file with mode: 0644]

diff --git a/blog/data/2021-01-12-ring-jami-debian.txt b/blog/data/2021-01-12-ring-jami-debian.txt
new file mode 100644 (file)
index 0000000..b20ba4a
--- /dev/null
@@ -0,0 +1,109 @@
+Title: Latest Jami back in Debian Testing, and scriptable using dbus
+Tags: english, debian, sikkerhet, surveillance
+Date: 2021-01-12 17:00
+
+<p>After a lot of hard work by its maintainer Alexandre Viau and
+others, the decentralized communication platform
+<a href="https://en.wikipedia.org/wiki/Jami_(software)">Jami</a>
+(earlier known as Ring), managed to get its latest version into Debian
+Testing.  Several of its dependencies has caused build and propagation
+problems, which all seem to be solved now.</p>
+
+<p>In addition to the fact that Jami is decentralized, similar to how
+bittorrent is decentralized, I first of all like how it is not
+connected to external IDs like phone numbers.  This allow me to set up
+computers to send me notifications using Jami without having to find
+get a phone number for each computer.  Automatic notification via Jami
+is also made trivial thanks to the provided client side API (as a DBus
+service).  Here is my bourne shell script demonstrating how to let any
+system send a message to any Jami address.  It will create a new
+identity before sending the message, if no Jami identity exist
+already:</p>
+
+<p><pre>
+#!/bin/sh
+#
+# Usage: $0 <jami-address> <message>
+#
+# Send <message> to <jami-address>, create local jami account if
+# missing.
+#
+# License: GPL v2 or later at your choice
+# Author: Petter Reinholdtsen
+
+
+if [ -z "$HOME" ] ; then
+    echo "error: missing \$HOME, required for dbus to work"
+    exit 1
+fi
+
+# First, get dbus running if not already running
+DBUSLAUNCH=/usr/bin/dbus-launch
+PIDFILE=/run/asterisk/dbus-session.pid
+if [ -e $PIDFILE ] ; then
+    . $PIDFILE
+    if ! kill -0 $DBUS_SESSION_BUS_PID 2>/dev/null ; then
+        unset DBUS_SESSION_BUS_ADDRESS
+    fi
+fi
+if [ -z "$DBUS_SESSION_BUS_ADDRESS" ] && [ -x "$DBUSLAUNCH" ]; then
+    DBUS_SESSION_BUS_ADDRESS="unix:path=$HOME/.dbus"
+    dbus-daemon --session --address="$DBUS_SESSION_BUS_ADDRESS" --nofork --nopidfile --syslog-only < /dev/null > /dev/null 2>&1 3>&1 &
+    DBUS_SESSION_BUS_PID=$!
+    (
+        echo DBUS_SESSION_BUS_PID=$DBUS_SESSION_BUS_PID
+        echo DBUS_SESSION_BUS_ADDRESS=\""$DBUS_SESSION_BUS_ADDRESS"\"
+        echo export DBUS_SESSION_BUS_ADDRESS
+    ) > $PIDFILE
+    . $PIDFILE
+fi &
+
+dringop() {
+    part="$1"; shift
+    op="$1"; shift
+    dbus-send --session \
+        --dest="cx.ring.Ring" /cx/ring/Ring/$part cx.ring.Ring.$part.$op $*
+}
+
+dringopreply() {
+    part="$1"; shift
+    op="$1"; shift
+    dbus-send --session --print-reply \
+        --dest="cx.ring.Ring" /cx/ring/Ring/$part cx.ring.Ring.$part.$op $*
+}
+
+firstaccount() {
+    dringopreply ConfigurationManager getAccountList | \
+      grep string | awk -F'"' '{print $2}' | head -n 1
+}
+
+account=$(firstaccount)
+
+if [ -z "$account" ] ; then
+    echo "Missing local account, trying to create it"
+    dringop ConfigurationManager addAccount \
+      dict:string:string:"Account.type","RING","Account.videoEnabled","false"
+    account=$(firstaccount)
+    if [ -z "$account" ] ; then
+        echo "unable to create local account"
+        exit 1
+    fi
+fi
+
+# Not using dringopreply to ensure $2 can contain spaces
+dbus-send --print-reply --session \
+  --dest=cx.ring.Ring \
+  /cx/ring/Ring/ConfigurationManager \
+  cx.ring.Ring.ConfigurationManager.sendTextMessage \
+  string:"$account" string:"$1" \
+  dict:string:string:"text/plain","$2" 
+</pre></p>
+
+<p>If you want to check it out yourself, visit the 
+<a href="https://jami.net/">the Jami system project page</a> to learn
+more, and install the latest Jami client from Debian Unstable or
+Testing.</p>
+
+<p>As usual, if you use Bitcoin and want to show your support of my
+activities, please send Bitcoin donations to my address
+<b><a href="bitcoin:15oWEoG9dUPovwmUL9KWAnYRtNJEkP1u1b">15oWEoG9dUPovwmUL9KWAnYRtNJEkP1u1b</a></b>.</p>