From dc0c5bffa4ea88e35af911e0876ec9994760ba4b Mon Sep 17 00:00:00 2001 From: epall Date: Fri, 13 Jun 2008 10:27:58 -0700 Subject: [PATCH] MMS prepends a 1 that needs to get stripped --- app/models/sms_gateway.rb | 4 +++- test/fixtures/sample_mms.txt | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/app/models/sms_gateway.rb b/app/models/sms_gateway.rb index 6c81e456..563fa8a4 100644 --- a/app/models/sms_gateway.rb +++ b/app/models/sms_gateway.rb @@ -2,7 +2,9 @@ class SMSGateway < ActionMailer::Base CONTEXT_NAME = 'Inbox' def receive(email) user = User.find(:first, :include => [:preference], :conditions => ["preferences.sms_email = ?", email.from[0].strip]) - logger.info "Receiving SMS task from #{email.from[0].strip} For user #{user.nil? nil : user.login}" + if user.nil? + user = User.find(:first, :include => [:preference], :conditions => ["preferences.sms_email = ?", email.from[0].strip[1,100]]) + end return if user.nil? context = user.prefs.sms_context diff --git a/test/fixtures/sample_mms.txt b/test/fixtures/sample_mms.txt index eb5e7443..a532e3ab 100644 --- a/test/fixtures/sample_mms.txt +++ b/test/fixtures/sample_mms.txt @@ -1,6 +1,6 @@ Return-Path: <15555555555/TYPE=PLMN@tmomail.net> Date: Fri, 6 Jun 2008 21:38:26 -0400 -From: 5555555555@tmomail.net +From: 15555555555@tmomail.net To: gtd@tracks.com Message-ID: <3645873.13759311212802713215.JavaMail.mms@rlyatl28> Subject: This is the subject