Our variable `alphabet` contains 62 alphanumeric symbols + '\0'.
When we use sizeof(alphabet) we will get 63 due to that.
But we want to choose a random numbers from the 62 alphanumeric letters only.
This mistake caused us to have strings with a max length of `length`
instead of the exact length.
When doing https://github.com/profanity-im/profanity/issues/1520
this caused our algo for muc reflection to not catch since we expect the
random ID to be exactly 15 symbols long in `message_is_sent_by_us()`.
* Generating a unique file name in tmp_dir folder
* Changed exec of vim to exec of sensible-editor
* Test file exists and create file with "private" rights
* Send a preview of the message in the window
* Delete temp file
It was a great ride!
IDs look instead of
`TE5BTDc2ZTc3YTMwZGU3MDgzMzllOTliNGExNjVmMjZkMTY1ZmUyZGEyNTUxMjVmODBkMmQzOGMxYWI2ZjAxNzdiM2Q=`
more like `7HcnNSoO1MVvb0p9a9e293152922853e910b8b1a65bb26e225a0568` now.
Regards https://github.com/profanity-im/profanity/issues/1520
We still has our identifier into it to filter MUC reflected messages.
profident maybe should be changed to be longer or be generated upon each
start.
Currently, only `chat_log_omemo_msg_out` can fail (i.e. return `NULL`
instead of a stanza id). In this case, the message is neither printed to
the chat window nor added to the log (since it wasn't sent).
If the message (key) can't be encrypted for any device, sending the
message is refused and an informative error message is presented to the
user.
Also, don't encrypt for the same device, since the OMEMO XEP disallows
this.
The function `omemo_start_session` was effectively called twice in the
`/msg` command: Once in `chatwin_new` and afterwards in `cmd_msg`. I've
removed the second call.
Two mistakes were here:
* `/autoaway time away` without a time argument segfaulted
* `/autoaway message away` without a mesage set to (null). We have
`/autoaway message off to set it off.
Also use g_strcmp0() instead of strcmp().
There was a todo for this in message.c which got forgotten.
This was most likely also the reason why there were NULL entries for
this in the DB which DebXWoody mentioned in the MUC.
Thus comparison was with NULL and no new entries were added to the
database.
Edit:
After checking pull requests I see Stefans draft PR:
https://github.com/profanity-im/profanity/pull/1505
So let's add him as co-author.
Co-authored-by: Stefan Kropp <stefan@debxwoody.de>