Remove getItem.

It's a relic from a time before the class subclassed a Backbone.Collection
This commit is contained in:
JC Brand 2013-10-08 08:45:17 +02:00
parent a3dc23bf3e
commit 8a2e4e83e7

View File

@ -2098,12 +2098,8 @@
return (Strophe.getBareJidFromJid(jid) === Strophe.getBareJidFromJid(converse.connection.jid)); return (Strophe.getBareJidFromJid(jid) === Strophe.getBareJidFromJid(converse.connection.jid));
}, },
getItem: function (id) {
return Backbone.Collection.prototype.get.call(this, id);
},
addResource: function (bare_jid, resource) { addResource: function (bare_jid, resource) {
var item = this.getItem(bare_jid), var item = this.get(bare_jid),
resources; resources;
if (item) { if (item) {
resources = item.get('resources'); resources = item.get('resources');
@ -2119,7 +2115,7 @@
}, },
removeResource: function (bare_jid, resource) { removeResource: function (bare_jid, resource) {
var item = this.getItem(bare_jid), var item = this.get(bare_jid),
resources, resources,
idx; idx;
if (item) { if (item) {
@ -2188,7 +2184,7 @@
for (i=0; i < this.models.length; ++i) { for (i=0; i < this.models.length; ++i) {
id = this.models[i].get('id'); id = this.models[i].get('id');
if (_.indexOf(roster_ids, id) === -1) { if (_.indexOf(roster_ids, id) === -1) {
this.getItem(id).destroy(); this.get(id).destroy();
} }
} }
}, },
@ -2197,7 +2193,7 @@
this.cleanCache(items); this.cleanCache(items);
_.each(items, function (item, index, items) { _.each(items, function (item, index, items) {
if (this.isSelf(item.jid)) { return; } if (this.isSelf(item.jid)) { return; }
var model = this.getItem(item.jid); var model = this.get(item.jid);
if (!model) { if (!model) {
is_last = false; is_last = false;
if (index === (items.length-1)) { is_last = true; } if (index === (items.length-1)) { is_last = true; }
@ -2224,7 +2220,7 @@
handleIncomingSubscription: function (jid) { handleIncomingSubscription: function (jid) {
var bare_jid = Strophe.getBareJidFromJid(jid); var bare_jid = Strophe.getBareJidFromJid(jid);
var item = this.getItem(bare_jid); var item = this.get(bare_jid);
if (!converse.allow_contact_requests) { if (!converse.allow_contact_requests) {
converse.connection.roster.unauthorize(bare_jid); converse.connection.roster.unauthorize(bare_jid);
@ -2298,7 +2294,7 @@
} else if (($presence.find('x').attr('xmlns') || '').indexOf(Strophe.NS.MUC) === 0) { } else if (($presence.find('x').attr('xmlns') || '').indexOf(Strophe.NS.MUC) === 0) {
return true; // Ignore MUC return true; // Ignore MUC
} }
item = this.getItem(bare_jid); item = this.get(bare_jid);
if (item && (status_message.text() != item.get('status'))) { if (item && (status_message.text() != item.get('status'))) {
item.save({'status': status_message.text()}); item.save({'status': status_message.text()});
} }