|
|
@@ -53,6 +53,26 @@ module.exports = function (XMPP, eventEmitter) {
|
|
53
|
53
|
this.connection.sendIQ(iq, success, error, timeout);
|
|
54
|
54
|
},
|
|
55
|
55
|
|
|
|
56
|
+ /**
|
|
|
57
|
+ * Checks if given <tt>jid</tt> has XEP-0199 ping support.
|
|
|
58
|
+ * @param jid the JID to be checked for ping support.
|
|
|
59
|
+ * @param callback function with boolean argument which will be
|
|
|
60
|
+ * <tt>true</tt> if XEP-0199 ping is supported by given <tt>jid</tt>
|
|
|
61
|
+ */
|
|
|
62
|
+ hasPingSupport: function (jid, callback) {
|
|
|
63
|
+ this.connection.disco.info(
|
|
|
64
|
+ jid, null,
|
|
|
65
|
+ function (result) {
|
|
|
66
|
+ var ping = $(result).find('>>feature[var="urn:xmpp:ping"]');
|
|
|
67
|
+ callback(ping.length > 0);
|
|
|
68
|
+ },
|
|
|
69
|
+ function (error) {
|
|
|
70
|
+ console.error("Ping feature discovery error", error);
|
|
|
71
|
+ callback(false);
|
|
|
72
|
+ }
|
|
|
73
|
+ );
|
|
|
74
|
+ },
|
|
|
75
|
+
|
|
56
|
76
|
/**
|
|
57
|
77
|
* Starts to send ping in given interval to specified remote JID.
|
|
58
|
78
|
* This plugin supports only one such task and <tt>stopInterval</tt>
|