mirror of
https://github.com/chatmail/core.git
synced 2026-05-12 11:26:29 +03:00
Add get_marker method to dc_array_t
This commit is contained in:
committed by
link2xt
parent
615a76f35e
commit
56518420bc
@@ -39,6 +39,17 @@ impl dc_array_t {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub(crate) fn get_marker(&self, index: usize) -> Option<&str> {
|
||||||
|
match self {
|
||||||
|
Self::MsgIds(_) => None,
|
||||||
|
Self::Chat(array) => None,
|
||||||
|
Self::Locations(array) => array
|
||||||
|
.get(index)
|
||||||
|
.and_then(|location| location.marker.as_deref()),
|
||||||
|
Self::Uint(_) => None,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
pub(crate) fn get_location(&self, index: usize) -> &Location {
|
pub(crate) fn get_location(&self, index: usize) -> &Location {
|
||||||
if let Self::Locations(array) = self {
|
if let Self::Locations(array) = self {
|
||||||
&array[index]
|
&array[index]
|
||||||
|
|||||||
@@ -2068,7 +2068,7 @@ pub unsafe extern "C" fn dc_array_get_marker(
|
|||||||
return std::ptr::null_mut(); // NULL explicitly defined as "no markers"
|
return std::ptr::null_mut(); // NULL explicitly defined as "no markers"
|
||||||
}
|
}
|
||||||
|
|
||||||
if let Some(s) = &(*array).get_location(index).marker {
|
if let Some(s) = (*array).get_marker(index) {
|
||||||
s.strdup()
|
s.strdup()
|
||||||
} else {
|
} else {
|
||||||
std::ptr::null_mut()
|
std::ptr::null_mut()
|
||||||
|
|||||||
Reference in New Issue
Block a user