Sayyiduna Ibn Umar (may Allah be pleased with them both) narrates that once, while the Messenger of Allah (peace and blessings be upon him) was delivering a sermon, he suddenly saw phlegm on the qiblah wall, so he became angry with the people and said: "Allah Almighty is in front of you. When anyone prays, let him not spit in front of him, nor throw out phlegm." Then he came down (from the pulpit), scraped it off and applied something there. I think he had saffron brought and rubbed it on the wall. Sayyiduna Ibn Umar (may Allah be pleased with them both) said: "When one of you spits out phlegm, let him spit it to his left."
Hadith Referenceالسنن الكبرى للبيهقي / كتاب الصلاة / 3604