Restrict logging only to when debug=true.
This commit is contained in:
parent
3110cda38b
commit
4253c9aeae
40
converse.js
40
converse.js
@ -71,6 +71,12 @@
|
|||||||
return text.replace(re, '<a target="_blank" href="$1">$1</a>');
|
return text.replace(re, '<a target="_blank" href="$1">$1</a>');
|
||||||
};
|
};
|
||||||
|
|
||||||
|
this.log = function (txt) {
|
||||||
|
if (this.debug) {
|
||||||
|
console.log(txt);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
this.toISOString = function (date) {
|
this.toISOString = function (date) {
|
||||||
var pad;
|
var pad;
|
||||||
if (typeof date.toISOString !== 'undefined') {
|
if (typeof date.toISOString !== 'undefined') {
|
||||||
@ -159,7 +165,7 @@
|
|||||||
converse.connection.sendIQ(iq,
|
converse.connection.sendIQ(iq,
|
||||||
callback,
|
callback,
|
||||||
function () {
|
function () {
|
||||||
console.log('Error while retrieving collections');
|
converse.log('Error while retrieving collections');
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -484,7 +490,7 @@
|
|||||||
});
|
});
|
||||||
}, this),
|
}, this),
|
||||||
$.proxy(function (stanza) {
|
$.proxy(function (stanza) {
|
||||||
console.log("ChatBoxView.initialize: An error occured while fetching vcard");
|
converse.log("ChatBoxView.initialize: An error occured while fetching vcard");
|
||||||
}, this)
|
}, this)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -695,7 +701,7 @@
|
|||||||
this.addContact(jid, fullname);
|
this.addContact(jid, fullname);
|
||||||
}, this),
|
}, this),
|
||||||
$.proxy(function (stanza) {
|
$.proxy(function (stanza) {
|
||||||
console.log("An error occured while fetching vcard");
|
converse.log("An error occured while fetching vcard");
|
||||||
var jid = $(stanza).attr('from');
|
var jid = $(stanza).attr('from');
|
||||||
this.addContact(jid, jid);
|
this.addContact(jid, jid);
|
||||||
}, this));
|
}, this));
|
||||||
@ -941,7 +947,7 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!nick) { return; }
|
if (!nick) { return; }
|
||||||
chatroom = converse.chatboxes.createChatBox({
|
chatroom = converse.chatboxesview.showChatBox({
|
||||||
'id': jid,
|
'id': jid,
|
||||||
'jid': jid,
|
'jid': jid,
|
||||||
'name': Strophe.unescapeNode(Strophe.getNodeFromJid(jid)),
|
'name': Strophe.unescapeNode(Strophe.getNodeFromJid(jid)),
|
||||||
@ -1607,16 +1613,6 @@
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
createChatBox: function (attrs) {
|
|
||||||
var chatbox = this.get(attrs.jid);
|
|
||||||
if (chatbox) {
|
|
||||||
chatbox.trigger('show');
|
|
||||||
} else {
|
|
||||||
chatbox = this.create(attrs);
|
|
||||||
}
|
|
||||||
return chatbox;
|
|
||||||
},
|
|
||||||
|
|
||||||
messageReceived: function (message) {
|
messageReceived: function (message) {
|
||||||
var partner_jid, $message = $(message),
|
var partner_jid, $message = $(message),
|
||||||
message_from = $message.attr('from');
|
message_from = $message.attr('from');
|
||||||
@ -1686,6 +1682,20 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}, this);
|
}, this);
|
||||||
|
},
|
||||||
|
|
||||||
|
showChatBox: function (attrs) {
|
||||||
|
var chatbox = this.model.get(attrs.jid);
|
||||||
|
if (chatbox) {
|
||||||
|
chatbox.trigger('show');
|
||||||
|
} else {
|
||||||
|
chatbox = this.model.create(attrs, {
|
||||||
|
'error': function (model, response) {
|
||||||
|
converse.log(response.responseText);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
return chatbox;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -1719,7 +1729,7 @@
|
|||||||
|
|
||||||
openChat: function (ev) {
|
openChat: function (ev) {
|
||||||
ev.preventDefault();
|
ev.preventDefault();
|
||||||
converse.chatboxes.createChatBox({
|
converse.chatboxesview.showChatBox({
|
||||||
'id': this.model.get('jid'),
|
'id': this.model.get('jid'),
|
||||||
'jid': this.model.get('jid'),
|
'jid': this.model.get('jid'),
|
||||||
'fullname': this.model.get('fullname'),
|
'fullname': this.model.get('fullname'),
|
||||||
|
@ -16,7 +16,6 @@
|
|||||||
<script type="text/javascript" src="components/underscore/underscore.js"></script>
|
<script type="text/javascript" src="components/underscore/underscore.js"></script>
|
||||||
<script type="text/javascript" src="components/backbone//backbone.js"></script>
|
<script type="text/javascript" src="components/backbone//backbone.js"></script>
|
||||||
<script type="text/javascript" src="components/backbone.localStorage/backbone.localStorage.js"></script>
|
<script type="text/javascript" src="components/backbone.localStorage/backbone.localStorage.js"></script>
|
||||||
<script type="text/javascript" src="components/sjcl/sjcl.js"></script>
|
|
||||||
<script type="text/javascript" src="components/tinysort/src/jquery.tinysort.js"></script>
|
<script type="text/javascript" src="components/tinysort/src/jquery.tinysort.js"></script>
|
||||||
<script type="text/javascript" src="components/jed/jed.js"></script>
|
<script type="text/javascript" src="components/jed/jed.js"></script>
|
||||||
<script type="text/javascript" src="locale/en/LC_MESSAGES/en.js"></script>
|
<script type="text/javascript" src="locale/en/LC_MESSAGES/en.js"></script>
|
||||||
|
Loading…
Reference in New Issue
Block a user