diff --git a/components/conversation-screen.tsx b/components/conversation-screen.tsx index 254dcbb1..402c15bb 100644 --- a/components/conversation-screen.tsx +++ b/components/conversation-screen.tsx @@ -714,6 +714,7 @@ const ConversationScreen = ({navigation, route}) => { }} > {lastMessageStatus === 'timeout' ? "Message not delivered. Are you online?" : '' } + {lastMessageStatus === 'spam' ? `We think that might be spam. Try sending ${name} a different message...` : '' } {lastMessageStatus === 'offensive' ? `Intros can’t be too rude. Try sending ${name} a different message...` : '' } {lastMessageStatus === 'blocked' ? name + ' is unavailable right now. Try messaging someone else!' : '' } {lastMessageStatus === 'not unique' ? `Someone already sent that intro! Try sending ${name} a different message...` : '' } diff --git a/xmpp/xmpp.tsx b/xmpp/xmpp.tsx index 765be2f3..1381611b 100644 --- a/xmpp/xmpp.tsx +++ b/xmpp/xmpp.tsx @@ -88,6 +88,7 @@ const safeSend = async (element: Element) => { type MessageStatus = | 'sent' | 'offensive' + | 'spam' | 'blocked' | 'not unique' | 'too long' @@ -582,6 +583,11 @@ const _sendMessage = ( doc ); + const spamNode = xpath.select1( + `/*[name()='duo_message_blocked'][@reason='spam'][@id='${id}']`, + doc + ); + const blockedNode = xpath.select1( `/*[name()='duo_message_blocked'][@id='${id}']`, doc @@ -592,7 +598,9 @@ const _sendMessage = ( doc ); - if (offensiveNode) { + if (spamNode) { + callback('spam'); + } else if (offensiveNode) { callback('offensive'); } else if (blockedNode) { callback('blocked');