-
Notifications
You must be signed in to change notification settings - Fork 886
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Push Notifications (XEP-0357) implementation #83
Conversation
9dd9d11
to
fc295a3
Compare
|
||
@Override | ||
public CharSequence toXML() { | ||
XmlStringBuilder xml = new XmlStringBuilder(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should use new XmlStringbuilder(this)
when possible. As it makes sure that the XML is well qualified with a namespace. This is not the case in the current code since only halfOpenElement()
is used which does not add xmlns
. As extra plus also reduces the LOC count by one since halfOpenElement()
is not required.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Flowdalic fixed
fc295a3
to
be968ad
Compare
14df0b0
to
eab3ccf
Compare
Needs conflict resolution |
final XMPPConnection connection = connection(); | ||
|
||
IQ responseIQ = null; | ||
PacketCollector responseIQCollector = connection.createPacketCollector(new IQReplyFilter(iq, connection)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For IQ request/response sequences simply use
connection.createPacketCollectorAndSend(iq).nextResultOrThrow();
this combination takes care of canceling the collector in any case. Reduces the LOC by ~10 here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Flowdalic before or after connection.sendStanza(iq);
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
createPacketCollectorAndSend(IQ)
does also send the stanza (look at the method name ;))
Thus the Smack Idiom to send a request IQ and get its response is
IQ request = ...;
IQ response = connection.createPacketCollectorAndSend(request).nextResultOrThrow();
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Flowdalic awesome
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
2f02e21
to
0bbc432
Compare
f46ab9a
to
fc9b1d6
Compare
@Flowdalic Conflicts resolution done |
8cf2914
to
f1f9758
Compare
Reviewed, this appears to be ready to go after it has been squashed. Assigned SMACK-738 for it. Please mention the key somewhere in the commit message. |
d525971
to
488e962
Compare
@Flowdalic Done |
Thanks, cherry picked ase266b1acd804c428cde26fa99fac265d9811612e Note that putting the issue key in the commit title is discouraged. |
Push Notifications XEP-0357
Documentation: http://xmpp.org/extensions/xep-0357.html