-
-
Notifications
You must be signed in to change notification settings - Fork 445
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
Added support to block/unblock contacts and receive block/unblock events #423
Conversation
Not sure if it should be stored in the db, might be better to just have the methods for modifying and fetching the list and event types for incoming notifications |
i've do this because in some cases my system send messages for blocked contacts and whatsapp return 403 error, but at whatsapp app or whatsapp web you can't send messages when the contact is blocked and i think this may cause problems with whatsapp to clients that use my system (because sending messages that isn't allowed for blocked contacts at official channels).. i've implemented before i send a message (call SendMessage function) to check at the local database (GetContact function) if the contact is blocked or not and skipping sending if blocked, but thinking now, maybe this control (send or not the message) shoud be implemented inside the whatsmeow SendMessage function, to avoid the problem i mentioned before.. i will do this refactor and update this PR |
…ocked memory cache data
according your reply, removed from database the store of contact block data, create a blocked contact memory cache similar to groupParticipantsCache and validate at sendMessage function to return an error when the contact is blocked |
@tulir any news about this PR? |
tested this PR and code is working fine |
I will open a new PR with this feature |
@emacielxp if possible, enter the URL of the new PR here. I'm waiting for the merge of this feature. |
@mateusfmello here is: #460 |
Block/Unblock support
Added support to block/unblock contacts and receive block/unblock events
Changes:
Included commands to test the block/unblock feature:
-- listblocked: get the blocked list from whatsapp
-- syncblockedlist: get the blocked list from whatsapp and update local database
-- block: block contact
-- unblock: unblock contact
Included contact blocked status changed event listener
Included queries to update database contact block column
Included functions to use the above queries
Change getContact and GetAllContacts functions to return the blocked flag inside the ContactInfo data
Notes:
this feature was already tested and works fine at: