I went with Ibn Umar to see Ibn Abbas about a matter. After Ibn Umar finished his business, part of what he related that day was the following.He said, A man passed by the Messenger of Allah ﷺ on one of the streets while the Prophet ﷺ had just relieved himself. The man greeted him with salaam, but he did not return the greeting. When the man was about to disappear down the street, the Prophet ﷺ struck his hands against the wall and wiped his face with them, then struck it once more and wiped his forearms. Then he returned the man's greeting and said, "Nothing prevented me from returning your greeting except that I was not in a state of purity."
حدثنا أحمد بن إبراهيم الموصلي أبو علي أخبرنا محمد بن ثابت العبدي أخبرنا
انطلقت مع ابن عمر في حاجة إلى ابن عباس فقضى ابن عمر حاجته فكان من حديثه يومئذ أن قال مر رجل على رسول الله ﷺ في سكة من السكك وقد خرج من غائط أو بول فسلم عليه فلم يرد عليه حتى إذا كاد الرجل أن يتوارى في السكة ضرب بيديه على الحائط ومسح بهما وجهه ثم ضرب ضربة أخرى فمسح ذراعيه ثم رد على الرجل السلام وقال إنه لم يمنعني أن أرد عليك السلام إلا أني لم أكن على طهر