Malik said that ‘Umar built a courtyard called al-Butaiha’ in the neighbourhood of the mosque and said, “If anyone wants to make a noise, or recite poetry, or raise his voice, he must go out to this courtyard.”
As-Sa'ib b. Yazid said that when he was sleeping in the mosque a man threw a pebble at him, and when he looked he saw that it was ‘Umar b. al-Khattab, who said, “Go and bring me these two men.” He brought them and ‘Umar asked them what tribe they belonged to, or what place they came from. On their replying that they belonged to at-Ta’if, he said, “If you had belonged to Medina I would have given you a beating for raising your voices in the mosque of God’s Messenger.
Anas said that the Prophet saw some mucus in the direction of the qibla and his displeasure was apparent in his face, so he got up, scraped it with his hand and said, “When one of you gets up to pray, he is holding intimate converse only with his Lord, and his Lord is between him and the qibla, so none of you must spit in the direction of the qibla, but towards his left side, or under his foot.” Then he took the end of his cloak, spat in it, folded it up and said, “Or he may do thus.”
Al-Hasan reported in mursal form that God's Messenger said, “A time is coming when people will talk in their mosques about their worldly affairs, so do not sit with them, for God has nothing to do with them.”