bepaald / signalbackup-tools

Tool to work with Signal Backup files.
GNU General Public License v3.0
790 stars 38 forks source link

Allow --croptothreads and --importthreads to match thread titles as alternative to IDs #109

Closed Meteor0id closed 1 year ago

Meteor0id commented 1 year ago

Try to match thread names (or phone number) as alternative to thread ID. Obviously this could fail if there are multiple treads with the same name, but that's ok, just throw a warning "failed to match thread xyz, try matching by phone number or thread id"

bepaald commented 1 year ago

Yeah, sure, this sounds ok. But it may be a little while before I get around to it.

bepaald commented 1 year ago

I think this is done.

It is enabled for --croptothreads and --importthreads. But also for the --limittothreads option (that can modify various export functions). Names can appear in the list mixed with (ranges of) numbers, e.g.: --importthreads 1,3-5,"Bobby Whatshisface",10-25,"Alice".

It has one small negative side effect: since any string of characters can now refer to an existing thread (not just numbers and ranges), the program will only come up with an error after opening the database and determining the named thread does not exist. Also, the parameter list is now (or can be) ambiguous: multiple contacts can have the same name (this causes failure) and contacts can have simple numeric names (which is always interpreted as thread._id as it used to).

Meteor0id commented 1 year ago

You could of course add '--croptothreadbynane' to solve the numeric name issue. And when multiple contacts have the same name throw a warning and continue to export both. The warning can include a list of threads and their numbers.

bepaald commented 1 year ago

Yes, I think I might do that instead. Should be a small thing to implement now, probably tomorrow or this weekend.

bepaald commented 1 year ago

It was such a small change, I did it quickly just now. All the options mentioned above have a --[option]byname counterpart.