1 /* Copyright (c) 2008, Nokia Corporation
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are
8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
13 * * Neither the name of the Nokia Corporation nor the names of its
14 * contributors may be used to endorse or promote products derived from
15 * this software without specific prior written permission.
17 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
18 * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
19 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
20 * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
21 * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
22 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
23 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
24 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
25 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
26 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
27 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 #include <tny-simple-list.h>
31 #include "modest-account-protocol.h"
32 #include "modest-account-mgr-helpers.h"
33 #include "widgets/modest-default-account-settings-dialog.h"
34 #include "modest-runtime.h"
35 #include "modest-marshal.h"
44 typedef struct _ModestAccountProtocolPrivate ModestAccountProtocolPrivate;
45 struct _ModestAccountProtocolPrivate {
48 TnyList *account_options;
49 GHashTable *custom_auth_mechs;
52 GHashTable *account_dialogs;
55 /* 'private'/'protected' functions */
56 static void modest_account_protocol_class_init (ModestAccountProtocolClass *klass);
57 static void modest_account_protocol_finalize (GObject *obj);
58 static void modest_account_protocol_get_property (GObject *obj,
62 static void modest_account_protocol_set_property (GObject *obj,
66 static void modest_account_protocol_instance_init (ModestAccountProtocol *obj);
68 #define MODEST_ACCOUNT_PROTOCOL_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), \
69 MODEST_TYPE_ACCOUNT_PROTOCOL, \
70 ModestAccountProtocolPrivate))
72 static TnyAccount *modest_account_protocol_create_account_default (ModestAccountProtocol *self);
74 static ModestAccountSettingsDialog *modest_account_protocol_create_account_settings_dialog_default (ModestAccountProtocol *self);
76 static ModestPairList* modest_account_protocol_get_easysetupwizard_tabs_default (ModestAccountProtocol *self);
78 static void modest_account_protocol_save_settings_default (ModestAccountProtocol *self,
79 ModestAccountSettingsDialog *dialog,
80 ModestAccountSettings *settings);
82 static void modest_account_protocol_save_wizard_settings_default (ModestAccountProtocol *self,
84 ModestAccountSettings *settings);
86 static ModestWizardDialogResponseOverrideFunc
87 modest_account_protocol_get_wizard_response_override_default (ModestAccountProtocol *self);
89 static void modest_account_protocol_check_support_default (ModestAccountProtocol *self,
90 ModestAccountProtocolCheckSupportFunc func,
92 static void modest_account_protocol_cancel_check_support_default (ModestAccountProtocol *self);
93 static void modest_account_protocol_wizard_finished_default (ModestAccountProtocol *self);
94 static gboolean modest_account_protocol_decode_part_to_stream_default (ModestAccountProtocol *protocol,
99 static gboolean modest_account_protocol_decode_part_to_stream_async_default (ModestAccountProtocol *protocol,
102 TnyMimePartCallback callback,
103 TnyStatusCallback status_callback,
105 static gboolean modest_account_protocol_is_supported_default (ModestAccountProtocol *self);
106 static gchar *modest_account_protocol_get_from_default (ModestAccountProtocol *self,
107 const gchar *account_id,
108 const gchar *mailbox);
109 static ModestPairList *modest_account_protocol_get_from_list_default (ModestAccountProtocol *self,
110 const gchar *account_id);
111 static gchar *modest_account_protocol_get_signature_default (ModestAccountProtocol *self,
112 const gchar *account_id,
113 const gchar *mailbox,
114 gboolean *has_signature);
115 static const GdkPixbuf *modest_account_protocol_get_icon_default (ModestAccountProtocol *self,
116 ModestAccountProtocolIconType icon_type,
120 static gchar *modest_account_protocol_get_service_name_default (ModestAccountProtocol *self,
121 const gchar *account_id,
122 const gchar *mailbox);
124 static const GdkPixbuf *modest_account_protocol_get_service_icon_default (ModestAccountProtocol *self,
125 const gchar *account_id,
126 const gchar *mailbox,
128 static void modest_account_protocol_save_remote_draft_default (ModestAccountProtocol *self,
129 const gchar *account_id,
132 ModestAccountProtocolSaveRemoteDraftCallback callback,
136 static GObjectClass *parent_class = NULL;
139 modest_account_protocol_get_type (void)
141 static GType my_type = 0;
144 static const GTypeInfo my_info = {
145 sizeof(ModestAccountProtocolClass),
146 NULL, /* base init */
147 NULL, /* base finalize */
148 (GClassInitFunc) modest_account_protocol_class_init,
149 NULL, /* class finalize */
150 NULL, /* class data */
151 sizeof(ModestAccountProtocol),
153 (GInstanceInitFunc) modest_account_protocol_instance_init,
157 my_type = g_type_register_static (MODEST_TYPE_PROTOCOL,
158 "ModestAccountProtocol",
165 modest_account_protocol_class_init (ModestAccountProtocolClass *klass)
167 GObjectClass *object_class;
168 ModestAccountProtocolClass *account_class;
170 object_class = (GObjectClass *) klass;
171 account_class = MODEST_ACCOUNT_PROTOCOL_CLASS (klass);
172 parent_class = g_type_class_peek_parent (klass);
173 object_class->finalize = modest_account_protocol_finalize;
174 object_class->set_property = modest_account_protocol_set_property;
175 object_class->get_property = modest_account_protocol_get_property;
177 g_object_class_install_property (object_class,
179 g_param_spec_uint ("port",
181 _("The standard port for the protocol"),
183 G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT));
185 g_object_class_install_property (object_class,
187 g_param_spec_uint ("alternate-port",
189 _("The alternate port for the protocol (usually used in SSL)"),
191 G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT));
193 g_object_class_install_property (object_class,
195 g_param_spec_gtype ("account-g-type",
196 _("Account factory GType"),
197 _("Account factory GType used for creating new instances."),
199 G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT));
201 g_type_class_add_private (object_class,
202 sizeof(ModestAccountProtocolPrivate));
204 /* Virtual methods */
205 account_class->create_account_settings_dialog =
206 modest_account_protocol_create_account_settings_dialog_default;
207 account_class->get_easysetupwizard_tabs =
208 modest_account_protocol_get_easysetupwizard_tabs_default;
209 account_class->save_settings =
210 modest_account_protocol_save_settings_default;
211 account_class->save_wizard_settings =
212 modest_account_protocol_save_wizard_settings_default;
213 account_class->create_account =
214 modest_account_protocol_create_account_default;
215 account_class->get_wizard_response_override =
216 modest_account_protocol_get_wizard_response_override_default;
217 account_class->is_supported =
218 modest_account_protocol_is_supported_default;
219 account_class->check_support =
220 modest_account_protocol_check_support_default;
221 account_class->cancel_check_support =
222 modest_account_protocol_cancel_check_support_default;
223 account_class->wizard_finished =
224 modest_account_protocol_wizard_finished_default;
225 account_class->decode_part_to_stream =
226 modest_account_protocol_decode_part_to_stream_default;
227 account_class->decode_part_to_stream_async =
228 modest_account_protocol_decode_part_to_stream_async_default;
229 account_class->get_from =
230 modest_account_protocol_get_from_default;
231 account_class->get_from_list =
232 modest_account_protocol_get_from_list_default;
233 account_class->get_signature =
234 modest_account_protocol_get_signature_default;
235 account_class->get_icon =
236 modest_account_protocol_get_icon_default;
237 account_class->get_service_name =
238 modest_account_protocol_get_service_name_default;
239 account_class->get_service_icon =
240 modest_account_protocol_get_service_icon_default;
241 account_class->save_remote_draft =
242 modest_account_protocol_save_remote_draft_default;
247 modest_account_protocol_instance_init (ModestAccountProtocol *obj)
249 ModestAccountProtocolPrivate *priv;
251 priv = MODEST_ACCOUNT_PROTOCOL_GET_PRIVATE (obj);
254 priv->alternate_port = 0;
255 priv->account_g_type = 0;
256 priv->account_options = tny_simple_list_new ();
257 priv->custom_auth_mechs = g_hash_table_new_full (g_direct_hash, g_direct_equal, NULL, g_free);
259 priv->account_dialogs = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL);
263 remove_account (const gchar *account_name, GObject *account, GObject *account_to_remove)
265 return (account == account_to_remove);
269 account_dialog_weak_handler (ModestAccountProtocol *self, GObject *where_the_object_was)
271 ModestAccountProtocolPrivate *priv = MODEST_ACCOUNT_PROTOCOL_GET_PRIVATE (self);
273 g_hash_table_foreach_remove (priv->account_dialogs, (GHRFunc) remove_account, where_the_object_was);
277 dialogs_remove (const gchar *account_name, GObject *account_dialog, ModestAccountProtocol *self)
279 g_object_weak_unref (account_dialog, (GWeakNotify) account_dialog_weak_handler, self);
285 modest_account_protocol_finalize (GObject *obj)
287 ModestAccountProtocol *protocol = MODEST_ACCOUNT_PROTOCOL (obj);
288 ModestAccountProtocolPrivate *priv = MODEST_ACCOUNT_PROTOCOL_GET_PRIVATE (protocol);
290 if (priv->account_dialogs) {
291 g_hash_table_foreach_remove (priv->account_dialogs, (GHRFunc) dialogs_remove, obj);
292 g_hash_table_destroy (priv->account_dialogs);
295 if (priv->account_options)
296 g_object_unref (priv->account_options);
297 priv->account_options = NULL;
299 if (priv->custom_auth_mechs)
300 g_hash_table_destroy (priv->custom_auth_mechs);
301 priv->custom_auth_mechs = NULL;
303 G_OBJECT_CLASS (parent_class)->finalize (obj);
307 modest_account_protocol_get_property (GObject *obj,
312 ModestAccountProtocol *protocol = MODEST_ACCOUNT_PROTOCOL (obj);
313 ModestAccountProtocolPrivate *priv = MODEST_ACCOUNT_PROTOCOL_GET_PRIVATE (protocol);
315 switch (property_id) {
317 g_value_set_uint (value, priv->port);
319 case PROP_ALTERNATE_PORT:
320 g_value_set_uint (value, priv->alternate_port);
322 case PROP_ACCOUNT_G_TYPE:
323 g_value_set_gtype (value, priv->account_g_type);
326 G_OBJECT_WARN_INVALID_PROPERTY_ID (obj, property_id, pspec);
332 modest_account_protocol_set_property (GObject *obj,
337 ModestAccountProtocol *protocol = MODEST_ACCOUNT_PROTOCOL (obj);
339 switch (property_id) {
341 modest_account_protocol_set_port (protocol, g_value_get_uint (value));
343 case PROP_ALTERNATE_PORT:
344 modest_account_protocol_set_alternate_port (protocol, g_value_get_uint (value));
346 case PROP_ACCOUNT_G_TYPE:
347 modest_account_protocol_set_account_g_type (protocol, g_value_get_gtype (value));
350 G_OBJECT_WARN_INVALID_PROPERTY_ID (obj, property_id, pspec);
357 modest_account_protocol_new (const gchar *name, const gchar *display_name,
358 guint port, guint alternate_port,
359 GType account_g_type)
361 return g_object_new (MODEST_TYPE_ACCOUNT_PROTOCOL,
362 "display-name", display_name, "name", name,
363 "port", port, "alternate-port", alternate_port,
364 "account-g-type", account_g_type,
369 modest_account_protocol_get_port (ModestAccountProtocol *self)
371 ModestAccountProtocolPrivate *priv;
373 g_return_val_if_fail (MODEST_IS_ACCOUNT_PROTOCOL (self), 0);
375 priv = MODEST_ACCOUNT_PROTOCOL_GET_PRIVATE (self);
380 modest_account_protocol_set_port (ModestAccountProtocol *self,
383 ModestAccountProtocolPrivate *priv;
385 g_return_if_fail (MODEST_IS_ACCOUNT_PROTOCOL (self));
387 priv = MODEST_ACCOUNT_PROTOCOL_GET_PRIVATE (self);
393 modest_account_protocol_get_alternate_port (ModestAccountProtocol *self)
395 ModestAccountProtocolPrivate *priv;
397 g_return_val_if_fail (MODEST_IS_ACCOUNT_PROTOCOL (self), 0);
399 priv = MODEST_ACCOUNT_PROTOCOL_GET_PRIVATE (self);
400 return priv->alternate_port;
404 modest_account_protocol_set_alternate_port (ModestAccountProtocol *self,
405 guint alternate_port)
407 ModestAccountProtocolPrivate *priv;
409 g_return_if_fail (MODEST_IS_ACCOUNT_PROTOCOL (self));
411 priv = MODEST_ACCOUNT_PROTOCOL_GET_PRIVATE (self);
412 priv->alternate_port = alternate_port;
416 modest_account_protocol_get_account_g_type (ModestAccountProtocol *self)
418 ModestAccountProtocolPrivate *priv;
420 g_return_val_if_fail (MODEST_IS_ACCOUNT_PROTOCOL (self), 0);
422 priv = MODEST_ACCOUNT_PROTOCOL_GET_PRIVATE (self);
423 return priv->account_g_type;
427 modest_account_protocol_get_account_options (ModestAccountProtocol *self)
430 ModestAccountProtocolPrivate *priv;
432 g_return_val_if_fail (MODEST_IS_ACCOUNT_PROTOCOL (self), NULL);
433 priv = MODEST_ACCOUNT_PROTOCOL_GET_PRIVATE (self);
435 result = tny_list_copy (priv->account_options);
441 modest_account_protocol_set_account_options (ModestAccountProtocol *self,
444 ModestAccountProtocolPrivate *priv;
446 g_return_if_fail (MODEST_IS_ACCOUNT_PROTOCOL (self));
447 priv = MODEST_ACCOUNT_PROTOCOL_GET_PRIVATE (self);
449 if (priv->account_options) {
450 g_object_unref (priv->account_options);
451 priv->account_options = NULL;
453 priv->account_options = tny_list_copy (list);
457 modest_account_protocol_has_custom_secure_auth_mech (ModestAccountProtocol *self,
458 ModestProtocolType auth_protocol_type)
460 ModestAccountProtocolPrivate *priv;
462 g_return_val_if_fail (MODEST_IS_ACCOUNT_PROTOCOL (self), FALSE);
463 priv = MODEST_ACCOUNT_PROTOCOL_GET_PRIVATE (self);
465 return g_hash_table_lookup_extended (priv->custom_auth_mechs, GINT_TO_POINTER (auth_protocol_type), NULL, NULL);
469 modest_account_protocol_get_custom_secure_auth_mech (ModestAccountProtocol *self,
470 ModestProtocolType auth_protocol_type)
472 ModestAccountProtocolPrivate *priv;
474 g_return_val_if_fail (MODEST_IS_ACCOUNT_PROTOCOL (self), NULL);
475 priv = MODEST_ACCOUNT_PROTOCOL_GET_PRIVATE (self);
477 return (const gchar *) g_hash_table_lookup (priv->custom_auth_mechs, GINT_TO_POINTER (auth_protocol_type));
481 modest_account_protocol_set_custom_secure_auth_mech (ModestAccountProtocol *self, ModestProtocolType auth_protocol_type, const gchar *secure_auth_mech)
483 ModestAccountProtocolPrivate *priv;
485 g_return_if_fail (MODEST_IS_ACCOUNT_PROTOCOL (self));
486 priv = MODEST_ACCOUNT_PROTOCOL_GET_PRIVATE (self);
488 g_hash_table_replace (priv->custom_auth_mechs, GINT_TO_POINTER (auth_protocol_type), g_strdup (secure_auth_mech));
492 modest_account_protocol_unset_custom_secure_auth_mech (ModestAccountProtocol *self, ModestProtocolType auth_protocol_type)
494 ModestAccountProtocolPrivate *priv;
496 g_return_if_fail (MODEST_IS_ACCOUNT_PROTOCOL (self));
497 priv = MODEST_ACCOUNT_PROTOCOL_GET_PRIVATE (self);
499 g_hash_table_remove (priv->custom_auth_mechs, GINT_TO_POINTER (auth_protocol_type));
504 modest_account_protocol_set_account_g_type (ModestAccountProtocol *self,
505 GType account_g_type)
507 ModestAccountProtocolPrivate *priv;
509 g_return_if_fail (MODEST_IS_ACCOUNT_PROTOCOL (self));
511 priv = MODEST_ACCOUNT_PROTOCOL_GET_PRIVATE (self);
512 priv->account_g_type = account_g_type;
516 modest_account_protocol_create_account_default (ModestAccountProtocol *self)
518 ModestAccountProtocolPrivate *priv;
520 g_return_val_if_fail (MODEST_IS_ACCOUNT_PROTOCOL (self), NULL);
522 priv = MODEST_ACCOUNT_PROTOCOL_GET_PRIVATE (self);
523 if (priv->account_g_type > 0) {
524 return g_object_new (priv->account_g_type, NULL);
531 modest_account_protocol_create_account (ModestAccountProtocol *self)
533 g_return_val_if_fail (MODEST_IS_ACCOUNT_PROTOCOL (self), NULL);
535 return MODEST_ACCOUNT_PROTOCOL_GET_CLASS (self)->create_account (self);
538 /* This is a template method for getting the account settings
539 dialog. It calls create_account_settings that must be implemented
540 by subclasses and then perform several common operations with the
542 ModestAccountSettingsDialog *
543 modest_account_protocol_get_account_settings_dialog (ModestAccountProtocol *self,
544 const gchar *account_name)
546 ModestAccountSettingsDialog *dialog;
547 ModestAccountSettings *settings;
548 ModestAccountProtocolPrivate *priv;
550 priv = MODEST_ACCOUNT_PROTOCOL_GET_PRIVATE (self);
551 dialog = g_hash_table_lookup (priv->account_dialogs, account_name);
553 if (dialog == NULL) {
555 dialog = MODEST_ACCOUNT_PROTOCOL_GET_CLASS (self)->create_account_settings_dialog (self);
558 settings = modest_account_mgr_load_account_settings (modest_runtime_get_account_mgr (),
560 modest_account_settings_dialog_load_settings (dialog, settings);
562 /* Close dialog on response */
563 g_signal_connect_swapped (dialog,
565 G_CALLBACK (gtk_widget_destroy),
568 g_hash_table_insert (priv->account_dialogs, g_strdup (account_name), dialog);
569 g_object_weak_ref (G_OBJECT (dialog), (GWeakNotify) account_dialog_weak_handler, self);
576 modest_account_protocol_get_easysetupwizard_tabs (ModestAccountProtocol *self)
578 return MODEST_ACCOUNT_PROTOCOL_GET_CLASS (self)->get_easysetupwizard_tabs (self);
583 modest_account_protocol_save_settings (ModestAccountProtocol *self,
584 ModestAccountSettingsDialog *dialog,
585 ModestAccountSettings *settings)
587 return MODEST_ACCOUNT_PROTOCOL_GET_CLASS (self)->save_settings (self, dialog, settings);
591 modest_account_protocol_save_wizard_settings (ModestAccountProtocol *self,
593 ModestAccountSettings *settings)
595 return MODEST_ACCOUNT_PROTOCOL_GET_CLASS (self)->save_wizard_settings (self, wizard_pages, settings);
598 /* Default implementations */
599 static ModestAccountSettingsDialog *
600 modest_account_protocol_create_account_settings_dialog_default (ModestAccountProtocol *self)
602 return modest_default_account_settings_dialog_new ();
605 static ModestPairList*
606 modest_account_protocol_get_easysetupwizard_tabs_default (ModestAccountProtocol *self)
608 g_warning ("You must implement get_easysetupwizard_tabs");
613 modest_account_protocol_save_settings_default (ModestAccountProtocol *self,
614 ModestAccountSettingsDialog *dialog,
615 ModestAccountSettings *settings)
617 g_return_if_fail (MODEST_IS_ACCOUNT_PROTOCOL (self));
618 g_return_if_fail (MODEST_IS_ACCOUNT_SETTINGS_DIALOG (dialog));
619 g_return_if_fail (MODEST_IS_ACCOUNT_SETTINGS (settings));
621 g_warning ("You must implement save_settings");
625 modest_account_protocol_save_wizard_settings_default (ModestAccountProtocol *self,
627 ModestAccountSettings *settings)
629 g_return_if_fail (MODEST_IS_ACCOUNT_PROTOCOL (self));
630 g_return_if_fail (wizard_pages);
631 g_return_if_fail (MODEST_IS_ACCOUNT_SETTINGS (settings));
633 g_warning ("You must implement save_wizard_settings");
636 static ModestWizardDialogResponseOverrideFunc
637 modest_account_protocol_get_wizard_response_override_default (ModestAccountProtocol *self)
639 g_return_val_if_fail (MODEST_IS_ACCOUNT_PROTOCOL (self), NULL);
644 ModestWizardDialogResponseOverrideFunc
645 modest_account_protocol_get_wizard_response_override (ModestAccountProtocol *self)
647 g_return_val_if_fail (MODEST_IS_ACCOUNT_PROTOCOL (self), NULL);
649 return MODEST_ACCOUNT_PROTOCOL_GET_CLASS (self)->get_wizard_response_override (self);
653 modest_account_protocol_is_supported_default (ModestAccountProtocol *self)
659 modest_account_protocol_is_supported (ModestAccountProtocol *self)
661 return MODEST_ACCOUNT_PROTOCOL_GET_CLASS (self)->is_supported (self);
665 modest_account_protocol_check_support_default (ModestAccountProtocol *self,
666 ModestAccountProtocolCheckSupportFunc func,
670 func (self, TRUE, userdata);
674 modest_account_protocol_check_support (ModestAccountProtocol *self,
675 ModestAccountProtocolCheckSupportFunc func,
678 MODEST_ACCOUNT_PROTOCOL_GET_CLASS (self)->check_support (self, func, userdata);
682 modest_account_protocol_cancel_check_support_default (ModestAccountProtocol *self)
688 modest_account_protocol_cancel_check_support (ModestAccountProtocol *self)
690 MODEST_ACCOUNT_PROTOCOL_GET_CLASS (self)->cancel_check_support (self);
694 modest_account_protocol_wizard_finished_default (ModestAccountProtocol *self)
700 modest_account_protocol_wizard_finished (ModestAccountProtocol *self)
702 MODEST_ACCOUNT_PROTOCOL_GET_CLASS (self)->wizard_finished (self);
706 modest_account_protocol_decode_part_to_stream_default (ModestAccountProtocol *self,
712 /* By default account protocols do not handle themselves the transfer */
717 modest_account_protocol_decode_part_to_stream (ModestAccountProtocol *self,
723 return MODEST_ACCOUNT_PROTOCOL_GET_CLASS (self)->decode_part_to_stream (self,
731 modest_account_protocol_decode_part_to_stream_async_default (ModestAccountProtocol *self,
734 TnyMimePartCallback callback,
735 TnyStatusCallback status_callback,
738 /* By default account protocols do not handle themselves the transfer */
743 modest_account_protocol_decode_part_to_stream_async (ModestAccountProtocol *self,
746 TnyMimePartCallback callback,
747 TnyStatusCallback status_callback,
750 return MODEST_ACCOUNT_PROTOCOL_GET_CLASS (self)->decode_part_to_stream_async (self,
759 modest_account_protocol_get_from (ModestAccountProtocol *self,
760 const gchar *account_id,
761 const gchar *mailbox)
763 return MODEST_ACCOUNT_PROTOCOL_GET_CLASS (self)->get_from (self, account_id, mailbox);
766 modest_account_protocol_get_from_default (ModestAccountProtocol *self,
767 const gchar *account_id,
768 const gchar *mailbox)
770 g_return_val_if_fail (MODEST_IS_ACCOUNT_PROTOCOL (self), NULL);
776 modest_account_protocol_get_from_list (ModestAccountProtocol *self,
777 const gchar *account_id)
779 return MODEST_ACCOUNT_PROTOCOL_GET_CLASS (self)->get_from_list (self, account_id);
781 static ModestPairList *
782 modest_account_protocol_get_from_list_default (ModestAccountProtocol *self,
783 const gchar *account_id)
785 g_return_val_if_fail (MODEST_IS_ACCOUNT_PROTOCOL (self), NULL);
791 modest_account_protocol_get_signature (ModestAccountProtocol *self,
792 const gchar *account_id,
793 const gchar *mailbox,
794 gboolean *has_signature)
796 return MODEST_ACCOUNT_PROTOCOL_GET_CLASS (self)->get_signature (self, account_id, mailbox, has_signature);
800 modest_account_protocol_get_signature_default (ModestAccountProtocol *self,
801 const gchar *account_id,
802 const gchar *mailbox,
803 gboolean *has_signature)
805 g_return_val_if_fail (MODEST_IS_ACCOUNT_PROTOCOL (self), NULL);
807 *has_signature = FALSE;
813 modest_account_protocol_get_icon (ModestAccountProtocol *self,
814 ModestAccountProtocolIconType icon_type,
818 return MODEST_ACCOUNT_PROTOCOL_GET_CLASS (self)->get_icon (self, icon_type, object, icon_size);
821 static const GdkPixbuf *
822 modest_account_protocol_get_icon_default (ModestAccountProtocol *self, ModestAccountProtocolIconType icon_type,
823 GObject *object, guint icon_size)
825 g_return_val_if_fail (MODEST_IS_ACCOUNT_PROTOCOL (self), NULL);
831 modest_account_protocol_get_service_name (ModestAccountProtocol *self,
832 const gchar *account_id,
833 const gchar *mailbox)
835 return MODEST_ACCOUNT_PROTOCOL_GET_CLASS (self)->get_service_name (self, account_id, mailbox);
839 modest_account_protocol_get_service_name_default (ModestAccountProtocol *self,
840 const gchar *account_id,
841 const gchar *mailbox)
843 g_return_val_if_fail (MODEST_IS_ACCOUNT_PROTOCOL (self), NULL);
849 modest_account_protocol_get_service_icon (ModestAccountProtocol *self,
850 const gchar *account_id,
851 const gchar *mailbox,
854 return MODEST_ACCOUNT_PROTOCOL_GET_CLASS (self)->get_service_icon (self, account_id, mailbox, icon_size);
857 static const GdkPixbuf *
858 modest_account_protocol_get_service_icon_default (ModestAccountProtocol *self,
859 const gchar *account_id,
860 const gchar *mailbox,
863 g_return_val_if_fail (MODEST_IS_ACCOUNT_PROTOCOL (self), NULL);
869 modest_account_protocol_save_remote_draft (ModestAccountProtocol *self,
870 const gchar *account_id,
873 ModestAccountProtocolSaveRemoteDraftCallback callback,
876 MODEST_ACCOUNT_PROTOCOL_GET_CLASS (self)->save_remote_draft (self, account_id,
882 modest_account_protocol_save_remote_draft_default (ModestAccountProtocol *self,
883 const gchar *account_id,
886 ModestAccountProtocolSaveRemoteDraftCallback callback,
890 callback (self, NULL, account_id, NULL, new_msg, old_msg, userdata);