mirror of
https://github.com/logos-messaging/libchat.git
synced 2026-03-26 22:23:14 +00:00
chore: expose isNewConvo property
This commit is contained in:
parent
95ddce9161
commit
a9d365d51d
@ -226,6 +226,7 @@ pub struct HandlePayloadResult {
|
||||
pub error_code: i32,
|
||||
pub convo_id: repr_c::String,
|
||||
pub content: repr_c::Vec<u8>,
|
||||
pub is_new_convo: bool,
|
||||
}
|
||||
|
||||
/// Free the result from handle_payload
|
||||
@ -240,6 +241,7 @@ impl From<ContentData> for HandlePayloadResult {
|
||||
error_code: ErrorCode::None as i32,
|
||||
convo_id: value.conversation_id.into(),
|
||||
content: value.data.into(),
|
||||
is_new_convo: value.is_new_convo,
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -253,6 +255,7 @@ impl From<Option<ContentData>> for HandlePayloadResult {
|
||||
error_code: ErrorCode::None as i32,
|
||||
convo_id: repr_c::String::EMPTY,
|
||||
content: repr_c::Vec::EMPTY,
|
||||
is_new_convo: false,
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -265,6 +268,7 @@ impl From<ChatError> for HandlePayloadResult {
|
||||
error_code: ErrorCode::UnknownError as i32,
|
||||
convo_id: String::EMPTY,
|
||||
content: repr_c::Vec::EMPTY,
|
||||
is_new_convo: false,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -84,6 +84,7 @@ type
|
||||
error_code*: int32
|
||||
convo_id*: ReprCString
|
||||
content*: VecUint8
|
||||
is_new_convo*: bool
|
||||
|
||||
## Result from create_new_private_convo
|
||||
## error_code is 0 on success, negative on error (see ErrorCode)
|
||||
|
||||
@ -114,6 +114,7 @@ type
|
||||
ContentResult* = object
|
||||
conversationId*: string
|
||||
data*: seq[uint8]
|
||||
isNewConvo*: bool
|
||||
|
||||
## Handle an incoming payload and decrypt content
|
||||
proc handlePayload*(ctx: LibChat, payload: seq[byte]): Result[Option[ContentResult], string] =
|
||||
@ -141,5 +142,6 @@ proc handlePayload*(ctx: LibChat, payload: seq[byte]): Result[Option[ContentResu
|
||||
|
||||
return ok(some(ContentResult(
|
||||
conversationId: $res.convo_id,
|
||||
data: content
|
||||
data: content,
|
||||
isNewConvo: res.is_new_convo
|
||||
)))
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user