Fiqh-us-Sunnah Volume 2, Supererogatory Prayer, Fiqh 2.072.
Abu Hurairah reports that the Messenger of Allah said: “If you hear a man announcing in the mosque about some object which he has lost tell him: ‘May Allah not return it to you for the mosques are not built for that.”‘ This is related by Muslim.
Abu Hurairah also relates that the Prophet said: “If you see someone buying or selling in the mosque, say to him: ‘May Allah not give you any profit in your trading.”‘ This is related by an-Nasa’i and at-Tirmizhi. The latter calls it hasan.
‘Abdullah ibn ‘Umar reports that the Peophet forbade buying and selling in the mosque, reciting poetry in it, or announcing lost items, and he especially prohibited making a circle [i.e., a meeting in a circle] before the Friday prayer. This is related by the five, and at-Tirmizhi calls it sahih.
The poetry which is prohibited is that which ridicules a Muslim, praises a wrongdoer or some lewdness, and so on. Concerning that which contains wisdom or praises of Islam or encouragement to piety, there is nothing wrong with it. Abu Hurairah reports that ‘Umar passed by Hassan as he was reciting poetry in the mosque. ‘Umar looked at him in a disapproving manner. Hassan said: “I used to recite when one better than you was present.” He turned to Abu Hurairah and said: “I adjure you by Allah to state that you have heard the Messenger of Allah say: ‘Respond for me [Hassan]. O Allah, support him with the Angel Gabriel.'” Abu Hurairah said: “Yes, [I heard it].” This is related by al-Bukhari and Muslim.