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>
`/affiliation register` can now be used to register a nickname with a
MUC.
Tested with a server without forms. Couldn't find a server which
supports forms yet.
Implements https://github.com/profanity-im/profanity/issues/1210
Through asprintf() we can get rid of malloc() + sprintf().
Also we don't need to calculate the strlen() again since asprintf()
returns the bytes printes.
Only non UTF-8 characters. But that was true before already.
Main changes:
1. Attributes instead of tags
2. Read the optional <header> tags and send them in the HTTP PUT header:
* Authorization
* Cookie
* Expires
Co-authored-by: Martin Dosch <martin@mdosch.de>
Use the following options in `omemo_bundle_publish()`:
- "pubsub#persist_items" = "true"
- "pubsub#access_model" = "open"
The same options are also used in Gajim.
I've tested this on two different servers. The bundle was successfully
added as a new PEP node. Test cases:
1. Normal use on my main account
2. Log in into a fresh tesst account on a different server
3. `/omemo clear_device_list`. In this case, the client(s) may have to
be restarted.
Note: In `_omemo_bundle_publish_result`, there's a route that is taken
when the bundle publish stanza failed. In this case, the node is
configured manually, i.e. the access_model is set to 'open'. I have
manually tested this case, but this case didn't naturally occur for me.
Note: The option "pubsub#max_items=max" is REQUIRED for the bundle
publication, as per XEP-0384. However, this is not done in other clients
(I've checked the source code of Gajim and Conversations), and it is
also not supported by Prosody. Cf. <https://github.com/xsf/xeps/pull/988>.
Regards https://github.com/profanity-im/profanity/issues/1488
Actually I would have loved to see the stanza that caused the segfault
since I'm not entirely sure whether this actually means that we do
something wrong earlier on.
Right now I don't know why the to_jid should be empty.
Let's prevent the segfault for now and see whether we get further
bugreports later.
Segfaulting issue got introduced with dd566d8d56.
On every write to `chatlog.db` syslog throws
```
profanity: vfprintf %s NULL in "INSERT INTO `ChatLogs` (`from_jid`,
`from_resource`, `to_jid`, `to_resource`, `message`, `timestamp`,
`stanza_id`, `archive_id`, `replace_id`, `type`, `encryption`) SELECT
'%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s' WHERE
NOT EXISTS (SELECT 1 FROM `ChatLogs` WHERE `archive_id` = '%s')"
```
in `/var/log/messages`. Checking for `NULL` except in the fields the DB
is expected to throw errors for, satisfies OpenBSDs security measures
Error log:
GLib-CRITICAL - g_string_insert_len: assertion 'len == 0 || val != NULL' failed
Check if a room name exists, before adding the name into the title bar.
Some functions changed in the meantime.
stanza_get_child_by_name_and_ns() got dropped and
xmpp_stanza_get_child_by_name_and_ns() from newer libstrophe is used.
It was added in f7fe87dd4e when I rewrote
window functions to include more infos (not just char* but whole jid
struct I think).
The same todo was added to win_print_outgoing_muc() but removed in
f3d9de133e.
This TODO should have been removed in
f3d9de133e since there we added the myjid
parameter.
Discovered by @aba-hollerer.
Mistake was introduced in b6b7dd5ad4
probably due to a wrong copy/paste.
First wasn't reproducible because I had `/receipts request on` and thus
win_print_outgoing_receipts() is used which has the correct
THEME_TEXT_ME.
Fixes https://github.com/profanity-im/profanity/issues/1441
`profanity -f my` created ~/.local/share/profanity/logs/my.log`.
It would be nicer if one could define the actual path, so one can choose
another directory or even use /dev/null.
Fixes https://github.com/profanity-im/profanity/issues/1442
00dbc1ba7c attempted to fix
https://github.com/profanity-im/profanity/issues/1449.
Here we revert the part about initializing is_omemo in chatwin_new()
since this is done in win_create_chat() already.
The actual mistake was the wrong cast of the muc window which is fixed
by the same commit. The mistake was introduced in in 3370418d71.
While being at it we also remove the is_ox initialization since this is
handled in win_create_chat()/win_create_muc() too.