Skip to content

Commit b16d527

Browse files
committed
only avoid logging if request was processed once
1 parent df65231 commit b16d527

1 file changed

Lines changed: 15 additions & 8 deletions

File tree

register/strophe.register.js

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -57,18 +57,25 @@ Strophe.addConnectionPlugin('register', {
5757
var connect_cb = conn._connect_cb.bind(conn);
5858
conn._connect_cb = function (req, callback, raw) {
5959
if (!self._registering) {
60-
// exchange Input hooks to not print the stream:features twice
61-
var xmlInput = conn.xmlInput;
62-
conn.xmlInput = Strophe.Connection.prototype.xmlInput;
63-
var rawInput = conn.rawInput;
64-
conn.rawInput = Strophe.Connection.prototype.rawInput;
65-
connect_cb(req, callback, raw);
66-
conn.xmlInput = xmlInput;
67-
conn.rawInput = rawInput;
60+
if (self.processed_features) {
61+
// exchange Input hooks to not print the stream:features twice
62+
var xmlInput = conn.xmlInput;
63+
conn.xmlInput = Strophe.Connection.prototype.xmlInput;
64+
var rawInput = conn.rawInput;
65+
conn.rawInput = Strophe.Connection.prototype.rawInput;
66+
connect_cb(req, callback, raw);
67+
conn.xmlInput = xmlInput;
68+
conn.rawInput = rawInput;
69+
delete self.processed_features;
70+
} else {
71+
connect_cb(req, callback, raw);
72+
}
6873
} else {
6974
// Save this request in case we want to authenticate later
7075
self._connect_cb_data = {req: req,
7176
raw: raw};
77+
// remember that we already processed stream:features
78+
self.processed_features = true;
7279
self._register_cb(req, callback, raw);
7380
delete self._registering;
7481
}

0 commit comments

Comments
 (0)