1
0
mirror of https://github.com/profanity-im/profanity.git synced 2024-10-27 20:30:13 -04:00
Commit Graph

6582 Commits

Author SHA1 Message Date
Michael Vetter
8e588d6764 Fix random string generation
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()`.
2021-04-17 22:37:21 +02:00
Stefan
3ba38eafa8
OMEMO - trust mode (#1506)
Add OMEMO trust mode capabilities.

* ToFu / first usage
* blind trust
* manual
2021-04-17 13:28:54 +02:00
Michael Vetter
c79979401b sponsors: mention new sponsor James Pond 2021-04-16 23:25:21 +02:00
Michael Vetter
d566f3cae1 readme: remove extra mention regarding ml
Already mentioned in SPONSORS.md.
2021-04-16 23:22:42 +02:00
Michael Vetter
19c5925c37 editor: make editor configurable via /executable
`/executable set editor /full/path/to/edit`.

Regards https://github.com/profanity-im/profanity/issues/1521
2021-04-16 23:18:19 +02:00
Michael Vetter
1f4f912e78 editor: adapt help description 2021-04-16 23:04:13 +02:00
Michael Vetter
db2205d30c editor: Save temp files as .md
Probably many people render text in their head to markdown
automatically.
2021-04-16 22:18:01 +02:00
Michael Vetter
2f4289bb3e
Merge pull request #1485 from StefanKropp/feature/editor-command
Add basic functionality to launch external editor

Regards https://github.com/profanity-im/profanity/issues/1521
2021-04-16 19:27:07 +02:00
Michael Vetter
e1249d9bbb Editor: improve error messages 2021-04-16 19:14:40 +02:00
Michael Vetter
8be46422d2 editor: Use g_strdup_printf() instead of g_string_new() 2021-04-16 18:06:30 +02:00
Michael Vetter
880ce20018 Run clang-format on new editor code 2021-04-16 18:04:03 +02:00
Stefan
f5e1f9fa63 Editor: Fix redisplay 2021-04-16 18:04:03 +02:00
Stefan
ce508a826a Editor: Use _exit() instead of exit() 2021-04-16 18:04:03 +02:00
Stefan
9f32b2afb2 Editor: Using preferences compose.editor
compose.editor is the path to the executable ( default /usr/bin/vim )
2021-04-16 18:04:03 +02:00
Stefan
35b0b0f194 Editor command: filename / sensible-editor
* 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
2021-04-16 18:04:03 +02:00
Stefan
8be8f75b87 Add new editor command
Goal is to launch an external editor (eg vim) to edit the text there.
2021-04-16 18:03:58 +02:00
Michael Vetter
791b13cb9a Mention clipboard in version output 2021-04-16 13:17:04 +02:00
Michael Vetter
8c50b63e56 Goodbye beautiful IDs
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.
2021-04-14 22:47:58 +02:00
Michael Vetter
558d672733
Merge pull request #1515 from mwuttke97/fix_omemo_empty_devlist
[OMEMO] Fix sending messages
2021-04-08 10:20:42 +02:00
Maximilian Wuttke
025c2fb1e0 Msg sending: don't write to chatwin nor to log if sending failed
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).
2021-04-08 00:30:03 +02:00
Maximilian Wuttke
e8664e2730 OMEMO: Fail if message keys couldn't be encrypted for any recipient device
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.
2021-04-08 00:29:58 +02:00
Maximilian Wuttke
9e0d0ed466 OMEMO: Remove duplicate session initalisation
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.
2021-04-08 00:23:07 +02:00
Michael Vetter
1ec606540e Get rid of asprintf and _GNU_SOURCE define
_GNU_SOURCE was even in some files where it was not needed at all
(http*).

Let's replace asprintf() with g_strdup_printf().
2021-03-30 17:38:13 +02:00
Michael Vetter
3c1e4bac3a Fix segfault in cmd_autoaway()
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().
2021-03-29 10:48:42 +02:00
Michael Vetter
a09d49d884
Merge pull request #1514 from profanity-im/fix/1512-rpi
Include config.h in omemo files
2021-03-26 20:07:18 +01:00
Michael Vetter
057c9ad776 Add config.h in files were it was missing
Related to https://github.com/profanity-im/profanity/issues/1512
2021-03-26 19:54:22 +01:00
Michael Vetter
eaf76555bd Include config.h in omemo files
So that off_t is defined in all files (so far http_upload.c and
http_download.c too) the same way.

Fix https://github.com/profanity-im/profanity/issues/1512

Thanks @pasis for finding the solution!
2021-03-26 19:54:04 +01:00
Michael Vetter
acda845b2a iq: use define for 'cancel' 2021-03-26 10:05:24 +01:00
Michael Vetter
3884a4d35b message: parse stanzaid in MUC case
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>
2021-03-25 17:09:52 +01:00
Michael Vetter
c72351375d
Merge pull request #1513 from profanity-im/fix-possible-segfault1
Fix potential problems caused by unexpected stanzas
2021-03-25 17:04:22 +01:00
Michael Vetter
a1a37cf9bf ox: fix memleak in ox_announce_public_key 2021-03-25 17:02:59 +01:00
Michael Vetter
8df5e99981 message: make _handle_error safer 2021-03-25 16:50:10 +01:00
Michael Vetter
3a6bce5a09 event: make log_database_get_previous_chat safer 2021-03-25 16:47:35 +01:00
Michael Vetter
901f9d3d8c database: make log_database_get_previous_chat safer 2021-03-25 16:46:18 +01:00
Michael Vetter
e93d4ff331 database: simplify _log_database_add_outgoing 2021-03-25 16:45:30 +01:00
Michael Vetter
c0e339130e database: simplify log_database_add_incoming 2021-03-25 16:44:36 +01:00
Michael Vetter
e09f3fb615 avatar: make _avatar_request_item_result_handler safer 2021-03-25 16:35:43 +01:00
Michael Vetter
44343a5c37 avatar: make _avatar_metadata_handler safer 2021-03-25 16:34:20 +01:00
Michael Vetter
b584a1ecd0 ox: make _ox_public_key_result safer 2021-03-25 16:30:19 +01:00
Michael Vetter
10df93ee3e ox: guard printing of fingerprint 2021-03-25 16:25:18 +01:00
Michael Vetter
fb81b80499 ox: improve error log in _ox_metadata_result 2021-03-25 16:24:07 +01:00
Michael Vetter
31a78e2629 ox: add logging prefix 2021-03-25 16:22:47 +01:00
Michael Vetter
f81ed759f5 stanza: guard mallocs
If this happens we have more serious problems :-)
But anyways..
2021-03-25 16:14:40 +01:00
Michael Vetter
d23c3dd065 stanza: simplify stanza_get_muc_destroy_alternative_room 2021-03-25 15:59:48 +01:00
Michael Vetter
caa2c7afd0 stanza: replae strcmp with g_strcmp0
since its NULL safe
2021-03-25 15:55:18 +01:00
Michael Vetter
1f96e14ce7 message: simplify _handle_headline 2021-03-25 15:43:57 +01:00
Michael Vetter
b2a02424ed message: make _receipt_request_handler safer 2021-03-25 15:38:48 +01:00
Michael Vetter
099260a4e3 message: make _handle_receipt_received safer 2021-03-25 15:37:54 +01:00
Michael Vetter
2236242407 message: make _handle_groupchat safer 2021-03-25 15:36:17 +01:00
Michael Vetter
ca9c946ddc message: simplify _handle_conference 2021-03-25 15:33:30 +01:00