Copy SMS + prepend/phone-context append logic to MMS

Amolith created

Change summary

sgx_endstream.rb | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)

Detailed changes

sgx_endstream.rb 🔗

@@ -219,14 +219,20 @@ message from: /@mms.chat.1pcom.net\Z/ do |m|
 	end
 
 	IncomingMMS.for(m.to, json).then { |incoming|
+		tel = if m.from.node.length > 7
+			"+#{m.from.node}"
+		else
+			"#{m.from.node};phone-context=ca-us.phone-context.soprani.ca"
+		end
+
 		to_send = incoming.to_stanza
 		to_send.id = m.id
-		to_send.from = Blather::JID.new("+#{m.from.node}", CONFIG[:component][:jid])
+		to_send.from = Blather::JID.new(tel, CONFIG[:component][:jid])
 		self << to_send
 
 		emit_incoming_event(
 			incoming.unproxied_to,
-			from: "+#{m.from.node}",
+			from: tel,
 			body: incoming.body_text,
 			endstream_id: m.id,
 			media_urls: incoming.media_urls