Check that the received roster is from our own account.
This commit is contained in:
parent
c69140b05e
commit
88041550b9
1 changed files with 4 additions and 1 deletions
|
@ -183,6 +183,7 @@ impl ClientBuilder<'_> {
|
|||
sender_tx.unbounded_send(packet)
|
||||
.unwrap();
|
||||
events.push(Event::Online);
|
||||
// TODO: only send this when the ContactList feature is enabled.
|
||||
let iq = Iq::from_get("roster", Roster { ver: None, items: vec![] })
|
||||
.into();
|
||||
sender_tx.unbounded_send(Packet::Stanza(iq)).unwrap();
|
||||
|
@ -214,7 +215,9 @@ impl ClientBuilder<'_> {
|
|||
send_error(iq.from.unwrap(), iq.id, ErrorType::Cancel, DefinedCondition::ServiceUnavailable, "No handler defined for this kind of iq.");
|
||||
}
|
||||
} else if let IqType::Result(Some(payload)) = iq.payload {
|
||||
if payload.is("query", ns::ROSTER) {
|
||||
// TODO: move private iqs like this one somewhere else, for
|
||||
// security reasons.
|
||||
if payload.is("query", ns::ROSTER) && iq.from.is_none() {
|
||||
let roster = Roster::try_from(payload).unwrap();
|
||||
for item in roster.items.into_iter() {
|
||||
events.push(Event::ContactAdded(item));
|
||||
|
|
Loading…
Reference in a new issue