Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion advanced/binary-protocol.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ let mut builder = NodeBuilder::new("receipt")
.attr("id", &info.id)
.jid_attr("to", info.source.chat.clone());

if info.category == "peer" {
if info.category == MessageCategory::Peer {
builder = builder.attr("type", "peer_msg");
}

Expand Down
25 changes: 23 additions & 2 deletions api/newsletter.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -379,8 +379,8 @@ pub struct NewsletterMessage {
pub server_id: u64,
/// Message timestamp (Unix seconds).
pub timestamp: u64,
/// Message type ("text", "media", etc.).
pub message_type: String,
/// Message type (Text, Media, Reaction, etc.).
pub message_type: NewsletterMessageType,
/// Whether the viewer is the sender.
pub is_sender: bool,
/// Decoded protobuf message (from plaintext bytes).
Expand All @@ -390,6 +390,27 @@ pub struct NewsletterMessage {
}
```

### NewsletterMessageType

The type of a newsletter message. Uses a `StringEnum` for type-safe wire-protocol mapping.

```rust
pub enum NewsletterMessageType {
Text, // "text"
Media, // "media"
Reaction, // "reaction"
Revoke, // "revoke"
PollCreation, // "poll_creation"
PollVote, // "poll_vote"
Edit, // "edit"
Other(String), // Unknown/future types
}
```

**Methods:**
- `as_str()` - Returns the wire-protocol string representation
- `From<&str>` - Parse from wire string, unknown values become `Other(String)`

### NewsletterReactionCount

A reaction count on a newsletter message.
Expand Down
2 changes: 1 addition & 1 deletion api/receipt.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ let mut builder = NodeBuilder::new("receipt")
.attr("id", &info.id)
.jid_attr("to", info.source.chat.clone());

if info.category == "peer" {
if info.category == MessageCategory::Peer {
builder = builder.attr("type", "peer_msg");
}

Expand Down