Add truncation to avoid MMS filename limitation r=rwaldron
Bug 920546 - [Messages] Short-term fixes for the recipient panel r=julienw

https://bugzilla.mozilla.org/show_bug.cgi?id=920546

- Apply new "invalid recipient" indicator style
- Decouple searchContact from list display
- Create ThreadUI.listContact(...)
- Create ThreadUI.validateContact(...)
- Adds two level validation:
    - Is the entry questionable?
        - This kicks off a silent search for matching contacts
        - If there are one or more matches, use the first to create a Recipient
    - Is the entry invalid?
        - This state is reached if no contacts could be found
          for the typed value.
        - Prevents enableSend
        - Prevents "export" of recipient entry at Send
          (when mixed with multiple valid recipients)
- Refactor Utils.getContactDisplayInfo logic
- Adds tests for enableSend
- Adds tests for questionable Recipient detection.

Changes, post review:

> Bug 1:
>  - enter a bogus recipient, press enter to "accept" it
>  - press backspace => the cursor is correctly inside the contenteditable element, but it's still "red" and the keyboard is hiding

Fixed by adding CSS rules:
  [contenteditable=false].attention
  [contenteditable=true].attention

---

> Bug 2:
>  - with the recipient light workload, that has a "Adam L. Card" contact
>  - typing exactly "Adam L. Card" => no match
>  - typing "Adam Card" => match

Yep, this has always been true. See also: https://bugzilla.mozilla.org/show_bug.cgi?id=860804

---

> Bug 3:
>  - add text in the composer
>  - add a bogus contact => the send button is enabled, should be disabled

Fixed by being more explicit in enableSend:

Set hasRecipients to true based on the following conditions:

 1. There is a valid recipients object
 2. One of the following is true:
     - The recipients object contains at least 1 valid recipient
       - OR -
     - There is >1 character typed and the value will not
       evaluate to a NaN

Signed-off-by: Rick Waldron <waldron.rick@gmail.com>

Conflicts:
	apps/sms/test/unit/thread_ui_test.js
Bug 920546 (follow up)

- Do contact search for any accepted recipient that has either
    - isLookupable = true
    - isQuestionable = true

- Validation Rules:
    - If there are 1 or more contact record matches
        - Received an exact match with a single tel record
            - This is a valid contact
        - Received an exact match with multiple tel records
            - This may be a valid contact, extract other number
            - If no number could be extracted, mark invalid
        - If input value matches a valid contact
            - Remove the manually entered recipient
            - Generate a basic contact data object, source = 'contacts'
            - Add the newly accepted, valid contact record as a recipient
            - Return
        - If input value does not match the first contact record
            - Try again with the next contact record
            - Return
    - Else
        - Mark the manually entered and accepted recipient as invalid
        - If there is an active placeholder with typed contents (this happens when editting a manually entered recipient)
            - Preserve all accepted recipients
        - Else
            - Update the manually entered and accepted recipient as "invalid"

Signed-off-by: Rick Waldron <waldron.rick@gmail.com>
Tighten the check for a match by number

Signed-off-by: Rick Waldron <waldron.rick@gmail.com>
Only suppress send enabling if the input value was questionable

Signed-off-by: Rick Waldron <waldron.rick@gmail.com>
Auto-accepted by edit-abort recipients do not explicitly do lookups

Signed-off-by: Rick Waldron <waldron.rick@gmail.com>
Remove edit-in-progress recipient.add operation

Signed-off-by: Rick Waldron <waldron.rick@gmail.com>
Remove fixture input value

Signed-off-by: Rick Waldron <waldron.rick@gmail.com>
Set fixture contents of recipient input value to (empty-string)

Signed-off-by: Rick Waldron <waldron.rick@gmail.com>