-/* create a tnyaccount for the server account connected to the account with name 'key'
- */
-static TnyAccount*
-get_tny_account_from_server_account (ModestTnyAccountStore *self,
- ModestServerAccountData *account_data,
- ModestProtocolType modest_type)
-{
- TnyAccount *tny_account;
- ModestTnyAccountStorePrivate *priv;
-
- g_return_val_if_fail (self, NULL);
- g_return_val_if_fail (account_data, NULL);
-
- priv = MODEST_TNY_ACCOUNT_STORE_GET_PRIVATE(self);
-
- /* proto */
- if (account_data->proto == MODEST_PROTOCOL_UNKNOWN) {
- g_printerr ("modest: '%s' does not provide a protocol\n",
- account_data->account_name);
- return NULL;
- }
-
- tny_account = tny_account_for_proto (account_data->proto);
- if (!tny_account) {
- g_printerr ("modest: could not create tny account for '%s'\n",
- account_data->account_name);
- return NULL;
- }
-
- /* Set account store, session and id */
- tny_camel_account_set_session (TNY_CAMEL_ACCOUNT(tny_account), /* session */
- priv->tny_session_camel);
-
- /* Proto */
- tny_account_set_proto (tny_account,
- modest_protocol_info_get_protocol_name(account_data->proto));
-
- g_object_set_data (G_OBJECT(tny_account), "account_store", (gpointer)self);
-
- /* Options */
- if (account_data->options) {
- GSList *tmp = account_data->options;
- while (tmp) {
- tny_camel_account_add_option (TNY_CAMEL_ACCOUNT (tny_account),
- tmp->data);
- tmp = g_slist_next (tmp);
- }
- }
- /* id */
- tny_account_set_id (tny_account, account_data->account_name);
-
- /* Hostname & Username */
- if (account_data->username)
- tny_account_set_user (tny_account, account_data->username);
-
- if (account_data->hostname)
- tny_account_set_hostname (tny_account, account_data->hostname);
-
- /* Password functions */
- tny_account_set_forget_pass_func (tny_account, forget_password);
- tny_account_set_pass_func (tny_account, get_password);
-
- return tny_account;
-}
-
-
-