Ejemplo n.º 1
0
			print(k + " , " + str(v))
		continue

	match = re.match(r"heatmap( -o (.*))?$", do)
	if match:
		if match.group(2):
			f = open(match.group(2), 'w')
			f.write(formatMap(thisPeer.getAllNeighbours(), thisPeer.getMessagesPerPeer()))
			f.close()
		else:
			print(formatMap(thisPeer.getAllNeighbours(), thisPeer.getMessagesPerPeer()))
		continue

	match = re.match(r"message ([a-zA-Z0-9]+) ([a-zA-Z0-9\ ]+)$", do)
	if match:
		thisPeer.sendMessage(match.group(1), match.group(2))
		continue

	match = re.match(r"kmessage ([a-zA-Z0-9]+) ([a-zA-Z0-9\ ]+)$", do)
	if match:
		thisPeer.kSendMessage(match.group(1), match.group(2))
		continue

	match = re.match(r"friend ([a-zA-Z0-9]+) (.+)$", do)
	if match:
		thisPeer.addFriend(match.group(1), match.group(2))
		continue

	match = re.match(r"secret (.+)$", do)
	if match:
		thisPeer.setSecret(match.group(1))