add: channel.on({ event     : 'presence', direction : 'in', stanza    : function(s) { return s.@type == 'subscribe'; }, }, function(presence) { var roster = XMPP.cache.find({ event     : 'iq', direction : 'in', account   : presence.account, stanza    : function(s) { return s.ns_roster::query != undefined } }); if(roster.stanza..ns_roster::item.(@jid == presence.stanza.@from)) receivedSubscriptionApproval(presence); }); 
context: function init() {    $('#contacts')._.selectedIndex = -1;    channel = XMPP.createChannel();    channel.on(        {event: 'presence', direction: 'in', stanza: function(s) {                return s.@type == undefined || s.@type == 'unavailable';            }},        function(presence) { receivedPresence(presence) });    channel.on(        {event: 'iq', direction: 'in', stanza: function(s) {                return s.ns_roster::query.length() > 0;            }},        function(iq) { receivedRoster(iq); });    channel.on(        {event: 'message', direction: 'in'},        function(message) {            receivedMessage(message);        });    channel.on(        {event: 'presence', direction: 'in', stanza: function(s) {                return s.@type == 'subscribe';            }},        function(presence) { receivedSubscriptionRequest(presence); });    channel.on(        {event: 'presence', direction: 'in', stanza: function(s) {                return s.ns_muc_user::x.length() > 0;            }}, function(presence) { receivedMUCPresence(presence) });    channel.on(        {event: 'iq', direction: 'out', stanza: function(s) {                return s.@type == 'set' &&                    s.ns_private::query.ns_bookmarks::storage != undefined;            }}, function(iq) { requestMUCBookmarks(iq.account); });    channel.on(        {event: 'iq', direction: 'in', stanza: function(s) {                return s.@type == 'result' &&                    s.ns_private::query.ns_bookmarks::storage != undefined;            }}, function(iq) { receivedMUCBookmarks(iq); });    XMPP.cache.fetch({        event: 'iq',        direction: 'in',        stanza: function(s) {                return s.ns_roster::query.length() > 0;            }})        .forEach(receivedRoster);    XMPP.cache.fetch({        event: 'presence',        direction: 'in',        })        .forEach(receivedPresence);    XMPP.cache.fetch({        event: 'iq',        direction: 'in',        stanza: function(s) {                return s.ns_private::query.ns_bookmarks::storage != undefined;            }        })        .forEach(receivedMUCBookmarks);}
meta: 1705	/local1/tlutelli/issta_data/temp/all_js/javascript/2007_temp/2007/1705/833837aae11242cdf43b67f41fa60b27948f2eed/contacts.js/buggy/chrome/content/contacts.js