<commit_before>export default function(client) {
    client.on('message', function(msg) {
        if (msg.event) {
            client.emit('pubsub:event', msg);
            client.emit('pubsubEvent', msg);

            if (msg.event.updated) {
                const published = msg.event.updated.published;
                const retracted = msg.event.updated.retracted;

                if (published && published.length) {
                    client.emit('pubsub:published', msg);
                }

                if (retracted && retracted.length) {
                    client.emit('pubsub:retracted', msg);
                }
            }

            if (msg.event.purged) {
                client.emit('pubsub:purged', msg);
            }

            if (msg.event.deleted) {
                client.emit('pubsub:deleted', msg);
            }

            if (msg.event.subscriptionChanged) {
                client.emit('pubsub:subscription', msg);
            }

            if (msg.event.configurationChanged) {
                client.emit('pubsub:config', msg);
            }
        }

        if (msg.pubsub && msg.pubsub.affiliations) {
            client.emit('pubsub:affiliation', msg);
        }
    });

    client.subscribeToNode = function(jid, opts, cb) {
        if (typeof opts === 'string') {
            opts = {
                node: opts
            };
        }
        opts.jid = opts.jid || client.jid;

        return this.sendIq(
            {
                type: 'set',
                to: jid,
                pubsub: {
                    subscribe: opts
                }
            },
            cb
        );
    };

    client.unsubscribeFromNode = function(jid, opts, cb) {
        if (typeof opts === 'string') {
            opts = {
                node: opts
            };
        }
        opts.jid = opts.jid || client.jid.bare;

        return this.sendIq(
            {
                type: 'set',
                to: jid,
                pubsub: {
                    unsubscribe: opts
                }
            },
            cb
        );
    };

    client.publish = function(jid, node, item, cb) {
        return this.sendIq(
            {
                type: 'set',
                to: jid,
                pubsub: {
                    publish: {
                        node: node,
                        item: item
                    }
                }
            },
            cb
        );
    };

    client.getItem = function(jid, node, id, cb) {
        return this.sendIq(
            {
                type: 'get',
                to: jid,
                pubsub: {
                    retrieve: {
                        node: node,
                        item: id
                    }
                }
            },
            cb<commit_msg>fix pubsub getItem<commit_after>export default function(client) {
    client.on('message', function(msg) {
        if (msg.event) {
            client.emit('pubsub:event', msg);
            client.emit('pubsubEvent', msg);

            if (msg.event.updated) {
                const published = msg.event.updated.published;
                const retracted = msg.event.updated.retracted;

                if (published && published.length) {
                    client.emit('pubsub:published', msg);
                }

                if (retracted && retracted.length) {
                    client.emit('pubsub:retracted', msg);
                }
            }

            if (msg.event.purged) {
                client.emit('pubsub:purged', msg);
            }

            if (msg.event.deleted) {
                client.emit('pubsub:deleted', msg);
            }

            if (msg.event.subscriptionChanged) {
                client.emit('pubsub:subscription', msg);
            }

            if (msg.event.configurationChanged) {
                client.emit('pubsub:config', msg);
            }
        }

        if (msg.pubsub && msg.pubsub.affiliations) {
            client.emit('pubsub:affiliation', msg);
        }
    });

    client.subscribeToNode = function(jid, opts, cb) {
        if (typeof opts === 'string') {
            opts = {
                node: opts
            };
        }
        opts.jid = opts.jid || client.jid;

        return this.sendIq(
            {
                type: 'set',
                to: jid,
                pubsub: {
                    subscribe: opts
                }
            },
            cb
        );
    };

    client.unsubscribeFromNode = function(jid, opts, cb) {
        if (typeof opts === 'string') {
            opts = {
                node: opts
            };
        }
        opts.jid = opts.jid || client.jid.bare;

        return this.sendIq(
            {
                type: 'set',
                to: jid,
                pubsub: {
                    unsubscribe: opts
                }
            },
            cb
        );
    };

    client.publish = function(jid, node, item, cb) {
        return this.sendIq(
            {
                type: 'set',
                to: jid,
                pubsub: {
                    publish: {
                        node: node,
                        item: item
                    }
                }
            },
            cb
        );
    };

    client.getItem = function(jid, node, id, cb) {
        return this.sendIq(
            {
                type: 'get',
                to: jid,
                pubsub: {
                    retrieve: {
                        node: node,
                        item: {
                            id: id
                        }
                    }
                }
            },
            cb
{'fraction_non_alphanumeric': 0.10924663520363573, 'fraction_numerical': 0.0, 'mean_word_length': 0.8785292186474064, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5902849', 'n_tokens_mistral': 1555, 'n_tokens_neox': 1443, 'n_words': 270}