Add group management IQs and participant types - #268
Conversation
📝 WalkthroughWalkthroughThis PR introduces comprehensive group management APIs with eight new operations, adds IQ specifications for participant management and metadata updates, enables downloads from raw parameters, and implements message read receipts. Additionally, it refactors logging invocations across handlers and client code to remove explicit target specifications, and updates the message-processing flow to handle critical nodes inline. Changes
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Implement multiple group management IqSpecs and helpers: SetGroupSubject, SetGroupDescription, LeaveGroup, Add/Remove/Promote/DemoteParticipants, GetGroupInviteLink and ParticipantChangeResponse with parsing/builders. Add DownloadParams in download.rs implementing Downloadable for raw media parameters. Simplify logging calls by removing explicit target="Client" arguments. Re-export Jid from crate root, update imports, and expose new group types in features mod
43ec4d1 to
a92a0b8
Compare
There was a problem hiding this comment.
Pull request overview
This pull request implements comprehensive group management functionality for WhatsApp, including operations to modify group settings, manage participants, and handle group invitations. It also adds the ability to download media from raw parameters and simplifies logging by removing redundant explicit target specifications.
Changes:
- Implemented 7 new IQ specifications for group management: SetGroupSubject, SetGroupDescription, LeaveGroup, Add/Remove/Promote/DemoteParticipants, and GetGroupInviteLink
- Added ParticipantChangeResponse type with ProtocolNode implementation for parsing participant operation responses
- Introduced DownloadParams struct to enable downloading media from raw parameters without requiring the original message
- Simplified logging calls by removing explicit
target="Client"arguments throughout the codebase while preserving specific context targets - Added mark_as_read method to Client for sending read receipts
- Exposed Jid and new group types (GroupSubject, GroupDescription, ParticipantChangeResponse) in public API
Reviewed changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| wacore/src/iq/groups.rs | Core implementation of 7 new group management IQ specs with ParticipantChangeResponse type and comprehensive test coverage |
| src/features/groups.rs | Public API methods for group management operations (set_subject, set_description, leave, add/remove/promote/demote participants, get_invite_link) |
| src/download.rs | Added DownloadParams struct and download_from_params method for downloading media from raw parameters |
| src/receipt.rs | Implemented mark_as_read method for sending read receipts with batch support |
| src/handshake.rs | Simplified logging by removing explicit target="Client" |
| src/handlers/notification.rs | Simplified logging and removed redundant comment |
| src/handlers/iq.rs | Simplified logging |
| src/handlers/ib.rs | Simplified logging |
| src/client.rs | Simplified logging throughout the file |
| src/lib.rs | Re-exported Jid and new group types from crate root |
| src/features/mod.rs | Updated exports to include GroupSubject, GroupDescription, and ParticipantChangeResponse |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
In `@src/features/groups.rs`:
- Around line 156-232: The mutating group methods (set_subject, set_description,
leave, add_participants, remove_participants, promote_participants,
demote_participants, and get_invite_link when reset=true) must acquire the
per-chat lock from Client::chat_locks before calling client.execute to avoid
races; update each method to obtain the per-chat lock for the target jid (using
the same locking API/pattern already used elsewhere in the codebase) and hold
that guard while calling the corresponding IQ executor (e.g.,
SetGroupSubjectIq::new, SetGroupDescriptionIq::new, LeaveGroupIq::new,
AddParticipantsIq::new, RemoveParticipantsIq::new, PromoteParticipantsIq::new,
DemoteParticipantsIq::new, GetGroupInviteLinkIq::new) so the execute calls are
serialized per-chat.
Implement multiple group management IqSpecs and helpers: SetGroupSubject,
SetGroupDescription, LeaveGroup, Add/Remove/Promote/DemoteParticipants, GetGroupInviteLink and ParticipantChangeResponse with parsing/builders.
Add DownloadParams in download.rs implementing Downloadable for raw media parameters.
Simplify logging calls by removing explicit target="Client" arguments.
Re-export Jid from crate root, update imports, and expose new group types
in features mod
Summary by CodeRabbit
Release Notes
New Features