<commit_before># encoding: UTF-8

module Vines
  class Stream
    class Component
      class Ready < State
        def node(node)
          stanza = to_stanza(node)
          raise StreamErrors::UnsupportedStanzaType unless stanza
          to, from = stanza.validate_to, stanza.validate_from
          raise StreamErrors::ImproperAddressing unless to && from
          raise StreamErrors::InvalidFrom unless from.domain == stream.remote_domain
          stream.user = User.new(:jid => from)
          if stanza.local?
            stanza.process
          else
            stanza.route
          end
        end
      end<commit_msg>Process stanzas addressed to pubsub domains from components locally, rather than incorrectly trying to route them to a remote server.<commit_after># encoding: UTF-8

module Vines
  class Stream
    class Component
      class Ready < State
        def node(node)
          stanza = to_stanza(node)
          raise StreamErrors::UnsupportedStanzaType unless stanza
          to, from = stanza.validate_to, stanza.validate_from
          raise StreamErrors::ImproperAddressing unless to && from
          raise StreamErrors::InvalidFrom unless from.domain == stream.remote_domain
          stream.user = User.new(jid: from)
          if stanza.local? || stanza.to_pubsub_domain?
            stanza.process
          else
            stanza.route
          end
        end
      end
{'fraction_non_alphanumeric': 0.06086341118188252, 'fraction_numerical': 0.0014154281670205238, 'mean_word_length': 2.1918735891647856, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 4, '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': '7230723', 'n_tokens_mistral': 370, 'n_tokens_neox': 364, 'n_words': 109}