def allowed?(to, from)
      to, from = JID.new(to), JID.new(from)
      return false                      if to.empty? || from.empty?
      return true                       if to.domain == from.domain # same domain always allowed
      return cross_domain?(to, from)    if local_jid?(to, from)     # both virtual hosted here
      return check_subdomains(to, from) if subdomain?(to, from)     # component/pubsub to component/pubsub
      return check_subdomain(to, from)  if subdomain?(to)           # to component/pubsub
      return check_subdomain(from, to)  if subdomain?(from)         # from component/pubsub
      return cross_domain?(to)          if local_jid?(to)           # from is remote
      return cross_domain?(from)        if local_jid?(from)         # to is remote
      return false
    end
def allowed?(to, from)
      to, from = JID.new(to), JID.new(from)
      return false                      if to.empty? || from.empty?
      return true                       if to.domain == from.domain # same domain always allowed
      return cross_domain?(to, from)    if local_jid?(to, from)     # both virtual hosted here
      return check_subdomains(to, from) if subdomain?(to, from)     # component/pubsub to component/pubsub
      return check_subdomain(to, from)  if subdomain?(to)           # to component/pubsub
      return check_subdomain(from, to)  if subdomain?(from)         # from component/pubsub
      return cross_domain?(to)          if local_jid?(to)           # from is remote
      return cross_domain?(from)        if local_jid?(from)         # to is remote
      return false
    end
Return true if the two JIDs are allowed to send messages to each other.
 Both domains must have enabled cross_domain_messages in their config files.