]> pere.pagekite.me Git - homepage.git/blob - blog/data/2021-01-12-ring-jami-debian.txt
Generated.
[homepage.git] / blog / data / 2021-01-12-ring-jami-debian.txt
1 Title: Latest Jami back in Debian Testing, and scriptable using dbus
2 Tags: english, debian, sikkerhet, surveillance
3 Date: 2021-01-12 17:00
4
5 <p>After a lot of hard work by its maintainer Alexandre Viau and
6 others, the decentralized communication platform
7 <a href="https://en.wikipedia.org/wiki/Jami_(software)">Jami</a>
8 (earlier known as Ring), managed to get
9 <a href="https://tracker.debian.org/pkg/ring">its latest version</a>
10 into Debian Testing. Several of its dependencies has caused build and
11 propagation problems, which all seem to be solved now.</p>
12
13 <p>In addition to the fact that Jami is decentralized, similar to how
14 bittorrent is decentralized, I first of all like how it is not
15 connected to external IDs like phone numbers. This allow me to set up
16 computers to send me notifications using Jami without having to find
17 get a phone number for each computer. Automatic notification via Jami
18 is also made trivial thanks to the provided client side API (as a DBus
19 service). Here is my bourne shell script demonstrating how to let any
20 system send a message to any Jami address. It will create a new
21 identity before sending the message, if no Jami identity exist
22 already:</p>
23
24 <p><pre>
25 #!/bin/sh
26 #
27 # Usage: $0 <jami-address> <message>
28 #
29 # Send <message> to <jami-address>, create local jami account if
30 # missing.
31 #
32 # License: GPL v2 or later at your choice
33 # Author: Petter Reinholdtsen
34
35
36 if [ -z "$HOME" ] ; then
37 echo "error: missing \$HOME, required for dbus to work"
38 exit 1
39 fi
40
41 # First, get dbus running if not already running
42 DBUSLAUNCH=/usr/bin/dbus-launch
43 PIDFILE=/run/asterisk/dbus-session.pid
44 if [ -e $PIDFILE ] ; then
45 . $PIDFILE
46 if ! kill -0 $DBUS_SESSION_BUS_PID 2>/dev/null ; then
47 unset DBUS_SESSION_BUS_ADDRESS
48 fi
49 fi
50 if [ -z "$DBUS_SESSION_BUS_ADDRESS" ] && [ -x "$DBUSLAUNCH" ]; then
51 DBUS_SESSION_BUS_ADDRESS="unix:path=$HOME/.dbus"
52 dbus-daemon --session --address="$DBUS_SESSION_BUS_ADDRESS" --nofork --nopidfile --syslog-only < /dev/null > /dev/null 2>&1 3>&1 &
53 DBUS_SESSION_BUS_PID=$!
54 (
55 echo DBUS_SESSION_BUS_PID=$DBUS_SESSION_BUS_PID
56 echo DBUS_SESSION_BUS_ADDRESS=\""$DBUS_SESSION_BUS_ADDRESS"\"
57 echo export DBUS_SESSION_BUS_ADDRESS
58 ) > $PIDFILE
59 . $PIDFILE
60 fi &
61
62 dringop() {
63 part="$1"; shift
64 op="$1"; shift
65 dbus-send --session \
66 --dest="cx.ring.Ring" /cx/ring/Ring/$part cx.ring.Ring.$part.$op $*
67 }
68
69 dringopreply() {
70 part="$1"; shift
71 op="$1"; shift
72 dbus-send --session --print-reply \
73 --dest="cx.ring.Ring" /cx/ring/Ring/$part cx.ring.Ring.$part.$op $*
74 }
75
76 firstaccount() {
77 dringopreply ConfigurationManager getAccountList | \
78 grep string | awk -F'"' '{print $2}' | head -n 1
79 }
80
81 account=$(firstaccount)
82
83 if [ -z "$account" ] ; then
84 echo "Missing local account, trying to create it"
85 dringop ConfigurationManager addAccount \
86 dict:string:string:"Account.type","RING","Account.videoEnabled","false"
87 account=$(firstaccount)
88 if [ -z "$account" ] ; then
89 echo "unable to create local account"
90 exit 1
91 fi
92 fi
93
94 # Not using dringopreply to ensure $2 can contain spaces
95 dbus-send --print-reply --session \
96 --dest=cx.ring.Ring \
97 /cx/ring/Ring/ConfigurationManager \
98 cx.ring.Ring.ConfigurationManager.sendTextMessage \
99 string:"$account" string:"$1" \
100 dict:string:string:"text/plain","$2"
101 </pre></p>
102
103 <p>If you want to check it out yourself, visit the
104 <a href="https://jami.net/">the Jami system project page</a> to learn
105 more, and install the latest Jami client from Debian Unstable or
106 Testing.</p>
107
108 <p>As usual, if you use Bitcoin and want to show your support of my
109 activities, please send Bitcoin donations to my address
110 <b><a href="bitcoin:15oWEoG9dUPovwmUL9KWAnYRtNJEkP1u1b">15oWEoG9dUPovwmUL9KWAnYRtNJEkP1u1b</a></b>.</p>