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,
98 static gboolean modest_account_protocol_decode_part_to_stream_async_default (ModestAccountProtocol *protocol,
101 TnyMimePartCallback callback,
102 TnyStatusCallback status_callback,
104 static gboolean modest_account_protocol_is_supported_default (ModestAccountProtocol *self);
105 static gchar *modest_account_protocol_get_from_default (ModestAccountProtocol *self,
106 const gchar *account_id,
107 const gchar *mailbox);
108 static ModestPairList *modest_account_protocol_get_from_list_default (ModestAccountProtocol *self,
109 const gchar *account_id);
110 static gchar *modest_account_protocol_get_signature_default (ModestAccountProtocol *self,
111 const gchar *account_id,
112 const gchar *mailbox,
113 gboolean *has_signature);
114 static const GdkPixbuf *modest_account_protocol_get_icon_default (ModestAccountProtocol *self,
115 ModestAccountProtocolIconType icon_type,
119 static gchar *modest_account_protocol_get_service_name_default (ModestAccountProtocol *self,
120 const gchar *account_id,
121 const gchar *mailbox);
123 static const GdkPixbuf *modest_account_protocol_get_service_icon_default (ModestAccountProtocol *self,
124 const gchar *account_id,
125 const gchar *mailbox,
127 static void modest_account_protocol_save_remote_draft_default (ModestAccountProtocol *self,
128 const gchar *account_id,
131 ModestAccountProtocolSaveRemoteDraftCallback callback,
135 static GObjectClass *parent_class = NULL;
138 modest_account_protocol_get_type (void)
140 static GType my_type = 0;
143 static const GTypeInfo my_info = {
144 sizeof(ModestAccountProtocolClass),
145 NULL, /* base init */
146 NULL, /* base finalize */
147 (GClassInitFunc) modest_account_protocol_class_init,
148 NULL, /* class finalize */
149 NULL, /* class data */
150 sizeof(ModestAccountProtocol),
152 (GInstanceInitFunc) modest_account_protocol_instance_init,
156 my_type = g_type_register_static (MODEST_TYPE_PROTOCOL,
157 "ModestAccountProtocol",
164 modest_account_protocol_class_init (ModestAccountProtocolClass *klass)
166 GObjectClass *object_class;
167 ModestAccountProtocolClass *account_class;
169 object_class = (GObjectClass *) klass;
170 account_class = MODEST_ACCOUNT_PROTOCOL_CLASS (klass);
171 parent_class = g_type_class_peek_parent (klass);
172 object_class->finalize = modest_account_protocol_finalize;
173 object_class->set_property = modest_account_protocol_set_property;
174 object_class->get_property = modest_account_protocol_get_property;
176 g_object_class_install_property (object_class,
178 g_param_spec_uint ("port",
180 _("The standard port for the protocol"),
182 G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT));
184 g_object_class_install_property (object_class,
186 g_param_spec_uint ("alternate-port",
188 _("The alternate port for the protocol (usually used in SSL)"),
190 G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT));
192 g_object_class_install_property (object_class,
194 g_param_spec_gtype ("account-g-type",
195 _("Account factory GType"),
196 _("Account factory GType used for creating new instances."),
198 G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT));
200 g_type_class_add_private (object_class,
201 sizeof(ModestAccountProtocolPrivate));
203 /* Virtual methods */
204 account_class->create_account_settings_dialog =
205 modest_account_protocol_create_account_settings_dialog_default;
206 account_class->get_easysetupwizard_tabs =
207 modest_account_protocol_get_easysetupwizard_tabs_default;
208 account_class->save_settings =
209 modest_account_protocol_save_settings_default;
210 account_class->save_wizard_settings =
211 modest_account_protocol_save_wizard_settings_default;
212 account_class->create_account =
213 modest_account_protocol_create_account_default;
214 account_class->get_wizard_response_override =
215 modest_account_protocol_get_wizard_response_override_default;
216 account_class->is_supported =
217 modest_account_protocol_is_supported_default;
218 account_class->check_support =
219 modest_account_protocol_check_support_default;
220 account_class->cancel_check_support =
221 modest_account_protocol_cancel_check_support_default;
222 account_class->wizard_finished =
223 modest_account_protocol_wizard_finished_default;
224 account_class->decode_part_to_stream =
225 modest_account_protocol_decode_part_to_stream_default;
226 account_class->decode_part_to_stream_async =
227 modest_account_protocol_decode_part_to_stream_async_default;
228 account_class->get_from =
229 modest_account_protocol_get_from_default;
230 account_class->get_from_list =
231 modest_account_protocol_get_from_list_default;
232 account_class->get_signature =
233 modest_account_protocol_get_signature_default;
234 account_class->get_icon =
235 modest_account_protocol_get_icon_default;
236 account_class->get_service_name =
237 modest_account_protocol_get_service_name_default;
238 account_class->get_service_icon =
239 modest_account_protocol_get_service_icon_default;
240 account_class->save_remote_draft =
241 modest_account_protocol_save_remote_draft_default;
246 modest_account_protocol_instance_init (ModestAccountProtocol *obj)
248 ModestAccountProtocolPrivate *priv;
250 priv = MODEST_ACCOUNT_PROTOCOL_GET_PRIVATE (obj);
253 priv->alternate_port = 0;
254 priv->account_g_type = 0;
255 priv->account_options = tny_simple_list_new ();
256 priv->custom_auth_mechs = g_hash_table_new_full (g_direct_hash, g_direct_equal, NULL, g_free);
258 priv->account_dialogs = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL);
262 remove_account (const gchar *account_name, GObject *account, GObject *account_to_remove)
264 return (account == account_to_remove);
268 account_dialog_weak_handler (ModestAccountProtocol *self, GObject *where_the_object_was)
270 ModestAccountProtocolPrivate *priv = MODEST_ACCOUNT_PROTOCOL_GET_PRIVATE (self);
272 g_hash_table_foreach_remove (priv->account_dialogs, (GHRFunc) remove_account, where_the_object_was);
276 dialogs_remove (const gchar *account_name, GObject *account_dialog, ModestAccountProtocol *self)
278 g_object_weak_unref (account_dialog, (GWeakNotify) account_dialog_weak_handler, self);
284 modest_account_protocol_finalize (GObject *obj)
286 ModestAccountProtocol *protocol = MODEST_ACCOUNT_PROTOCOL (obj);
287 ModestAccountProtocolPrivate *priv = MODEST_ACCOUNT_PROTOCOL_GET_PRIVATE (protocol);
289 if (priv->account_dialogs) {
290 g_hash_table_foreach_remove (priv->account_dialogs, (GHRFunc) dialogs_remove, obj);
291 g_hash_table_destroy (priv->account_dialogs);
294 if (priv->account_options)
295 g_object_unref (priv->account_options);
296 priv->account_options = NULL;
298 if (priv->custom_auth_mechs)
299 g_hash_table_destroy (priv->custom_auth_mechs);
300 priv->custom_auth_mechs = NULL;
302 G_OBJECT_CLASS (parent_class)->finalize (obj);
306 modest_account_protocol_get_property (GObject *obj,
311 ModestAccountProtocol *protocol = MODEST_ACCOUNT_PROTOCOL (obj);
312 ModestAccountProtocolPrivate *priv = MODEST_ACCOUNT_PROTOCOL_GET_PRIVATE (protocol);
314 switch (property_id) {
316 g_value_set_uint (value, priv->port);
318 case PROP_ALTERNATE_PORT:
319 g_value_set_uint (value, priv->alternate_port);
321 case PROP_ACCOUNT_G_TYPE:
322 g_value_set_gtype (value, priv->account_g_type);
325 G_OBJECT_WARN_INVALID_PROPERTY_ID (obj, property_id, pspec);
331 modest_account_protocol_set_property (GObject *obj,
336 ModestAccountProtocol *protocol = MODEST_ACCOUNT_PROTOCOL (obj);
338 switch (property_id) {
340 modest_account_protocol_set_port (protocol, g_value_get_uint (value));
342 case PROP_ALTERNATE_PORT:
343 modest_account_protocol_set_alternate_port (protocol, g_value_get_uint (value));
345 case PROP_ACCOUNT_G_TYPE:
346 modest_account_protocol_set_account_g_type (protocol, g_value_get_gtype (value));
349 G_OBJECT_WARN_INVALID_PROPERTY_ID (obj, property_id, pspec);
356 modest_account_protocol_new (const gchar *name, const gchar *display_name,
357 guint port, guint alternate_port,
358 GType account_g_type)
360 return g_object_new (MODEST_TYPE_ACCOUNT_PROTOCOL,
361 "display-name", display_name, "name", name,
362 "port", port, "alternate-port", alternate_port,
363 "account-g-type", account_g_type,
368 modest_account_protocol_get_port (ModestAccountProtocol *self)
370 ModestAccountProtocolPrivate *priv;
372 g_return_val_if_fail (MODEST_IS_ACCOUNT_PROTOCOL (self), 0);
374 priv = MODEST_ACCOUNT_PROTOCOL_GET_PRIVATE (self);
379 modest_account_protocol_set_port (ModestAccountProtocol *self,
382 ModestAccountProtocolPrivate *priv;
384 g_return_if_fail (MODEST_IS_ACCOUNT_PROTOCOL (self));
386 priv = MODEST_ACCOUNT_PROTOCOL_GET_PRIVATE (self);
392 modest_account_protocol_get_alternate_port (ModestAccountProtocol *self)
394 ModestAccountProtocolPrivate *priv;
396 g_return_val_if_fail (MODEST_IS_ACCOUNT_PROTOCOL (self), 0);
398 priv = MODEST_ACCOUNT_PROTOCOL_GET_PRIVATE (self);
399 return priv->alternate_port;
403 modest_account_protocol_set_alternate_port (ModestAccountProtocol *self,
404 guint alternate_port)
406 ModestAccountProtocolPrivate *priv;
408 g_return_if_fail (MODEST_IS_ACCOUNT_PROTOCOL (self));
410 priv = MODEST_ACCOUNT_PROTOCOL_GET_PRIVATE (self);
411 priv->alternate_port = alternate_port;
415 modest_account_protocol_get_account_g_type (ModestAccountProtocol *self)
417 ModestAccountProtocolPrivate *priv;
419 g_return_val_if_fail (MODEST_IS_ACCOUNT_PROTOCOL (self), 0);
421 priv = MODEST_ACCOUNT_PROTOCOL_GET_PRIVATE (self);
422 return priv->account_g_type;
426 modest_account_protocol_get_account_options (ModestAccountProtocol *self)
429 ModestAccountProtocolPrivate *priv;
431 g_return_val_if_fail (MODEST_IS_ACCOUNT_PROTOCOL (self), NULL);
432 priv = MODEST_ACCOUNT_PROTOCOL_GET_PRIVATE (self);
434 result = tny_list_copy (priv->account_options);
440 modest_account_protocol_set_account_options (ModestAccountProtocol *self,
443 ModestAccountProtocolPrivate *priv;
445 g_return_if_fail (MODEST_IS_ACCOUNT_PROTOCOL (self));
446 priv = MODEST_ACCOUNT_PROTOCOL_GET_PRIVATE (self);
448 if (priv->account_options) {
449 g_object_unref (priv->account_options);
450 priv->account_options = NULL;
452 priv->account_options = tny_list_copy (list);
456 modest_account_protocol_has_custom_secure_auth_mech (ModestAccountProtocol *self,
457 ModestProtocolType auth_protocol_type)
459 ModestAccountProtocolPrivate *priv;
461 g_return_val_if_fail (MODEST_IS_ACCOUNT_PROTOCOL (self), FALSE);
462 priv = MODEST_ACCOUNT_PROTOCOL_GET_PRIVATE (self);
464 return g_hash_table_lookup_extended (priv->custom_auth_mechs, GINT_TO_POINTER (auth_protocol_type), NULL, NULL);
468 modest_account_protocol_get_custom_secure_auth_mech (ModestAccountProtocol *self,
469 ModestProtocolType auth_protocol_type)
471 ModestAccountProtocolPrivate *priv;
473 g_return_val_if_fail (MODEST_IS_ACCOUNT_PROTOCOL (self), NULL);
474 priv = MODEST_ACCOUNT_PROTOCOL_GET_PRIVATE (self);
476 return (const gchar *) g_hash_table_lookup (priv->custom_auth_mechs, GINT_TO_POINTER (auth_protocol_type));
480 modest_account_protocol_set_custom_secure_auth_mech (ModestAccountProtocol *self, ModestProtocolType auth_protocol_type, const gchar *secure_auth_mech)
482 ModestAccountProtocolPrivate *priv;
484 g_return_if_fail (MODEST_IS_ACCOUNT_PROTOCOL (self));
485 priv = MODEST_ACCOUNT_PROTOCOL_GET_PRIVATE (self);
487 g_hash_table_replace (priv->custom_auth_mechs, GINT_TO_POINTER (auth_protocol_type), g_strdup (secure_auth_mech));
491 modest_account_protocol_unset_custom_secure_auth_mech (ModestAccountProtocol *self, ModestProtocolType auth_protocol_type)
493 ModestAccountProtocolPrivate *priv;
495 g_return_if_fail (MODEST_IS_ACCOUNT_PROTOCOL (self));
496 priv = MODEST_ACCOUNT_PROTOCOL_GET_PRIVATE (self);
498 g_hash_table_remove (priv->custom_auth_mechs, GINT_TO_POINTER (auth_protocol_type));
503 modest_account_protocol_set_account_g_type (ModestAccountProtocol *self,
504 GType account_g_type)
506 ModestAccountProtocolPrivate *priv;
508 g_return_if_fail (MODEST_IS_ACCOUNT_PROTOCOL (self));
510 priv = MODEST_ACCOUNT_PROTOCOL_GET_PRIVATE (self);
511 priv->account_g_type = account_g_type;
515 modest_account_protocol_create_account_default (ModestAccountProtocol *self)
517 ModestAccountProtocolPrivate *priv;
519 g_return_val_if_fail (MODEST_IS_ACCOUNT_PROTOCOL (self), NULL);
521 priv = MODEST_ACCOUNT_PROTOCOL_GET_PRIVATE (self);
522 if (priv->account_g_type > 0) {
523 return g_object_new (priv->account_g_type, NULL);
530 modest_account_protocol_create_account (ModestAccountProtocol *self)
532 g_return_val_if_fail (MODEST_IS_ACCOUNT_PROTOCOL (self), NULL);
534 return MODEST_ACCOUNT_PROTOCOL_GET_CLASS (self)->create_account (self);
537 /* This is a template method for getting the account settings
538 dialog. It calls create_account_settings that must be implemented
539 by subclasses and then perform several common operations with the
541 ModestAccountSettingsDialog *
542 modest_account_protocol_get_account_settings_dialog (ModestAccountProtocol *self,
543 const gchar *account_name)
545 ModestAccountSettingsDialog *dialog;
546 ModestAccountSettings *settings;
547 ModestAccountProtocolPrivate *priv;
549 priv = MODEST_ACCOUNT_PROTOCOL_GET_PRIVATE (self);
550 dialog = g_hash_table_lookup (priv->account_dialogs, account_name);
552 if (dialog == NULL) {
554 dialog = MODEST_ACCOUNT_PROTOCOL_GET_CLASS (self)->create_account_settings_dialog (self);
557 settings = modest_account_mgr_load_account_settings (modest_runtime_get_account_mgr (),
559 modest_account_settings_dialog_load_settings (dialog, settings);
561 /* Close dialog on response */
562 g_signal_connect_swapped (dialog,
564 G_CALLBACK (gtk_widget_destroy),
567 g_hash_table_insert (priv->account_dialogs, g_strdup (account_name), dialog);
568 g_object_weak_ref (G_OBJECT (dialog), (GWeakNotify) account_dialog_weak_handler, self);
575 modest_account_protocol_get_easysetupwizard_tabs (ModestAccountProtocol *self)
577 return MODEST_ACCOUNT_PROTOCOL_GET_CLASS (self)->get_easysetupwizard_tabs (self);
582 modest_account_protocol_save_settings (ModestAccountProtocol *self,
583 ModestAccountSettingsDialog *dialog,
584 ModestAccountSettings *settings)
586 return MODEST_ACCOUNT_PROTOCOL_GET_CLASS (self)->save_settings (self, dialog, settings);
590 modest_account_protocol_save_wizard_settings (ModestAccountProtocol *self,
592 ModestAccountSettings *settings)
594 return MODEST_ACCOUNT_PROTOCOL_GET_CLASS (self)->save_wizard_settings (self, wizard_pages, settings);
597 /* Default implementations */
598 static ModestAccountSettingsDialog *
599 modest_account_protocol_create_account_settings_dialog_default (ModestAccountProtocol *self)
601 return modest_default_account_settings_dialog_new ();
604 static ModestPairList*
605 modest_account_protocol_get_easysetupwizard_tabs_default (ModestAccountProtocol *self)
607 g_warning ("You must implement get_easysetupwizard_tabs");
612 modest_account_protocol_save_settings_default (ModestAccountProtocol *self,
613 ModestAccountSettingsDialog *dialog,
614 ModestAccountSettings *settings)
616 g_return_if_fail (MODEST_IS_ACCOUNT_PROTOCOL (self));
617 g_return_if_fail (MODEST_IS_ACCOUNT_SETTINGS_DIALOG (dialog));
618 g_return_if_fail (MODEST_IS_ACCOUNT_SETTINGS (settings));
620 g_warning ("You must implement save_settings");
624 modest_account_protocol_save_wizard_settings_default (ModestAccountProtocol *self,
626 ModestAccountSettings *settings)
628 g_return_if_fail (MODEST_IS_ACCOUNT_PROTOCOL (self));
629 g_return_if_fail (wizard_pages);
630 g_return_if_fail (MODEST_IS_ACCOUNT_SETTINGS (settings));
632 g_warning ("You must implement save_wizard_settings");
635 static ModestWizardDialogResponseOverrideFunc
636 modest_account_protocol_get_wizard_response_override_default (ModestAccountProtocol *self)
638 g_return_val_if_fail (MODEST_IS_ACCOUNT_PROTOCOL (self), NULL);
643 ModestWizardDialogResponseOverrideFunc
644 modest_account_protocol_get_wizard_response_override (ModestAccountProtocol *self)
646 g_return_val_if_fail (MODEST_IS_ACCOUNT_PROTOCOL (self), NULL);
648 return MODEST_ACCOUNT_PROTOCOL_GET_CLASS (self)->get_wizard_response_override (self);
652 modest_account_protocol_is_supported_default (ModestAccountProtocol *self)
658 modest_account_protocol_is_supported (ModestAccountProtocol *self)
660 return MODEST_ACCOUNT_PROTOCOL_GET_CLASS (self)->is_supported (self);
664 modest_account_protocol_check_support_default (ModestAccountProtocol *self,
665 ModestAccountProtocolCheckSupportFunc func,
669 func (self, TRUE, userdata);
673 modest_account_protocol_check_support (ModestAccountProtocol *self,
674 ModestAccountProtocolCheckSupportFunc func,
677 MODEST_ACCOUNT_PROTOCOL_GET_CLASS (self)->check_support (self, func, userdata);
681 modest_account_protocol_cancel_check_support_default (ModestAccountProtocol *self)
687 modest_account_protocol_cancel_check_support (ModestAccountProtocol *self)
689 MODEST_ACCOUNT_PROTOCOL_GET_CLASS (self)->cancel_check_support (self);
693 modest_account_protocol_wizard_finished_default (ModestAccountProtocol *self)
699 modest_account_protocol_wizard_finished (ModestAccountProtocol *self)
701 MODEST_ACCOUNT_PROTOCOL_GET_CLASS (self)->wizard_finished (self);
705 modest_account_protocol_decode_part_to_stream_default (ModestAccountProtocol *self,
710 /* By default account protocols do not handle themselves the transfer */
715 modest_account_protocol_decode_part_to_stream (ModestAccountProtocol *self,
720 return MODEST_ACCOUNT_PROTOCOL_GET_CLASS (self)->decode_part_to_stream (self,
727 modest_account_protocol_decode_part_to_stream_async_default (ModestAccountProtocol *self,
730 TnyMimePartCallback callback,
731 TnyStatusCallback status_callback,
734 /* By default account protocols do not handle themselves the transfer */
739 modest_account_protocol_decode_part_to_stream_async (ModestAccountProtocol *self,
742 TnyMimePartCallback callback,
743 TnyStatusCallback status_callback,
746 return MODEST_ACCOUNT_PROTOCOL_GET_CLASS (self)->decode_part_to_stream_async (self,
755 modest_account_protocol_get_from (ModestAccountProtocol *self,
756 const gchar *account_id,
757 const gchar *mailbox)
759 return MODEST_ACCOUNT_PROTOCOL_GET_CLASS (self)->get_from (self, account_id, mailbox);
762 modest_account_protocol_get_from_default (ModestAccountProtocol *self,
763 const gchar *account_id,
764 const gchar *mailbox)
766 g_return_val_if_fail (MODEST_IS_ACCOUNT_PROTOCOL (self), NULL);
772 modest_account_protocol_get_from_list (ModestAccountProtocol *self,
773 const gchar *account_id)
775 return MODEST_ACCOUNT_PROTOCOL_GET_CLASS (self)->get_from_list (self, account_id);
777 static ModestPairList *
778 modest_account_protocol_get_from_list_default (ModestAccountProtocol *self,
779 const gchar *account_id)
781 g_return_val_if_fail (MODEST_IS_ACCOUNT_PROTOCOL (self), NULL);
787 modest_account_protocol_get_signature (ModestAccountProtocol *self,
788 const gchar *account_id,
789 const gchar *mailbox,
790 gboolean *has_signature)
792 return MODEST_ACCOUNT_PROTOCOL_GET_CLASS (self)->get_signature (self, account_id, mailbox, has_signature);
796 modest_account_protocol_get_signature_default (ModestAccountProtocol *self,
797 const gchar *account_id,
798 const gchar *mailbox,
799 gboolean *has_signature)
801 g_return_val_if_fail (MODEST_IS_ACCOUNT_PROTOCOL (self), NULL);
803 *has_signature = FALSE;
809 modest_account_protocol_get_icon (ModestAccountProtocol *self,
810 ModestAccountProtocolIconType icon_type,
814 return MODEST_ACCOUNT_PROTOCOL_GET_CLASS (self)->get_icon (self, icon_type, object, icon_size);
817 static const GdkPixbuf *
818 modest_account_protocol_get_icon_default (ModestAccountProtocol *self, ModestAccountProtocolIconType icon_type,
819 GObject *object, guint icon_size)
821 g_return_val_if_fail (MODEST_IS_ACCOUNT_PROTOCOL (self), NULL);
827 modest_account_protocol_get_service_name (ModestAccountProtocol *self,
828 const gchar *account_id,
829 const gchar *mailbox)
831 return MODEST_ACCOUNT_PROTOCOL_GET_CLASS (self)->get_service_name (self, account_id, mailbox);
835 modest_account_protocol_get_service_name_default (ModestAccountProtocol *self,
836 const gchar *account_id,
837 const gchar *mailbox)
839 g_return_val_if_fail (MODEST_IS_ACCOUNT_PROTOCOL (self), NULL);
845 modest_account_protocol_get_service_icon (ModestAccountProtocol *self,
846 const gchar *account_id,
847 const gchar *mailbox,
850 return MODEST_ACCOUNT_PROTOCOL_GET_CLASS (self)->get_service_icon (self, account_id, mailbox, icon_size);
853 static const GdkPixbuf *
854 modest_account_protocol_get_service_icon_default (ModestAccountProtocol *self,
855 const gchar *account_id,
856 const gchar *mailbox,
859 g_return_val_if_fail (MODEST_IS_ACCOUNT_PROTOCOL (self), NULL);
865 modest_account_protocol_save_remote_draft (ModestAccountProtocol *self,
866 const gchar *account_id,
869 ModestAccountProtocolSaveRemoteDraftCallback callback,
872 MODEST_ACCOUNT_PROTOCOL_GET_CLASS (self)->save_remote_draft (self, account_id,
878 modest_account_protocol_save_remote_draft_default (ModestAccountProtocol *self,
879 const gchar *account_id,
882 ModestAccountProtocolSaveRemoteDraftCallback callback,
886 callback (self, NULL, account_id, NULL, new_msg, old_msg, userdata);