JIDs now have typed and stringy methods for node/domain/resource access
Jid now has typed with_resource and stringy with_resource_str Jid now has is_full, is_bare
This commit is contained in:
parent
199b3ae7ae
commit
4266368a98
8 changed files with 177 additions and 39 deletions
|
|
@ -180,7 +180,7 @@ impl ClientBuilder<'_> {
|
|||
|
||||
pub fn build(self) -> Agent {
|
||||
let jid: Jid = if let Some(resource) = &self.resource {
|
||||
self.jid.with_resource(resource).unwrap().into()
|
||||
self.jid.with_resource_str(resource).unwrap().into()
|
||||
} else {
|
||||
self.jid.clone().into()
|
||||
};
|
||||
|
|
@ -233,7 +233,7 @@ impl Agent {
|
|||
}
|
||||
|
||||
let nick = nick.unwrap_or_else(|| self.default_nick.read().unwrap().clone());
|
||||
let room_jid = room.with_resource(&nick).unwrap();
|
||||
let room_jid = room.with_resource_str(&nick).unwrap();
|
||||
let mut presence = Presence::new(PresenceType::None).with_to(room_jid);
|
||||
presence.add_payload(muc);
|
||||
presence.set_status(String::from(lang), String::from(status));
|
||||
|
|
@ -262,7 +262,7 @@ impl Agent {
|
|||
lang: &str,
|
||||
text: &str,
|
||||
) {
|
||||
let recipient: Jid = room.with_resource(&recipient).unwrap().into();
|
||||
let recipient: Jid = room.with_resource_str(&recipient).unwrap().into();
|
||||
let mut message = Message::new(recipient).with_payload(MucUser::new());
|
||||
message.type_ = MessageType::Chat;
|
||||
message
|
||||
|
|
|
|||
Loading…
Reference in a new issue