Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extend /pgp command to make key exchange procedure easier #1850

Merged
merged 4 commits into from
Jul 3, 2023

Conversation

H3rnand3zzz
Copy link
Contributor

See commit messages

@H3rnand3zzz H3rnand3zzz changed the title Improve PGP Extend /pgp command to make key exchange procedure easier May 13, 2023
@jubalh
Copy link
Member

jubalh commented May 15, 2023

Hi! Didn't have time to review yet, only skimmed it. But I would suggest (for the future if you don't want to do it for this PR) to split the commits.
I think this should actually be two or three commits :)

The reason is that it makes it easier to revert commits. Let's say for some (imagined) reason we would like to remove the pgp exchange procedure. Then we could just do git revert xxx. But if all three changes are in one commit we would also loose the typo fixes and the improvements not directly related to the exchange procedure. So that means we would have to revert by hand.

So it's good practise to have such things in individual commits. Even when it's unlikely that a revert will happen :)

@H3rnand3zzz H3rnand3zzz marked this pull request as ready for review May 16, 2023 00:46
@jubalh jubalh added this to the next milestone May 16, 2023
@jubalh jubalh requested review from jubalh and sjaeckel May 16, 2023 05:57
src/command/cmd_ac.c Outdated Show resolved Hide resolved
@jubalh
Copy link
Member

jubalh commented May 29, 2023

@sjaeckel ping

src/command/cmd_funcs.c Outdated Show resolved Hide resolved
src/pgp/gpg.c Outdated Show resolved Hide resolved
@jubalh
Copy link
Member

jubalh commented Jun 29, 2023

@sjaeckel I'm uncertain if you plan to review again :)
Otherwise I would merge.

Copy link
Member

@sjaeckel sjaeckel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like the refactor of _cmd_set_boolean_preference() 👍

Would it maybe make sense to have a /pgp import command which lets you select one of the last messages in a private chat and then tries to import that? ... in case a user doesn't want to auto-import all public keys. But that'd be for another PR I guess.

src/command/cmd_funcs.c Outdated Show resolved Hide resolved
src/command/cmd_funcs.c Outdated Show resolved Hide resolved
src/pgp/gpg.c Outdated Show resolved Hide resolved
src/pgp/gpg.c Outdated Show resolved Hide resolved
@H3rnand3zzz H3rnand3zzz force-pushed the feature/pgp-improved branch 2 times, most recently from 19b0e37 to 507936a Compare June 30, 2023 13:09
@H3rnand3zzz
Copy link
Contributor Author

@jubalh review suggestions are applied. After almost 2 month in waiting, maybe it's time to merge?

@jubalh jubalh self-requested a review July 2, 2023 07:28
Copy link
Member

@jubalh jubalh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for your patience!

So far I only looked at the code but now realize there could be a change in the commit messages as well.

In the first commit (Add /pgp sendpub command ) I'm missing a description what the command will do/why it is useful. And also with which other clients it is compatible (if it applies and you are aware of this info. I think you said it works with PSI).

Same for Add optional pgp public key autoimport.

I think it deserves a short description of what it will do/why its wanted.

After this I think good to go. Sorry again for the long waiting time!

Copy link
Member

@sjaeckel sjaeckel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry for the next bunch of change requests, but this PR is so huge, it's not easy to review. Also there are two sets of independent changes in there, which makes it even harder. That's really where the PR focused review approach falls short. If this were a commit based review approach it'd be cleaner, but it is as it is and therefore 🤷

Still I suggest to rebase on top of master and re-order the commits. Put "Refactor _cmd_set_boolean_preference function" as the first commit and create a separate branch & PR for that single commit, which can then be quickly merged, so the "real changes" of this feature become visible.

@@ -381,6 +375,7 @@ p_gpg_list_keys(void)

gpgme_release(ctx);

// TODO: move autocomplete in other place
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why? Where?

Copy link
Contributor Author

@H3rnand3zzz H3rnand3zzz Jul 2, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It might be considered unintended functionality, the function is a bit too bloated. It's more a design question and I left it for anyone who want to clean up the code even more in the future.

src/pgp/gpg.c Outdated Show resolved Hide resolved
src/pgp/gpg.c Outdated Show resolved Hide resolved
src/pgp/gpg.c Outdated Show resolved Hide resolved
src/command/cmd_funcs.c Outdated Show resolved Hide resolved
@sjaeckel
Copy link
Member

sjaeckel commented Jul 2, 2023

Still I suggest to rebase on top of master and re-order the commits. Put "Refactor _cmd_set_boolean_preference function" as the first commit and create a separate branch & PR for that single commit, which can then be quickly merged, so the "real changes" of this feature become visible.

If you open a separate PR for those unrelated changes, maybe also include Cleanup char* to auto_gchar gchar* for prefs_get_string and Fix memory leak and cleanup of #1857

@H3rnand3zzz H3rnand3zzz force-pushed the feature/pgp-improved branch 2 times, most recently from 150bb8d to a0e0bde Compare July 2, 2023 12:21
Command allows to share your PGP pub key with ease,
it's not described in XEP-0027, but used in some clients,
such as PSI, Pidgin.
Fix typos
Minor improvements
Improve documentation
Update code formatting and indentation for better readability
Show state if no argument provided
Show if argument wasn't changed
Reduce amount of arguments
Refactor `p_gpg_list_keys`
Add `/pgp autoimport` command,
it's not described in XEP-0027, but used in some clients,
such as PSI, Pidgin. It will autoimport keys received with
`/pgp sendpub`, in plain text as a message, or using features,
provided in other clients. It doesn't autoassign them, but shows
command to assign, letting user to decide.
Improve documentation for some preexisting functions
Add contact argument to `/pgp sendpub`
Use `_cmd_ac_complete_params` when fits, thus reducing plurality
Copy link
Member

@jubalh jubalh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's great descriptive commit messages now! Thanks :)

@jubalh jubalh merged commit f67d548 into profanity-im:master Jul 3, 2023
6 checks passed
@jubalh
Copy link
Member

jubalh commented Jul 3, 2023

Thanks for your contribution!

@H3rnand3zzz
Copy link
Contributor Author

Thank you for reviews

@H3rnand3zzz H3rnand3zzz deleted the feature/pgp-improved branch August 22, 2023 11:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants