-
-
Notifications
You must be signed in to change notification settings - Fork 2
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
Changes from 2 commits
13f3a9e
77f1ffa
bb737ce
e8aad41
3b4a2e1
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -62,7 +62,13 @@ 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(): | ||
sender = message.get_sender_contact().addr | ||
logging.warning("The bot doesn't trust %s, please re-add them to admin group" % | ||
missytake marked this conversation as resolved.
Show resolved
Hide resolved
|
||
(sender,)) | ||
message.chat.send_text("I didn't see %s being added to this group - can someone who" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. True. I'll think of something. There was a problem hiding this comment. Choose a reason for hiding this commentThe 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? |
||
" verified them re-add them?" % (sender,)) | ||
elif chat.is_group(): | ||
logging.info("%s added me to a group, I'm leaving it.", | ||
message.get_sender_contact().addr) | ||
chat.send_text("Sorry, you can not contact me in groups. Please use a 1:1 chat.") | ||
|
@@ -116,6 +122,9 @@ def is_admin_group_message(self, command: deltachat.Message): | |
else: | ||
logging.info("%s is not allowed to give commands to mailadm.", | ||
command.get_sender_contact()) | ||
elif command.chat.is_protected() and not command.is_encrypted(): | ||
# warning is handled in ac_incoming_message | ||
return False | ||
else: | ||
logging.info("The admin group is broken. Try `mailadm setup-bot`. Group ID: %s", | ||
str(self.admingrpid)) | ||
|
There was a problem hiding this comment.
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: