Update existing outgoing message events when reported as sent by telepathy

The first part of this change refactors getEventForToken to be synchronous, which it would be anyway. The asynchronous logic was broken and awkwardly inflexible. A corresponding getEventById method was also added.

The second part updates pre-existing events when outgoing messages are accepted by telepathy. That fixes message tokens and some IM error cases for outgoing messages.