Skip to content

Commit

Permalink
Store stream:features offered by the server
Browse files Browse the repository at this point in the history
  • Loading branch information
kalkin committed Feb 4, 2017
1 parent 7182c69 commit 855e6ae
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion lib/Net/XMPP.pm6
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ has $.jid-local;
has $.jid-domain;
has $.jid-resource;

has @.features = [];

method new(:$jid!, :$login, :$password, :$server, :$port = 5222, :$socket) {
self.bless(:$jid, :$login, :$password, :$server, :$port, :$socket);
}
Expand Down Expand Up @@ -96,7 +98,12 @@ method !bind {
unless $xml.root.name eq 'stream:features' {
die "confused";
}
my XML::Node:D $bind = $xml.root.nodes.grep(*.name eq 'bind').first;

for $xml.nodes { $.features.push: $_ };

unless $xml.root.nodes.grep(*.name eq 'bind') {
die "Server doesn't offer the bind stream:feature"
}
self.send-stanza(Net::XMPP::IQ.new(:type('set'),
:id(1),
:body("<bind xmlns='urn:ietf:params:xml:ns:xmpp-bind'/>")));
Expand Down

0 comments on commit 855e6ae

Please sign in to comment.