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

WIP: send error if someone wasn't added to admin group correctly. #99

Closed
wants to merge 5 commits into from

Conversation

missytake
Copy link
Contributor

closes #68
supercedes #95

@missytake missytake requested a review from hpk42 January 20, 2023 22:09
Base automatically changed from missytake/refactor-incoming-messages to master January 29, 2023 15:47
src/mailadm/bot.py Outdated Show resolved Hide resolved
sender = message.get_sender_contact().addr
logging.warning("The bot doesn't trust %s, please re-add them to admin group" %
(sender,))
message.chat.send_text("I didn't see %s being added to this group - can someone who"
Copy link
Contributor

Choose a reason for hiding this comment

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

Does this really work? I guess in this case you will not be able to send the message, because the group is protected and you don't have a verified key for one of the members.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

True. I'll think of something.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I decided to create a new unverified group to tell the admin group members that the admin group is broken.

I also mitigated one corner case in which this can lead to an AttributeError (if someone in the group quote-replies to the group creation message, because then the bot thinks it's a support group).

I don't like this solution very much; it basically adds one more chat type which the bot needs to handle, thereby further increasing complexity. Maybe just leaving the recovery group directly after creating it would be better, what do you think?

@@ -62,7 +62,15 @@ def ac_incoming_message(self, message: deltachat.Message):
logging.debug("ignoring message, it's just admins discussing in a support group")
else:
chat = message.create_chat()
if chat.is_group():
if chat.is_protected() and not message.is_encrypted():
Copy link
Contributor

Choose a reason for hiding this comment

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

This can mean any of:

  • The message was not encrypted, probably sent with a classic MUA
  • The message was signed with a different key, probably because we verified the contact earlier, then the contact changed the key. It could be that nobody verified the contact yet. We can still write into the group.
  • The contact is not a member of the group. We cannot write to the group and need a recovery group.

@missytake missytake changed the title send error if someone wasn't added to admin group correctly. WIP: send error if someone wasn't added to admin group correctly. Feb 3, 2023
@missytake
Copy link
Contributor Author

Closing as stale.

@missytake missytake closed this Mar 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ValueError if someone writes to admin group without being part of the admin group from the bot's perspective
2 participants