pub struct Jid {
pub user: String,
pub server: String,
pub agent: u8,
pub device: u16,
pub integrator: u16,
}Fields§
§user: String§server: String§agent: u8§device: u16§integrator: u16Implementations§
Source§impl Jid
impl Jid
pub fn new(user: &str, server: &str) -> Self
Sourcepub fn pn_device(user: impl Into<String>, device: u16) -> Self
pub fn pn_device(user: impl Into<String>, device: u16) -> Self
Create a phone number JID with device ID
Sourcepub fn lid_device(user: impl Into<String>, device: u16) -> Self
pub fn lid_device(user: impl Into<String>, device: u16) -> Self
Create a LID JID with device ID
Sourcepub fn user_base(&self) -> &str
pub fn user_base(&self) -> &str
Returns the user part without the device ID suffix (e.g., “123:4” -> “123”)
Sourcepub fn with_device(&self, device_id: u16) -> Self
pub fn with_device(&self, device_id: u16) -> Self
Helper to construct a specific device JID from this one
pub fn actual_agent(&self) -> u8
pub fn to_non_ad(&self) -> Self
Sourcepub fn matches_user_or_lid(&self, user: &Jid, lid: Option<&Jid>) -> bool
pub fn matches_user_or_lid(&self, user: &Jid, lid: Option<&Jid>) -> bool
Check if this JID matches the user or their LID. Useful for checking if a participant is “us” in group messages.
pub fn to_ad_string(&self) -> String
Trait Implementations§
Source§impl JidExt for Jid
impl JidExt for Jid
fn user(&self) -> &str
fn server(&self) -> &str
fn device(&self) -> u16
fn integrator(&self) -> u16
fn is_ad(&self) -> bool
fn is_interop(&self) -> bool
fn is_messenger(&self) -> bool
fn is_group(&self) -> bool
fn is_broadcast_list(&self) -> bool
fn is_status_broadcast(&self) -> bool
fn is_bot(&self) -> bool
Source§fn is_hosted(&self) -> bool
fn is_hosted(&self) -> bool
Returns true if this is a hosted/Cloud API device.
Hosted devices have device ID 99 or use @hosted/@hosted.lid server.
These devices should be excluded from group message fanout.
fn is_empty(&self) -> bool
fn is_same_user_as(&self, other: &impl JidExt) -> bool
impl Eq for Jid
impl StructuralPartialEq for Jid
Auto Trait Implementations§
impl Freeze for Jid
impl RefUnwindSafe for Jid
impl Send for Jid
impl Sync for Jid
impl Unpin for Jid
impl UnwindSafe for Jid
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.