derricw / siggo

a TUI for signal messenger, written in Go
GNU General Public License v3.0
320 stars 9 forks source link

Siggo TUI empty on startup #27

Closed beune closed 3 years ago

beune commented 3 years ago

Problem: when I start siggo, I get an empty TUI.

Here is the log file:

time="2020-11-22T20:11:22+01:00" level=warning msg="failed to read contacts from disk: json: cannot unmarshal string into Go struct field SignalGroup.groupStore.groups.members of type signal.SignalGroupMember"
time="2020-11-22T20:11:22+01:00" level=debug msg="contacts found: []"
time="2020-11-22T20:11:22+01:00" level=info msg="starting dbus daemon..."
time="2020-11-22T20:11:22+01:00" level=info msg="scanning stdout"
time="2020-11-22T20:11:25+01:00" level=info msg="starting dbus daemon..."
time="2020-11-22T20:11:25+01:00" level=info msg="scanning stdout"
time="2020-11-22T20:11:27+01:00" level=info msg="starting dbus daemon..."
time="2020-11-22T20:11:27+01:00" level=info msg="scanning stdout"
time="2020-11-22T20:11:28+01:00" level=debug msg="Key Event <NORMAL>: 256 mods: 0 rune: 113"
time="2020-11-22T20:11:28+01:00" level=debug msg="Key Event <NORMAL>: 24 mods: 2 rune: 24"
time="2020-11-22T20:11:28+01:00" level=debug msg="Key Event <NORMAL>: 3 mods: 2 rune: 3"
time="2020-11-22T20:11:28+01:00" level=debug msg="killing signal-cli daemon..."

I can confirm signal-cli works, as I can receive messages using the cli. Moreover, I can send messages through signal-cli.

Am I doing something wrong, or did I find a bug?

derricw commented 3 years ago

@beune

Haha yeah it is totally possible that you found a bug. So your TUI is empty because it couldn't read your contact list. Here are a couple questions for you, so we can fix this:

1) what version of signal-cli are you running? You should be able to print it with signal-cli --version 2) Is there a signal-cli data file at ~/.local/share/signal-cli/data/+<your-phone-number>

They just released a new version of signal-cli (0.6.12) and the changelog suggests that they may have moved the contact store, which could definitely be causing this problem: https://github.com/AsamK/signal-cli/blob/master/CHANGELOG.md

Also, siggo runs signal-cli in daemon mode, which requires dbus. The fact that your log file shows multiple attempts to start the daemon might indicate that you don't have dbus. Take a look here: https://github.com/AsamK/signal-cli/wiki/DBus-service

beune commented 3 years ago
  1. I am indeed running signal-cli 0.6.12
  2. There is indeed a data file present at that location.

Now when I try to run signal-cli in daemon mode, I get the following error:

$ signal-cli -u +xxxxxxxx daemon
Exception in thread "main" java.lang.RuntimeException: Cannot Resolve Session Bus Address
        at org.freedesktop.dbus.connections.impl.DBusConnection.lambda$getConnection$1(DBusConnection.java:257)
        at org.freedesktop.dbus.connections.impl.DBusConnection.getConnection(DBusConnection.java:165)
        at org.freedesktop.dbus.connections.impl.DBusConnection.getConnection(DBusConnection.java:228)
        at org.freedesktop.dbus.connections.impl.DBusConnection.getConnection(DBusConnection.java:184)
        at org.asamk.signal.commands.DaemonCommand.handleCommand(DaemonCommand.java:51)
        at org.asamk.signal.Main.handleCommands(Main.java:184)
        at org.asamk.signal.Main.handleCommands(Main.java:135)
        at org.asamk.signal.Main.main(Main.java:65)

I tried to make use of the system bus, but I do not have systemd on my linux distro, as I run OpenRC (a different init system). I also could not get this to work, as the signal-cli repo does not offer any OpenRC init files.

I already filed an issue in the signal-cli repo to provide those init files.

Is there anything I can do right now?

derricw commented 3 years ago

You know, when I first started this project, I had a build that just ran signal-cli receive on a loop as a subprocess instead of using the dbus daemon. it worked fine but used too much resources since it was continually spinning up the jvm in the background.

I would love an alternative signal-cli command like receive_forever or something that just continually receives instead of doing it once then dying. If I were a better java programmer I would try to add that feature for them. That would eliminate our reliance on their dbus daemon for continually receiving messages.

beune commented 3 years ago

Ah so that's what the daemon is for!

I think I'll have to wait until I get a response in the signal-cli repo. Or can you explain why I get the error when running $ signal-cli -u +xxxxxxxx daemon?

derricw commented 3 years ago

Definitely seems most likely that you have no dbus service running. I have no idea how to get that running with OpenRC.

Might be something here: https://wiki.gentoo.org/wiki/D-Bus

cycneuramus commented 3 years ago

I'm having the same issue (i. e. siggo just gives me an empty TUI) even though signal-cli -u +xxxxxxxx daemon works fine on my end. So I suppose the problem has to do with the updates to the contacts store.

I'm on signal-cli 0.7.0.

derricw commented 3 years ago

Hey! I have not tested siggo yet with signal-cli 0.7.X. I will try to very soon.

Masacaai commented 3 years ago

Hi, I've got the same issue. My signal-cli daemon works fine though. I am on signal-cli 0.7.2

derricw commented 3 years ago

Hey, after testing with signal-cli 0.7, I've made an update that may fix this problem. Could you try pulling master and rebuilding?

beune commented 3 years ago

The empty TUI is gone, but now there is still a couple of problems:

Do you want me to file separate issues for this?

Info:

Build Date: 2021-01-25-09:20:30
Git Commit: cbe0210a74c9a004e35353b68f3c964eed342741
Version: 0.8.2
Go Version: go1.15.7
OS/Arch: linux amd64
signal-cli Version: 0.7.4

siggo config:

user_name: self
save_messages: true
desktop_notifications: false
desktop_notifications_show_message: false
desktop_notifications_show_avatar: false
terminal_bell_notifications: false
max_coversation_length: 0
hide_panel_titles: false
hide_phone_numbers: false
contact_colors: {}
contact_aliases: {}
log_file: ""

signal-cli 0.7.4

derricw commented 3 years ago

Ok, well we're getting somewhere at least! Thanks for being patient with this. I need to build a good test suite for this stuff ><.

  1. I think there are some issues with saving messages (and adding conversations to the GUI) from people who were not initially loaded from the signal-cli data file.
  2. The base64 chats are group chat IDs. They should only show up with an ID like that if they group chat doesn't have a name in the signal-cli data file? I didn't think it was possible to not have a group name, but maybe it is? I'd love it if you could confirm that you have group names in your groupStore in ~/.local/share/signal-cli/data/<yournumber>
  3. Haha of course this happens. I have never had a contact list that full so I've never noticed this. I've opened up a bug for this: https://github.com/derricw/siggo/issues/34
  4. This may not be possible to solve if signal-cli doesn't put the contact name in the data file somewhere for me to read.
  5. I think this is related to https://github.com/derricw/siggo/issues/28 and the first issue on your list.

Thanks so much for troubleshooting this. I use this personally every day but my particular use cases dont surface some of these bugs.

beune commented 3 years ago
  1. I can confirm that some groups in the groupStore have a name and a groupId, some only have a groupId. These same group names are also visible in siggo. However, I do not have any groups in my signal app that don't have a name. So for some reason some groups in signal-cli don't have a name.
  2. Ok that makes sense. Would it be better to make unread chats have a different color other than just a star? That makes them better to distinguish from read chats.
  3. Btw, I think that what I said is not true. You only see the names of people in group chats when they are on your signal homescreen. That means, you either sent them a message, or the person pops up on your homescreen with the message "Person is on Signal!"

No problem man, I would love to use siggo as my daily driver one day. Btw, do you have an explanation for issue 6?

derricw commented 3 years ago
  1. I will have to come up with something nicer than the GroupID when a group doesn't have a name. Maybe shorten the members names or initials or something? Or just like group0, but let you alias them however you want (like the way it works with contact names).
  2. Yeah I'm open to suggestions on how to better differentiate chats with new messages. Currently they get a star and bold font. You can also instantly jump to chats with new messages with CTRL+n.
  3. I think issue 5, 6, and 1 are all related to the same bug, which is a problem with the way the contact sorting works after a contact has been added dynamically (not read from the signal-cli data file at startup).
derricw commented 3 years ago

@beune 3. should be fixed. https://github.com/derricw/siggo/issues/34

derricw commented 3 years ago

@beune 2. should be fixed https://github.com/derricw/siggo/pull/44

derricw commented 3 years ago

I think I'm going to close this for now since the bugs we've discussed are either fixed or have their own issue entry.