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