Git Product home page Git Product logo

purple-signald's People

Contributors

benwiederhake avatar herm avatar hoehermann avatar quotuva avatar robfog avatar strykar avatar ttlmax avatar webmeister avatar zauberfisch 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  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  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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

purple-signald's Issues

Add support for externally served attachments

Unfortunately, bitlbee (which is what I'm using as my IRC bridge) doesn't appear to support the imgstore API in libpurple. As a result, I want to steal an idea from irslackd and sms-irc.

In those bridges, attachments are written out to a location that's accessible via web server, and the resulting channel message points to that location.

The idea would be:

  1. Introduce three new settings:
    1. "Use external server for attachments"
    2. "Local directory to store attachments"
    3. "URL where attachments are served"
  2. Have the default behaviour be the current behaviour (i.e. use the imgstore)
  3. If these settings are configured, when an attachment is supplied:
    1. Write the attachment out to the storage directory with an extension suitable for the mimetype.
    2. Generate a URL based on that filename and the base server URL specified.
    3. Dump the generated URL into the conversation.

Let me know if you'd be interested in this (or have other ideas)! Meanwhile, I'll probably start working on an implementation... the lack of attachment support in bitlbee is definitely annoying!

Externally saved attachments causes libpurple / bitlbee to crash

It used to work, but I didn't update for a long while so I just pulled the latest HEAD and now when I receive an attachment with external_attachments set to true, bitlbee crashes:

17:09:41 <*status> Error from server: BitlBee crashed! (SIGSEGV received)
17:09:41 <*status> Error from server: This is a bug either in BitlBee or a plugin, ask us on IRC if unsure

The debug logs (not much in there...):

With external_attachments = false (everything works fine, no crashes):

DEBUG prpl-hehoe-signald: got newline delimited message: {...}
DEBUG prpl-hehoe-signald: received type: IncomingMessage
DEBUG prpl-hehoe-signald: Attachment: <IMG ID="1"/><br/><a href="file:///signald/attachments/<hash>">Image (type: image/jpeg)</a><br/>
(process:7): GLib-CRITICAL **: 17:07:00.758: g_string_insert_len: assertion 'len == 0 || val != NULL' failed

With external_attachments = true (this kills bitlbee):

DEBUG prpl-hehoe-signald: got newline delimited message: {...}
DEBUG prpl-hehoe-signald: received type: IncomingMessage

** (process:7): CRITICAL **: 17:09:41.533: purple_conversation_get_im_data: assertion 'conv != NULL' failed
DEBUG prpl-hehoe-signald: Copying attachment from '/signald/attachments/<hash>' to '/var/lib/bitlbee/attachments/<hash>.jpe'
(process:7): GLib-GIO-CRITICAL **: 17:09:41.536: g_file_build_attribute_list_for_copy: assertion 'error == NULL || *error == NULL' failed

Colors of sender names in group chats differ from member list

While the entries in a group chat's member list are shown in different colors, the sender's name in the chat messages are all shown in the same color (some dark yellow for me).

I have no idea why pidgin is probably not able to get the color for the sender of the message from the related user in the members list as it is the case in chats with other protocols. Is there something that is missing in the plugin?

Messages sent via other device show as to "unknown"

Messages from other users show up fine, and sending messages to them via Pidgin also works and syncs to my phone (Android using the Signal app from the Google Play Store), but whenever I send a message from my phone, it shows up in a separate IM window to "unknown", which gets all of my messages to all contacts grouped together with no indication of which message was sent to which contact.

(This issue only applies to IMs: group chats work fine.)

Here's what shows up in the pidgin -d log when I send a message ("Test") to myself using my phone (phone number replaced with +15555551212 and GUIDs obfuscated to avoid identifying my Signal account):

(07:07:33) prpl-hehoe-signald: got newline delimited message: {"type":"IncomingMessage","version":"v1","data":{"account":"+15555551212","source":{"number":"+15555551212","uuid":"12345678-9abc-def0-1234-56789abcdef0"},"type":"CIPHERTEXT","timestamp":1648562851925,"source_device":1,"server_receiver_timestamp":1648562852941,"server_deliver_timestamp":1648562852942,"has_legacy_message":false,"has_content":true,"unidentified_sender":false,"sync_message":{"sent":{"destination":{"uuid":"12345678-9abc-def0-1234-56789abcdef0"},"timestamp":1648562851925,"expirationStartTimestamp":0,"message":{"timestamp":1648562851925,"body":"Test","endSession":false,"expiresInSeconds":0,"profileKeyUpdate":false,"viewOnce":false},"unidentifiedStatus":{"12345678-9abc-def0-1234-56789abcdef0":false},"isRecipientUpdate":false},"contactsComplete":false},"server_guid":"abcdef01-2345-6789-abcd-ef0123456789"},"account":"+15555551212"}

I'm using the latest HEAD of git:

commit f66768a5c372fc40769ad185b34c7ac76689b160 (HEAD -> master, origin/master, origin/HEAD)
Author: Avinash H. Duduskar <[email protected]>
Date:   Wed Mar 2 19:19:11 2022 +0530

with what I believe is the latest signald binary:

Package: signald
Version: 0.17.0-18-1217a9f7

This issue did not happen before I updated from the previous versions I had installed in November 2021... but those had other issues which were fixed by upgraded.

signald group v2 issue

My one group chat recently updated to a v2 group, add it looks like libpurple-signald may be having issues handling v2 groups.
Currently in my setup involving bitlbee:

  • Content I post to the group goes to a /privmsg named '-sig' (as I set bitlebee to append '-sig' to buddy names for signal)
  • Content my friend posts to the group shows up in in the /privmsg for thier buddy name as if it was one-on-one chat

Examples from NC:

## Them posting to group v2
{
  "type": "message",
  "data": {
    "username": "+ME",
    "source": {
      "number": "+THEM",
      "uuid": "REDACTED"
    },
    "sourceDevice": 1,
    "type": "CIPHERTEXT",
    "timestamp": 1610048610205,
    "timestampISO": "2021-01-07T19:43:30.205Z",
    "serverTimestamp": 1610048609015,
    "serverDeliveredTimestamp": 1610048609019,
    "hasContent": true,
    "dataMessage": {
      "timestamp": 1610048610205,
      "body": "Test received",
      "groupV2": {
        "id": "REDACTED",
        "revision": 1
      }
    }
  }
}

## Me to group v2
{
  "type": "message",
  "data": {
    "username": "+ME",
    "source": {
      "number": "+ME",
      "uuid": "REDACTED"
    },
    "sourceDevice": 1,
    "type": "CIPHERTEXT",
    "timestamp": 1610082077851,
    "timestampISO": "2021-01-08T05:01:17.851Z",
    "serverTimestamp": 1610082080136,
    "serverDeliveredTimestamp": 1610082080137,
    "hasContent": true,
    "syncMessage": {
      "sent": {
        "timestamp": 1610082077851,
        "message": {
          "timestamp": 1610082077851,
          "body": "Unmute for rapid fire... https://imgur.com/gallery/qslXPb7",
          "groupV2": {
            "id": "REDACTED",
            "revision": 1
          },
          "previews": [
            {
              "url": "https://imgur.com/gallery/qslXPb7",
              "title": "Unmute for rapid fire...",
              "attachment": {
                "contentType": "image/jpeg",
                "id": "REDACTED",
                "size": 28634,
                "width": 600,
                "height": 315,
                "key": "REDACTED",
                "digest": "REDACTED",
                "blurhash": "REDACTED"
              }
            }
          ]
        },
        "unidentifiedStatus": {
          "+THEM": true,
          "REDACTED": true
        }
      }
    }
  }
}

Add Installation Guide to README

Hi!
I really want to get signal working with Pidgin (since I thought of programming something like this on my own not knowing it already exists).

I got it installed executing the Makefile and manually copying the .so-File. (It seems like r4m0n/libpurple-signald is working on a make install)

Now I am struggeling to log in. I added my Phone-Number in the +{countrycode}{number}-Style, but it seems not to work.

Generally I am also interested in contributing some time into signald, I just don't know how much time I will have. Are Pull-Requests welcome?

Key Issue in your Git Repo

Hi.
Here is my output:

git clone --recurse-submodules [email protected]:hoehermann/purple-signald.git
Klone nach 'purple-signald' ...
[email protected]: Permission denied (publickey).
fatal: Konnte nicht vom Remote-Repository lesen.

Bitte stellen Sie sicher, dass die korrekten Zugriffsberechtigungen bestehen
und das Repository existiert.

Initiating a conversation produces unexpected_error

at efb0d47 with signald 0.13.1:

Sending: {"type":"send","username":"[REDACTED]","recipientGroupId":"[REDACTED]","attachments":[],"messageBody":"2"}
…
got newline delimited message: {"type":"unexpected_error","data":{"msg_number":0,"error":true,"request":{"type":"send","username":"[REDACTED]","messageBody":"2","recipientGroupId":"[REDACTED]","attachments":[],"expiresInSeconds":0,"when":0,"version":"v0"}}}
received type: unexpected_error

Message is sent to server and received by participants in spite of the error.

Happens to direct messages and group messages. Replying to a direct message works fine.

Bitlbee Restarting on Account Activation

I'm attempting to get this plugin working with bitlbee on Arch Linux. I've built the latest master (90cc584) and am using signald 0.11.0 (via https://aur.archlinux.org/packages/signald/). I'm able to send-receive messages via signald by talking to the socket directly with netcat - so that portion seems to be working okay.

And it appears that bitlbee is successfully recognizing libpurple-signald. I am able to successfully do:

add hehoe-signald +12223334444

(though I had to do account add hehoe-signald... instead, and obviously used my own phone number). I can later see with account list that it has created the account. However, the next step (rename _12223334444 name-sig) does not work for be because no buddies are registered. Finally (and I think this is the real bug), when I do account hehoe-signald on, bitlbee unceremoniously restarts itself. When I peek in the bitlbee log from this time period, I see the following messages:

Jan 19 15:12:10 host bitlbee[4036611]: purple_buddy_new: assertion 'name != NULL' failed
Jan 19 15:12:10 host bitlbee[4036611]: purple_blist_add_buddy: assertion 'buddy != NULL' failed
Jan 19 15:12:10 host bitlbee[4036611]: purple_blist_alias_buddy: assertion 'buddy != NULL' failed

I'm happy to help debug this further if you point me in the right direction.

display emoji reactions

Signal supports reacting to a message with an emoji, which is sometimes used for important content (e.g., using 👍 to explicitly acknowledge receipt of a message). It would be nice if Pidgin could display those; currently I just view them on the Signal app on my phone.

A major complication is that I'm not sure if Pidgin's API/UI really supports the concept of updating the display of an already received message. If not, this would either require a change to Pidgin or some kind of awkward display of the reactions as messages.

Hourly disconnect

Every hour, the connection to signald drops and resets, alternating between IOException and Unknown error. The bitlbee messages are:

09:36:47    @root | hehoe-signald - Error: Unknown error
09:36:47    @root | hehoe-signald - Signing off..
09:36:47    @root | hehoe-signald - Reconnecting in 5 seconds..
09:36:53    @root | hehoe-signald - Logging in: Logged in
10:36:48    @root | hehoe-signald - Error: java.io.IOException: Connection closed!
10:36:48    @root | hehoe-signald - Signing off..
10:36:48    @root | hehoe-signald - Reconnecting in 5 seconds..
10:36:54    @root | hehoe-signald - Logging in: Logged in

etc.

The signald logs give a bit more detail:

 17:36:47.671 [socketlistener] INFO  io.finn.signald.MessageReceiver - Last client for **********65 unsubscribed, shutting down message pipe!
 17:36:47.672 [socketlistener] ERROR io.finn.signald.SocketHandler - Catching
 java.net.SocketException: Not open
        at org.newsclub.net.unix.AFUNIXSocketImpl.validFdOrException(AFUNIXSocketImpl.java:424) ~[junixsocket-common-2.3.2.jar:?]
        at org.newsclub.net.unix.AFUNIXSocketImpl.access$200(AFUNIXSocketImpl.java:46) ~[junixsocket-common-2.3.2.jar:?]
        at org.newsclub.net.unix.AFUNIXSocketImpl$AFUNIXInputStream.read(AFUNIXSocketImpl.java:318) ~[junixsocket-common-2.3.2.jar:?]
        at sun.nio.cs.StreamDecoder.readBytes(Unknown Source) ~[?:?]
        at sun.nio.cs.StreamDecoder.implRead(Unknown Source) ~[?:?]
        at sun.nio.cs.StreamDecoder.read(Unknown Source) ~[?:?]
        at java.io.InputStreamReader.read(Unknown Source) ~[?:?]
        at java.io.BufferedReader.fill(Unknown Source) ~[?:?]
        at java.io.BufferedReader.readLine(Unknown Source) ~[?:?]
        at java.io.BufferedReader.readLine(Unknown Source) ~[?:?]
        at io.finn.signald.SocketHandler.run(SocketHandler.java:98) [signald.jar:unspecified]
        at java.lang.Thread.run(Unknown Source) [?:?]
 17:36:52.673 [socketlistener] INFO  io.finn.signald.SocketHandler - Client connected
 18:36:48.120 [**********65-receiver] ERROR io.finn.signald.MessageReceiver - Catching
 java.io.IOException: Connection closed!
        at org.whispersystems.signalservice.internal.websocket.WebSocketConnection.readRequest(WebSocketConnection.java:189) ~[signal-service-java-x86_64-unknown-linux-gnu-2.15.3_unofficial_17.jar:?]
        at org.whispersystems.signalservice.api.SignalServiceMessagePipe.readOrEmpty(SignalServiceMessagePipe.java:148) ~[signal-service-java-x86_64-unknown-linux-gnu-2.15.3_unofficial_17.jar:?]
        at org.whispersystems.signalservice.api.SignalServiceMessagePipe.read(SignalServiceMessagePipe.java:122) ~[signal-service-java-x86_64-unknown-linux-gnu-2.15.3_unofficial_17.jar:?]
        at io.finn.signald.Manager.receiveMessages(Manager.java:1090) ~[signald.jar:unspecified]
        at io.finn.signald.MessageReceiver.run(MessageReceiver.java:68) [signald.jar:unspecified]
        at java.lang.Thread.run(Unknown Source) [?:?]
 18:36:48.120 [socketlistener] INFO  io.finn.signald.MessageReceiver - Last client for **********65 unsubscribed, shutting down message pipe!
 18:36:48.121 [socketlistener] ERROR io.finn.signald.SocketHandler - Catching
 java.net.SocketException: Not open
        at org.newsclub.net.unix.AFUNIXSocketImpl.validFdOrException(AFUNIXSocketImpl.java:424) ~[junixsocket-common-2.3.2.jar:?]
        at org.newsclub.net.unix.AFUNIXSocketImpl.access$200(AFUNIXSocketImpl.java:46) ~[junixsocket-common-2.3.2.jar:?]
        at org.newsclub.net.unix.AFUNIXSocketImpl$AFUNIXInputStream.read(AFUNIXSocketImpl.java:318) ~[junixsocket-common-2.3.2.jar:?]
        at sun.nio.cs.StreamDecoder.readBytes(Unknown Source) ~[?:?]
        at sun.nio.cs.StreamDecoder.implRead(Unknown Source) ~[?:?]
        at sun.nio.cs.StreamDecoder.read(Unknown Source) ~[?:?]
        at java.io.InputStreamReader.read(Unknown Source) ~[?:?]
        at java.io.BufferedReader.fill(Unknown Source) ~[?:?]
        at java.io.BufferedReader.readLine(Unknown Source) ~[?:?]
        at java.io.BufferedReader.readLine(Unknown Source) ~[?:?]
        at io.finn.signald.SocketHandler.run(SocketHandler.java:98) [signald.jar:unspecified]
        at java.lang.Thread.run(Unknown Source) [?:?]
 18:36:53.122 [socketlistener] INFO  io.finn.signald.SocketHandler - Client connected

The signald logs make me think that the problem arises in the client, though it could be something in signald (I've copied this issue over to that repository as well: https://gitlab.com/signald/signald/-/issues/124). Or maybe it's a docker issue? They're running in separate containers communicating through a shared docker volume with the socket.

Add buddy list download (for usage with Bitlbee and more)

I'm trying to get this plugin to work with Bitlbee, which can use most Pidgin/libpurple plugins.

I'm running Arch linux and have the latest Bitlbee installed, which uses libpurple-plugins to connect to different messaging networks like Discord, Telegram, Steam, Skypeweb and more.

I've setup signald, linked it to my phone's Signal account, and I can send messages via nc and the recipient receives them fine.
Bitlbee can see the libpurple-signald plugin, and I created a hehoe-signald account (in Bitblee) which shows up as connected.
However, I do not see Signal's user/group list or messages sent to me via Bitlbee or in &hehoe-signald.

@hoehermann I understand you may have only tested with Pidgin, but I'd be happy to help get this working with Bitlbee.
@EionRobb Any tips on where to start troubleshooting this? Could the lack of persistent rosters cause this?

Incorrect file extensions for externally served attachments

Splitting out the first half of #19 into its own separate bug report rather than an enhancement ( @fancypantalons ):

I think sometimes libmagic fails to detect the proper file extension (I've seen image/gif and video/mp4 attachments always result in .???). Ideally libmagic should know what extension a gif or an mp4 should be and use that, but if not, it could fall back on the provided attachment type and use the part after the / as the appropriate extension?

Trouble receiving incoming msgs in bitlbee

Hi again,

It's honestly been a while since I had working incoming msgs in bitlbee via libpurple-signald, but I hadn't gotten around to troubleshooting.... (outgoing has been fine).

I'm currently testing the automated-upgrade/com.github.turasa-signal-service-java branch for @thefinn93, and getting incoming msgs like the following in nc

{
  "type": "message",
  "data": {
    "username": "+ME",
    "source": {
      "number": "+THEM"
    },
    "sourceDevice": 0,
    "type": "UNIDENTIFIED_SENDER",
    "timestamp": 1593111463841,
    "timestampISO": "2020-06-25T18:57:43.841Z",
    "serverTimestamp": 1593111464606,
    "hasLegacyMessage": false,
    "hasContent": true,
    "isUnidentifiedSender": true,
    "dataMessage": {
      "timestamp": 1593111463841,
      "body": "HERE IS TEXT",
      "endSession": false,
      "expiresInSeconds": 0,
      "profileKeyUpdate": false,
      "viewOnce": false
    }
  }
}
{
  "type": "message",
  "data": {
    "username": "+ME",
    "source": {
      "number": "+THEM"
    },
    "sourceDevice": 0,
    "type": "UNIDENTIFIED_SENDER",
    "timestamp": 1593112497592,
    "timestampISO": "2020-06-25T19:14:57.592Z",
    "serverTimestamp": 1593112498215,
    "hasLegacyMessage": false,
    "hasContent": true,
    "isUnidentifiedSender": true,
    "dataMessage": {
      "timestamp": 1593112497592,
      "body": "MORE TEXT HERE",
      "endSession": false,
      "expiresInSeconds": 0,
      "profileKeyUpdate": false,
      "viewOnce": false
    }
  }
}

These are both examples of one of my contacts msging me, and they appear to be self contained (no second msg with more data)

Please let me know if there is more info needed, or if I can help troubleshooting.
I also hang out in the signald irc chan on freenode if you would like to ping me.

Add get_profile feature to pull contact details

@thefinn93 │ Strykar: there should be contact lookup methods? not entirely sure though, new profiles aren't fully implemented yet, sadly
@thefinn93 │ oh actually get_profile should do what you need

So this should enable changing the phone numbers to contact names?

Message text when replying without "@needle: "

The ability to reply to messages is a great feature, thanks for that. However, wouldn't it be better to remove the "@needle: " substring in the reply? This part of the message might be confusing to the reader otherwise.

account loses registered state in signald

A few minutes after Bitlbee starts it logs:

23:18 <@root> hehoe-signald - Logging in: Logged in
23:18 <@root> purple - Error: Signal Protocol - Link to Signal App - QR code creation failed:
23:18 <@root> qrencode -s 6 -o /tmp/signald_link_purple_qrcode.png 'tsdevice:/?uuid=XXXX&pub_key=XXXXXX'
23:20 <@root> purple - Error: Signal Protocol - Link to Signal App - Linking not successful!
23:20 <@root> Timed out while waiting for device to link
23:30 <@root> You're already logged in.

Bitlbee and libpurple-signald work fine and Group chats are loaded and function fine.

However, intermittently, it keeps logging:

00:18 <@root> hehoe-signald - Error: Unknown error
00:18 <@root> hehoe-signald - Signing off..
00:18 <@root> hehoe-signald - Reconnecting in 5 seconds..
00:19 <@root> hehoe-signald - Logging in: Logged in
00:19 <@root> purple - Error: Signal Protocol - Link to Signal App - QR code creation failed:
00:19 <@root> qrencode -s 6 -o /tmp/signald_link_purple_qrcode.png 'tsdevice:/?uuid=XXXX&pub_key=XXXXX'
00:20 <@root> purple - Error: Signal Protocol - Link to Signal App - Linking not successful!
00:20 <@root> Timed out while waiting for device to link

Signal in Bitblee appears to be working, the only change I see is I am kicked out my Signal group chats.

Crashes Pidgin 2.14.3 (libpurple 2.14.3)

When libpurple-signald is installed together with pidgin Pidgin 2.14.3 (libpurple 2.14.3), it crashes the pidgin. Output from gdb:

Reading symbols from pidgin...
(No debugging symbols found in pidgin)
(gdb) handle SIGPIPE nostop noprint 
Signal        Stop	Print	Pass to program	Description
SIGPIPE       No	No	Yes		Broken pipe
(gdb) run
Starting program: /usr/bin/pidgin 
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/usr/lib/libthread_db.so.1".
[New Thread 0x7fffec73d640 (LWP 46550)]
[New Thread 0x7fffebf3c640 (LWP 46551)]
[New Thread 0x7fffeb73b640 (LWP 46552)]
[New Thread 0x7fffea7ee640 (LWP 46553)]
[New Thread 0x7fffe9fed640 (LWP 46554)]
[New Thread 0x7fffe8e6f640 (LWP 46555)]
[New Thread 0x7fffb7fff640 (LWP 46556)]
[New Thread 0x7fffb77fe640 (LWP 46557)]
[Thread 0x7fffe8e6f640 (LWP 46555) exited]
[Thread 0x7fffb7fff640 (LWP 46556) exited]
[Detaching after fork from child process 46565]
[New Thread 0x7fffb7fff640 (LWP 46566)]
[New Thread 0x7fffe8e6f640 (LWP 46567)]
[Thread 0x7fffb7fff640 (LWP 46566) exited]
[Thread 0x7fffe8e6f640 (LWP 46567) exited]
[Detaching after fork from child process 46573]

Thread 1 "pidgin" received signal SIGSEGV, Segmentation fault.
0x00007fffeaad2270 in signald_assume_buddy_online () from /usr/lib/purple-2/libsignald.so
(gdb) bt full
#0  0x00007fffeaad2270 in signald_assume_buddy_online () at /usr/lib/purple-2/libsignald.so
#1  0x00007fffed0216b6 in json_array_foreach_element () at /usr/lib/libjson-glib-1.0.so.0
#2  0x00007fffeaad5690 in signald_handle_input () at /usr/lib/purple-2/libsignald.so
#3  0x00007fffeaad5aaf in signald_read_cb () at /usr/lib/purple-2/libsignald.so
#4  0x00005555555c9333 in  ()
#5  0x00007ffff71dbf30 in g_main_context_dispatch () at /usr/lib/libglib-2.0.so.0
#6  0x00007ffff722fb59 in  () at /usr/lib/libglib-2.0.so.0
#7  0x00007ffff71db593 in g_main_loop_run () at /usr/lib/libglib-2.0.so.0
#8  0x00007ffff78a49fe in gtk_main () at /usr/lib/libgtk-x11-2.0.so.0
#9  0x000055555558a97d in main ()
(gdb) quit
A debugging session is active.

	Inferior 1 [process 46542] will be killed.

Quit anyway? (y or n) y

Error handling with external attachments

When using the SUPPORT_EXTERNAL_ATTACHMENTS functionality, Bad Stuff happens without access to the signald attachments folder, e.g. on bitlbee:

(process:6): GLib-WARNING **: 20:51:15.549: GError set over the top of a previous GError or uninitialized memory.
This indicates a bug in someone's code. You must ensure an error is NULL before it's set.
The overwriting error message was: Error opening file < path from signald >: Permission denied
** (process:6): CRITICAL **: 20:52:19.762: purple_conversation_get_im_data: assertion 'conv != NULL' failed 
** (process:6): CRITICAL **: 20:52:19.762: purple_connection_get_account: assertion 'gc != NULL' failed 
(process:17): Json-CRITICAL **: 20:52:58.565: json_object_has_member: assertion 'object != NULL' failed 
(process:17): Json-CRITICAL **: 20:52:58.565: json_array_get_length: assertion 'array != NULL' failed 

and then bitlbee dies.

Add support for latest signald client protocol

The move to the latest Signal client library in signald MR 14 introduces client protocol changes that will require an update to libpurple-signald.

This update will address a number of issues in signald and has the potential to enable additional features.

The MR is ready for client test integration.

Create IRC channel for the libpurple-signald project

It's fair to assume a large portion of the libpurple-signald project use it with Bitlbee, and thus are already using IRC.
Please create a channel like (#purple-signald or something along those lines) for it, so users / developers could interact in real time to discuss it.

Freenode / OFTC are free popular IRC networks for OSS projects.
#signald is already used by TheFinn93 for signald :)

Cannot connect to signald

I try to connect pidgin to signald and keep getting the error message
+xxxxxxxxxx disconnected Could not connect to socket.

My socket is pointed to:
/var/run/signald/signald.sock

Output of systemd status:

signald.service - A daemon for interacting with the Signal Private Messenger
     Loaded: loaded (/usr/lib/systemd/system/signald.service; enabled; vendor preset: disabled)
     Active: active (running) since Thu 2021-10-07 18:00:50 CDT; 55min ago
   Main PID: 8622 (java)
      Tasks: 16 (limit: 28774)
     Memory: 129.6M
        CPU: 3.269s
     CGroup: /system.slice/signald.service
             └─8622 java -classpath /var/lib/signald/lib/signald.jar:/var/lib/signald/lib/signal-service-java-x86_64-unknown-linux-gnu-2.15.3_unofficial_27.jar:/var/lib/signald/lib/bcprov-jdk15on-1.66.jar:/var/lib/signald/lib/junixsocket>

Oct 07 18:00:50 Synolvia-GX1 systemd[1]: Started A daemon for interacting with the Signal Private Messenger.
Oct 07 18:00:51 Synolvia-GX1 signald[8622]: 18:00:51.020 [main] WARN  io.finn.signald.Main - Support for this version of Java may be going away. Please update your java version. For more information see https://gitlab.com/signald/signald>
Oct 07 18:00:51 Synolvia-GX1 signald[8622]: 18:00:51.293 [main] INFO  io.finn.signald.Main - Binding to socket /var/run/signald/signald.sock
Oct 07 18:00:51 Synolvia-GX1 signald[8622]: 18:00:51.301 [main] INFO  io.finn.signald.Main - Started signald 0.15.0-6-7fb32321

undefined symbol: g_memdup2

The latest changes introduce g_memdup2, which seems to be available only in recent version of glib2. At least it is not included in Debian 11 (current stable).

vague instructions (wrong adduser)

Normally instructions are in README.txt & INSTALL.txt or .md (or no extension, but best to always have plain-text .txt despite whatever else).

root@cosmos:~# adduser $USER signald
- User 'root' already exists; please choose another

Cannot message particular user due to "identityFailure"

pidgin -d prints:

(09:38:42) prpl-hehoe-signald: signald_send_im: flags: 1 msg:Well, now I finally know why you didn't respond: My signal client somehow lost the message xD
(09:38:42) prpl-hehoe-signald: Sending: {"type":"send","username":"+49AAAAAAAAAAA","recipientAddress":"+49BBBBBBBBBB","attachments":[],"messageBody":"Well, now I finally know why you didn't 
respond: My signal client somehow lost the message xD"}
(09:38:42) prpl-hehoe-signald: got newline delimited message: {"type":"send_results","data":[{"address":{"number":"+49BBBBBBBBBB","uuid":"1e4d55e7-7040-414a-9f6c-5e4aac138f43"},"networkFailu
re":false,"unregisteredFailure":false,"identityFailure":"05 ed c6 4c 29 31 b2 aa 2a 5b 54 53 5c b4 6a aa 96 8b 7f d0 32 81 a4 31 15 98 c1 b6 9f b0 b1 12 39"}]}
(09:38:42) prpl-hehoe-signald: received type: send_results
(09:38:42) prpl-hehoe-signald: Ignored message of unknown type 'send_results'.

The returned string in identityFailure is always the same; presumably it's some kind of "new public key".

I couldn't find anything about this error in the entire repository. How do I fix this "broken" state?

Bad response: 429 with libpurple-signald

I am running Bitlbee-libpurple and signald in Docker containers. The bitlbee-libpurple container builds libpurple-signald from source so I should be on the latest version of libpurple-signald.

I am running into an issue that when I attempt to turn on the hehoe-signald account through Bitlbee via libpurple-signald then Bitlbee crashes.

Specifically when I execute account hehoe-signald on, Bitlbee crashes.

I get the following error logs from signald:

18:26:15.656 [main] INFO  io.finn.signald.Main - Binding to socket /signald/signald.sock
18:26:15.708 [main] INFO  io.finn.signald.Main - Started signald 0.12.0+git2021-02-08r98148393.17
18:27:14.102 [socketlistener] INFO  io.finn.signald.SocketHandler - Client connected
18:27:15.171 [socketlistener] INFO  manager-**********30 - Creating new manager for **********30 (stored at /signald)
18:27:17.096 [socketlistener] INFO  manager - Created a manager for **********30
18:27:17.184 [socketlistener] ERROR io.finn.signald.SocketHandler - Catching
org.whispersystems.signalservice.api.push.exceptions.NonSuccessfulResponseCodeException: Bad response: 429 
        at org.whispersystems.signalservice.internal.push.PushServiceSocket.validateServiceResponse(PushServiceSocket.java:1477) ~[signal-service-java-x86_64-unknown-linux-gnu-2.15.3_unofficial_17.jar:?]
        at org.whispersystems.signalservice.internal.push.PushServiceSocket.makeServiceRequest(PushServiceSocket.java:1435) ~[signal-service-java-x86_64-unknown-linux-gnu-2.15.3_unofficial_17.jar:?]
        at org.whispersystems.signalservice.internal.push.PushServiceSocket.makeServiceBodyRequest(PushServiceSocket.java:1420) ~[signal-service-java-x86_64-unknown-linux-gnu-2.15.3_unofficial_17.jar:?]
        at org.whispersystems.signalservice.internal.push.PushServiceSocket.makeServiceRequest(PushServiceSocket.java:1362) ~[signal-service-java-x86_64-unknown-linux-gnu-2.15.3_unofficial_17.jar:?]
        at org.whispersystems.signalservice.internal.push.PushServiceSocket.makeServiceRequest(PushServiceSocket.java:1338) ~[signal-service-java-x86_64-unknown-linux-gnu-2.15.3_unofficial_17.jar:?]
        at org.whispersystems.signalservice.internal.push.PushServiceSocket.getContactTokenDetails(PushServiceSocket.java:782) ~[signal-service-java-x86_64-unknown-linux-gnu-2.15.3_unofficial_17.jar:?]
        at org.whispersystems.signalservice.api.SignalServiceAccountManager.getContact(SignalServiceAccountManager.java:364) ~[signal-service-java-x86_64-unknown-linux-gnu-2.15.3_unofficial_17.jar:?]
        at io.finn.signald.Manager.getUser(Manager.java:1511) ~[signald.jar:unspecified]
        at io.finn.signald.SocketHandler.getUser(SocketHandler.java:574) ~[signald.jar:unspecified]
        at io.finn.signald.SocketHandler.handleRequest(SocketHandler.java:214) [signald.jar:unspecified]
        at io.finn.signald.SocketHandler.run(SocketHandler.java:132) [signald.jar:unspecified]
        at java.lang.Thread.run(Unknown Source) [?:?]
18:27:17.342 [socketlistener] INFO  io.finn.signald.SocketHandler - Client disconnected
18:27:17.343 [socketlistener] INFO  io.finn.signald.MessageReceiver - Last client for **********30 unsubscribed, shutting down message pipe!

I can send a message using the signald.sock socket file that is running in the finn/signald container from my Bitlbee container:

[root@arch-oryx ~]# docker exec -it bitlbee bash
bash-5.0$ nc -U /var/run/signald/signald.sock
{"type":"version","data":{"name":"signald","version":"0.12.0+git2021-02-08r98148393.17","branch":"main","commit":"9814839376b0aceed8329fecc7477a5da7d0cae8"}}
{"type": "send", "username": "+1********30", "recipientAddress": {"number": "+1********30"}, "messageBody": "Testing"}
{"type":"send_results","data":[]}

(FYI I just sent a test message to myself) ^^

I'm able to send and receive my message using netcat without issue:

image

Since I'm able to interface with the signald.sock socket file without issue from my Bitlbee container this looks to me like an implementation issue with libpurple-signald.

I would greatly appreciate any suggestions on how to fix this issue! :D

Always window popup

When a new message arrives:
Despite the setting to not popup the window the conversation window does appear.
(Thanks for the addon, I'd love to use pidgin rather than the memory hog sigal)

No rules to make Megamimes.c

Make produces the error below:

$ make
.
.
.
  inflating: libpurple-signald-master/purple_compat.h  
   creating: libpurple-signald-master/submodules/
   creating: libpurple-signald-master/submodules/MegaMimes/
make: *** No rule to make target 'submodules/MegaMimes/src/MegaMimes.c', needed by 'comms.o'.  Pare.

New socket file location

Hello,
This is to let you know that signald is moving it's default socket file location. The old location and the new location should both be searched, as the old location isn't being deprecated any time soon.

more details in #66, although what you need to know is:

please ensure your client's default behavior when the user has not specified a different path to the socket file is to first attempt to connect to $XDG_RUNTIME_DIR/signald/signald.sock, then fall back to /var/run/signald/signald.sock.

signald has a CLI flag --user-socket to it to make it use the new behavior.

extra bytes in input buffer

signald_send_im: flags: 1 msg: »ddd 	  				 	 	 	    		  	   	  		«
Sending JSON of length 162: {"type":"send","username":"+494034868236","recipientAddress":"+4915258474112","attachments":[],"messageBody":"ddd \t  \t\t\t\t \t \t \t    \t\t  \t   \t\t  \t\t"}

I have no idea what is going on there. Probably some mean case of stack corruption originating from somewhere else in the plug-in.

No ack to sender

When sending to the pidgin signal:
There is no ack that the message has arrived.
And no ack that the message has been displayed.
(Or am I missng a setting?)
Chris

Trying to join a missing group terminates the connection

Error is

{"type":"get_group","error":{"message":"unknown group requested"},"error_type":"UnknownGroupError"}

. Happens when clicking the chat in the buddy list while group not being mentioned by list_groups. Receiving a message from another participant of the group resolves the issue.

Cannot log in

I get and exception in the signald log when logging in:

18:09:00.798 [main] INFO io.finn.signald.Main - Binding to socket /home/szb/signald/signald.sock
18:09:00.813 [main] INFO io.finn.signald.Main - Started signald +git2021-02-01r.
18:09:22.129 [socketlistener] INFO io.finn.signald.SocketHandler - Client connected
18:09:23.217 [socketlistener] INFO manager-**********97 - Creating new manager for **********97 (stored at ***
18:09:27.425 [socketlistener] ERROR io.finn.signald.SocketHandler - Catching
java.lang.NullPointerException: null
at io.finn.signald.storage.ProfileCredentialStore.update(ProfileCredentialStore.java:80) ~[signald.jar:unspecified]
at io.finn.signald.actions.RefreshProfileAction.run(RefreshProfileAction.java:70) ~[signald.jar:unspecified]
at io.finn.signald.Manager.getRecipientProfileKeyCredential(Manager.java:1564) ~[signald.jar:unspecified]
at io.finn.signald.Manager.init(Manager.java:294) ~[signald.jar:unspecified]
at io.finn.signald.Manager.get(Manager.java:157) ~[signald.jar:unspecified]
at io.finn.signald.Manager.get(Manager.java:144) ~[signald.jar:unspecified]
at io.finn.signald.Manager.getAll(Manager.java:192) ~[signald.jar:unspecified]
at io.finn.signald.JsonAccountList.(JsonAccountList.java:27) ~[signald.jar:unspecified]
at io.finn.signald.SocketHandler.listAccounts(SocketHandler.java:381) ~[signald.jar:unspecified]
at io.finn.signald.SocketHandler.handleRequest(SocketHandler.java:189) [signald.jar:unspecified]
at io.finn.signald.SocketHandler.run(SocketHandler.java:134) [signald.jar:unspecified]
at java.lang.Thread.run(Thread.java:748) [?:1.8.0_275]

Trailing space in attachment file:// link causes file not to be found by KIO on KDE

The file:// URL for attachments has a trailing space, which breaks at least on KDE (didn't test other environments).

Easily fixed by removing the space in lines 135 and 138 in message.c.

Demonstration: https://i.imgur.com/8XZLgCB.png

Sorry for not opening a pull request but I didn't feel like figuring out how to do it properly on github for such a small change. Anyway, here's the patch:

diff --git a/message.c b/message.c
index 605a84f..d1476a3 100644
--- a/message.c
+++ b/message.c
@@ -132,10 +132,10 @@ signald_parse_attachment(SignaldAccount *sa, JsonObject *obj, GString *message)
         int img_id = purple_imgstore_add_with_id(g_memdup(purple_imgstore_get_data(img), size), size, NULL);
 
         g_string_append_printf(message, "<IMG ID=\"%d\"/><br/>", img_id);
-        g_string_append_printf(message, "<a href=\"file://%s \">Image (type: %s)</a><br/>", fn, type);
+        g_string_append_printf(message, "<a href=\"file://%s\">Image (type: %s)</a><br/>", fn, type);
     } else {
         //TODO: Receive file using libpurple's file transfer API
-        g_string_append_printf(message, "<a href=\"file://%s \">Attachment (type: %s)</a><br/>", fn, type);
+        g_string_append_printf(message, "<a href=\"file://%s\">Attachment (type: %s)</a><br/>", fn, type);
     }
 
     purple_debug_info(SIGNALD_PLUGIN_ID, "Attachment: %s", message->str);

Externally served attachments naming [ Feature requests ]

The externally served attachments functionality is great, thanks for that @fancypantalons! Two additional features that could make it even better:

  • I think sometimes libmagic fails to detect the proper file type (I've seen image/gif and video/mp4 attachments result in .???). Perhaps in such cases, it can split the attachment type and use the part after the / as the appropriate extension? (handled in #39)
  • It would be nice to rename the files to something more useful -- perhaps allow a formatstring option that lets you select variables like sender name, recipient name, date/time string, etc. ?

QRencode permission issue for linked account

When starting pidgin you may get an error about qrencode failing to execute. In my case I have apparmor on debian and the default profile for pidgin does not allow that execution.
The fix is adding this line
/usr/bin/qrencode rix,
in the appropriate place in the file:
/etc/apparmor.d/usr.bin.pidgin

I am creating this issue in case someone else has the same problem. It is very not obvious that it would be an app armor issue and I figured that out by finding the "system" call in the source.

Core dump on pidgin enable

I've had some trouble with signald/libpurple-signald for some time, now, as libpurple-signald kept disconnecting (may be 1-2 months). It seems as though it crashed whenever there had been offline-messages, and after clicking re-enable dozens of times (to seemingly download each of the offline-message one by one), it would run comparatively stable (until there again were offline-messages).

I've realized there were some changes committed today, so pulled, made, installed -- and now I first of all still get "signald reported an unexpected error. View the console output in debug mode for more information."

When starting pidgin, but pushing re-enable now directly leads to pidgin crashing completely:

$ pidgin 
<click "re-enable">
*** buffer overflow detected ***: terminated
Aborted (core dumped)

The syslog previously complained about a couple of issues

Oct  3 17:39:55 diskordia signald[969]: 17:39:55.879 [connection-pid-6450] INFO  io.finn.signald.clientp
rotocol.ClientConnection - Client connected
Oct  3 17:39:56 diskordia signald[969]: 17:39:56.879 [Thread-193] INFO  io.finn.signald.clientprotocol.C
lientConnection - signald received a request with no version. This will stop working in a future version
 of signald. Please update your client. Client authors, see https://signald.org/articles/protocol-versio
ning/
Oct  3 17:39:57 diskordia systemd[1]: NetworkManager-dispatcher.service: Deactivated successfully.
Oct  3 17:39:59 diskordia signald[969]: 17:39:59.102 [Thread-199] ERROR io.finn.signald.clientprotocol.C
lientConnection - Catching
Oct  3 17:39:59 diskordia signald[969]: java.lang.NullPointerException: null
Oct  3 17:39:59 diskordia signald[969]: #011at org.whispersystems.libsignal.util.guava.Preconditions.che
ckNotNull(Preconditions.java:189) ~[signal-client-java-x86_64-unknown-linux-gnu-0.9.0.jar:?]
Oct  3 17:39:59 diskordia signald[969]: #011at org.whispersystems.signalservice.api.push.SignalServiceAddress.<init>(SignalServiceAddress.java:34) ~[signal-service-java-x86_64-unknown-linux-gnu-2.15.3_unofficial_27.jar:?]
Oct  3 17:39:59 diskordia signald[969]: #011at org.whispersystems.signalservice.api.push.SignalServiceAddress.<init>(SignalServiceAddress.java:47) ~[signal-service-java-x86_64-unknown-linux-gnu-2.15.3_unofficial_27.jar:?]
Oct  3 17:39:59 diskordia signald[969]: #011at io.finn.signald.clientprotocol.v1.JsonAddress.getSignalServiceAddress(JsonAddress.java:63) ~[signald.jar:unspecified]
Oct  3 17:39:59 diskordia signald[969]: #011at io.finn.signald.storage.GroupInfo.getMembers(GroupInfo.java:39) ~[signald.jar:unspecified]
Oct  3 17:39:59 diskordia signald[969]: #011at io.finn.signald.clientprotocol.v1.JsonGroupInfo.<init>(JsonGroupInfo.java:65) ~[signald.jar:unspecified]
Oct  3 17:39:59 diskordia signald[969]: #011at io.finn.signald.JsonGroupList.<init>(JsonGroupList.java:35) ~[signald.jar:unspecified]
Oct  3 17:39:59 diskordia signald[969]: #011at io.finn.signald.LegacySocketHandler.listGroups(LegacySocketHandler.java:466) ~[signald.jar:unspecified]
Oct  3 17:39:59 diskordia signald[969]: #011at io.finn.signald.LegacySocketHandler.handleRequest(LegacySocketHandler.java:143) ~[signald.jar:unspecified]
Oct  3 17:39:59 diskordia signald[969]: #011at io.finn.signald.clientprotocol.ClientConnection$RequestRunner.run(ClientConnection.java:157) [signald.jar:unspecified]
Oct  3 17:39:59 diskordia signald[969]: #011at java.lang.Thread.run(Thread.java:829) [?:?]
Oct  3 17:39:59 diskordia signald[969]: 17:39:59.129 [connection-pid-6450] INFO  io.finn.signald.MessageReceiver - Last client for **********************************3d unsubscribed, shutting down message pipe
Oct  3 17:39:59 diskordia signald[969]: 17:39:59.129 [Thread-200] INFO  io.finn.signald.clientprotocol.ClientConnection - signald received a request with no version. This will stop working in a future version of signald. Please update your client. Client authors, see https://signald.org/articles/protocol-versioning/
Oct  3 17:39:59 diskordia signald[969]: 17:39:59.129 [connection-pid-6450] INFO  io.finn.signald.clientprotocol.ClientConnection - Client disconnected

But now there's not even a message in the syslog (so that's an improvement, I guess ;-D)

Having signal run in pidgin was really useful, I hope we'll get it back to work like it did before! :)

Not sure if there's anything I can do to help?

Can't see any buddies in Buddy List

Thanks very much for this plugin!

Using Pidgin 2.13.0 on Ubuntu 18.04, I installed the latest 0.2.0 build of the plugin in ~/.purple/plugins. (I also tried building it from git master with the same result).

When I restart Pidgin, I am able to create an account. (I notice that the account has no icon, is that normal?) It seems to connect fine. (I have previously set up signald and verified my account.)

Nothing appears in the Buddy List, however. As far as I can see, the buddy list should be updated since 0.2.0, but I can't even see a heading for Signal. Am I missing something? I can't find anything about this in README.md or the open or closed issues.

Better auto-join behaviour for group chats

Figured I'd break this into its own issue.

Right now, if a user is a member of a group chat, the plugin automatically opens a window in Pidgin for that chat at startup. And this is definitely pretty annoying.

The goal is to make this behaviour more flexible.

In particular, I'm proposing a configuration setting for the account that controls auto-join behaviour, with three settings:

  1. Never automatically open
  2. Automatically open when a message is received or when invited to a group chat
  3. Always open

Of course, if the user has selected 1 or 2, they'll need some way to open existing group chats, so the proposal is to also automatically add group chats to the buddy list (with the gtk-persistent flag set by default), which will allow the user to then open the chats on demand.

Contacts Disappear After Quitting Weechat

I use Weechat as my client to connect to Bitlbee+Libpurple.

After quitting Weechat and reopening it none of my contacts in signald show up. The contacts are still in signald when I connect to the socket manually and list the contacts.

Restarting signald and bitlbee fixes the problem.

Is there any way to get the contacts to show back up without restarting the services?

Must send version to signald

systemctl status signald shows this error message over and over:

signald received a request with no version. This will stop working in a future version of signald. Please update your client. Client authors, see https://signald.org/articles/protocol-versioning/

I think it's a good idea to document this warning, and ideally fix it :D

EDIT: Earlier I talked about message loss; turns out, that was a separate issue and because I did something else wrong. The above-mentioned warning still appears, so the message loss appears to be unrelated.

Not receiving incoming msgs

Hi,

Over the last few days @thefinn93 has troubleshoot and fixed some errors I was experiencing with signald, among which was one where "unidentified" (a term thefinn93 used) contacts' messages would not appear. Now that I can again see incoming messages in netcat, I find that libpurple-signald is not seeing the incoming messages, or at least not properly sending them to my irc client via bitlbee (which has worked for me in the past).

On receiving an incoming message in signal, I see the following in my journalctl at the same time stamp:

Dec 26 21:41:45 vps-of-doom bitlbee[24662]: purple_find_conversation_with_account: assertion 'name != NULL' failed

And I believe that the following may correspond with my received receipts (from me to other user):

Dec 26 21:43:53 vps-of-doom bitlbee[24662]: g_string_insert_len: assertion 'len == 0 || val != NULL' failed

Please let me know if there is any more information I could provide, or steps I could take to further troubleshoot.

list_contacts leads to NullPointerException in signald

[connection-pid-8851] INFO  io.finn.signald.clientprotocol.ClientConnection - Client connected
[list_contacts] ERROR list_contacts - error while handling request
java.lang.NullPointerException: null
        at org.whispersystems.libsignal.util.guava.Preconditions.checkNotNull(Preconditions.java:189) ~[signal-client-java-x86_64-unknown-linux-gnu-0.10.0.jar:?]
        at org.whispersystems.signalservice.api.push.SignalServiceAddress.<init>(SignalServiceAddress.java:33) ~[signal-service-java-x86_64-unknown-linux-gnu-2.15.3_unofficial_34.jar:?]
        at org.whispersystems.signalservice.api.push.SignalServiceAddress.<init>(SignalServiceAddress.java:46) ~[signal-service-java-x86_64-unknown-linux-gnu-2.15.3_unofficial_34.jar:?]
        at io.finn.signald.clientprotocol.v1.JsonAddress.getSignalServiceAddress(JsonAddress.java:55) ~[signald.jar:?]
        at io.finn.signald.clientprotocol.v1.ListContactsRequest.run(ListContactsRequest.java:48) ~[signald.jar:?]
        at io.finn.signald.clientprotocol.v1.ListContactsRequest.run(ListContactsRequest.java:33) ~[signald.jar:?]
        at io.finn.signald.clientprotocol.Request.<init>(Request.java:148) [signald.jar:?]
        at io.finn.signald.clientprotocol.ClientConnection$RequestRunner.run(ClientConnection.java:160) [signald.jar:?]
        at java.lang.Thread.run(Thread.java:829) [?:?]

Implementation of proper group chat support

Hey! I decided to take a crack at completely reworking the way libpurple-signald implements group chat support.

The big observation is that, in the libpurple model, the two major forms of conversation are IMs, which are direct 1:1 conversations between two users, and chats, which map more or less to Signal groups.

The trouble with the current implementation is that the plugin maps both types of Signal traffic to IMs, which doesn't take full advantage of the capabilities libpurple offers for group chats.

So in my groupchat branch I completely rewrote the way Signal groups are handled (and also engaged in a ton of refactoring where needed).

With the plugin installed, with Pidgin first starts up, now any existing Signal groups are turned into open chat windows that work as you'd expect.

In addition, you can:

  • Buddies->Add Chat... to create a new Signal group.
  • Conversation->Invite... to invite Signal users into a group.
  • Conversation->Close to leave the Signal group (take care!)

In addition, there's some other behaviours that I've implemented:

  • If users leave the chat, the user list updates correctly (this is done by handling QUIT events).
  • If you create or leave groups in Signal Desktop or the mobile apps, Pidgin responds appropriately by auto-joining the chat or leaving it as appropriate.

To be clear: I don't think the code is ready yet! I've not made it compatible with both purple2 and purple3. It almost certainly needs some hefty code review for memory leaks, bugs, and so forth. And the testing is... well, it needs more testing. :)

But please take a look at let me know what you think!

Failure after update "Must have either a UUID or E164 number!"

I upgraded bitlbee / libpurple / this plugin / signald recently (after several months), and the plugin no longer connects to the signald. The signald logs show (full trace at bottom):

23:34:22.616 [socketlistener] ERROR io.finn.signald.SocketHandler - Catching    
com.fasterxml.jackson.databind.JsonMappingException: Must have either a UUID or E164 number! 
...            
Caused by: java.lang.AssertionError: Must have either a UUID or E164 number!    
   at org.whispersystems.signalservice.api.push.SignalServiceAddress.<init>(SignalServiceAddress.java:35) ~[signal-service-java-2.15.3_unofficial_12.jar:?]
...

I assume something in the settings needed to have changed from before?

Full trace:

23:34:21.609 [socketlistener] INFO  io.finn.signald.SocketHandler - Client connected
23:34:22.611 [socketlistener] INFO  manager-**********65 - Creating new manager for **********65 (stored at /home/gradle/.config/signald)
23:34:22.615 [socketlistener] INFO  io.finn.signald.storage.AccountData - Migrating thread store
23:34:22.616 [socketlistener] ERROR io.finn.signald.SocketHandler - Catching
com.fasterxml.jackson.databind.JsonMappingException: Must have either a UUID or E164 number!
 at [Source: (File); line: 488, column: 3] (through reference chain: io.finn.signald.storage.AccountData["threadStore"])
   at com.fasterxml.jackson.databind.JsonMappingException.from(JsonMappingException.java:278) ~[jackson-databind-2.9.9.2.jar:2.9.9.2]
   at com.fasterxml.jackson.databind.deser.SettableBeanProperty._throwAsIOE(SettableBeanProperty.java:611) ~[jackson-databind-2.9.9.2.jar:2.9.9.2]
   at com.fasterxml.jackson.databind.deser.SettableBeanProperty._throwAsIOE(SettableBeanProperty.java:599) ~[jackson-databind-2.9.9.2.jar:2.9.9.2]
   at com.fasterxml.jackson.databind.deser.impl.MethodProperty.deserializeAndSet(MethodProperty.java:143) ~[jackson-databind-2.9.9.2.jar:2.9.9.2]
   at com.fasterxml.jackson.databind.deser.BeanDeserializer.vanillaDeserialize(BeanDeserializer.java:288) ~[jackson-databind-2.9.9.2.jar:2.9.9.2]
   at com.fasterxml.jackson.databind.deser.BeanDeserializer.deserialize(BeanDeserializer.java:151) ~[jackson-databind-2.9.9.2.jar:2.9.9.2]
   at com.fasterxml.jackson.databind.ObjectMapper._readMapAndClose(ObjectMapper.java:4014) ~[jackson-databind-2.9.9.2.jar:2.9.9.2]
   at com.fasterxml.jackson.databind.ObjectMapper.readValue(ObjectMapper.java:2903) ~[jackson-databind-2.9.9.2.jar:2.9.9.2]
   at io.finn.signald.storage.AccountData.load(AccountData.java:74) ~[signald.jar:unspecified]
   at io.finn.signald.Manager.init(Manager.java:286) ~[signald.jar:unspecified]
   at io.finn.signald.Manager.get(Manager.java:156) ~[signald.jar:unspecified]
   at io.finn.signald.Manager.get(Manager.java:142) ~[signald.jar:unspecified]
   at io.finn.signald.SocketHandler.subscribe(SocketHandler.java:508) ~[signald.jar:unspecified]
   at io.finn.signald.SocketHandler.handleRequest(SocketHandler.java:144) [signald.jar:unspecified]
   at io.finn.signald.SocketHandler.run(SocketHandler.java:107) [signald.jar:unspecified]
   at java.lang.Thread.run(Thread.java:748) [?:1.8.0_262]
Caused by: java.lang.AssertionError: Must have either a UUID or E164 number!
   at org.whispersystems.signalservice.api.push.SignalServiceAddress.<init>(SignalServiceAddress.java:35) ~[signal-service-java-2.15.3_unofficial_12.jar:?]
   at org.whispersystems.signalservice.api.push.SignalServiceAddress.<init>(SignalServiceAddress.java:51) ~[signal-service-java-2.15.3_unofficial_12.jar:?]
   at org.whispersystems.signalservice.api.push.SignalServiceAddress.<init>(SignalServiceAddress.java:47) ~[signal-service-java-2.15.3_unofficial_12.jar:?]
   at io.finn.signald.util.AddressUtil.fromIdentifier(AddressUtil.java:33) ~[signald.jar:unspecified]
   at io.finn.signald.storage.ContactStore.getContact(ContactStore.java:44) ~[signald.jar:unspecified]
   at io.finn.signald.storage.AccountData.setThreadStore(AccountData.java:223) ~[signald.jar:unspecified]
   at sun.reflect.GeneratedMethodAccessor9.invoke(Unknown Source) ~[?:?]
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_262]
   at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_262]
   at com.fasterxml.jackson.databind.deser.impl.MethodProperty.deserializeAndSet(MethodProperty.java:141) ~[jackson-databind-2.9.9.2.jar:2.9.9.2]
   ... 12 more
23:36:22.609 [socketlistener] ERROR io.finn.signald.SocketHandler - Catching
java.lang.NullPointerException: null
   at io.finn.signald.SocketHandler.unsubscribe(SocketHandler.java:523) ~[signald.jar:unspecified]
   at io.finn.signald.SocketHandler.handleRequest(SocketHandler.java:147) [signald.jar:unspecified]
   at io.finn.signald.SocketHandler.run(SocketHandler.java:107) [signald.jar:unspecified]
   at java.lang.Thread.run(Thread.java:748) [?:1.8.0_262]
23:36:22.610 [socketlistener] ERROR io.finn.signald.SocketHandler - Catching
java.net.SocketException: Not open
   at org.newsclub.net.unix.AFUNIXSocketImpl.validFdOrException(AFUNIXSocketImpl.java:424) ~[junixsocket-common-2.3.2.jar:?]
   at org.newsclub.net.unix.AFUNIXSocketImpl.access$200(AFUNIXSocketImpl.java:46) ~[junixsocket-common-2.3.2.jar:?]
   at org.newsclub.net.unix.AFUNIXSocketImpl$AFUNIXInputStream.read(AFUNIXSocketImpl.java:318) ~[junixsocket-common-2.3.2.jar:?]
   at sun.nio.cs.StreamDecoder.readBytes(StreamDecoder.java:284) ~[?:1.8.0_262]
   at sun.nio.cs.StreamDecoder.implRead(StreamDecoder.java:326) ~[?:1.8.0_262]
   at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:178) ~[?:1.8.0_262]
   at java.io.InputStreamReader.read(InputStreamReader.java:184) ~[?:1.8.0_262]
   at java.io.BufferedReader.fill(BufferedReader.java:161) ~[?:1.8.0_262]
   at java.io.BufferedReader.readLine(BufferedReader.java:324) ~[?:1.8.0_262]
   at java.io.BufferedReader.readLine(BufferedReader.java:389) ~[?:1.8.0_262]
   at io.finn.signald.SocketHandler.run(SocketHandler.java:88) [signald.jar:unspecified]
   at java.lang.Thread.run(Thread.java:748) [?:1.8.0_262]

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.