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

Add ability to disable avatar publishing #1843

Merged
merged 1 commit into from May 3, 2023
Merged

Add ability to disable avatar publishing #1843

merged 1 commit into from May 3, 2023

Conversation

ike08
Copy link
Contributor

@ike08 ike08 commented May 2, 2023

Add "/avatar disable" to comply with point "3.5 Publisher Disables Avatar Publishing" in XEP-0084.

src/command/cmd_defs.c:2416
Add "disable" argument. Reword the "/avatar" command description so it flows better.

src/command/cmd_ac.c:1101
Add "disable" to the "/avatar" autocomplete dictionary.

src/command/cmd_funcs.c:9277
Split "/avatar" commands into two groups with an if statement; those with a parameter and those without. "cons_bad_cmd_usage()" is in both groups, which is messy. "disable" has similar logic to "set", but it includes a failure message.

src/xmpp/avatar.c:152
"avatar_publishing_disable()" uses the same logic to publish metadata as in "avatar_set()".

src/xmpp/avatar.c:238
Add a message to inform users when they do not receive an avatar after using "/avatar get" and "/avatar open". In case of a failure, the user will be subscribed to future avatar updates as long as they continue to use their current instance of profanity. Adding "caps_remove_feature()" after "cons_show()" will unsubscribe the user from avatar updates and prevent the user from downloading an avatar unexpectedly hours later without issuing an "/avatar" command.

src/xmpp/stanza.c:2698
The new "disable" function follows the same logic as "stanza_create_avatar_metadata_publish_iq()".

How to test the functionality

  • Use "/avatar set" to upload an avatar.
  • Use "/avatar get" on a second Profanity instance using another JID. The avatar should download.
  • Use "/avatar disable" on the first Profanity instance. A disabled message should appear.
  • Use "/avatar get" again on the second instance. A failure message should appear.
  • Use "/avatar set" again on the first instance. The avatar should automatically download on the second instance.

I ran valgrind when using my new feature

Yes

@jubalh jubalh self-requested a review May 2, 2023 19:25
@jubalh jubalh self-assigned this May 2, 2023
@jubalh jubalh added the feature label May 2, 2023
@jubalh jubalh added this to the next milestone May 2, 2023
src/xmpp/avatar.c Outdated Show resolved Hide resolved
@jubalh
Copy link
Member

jubalh commented May 2, 2023

Cool! Thank you!
I did a quick review and it looks good, but will do another one tomorrow (?).

Add "/avatar disable" to comply with point "3.5 Publisher Disables
Avatar Publishing" in XEP-0084.

src/command/cmd_defs.c:2416
Add "disable" argument. Reword the "/avatar" command description
so it flows better.

src/command/cmd_ac.c:1101
Add "disable" to the "/avatar" autocomplete dictionary.

src/command/cmd_funcs.c:9277
Split "/avatar" commands into two groups with an if statement; those
with a parameter and those without. "cons_bad_cmd_usage()" is in both
groups, which is messy. "disable" has similar logic to "set", but it
includes a failure message.

src/xmpp/avatar.c:152
"avatar_publishing_disable()" uses the same logic to publish metadata
as in "avatar_set()".

src/xmpp/avatar.c:238
Add a message to inform users when they do not receive an avatar after
using "/avatar get" and "/avatar open". In case of a failure, the user
will be subscribed to future avatar updates as long as they continue
to use their current instance of profanity. Adding
"caps_remove_feature()" after "cons_show()" will unsubscribe the user
from avatar updates and prevent the user from downloading an avatar
unexpectedly hours later without issuing an "/avatar" command.

src/xmpp/stanza.c:2698
The new "disable" function follows the same logic as
"stanza_create_avatar_metadata_publish_iq()".
@jubalh jubalh self-requested a review May 3, 2023 11:32
@jubalh jubalh merged commit faccf24 into profanity-im:master May 3, 2023
6 checks passed
@jubalh
Copy link
Member

jubalh commented May 3, 2023

Thanks for your contribution!

@jubalh jubalh assigned ike08 and unassigned jubalh May 3, 2023
jubalh added a commit that referenced this pull request Jul 3, 2023
Downloading of avatars was added in
#1240
by me for 0.8.0.

Publishing avatars was added in
#1714
by @MarcoPolo-PasTonMolo for 0.13.0.

Disabling to publish avatar was added in
#1843
by ike08 for the next version.

A later improvement was done in
#1845
by me for the next version.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants