Masjids are built for performing Dhikr (Remembrance of Allah). Therefore, it should not be regarded as a place for discussing worldly matters. Allah (Exalted be He) says,
In houses (mosques) which Allâh has ordered to be raised (to be cleaned, and to be honoured), in them His Name is remembered [i.e. Adhan, Iqamah, Salât (prayers), invocations, recitation of the Qur’ân, etc.].
Commenting on this Ayah,
Ibn Kathir (may Allah be merciful to him) reports in his Tafsir (exegesis of the meanings of the Qur'an) on the authority of
Ibn `Abbas (may Allah be pleased with them both) that Allah (Glorified be He) forbade idle talk in Masjids. According to
Qatadah, the Ayah refers to the Masjids that Allah ordered to be built, celebrated by prayers, purified, and venerated. In this regard, the Prophet is authentically quoted to have said,
They are only built for the remembrance of Allah, performing Salah, and the recitation of the Qur'an.
Furthermore, you did well in denouncing them as it is not permissible to shout, abuse one another, or utter such obscene words and actions in Masjids. However, there is nothing wrong with occasionally speaking of some worldly matters when necessary.May Allah grant us success. May peace and blessings be upon our Prophet Muhammad, his family, and Companions.