Move target extraction and ordering

Move code for extracting title and site from 'title@site' and for
sorting targets into MassMessageTargets so they can be reused by API
code.

Change-Id: I2e9e39198986fa02abed2bfc3409356fcecd502c