src/Neuron/GameServer/Mappers/ChatMapper.php
private function getNewSince ($channelId, $limit, $before = null)
	{
		$db = Neuron_DB_Database::getInstance ();

		$where = "TRUE";
		if (isset ($before))
		{
			$where = "c_m_id < " . intval ($before);
		}

		$limit ++;

		$sql = "
			SELECT
				c_m_id
			FROM
				n_chat_messages
			WHERE
				c_c_id = '{$channelId}' AND
				{$where}
			ORDER BY
				c_m_id DESC
			LIMIT
				{$limit}
		";

		$messages = $db->query ($sql);

		$count = count ($messages);
		if ($count > 0)
		{
			// minus one, because we need to get the first
			// message as well. This might result in showing
			// 21 messages, but that's okay.
			return $messages[$count - 1]['c_m_id'] - 1;
		}
		return null;
	}
private function getNewSince ($channelId, $limit, $before = null)
	{
		$db = Neuron_DB_Database::getInstance ();

		$where = "TRUE";
		if (isset ($before))
		{
			$where = "c_m_id < " . intval ($before);
		}

		$limit ++;

		$sql = "
			SELECT
				c_m_id
			FROM
				n_chat_messages
			WHERE
				c_c_id = '{$channelId}' AND
				{$where}
			ORDER BY
				c_m_id DESC
			LIMIT
				{$limit}
		";

		$messages = $db->query ($sql);

		$count = count ($messages);
		if ($count > 0)
		{
			// minus one, because we need to get the first
			// message as well. This might result in showing
			// 21 messages, but that's okay.
			return $messages[$count - 1]['c_m_id'] - 1;
		}
		return null;
	}
Return the $since id that is $amount messages ago.