<commit_before>RocketChat.sendMessage = (user, message, room, upsert = false) ->
	if not user or not message or not room._id
		return false

	unless message.ts?
		message.ts = new Date()

	message.u = _.pick user, ['_id','username']

	message.rid = room._id

	if not room.usernames?
		room = RocketChat.models.Rooms.findOneById(room._id)

	if message.parseUrls isnt false
		if urls = message.msg.match /([A-Za-z]{3,9}):\/\/([-;:&=\+\$,\w]+@{1})?([-A-Za-z0-9\.]+)+:?(\d+)?((\/[-\+=!:~%\/\.@\,\w]*)?\??([-\+=&!:;%@\/\.\,\w]+)?(?:#([^\s\)]+))?)?/g
			message.urls = urls.map (url) -> url: url

	message = RocketChat.callbacks.run 'beforeSaveMessage', message

	# Avoid saving sandstormSessionId to the database
	sandstormSessionId = null
	if message.sandstormSessionId
		sandstormSessionId = message.sandstormSessionId
		delete message.sandstormSessionId<commit_msg>Allow send empty message<commit_after>RocketChat.sendMessage = (user, message, room, upsert = false) ->
	if not user or not message or not room._id
		return false

	unless message.ts?
		message.ts = new Date()

	message.u = _.pick user, ['_id','username']

	if not Match.test(message.msg, String)
		message.msg = ''

	message.rid = room._id

	if not room.usernames?
		room = RocketChat.models.Rooms.findOneById(room._id)

	if message.parseUrls isnt false
		if urls = message.msg.match /([A-Za-z]{3,9}):\/\/([-;:&=\+\$,\w]+@{1})?([-A-Za-z0-9\.]+)+:?(\d+)?((\/[-\+=!:~%\/\.@\,\w]*)?\??([-\+=&!:;%@\/\.\,\w]+)?(?:#([^\s\)]+))?)?/g
			message.urls = urls.map (url) -> url: url

	message = RocketChat.callbacks.run 'beforeSaveMessage', message

	# Avoid saving sandstormSessionId to the database
	sandstormSessionId = null
	if message.sandstormSessionId
		sandstormSessionId = message.sandstormSessionId
		delete message.sandstormSessionId
{'fraction_non_alphanumeric': 0.216471897607123, 'fraction_numerical': 0.005564830272676683, 'mean_word_length': 3.912568306010929, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, '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': '5042377', 'n_tokens_mistral': 725, 'n_tokens_neox': 668, 'n_words': 135}