-
-static gchar*
-account_from_key (const gchar *key, gboolean *is_account_key, gboolean *is_server_account)
-{
- const gchar* account_ns = MODEST_ACCOUNT_NAMESPACE "/";
- const gchar* server_account_ns = MODEST_SERVER_ACCOUNT_NAMESPACE "/";
- gchar *cursor;
- gchar *account = NULL;
-
- /* determine if it's an account or a server account,
- * based on the prefix */
- if (g_str_has_prefix (key, account_ns)) {
-
- if (is_server_account)
- *is_server_account = FALSE;
-
- account = g_strdup (key + strlen (account_ns));
-
- } else if (g_str_has_prefix (key, server_account_ns)) {
-
- if (is_server_account)
- *is_server_account = TRUE;
-
- account = g_strdup (key + strlen (server_account_ns));
- } else
- return NULL;
-
- /* if there are any slashes left in the key, it's not
- * the toplevel entry for an account
- */
- cursor = strstr(account, "/");
-
- if (is_account_key && cursor)
- *is_account_key = TRUE;
-
- /* put a NULL where the first slash was */
- if (cursor)
- *cursor = '\0';
-
- return account;
-}
-
-
-
-