<commit_before>
from spade import SpadeConfigParser
from spade import XMLCodec
from xmpp import *

class MTP:

	def __init__(self, name, config, acc):

		#parser = SpadeConfigParser.ConfifParser()
		#self.config = parser.parse(CONFIGFILE)

		self.name = name
		self.config = config
		self.acc = acc

		self.protocol = self.config.acc[name].protocol
		#self.instance = self.config.acc[name].instance

		self.setup()

	def setup(self):
		raise NotImplemented

	# Envelope = Envelope Class
	# Payload = raw text
	def send(self, envelope, payload):
		raise NotImplemented


	def dispatch(self, envelope, payload):

		xc = XMLCodec()
		envxml = xc.encodeXML(envelope)

		xenv = xmpp.protocol.Node('jabber:x:fipa x')
		xenv['content-type']='fipa.mts.env.rep.xml.std'
		xenv.addData(envxml)

		for to in envelope.getTo():

			stanza = xmpp.protocol.Message(to.getName(),payload, xmlns="")
			stanza.addChild(node=xenv)

			s=None
			s = self.acc._router._owner.getsession(to.getName())
			if s:
				s.enqueue(stanza)
		


PROTOCOL = None  #This must be overriden
INSTANCE = None  #This must be overriden
<commit_msg>packaging<commit_after>
from spade import SpadeConfigParser
from spade import XMLCodec
from xmpp import *

class MTP:

	def __init__(self, name, config, acc):

		#parser = SpadeConfigParser.ConfifParser()
		#self.config = parser.parse(CONFIGFILE)

		self.name = name
		self.config = config
		self.acc = acc

		self.protocol = self.config.acc[name].protocol
		#self.instance = self.config.acc[name].instance

		self.setup()

	def setup(self):
		raise NotImplemented

	# Envelope = Envelope Class
	# Payload = raw text
	def send(self, envelope, payload):
		raise NotImplemented


	def dispatch(self, envelope, payload):

		xc = XMLCodec.XMLCodec()
		envxml = xc.encodeXML(envelope)

		xenv = xmpp.protocol.Node('jabber:x:fipa x')
		xenv['content-type']='fipa.mts.env.rep.xml.std'
		xenv.addData(envxml)

		for to in envelope.getTo():

			stanza = xmpp.protocol.Message(to.getName(),payload, xmlns="")
			stanza.addChild(node=xenv)

			s=None
			s = self.acc._router._owner.getsession(to.getName())
			if s:
				s.enqueue(stanza)
		


PROTOCOL = None  #This must be overriden
INSTANCE = None  #This must be overriden

{'fraction_non_alphanumeric': 0.12190733243364822, 'fraction_numerical': 0.0, 'mean_word_length': 3.9642857142857144, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 8}, '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': '5342925', 'n_tokens_mistral': 871, 'n_tokens_neox': 787, 'n_words': 178}