On Apr 17, 2010, at 1:39 PM, Peter Hosey wrote:
>
> What I'm proposing is that we continue storing the user's settings for their
> Facebook account(s) the same way we have been doing, rather than storing them
> as an XMPP account would. Basically, store the user's settings according to
> the service the account uses, rather than according to the protocol the
> service uses. This removes the need to “migrate” the user's data from one
> settings format to another.
>
Preferences on an account are stored by its internalObjectID, which is a number
unique to that account. There's no necessary link to the service or the
protocol the account uses.
In fact, code is already in place to seamless switch from one service to
another at load-time. From AdiumAccounts:
/*!
* @brief ServiceID upgrade code (v0.63 -> v0.70 for libpurple, v0.70 -> v0.80
for bonjour, v1.0 -> v1.1 for libpurple)
*
* The changed name will only be saved if some other account change, such as
adding an account, occurs,
* so this code should remain indefinitely to provide an upgrade path to people
whose service IDs are in an
* old style.
*
* @param serviceID NSString service ID (old or new)
* @param accountDict Dictionary of the saved account
* @return NSString service ID (new), or nil if unable to upgrade
*/
- (NSString *)_upgradeServiceID:(NSString *)serviceID
forAccountDict:(NSDictionary *)accountDict
{
...
}
An XMPP subclass implementing a new Facebook XMPP-based service just needs to
know to add @facebook.com (or whatever the suffix is for the JID) to the stored
name if it's not already present.
-Evan