Generally speaking, bidding the Islamic formula of greeting is an act of Sunnah except for certain situations excluded by means of legal evidence. There are no religious texts that forbid a person entering the Masjid to say the Islamic greeting. Besides, it has been authentically established in the Hadith of the man who fell short in performing his Salah (Prayer) that he, after offering two Rak`ahs, reciprocated salutation with the Prophet (peace be upon him). As for worldly conversations such as the examples mentioned in the question, if they are short and necessary and do not distract people from performing Dhikr (Remembrance of Allah), reciting the Qur'an, or disturb those performing Salah, then there is nothing wrong with them. Otherwise, Masjids are only meant for performing `Ibadah (worship); Salah, Dhikr, recitation, religious lessons, and reconciling between people and other religious matters.May Allah grant us success. May peace and blessings be upon our Prophet Muhammad, his family, and Companions.