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,
96 const gchar *stream_uri,
100 static gboolean modest_account_protocol_decode_part_to_stream_async_default (ModestAccountProtocol *protocol,
102 const gchar *stream_uri,
104 TnyMimePartCallback callback,
105 TnyStatusCallback status_callback,
107 static gboolean modest_account_protocol_is_supported_default (ModestAccountProtocol *self);
108 static gchar *modest_account_protocol_get_from_default (ModestAccountProtocol *self,
109 const gchar *account_id,
110 const gchar *mailbox);
111 static ModestPairList *modest_account_protocol_get_from_list_default (ModestAccountProtocol *self,
112 const gchar *account_id);
113 static gchar *modest_account_protocol_get_signature_default (ModestAccountProtocol *self,
114 const gchar *account_id,
115 const gchar *mailbox,
116 gboolean *has_signature);
117 static const GdkPixbuf *modest_account_protocol_get_icon_default (ModestAccountProtocol *self,
118 ModestAccountProtocolIconType icon_type,
122 static gchar *modest_account_protocol_get_service_name_default (ModestAccountProtocol *self,
123 const gchar *account_id,
124 const gchar *mailbox);
126 static const GdkPixbuf *modest_account_protocol_get_service_icon_default (ModestAccountProtocol *self,
127 const gchar *account_id,
128 const gchar *mailbox,
130 static void modest_account_protocol_save_remote_draft_default (ModestAccountProtocol *self,
131 const gchar *account_id,
134 ModestAccountProtocolSaveRemoteDraftCallback callback,
138 static GObjectClass *parent_class = NULL;
141 modest_account_protocol_get_type (void)
143 static GType my_type = 0;
146 static const GTypeInfo my_info = {
147 sizeof(ModestAccountProtocolClass),
148 NULL, /* base init */
149 NULL, /* base finalize */
150 (GClassInitFunc) modest_account_protocol_class_init,
151 NULL, /* class finalize */
152 NULL, /* class data */
153 sizeof(ModestAccountProtocol),
155 (GInstanceInitFunc) modest_account_protocol_instance_init,
159 my_type = g_type_register_static (MODEST_TYPE_PROTOCOL,
160 "ModestAccountProtocol",
167 modest_account_protocol_class_init (ModestAccountProtocolClass *klass)
169 GObjectClass *object_class;
170 ModestAccountProtocolClass *account_class;
172 object_class = (GObjectClass *) klass;
173 account_class = MODEST_ACCOUNT_PROTOCOL_CLASS (klass);
174 parent_class = g_type_class_peek_parent (klass);
175 object_class->finalize = modest_account_protocol_finalize;
176 object_class->set_property = modest_account_protocol_set_property;
177 object_class->get_property = modest_account_protocol_get_property;
179 g_object_class_install_property (object_class,
181 g_param_spec_uint ("port",
183 _("The standard port for the protocol"),
185 G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT));
187 g_object_class_install_property (object_class,
189 g_param_spec_uint ("alternate-port",
191 _("The alternate port for the protocol (usually used in SSL)"),
193 G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT));
195 g_object_class_install_property (object_class,
197 g_param_spec_gtype ("account-g-type",
198 _("Account factory GType"),
199 _("Account factory GType used for creating new instances."),
201 G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT));
203 g_type_class_add_private (object_class,
204 sizeof(ModestAccountProtocolPrivate));
206 /* Virtual methods */
207 account_class->create_account_settings_dialog =
208 modest_account_protocol_create_account_settings_dialog_default;
209 account_class->get_easysetupwizard_tabs =
210 modest_account_protocol_get_easysetupwizard_tabs_default;
211 account_class->save_settings =
212 modest_account_protocol_save_settings_default;
213 account_class->save_wizard_settings =
214 modest_account_protocol_save_wizard_settings_default;
215 account_class->create_account =
216 modest_account_protocol_create_account_default;
217 account_class->get_wizard_response_override =
218 modest_account_protocol_get_wizard_response_override_default;
219 account_class->is_supported =
220 modest_account_protocol_is_supported_default;
221 account_class->check_support =
222 modest_account_protocol_check_support_default;
223 account_class->cancel_check_support =
224 modest_account_protocol_cancel_check_support_default;
225 account_class->wizard_finished =
226 modest_account_protocol_wizard_finished_default;
227 account_class->decode_part_to_stream =
228 modest_account_protocol_decode_part_to_stream_default;
229 account_class->decode_part_to_stream_async =
230 modest_account_protocol_decode_part_to_stream_async_default;
231 account_class->get_from =
232 modest_account_protocol_get_from_default;
233 account_class->get_from_list =
234 modest_account_protocol_get_from_list_default;
235 account_class->get_signature =
236 modest_account_protocol_get_signature_default;
237 account_class->get_icon =
238 modest_account_protocol_get_icon_default;
239 account_class->get_service_name =
240 modest_account_protocol_get_service_name_default;
241 account_class->get_service_icon =
242 modest_account_protocol_get_service_icon_default;
243 account_class->save_remote_draft =
244 modest_account_protocol_save_remote_draft_default;
249 modest_account_protocol_instance_init (ModestAccountProtocol *obj)
251 ModestAccountProtocolPrivate *priv;
253 priv = MODEST_ACCOUNT_PROTOCOL_GET_PRIVATE (obj);
256 priv->alternate_port = 0;
257 priv->account_g_type = 0;
258 priv->account_options = tny_simple_list_new ();
259 priv->custom_auth_mechs = g_hash_table_new_full (g_direct_hash, g_direct_equal, NULL, g_free);
261 priv->account_dialogs = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL);
265 remove_account (const gchar *account_name, GObject *account, GObject *account_to_remove)
267 return (account == account_to_remove);
271 account_dialog_weak_handler (ModestAccountProtocol *self, GObject *where_the_object_was)
273 ModestAccountProtocolPrivate *priv = MODEST_ACCOUNT_PROTOCOL_GET_PRIVATE (self);
275 g_hash_table_foreach_remove (priv->account_dialogs, (GHRFunc) remove_account, where_the_object_was);
279 dialogs_remove (const gchar *account_name, GObject *account_dialog, ModestAccountProtocol *self)
281 g_object_weak_unref (account_dialog, (GWeakNotify) account_dialog_weak_handler, self);
287 modest_account_protocol_finalize (GObject *obj)
289 ModestAccountProtocol *protocol = MODEST_ACCOUNT_PROTOCOL (obj);
290 ModestAccountProtocolPrivate *priv = MODEST_ACCOUNT_PROTOCOL_GET_PRIVATE (protocol);
292 if (priv->account_dialogs) {
293 g_hash_table_foreach_remove (priv->account_dialogs, (GHRFunc) dialogs_remove, obj);
294 g_hash_table_destroy (priv->account_dialogs);
297 if (priv->account_options)
298 g_object_unref (priv->account_options);
299 priv->account_options = NULL;
301 if (priv->custom_auth_mechs)
302 g_hash_table_destroy (priv->custom_auth_mechs);
303 priv->custom_auth_mechs = NULL;
305 G_OBJECT_CLASS (parent_class)->finalize (obj);
309 modest_account_protocol_get_property (GObject *obj,
314 ModestAccountProtocol *protocol = MODEST_ACCOUNT_PROTOCOL (obj);
315 ModestAccountProtocolPrivate *priv = MODEST_ACCOUNT_PROTOCOL_GET_PRIVATE (protocol);
317 switch (property_id) {
319 g_value_set_uint (value, priv->port);
321 case PROP_ALTERNATE_PORT:
322 g_value_set_uint (value, priv->alternate_port);
324 case PROP_ACCOUNT_G_TYPE:
325 g_value_set_gtype (value, priv->account_g_type);
328 G_OBJECT_WARN_INVALID_PROPERTY_ID (obj, property_id, pspec);
334 modest_account_protocol_set_property (GObject *obj,
339 ModestAccountProtocol *protocol = MODEST_ACCOUNT_PROTOCOL (obj);
341 switch (property_id) {
343 modest_account_protocol_set_port (protocol, g_value_get_uint (value));
345 case PROP_ALTERNATE_PORT:
346 modest_account_protocol_set_alternate_port (protocol, g_value_get_uint (value));
348 case PROP_ACCOUNT_G_TYPE:
349 modest_account_protocol_set_account_g_type (protocol, g_value_get_gtype (value));
352 G_OBJECT_WARN_INVALID_PROPERTY_ID (obj, property_id, pspec);
359 modest_account_protocol_new (const gchar *name, const gchar *display_name,
360 guint port, guint alternate_port,
361 GType account_g_type)
363 return g_object_new (MODEST_TYPE_ACCOUNT_PROTOCOL,
364 "display-name", display_name, "name", name,
365 "port", port, "alternate-port", alternate_port,
366 "account-g-type", account_g_type,
371 modest_account_protocol_get_port (ModestAccountProtocol *self)
373 ModestAccountProtocolPrivate *priv;
375 g_return_val_if_fail (MODEST_IS_ACCOUNT_PROTOCOL (self), 0);
377 priv = MODEST_ACCOUNT_PROTOCOL_GET_PRIVATE (self);
382 modest_account_protocol_set_port (ModestAccountProtocol *self,
385 ModestAccountProtocolPrivate *priv;
387 g_return_if_fail (MODEST_IS_ACCOUNT_PROTOCOL (self));
389 priv = MODEST_ACCOUNT_PROTOCOL_GET_PRIVATE (self);
395 modest_account_protocol_get_alternate_port (ModestAccountProtocol *self)
397 ModestAccountProtocolPrivate *priv;
399 g_return_val_if_fail (MODEST_IS_ACCOUNT_PROTOCOL (self), 0);
401 priv = MODEST_ACCOUNT_PROTOCOL_GET_PRIVATE (self);
402 return priv->alternate_port;
406 modest_account_protocol_set_alternate_port (ModestAccountProtocol *self,
407 guint alternate_port)
409 ModestAccountProtocolPrivate *priv;
411 g_return_if_fail (MODEST_IS_ACCOUNT_PROTOCOL (self));
413 priv = MODEST_ACCOUNT_PROTOCOL_GET_PRIVATE (self);
414 priv->alternate_port = alternate_port;
418 modest_account_protocol_get_account_g_type (ModestAccountProtocol *self)
420 ModestAccountProtocolPrivate *priv;
422 g_return_val_if_fail (MODEST_IS_ACCOUNT_PROTOCOL (self), 0);
424 priv = MODEST_ACCOUNT_PROTOCOL_GET_PRIVATE (self);
425 return priv->account_g_type;
429 modest_account_protocol_get_account_options (ModestAccountProtocol *self)
432 ModestAccountProtocolPrivate *priv;
434 g_return_val_if_fail (MODEST_IS_ACCOUNT_PROTOCOL (self), NULL);
435 priv = MODEST_ACCOUNT_PROTOCOL_GET_PRIVATE (self);
437 result = tny_list_copy (priv->account_options);
443 modest_account_protocol_set_account_options (ModestAccountProtocol *self,
446 ModestAccountProtocolPrivate *priv;
448 g_return_if_fail (MODEST_IS_ACCOUNT_PROTOCOL (self));
449 priv = MODEST_ACCOUNT_PROTOCOL_GET_PRIVATE (self);
451 if (priv->account_options) {
452 g_object_unref (priv->account_options);
453 priv->account_options = NULL;
455 priv->account_options = tny_list_copy (list);
459 modest_account_protocol_has_custom_secure_auth_mech (ModestAccountProtocol *self,
460 ModestProtocolType auth_protocol_type)
462 ModestAccountProtocolPrivate *priv;
464 g_return_val_if_fail (MODEST_IS_ACCOUNT_PROTOCOL (self), FALSE);
465 priv = MODEST_ACCOUNT_PROTOCOL_GET_PRIVATE (self);
467 return g_hash_table_lookup_extended (priv->custom_auth_mechs, GINT_TO_POINTER (auth_protocol_type), NULL, NULL);
471 modest_account_protocol_get_custom_secure_auth_mech (ModestAccountProtocol *self,
472 ModestProtocolType auth_protocol_type)
474 ModestAccountProtocolPrivate *priv;
476 g_return_val_if_fail (MODEST_IS_ACCOUNT_PROTOCOL (self), NULL);
477 priv = MODEST_ACCOUNT_PROTOCOL_GET_PRIVATE (self);
479 return (const gchar *) g_hash_table_lookup (priv->custom_auth_mechs, GINT_TO_POINTER (auth_protocol_type));
483 modest_account_protocol_set_custom_secure_auth_mech (ModestAccountProtocol *self, ModestProtocolType auth_protocol_type, const gchar *secure_auth_mech)
485 ModestAccountProtocolPrivate *priv;
487 g_return_if_fail (MODEST_IS_ACCOUNT_PROTOCOL (self));
488 priv = MODEST_ACCOUNT_PROTOCOL_GET_PRIVATE (self);
490 g_hash_table_replace (priv->custom_auth_mechs, GINT_TO_POINTER (auth_protocol_type), g_strdup (secure_auth_mech));
494 modest_account_protocol_unset_custom_secure_auth_mech (ModestAccountProtocol *self, ModestProtocolType auth_protocol_type)
496 ModestAccountProtocolPrivate *priv;
498 g_return_if_fail (MODEST_IS_ACCOUNT_PROTOCOL (self));
499 priv = MODEST_ACCOUNT_PROTOCOL_GET_PRIVATE (self);
501 g_hash_table_remove (priv->custom_auth_mechs, GINT_TO_POINTER (auth_protocol_type));
506 modest_account_protocol_set_account_g_type (ModestAccountProtocol *self,
507 GType account_g_type)
509 ModestAccountProtocolPrivate *priv;
511 g_return_if_fail (MODEST_IS_ACCOUNT_PROTOCOL (self));
513 priv = MODEST_ACCOUNT_PROTOCOL_GET_PRIVATE (self);
514 priv->account_g_type = account_g_type;
518 modest_account_protocol_create_account_default (ModestAccountProtocol *self)
520 ModestAccountProtocolPrivate *priv;
522 g_return_val_if_fail (MODEST_IS_ACCOUNT_PROTOCOL (self), NULL);
524 priv = MODEST_ACCOUNT_PROTOCOL_GET_PRIVATE (self);
525 if (priv->account_g_type > 0) {
526 return g_object_new (priv->account_g_type, NULL);
533 modest_account_protocol_create_account (ModestAccountProtocol *self)
535 g_return_val_if_fail (MODEST_IS_ACCOUNT_PROTOCOL (self), NULL);
537 return MODEST_ACCOUNT_PROTOCOL_GET_CLASS (self)->create_account (self);
540 /* This is a template method for getting the account settings
541 dialog. It calls create_account_settings that must be implemented
542 by subclasses and then perform several common operations with the
544 ModestAccountSettingsDialog *
545 modest_account_protocol_get_account_settings_dialog (ModestAccountProtocol *self,
546 const gchar *account_name)
548 ModestAccountSettingsDialog *dialog;
549 ModestAccountSettings *settings;
550 ModestAccountProtocolPrivate *priv;
552 priv = MODEST_ACCOUNT_PROTOCOL_GET_PRIVATE (self);
553 dialog = g_hash_table_lookup (priv->account_dialogs, account_name);
555 if (dialog == NULL) {
557 dialog = MODEST_ACCOUNT_PROTOCOL_GET_CLASS (self)->create_account_settings_dialog (self);
559 /* Check existence of dialog */
564 settings = modest_account_mgr_load_account_settings (modest_runtime_get_account_mgr (),
566 modest_account_settings_dialog_load_settings (dialog, settings);
568 /* Close dialog on response */
569 g_signal_connect_swapped (dialog,
571 G_CALLBACK (gtk_widget_destroy),
574 g_hash_table_insert (priv->account_dialogs, g_strdup (account_name), dialog);
575 g_object_weak_ref (G_OBJECT (dialog), (GWeakNotify) account_dialog_weak_handler, self);
582 modest_account_protocol_get_easysetupwizard_tabs (ModestAccountProtocol *self)
584 return MODEST_ACCOUNT_PROTOCOL_GET_CLASS (self)->get_easysetupwizard_tabs (self);
589 modest_account_protocol_save_settings (ModestAccountProtocol *self,
590 ModestAccountSettingsDialog *dialog,
591 ModestAccountSettings *settings)
593 return MODEST_ACCOUNT_PROTOCOL_GET_CLASS (self)->save_settings (self, dialog, settings);
597 modest_account_protocol_save_wizard_settings (ModestAccountProtocol *self,
599 ModestAccountSettings *settings)
601 return MODEST_ACCOUNT_PROTOCOL_GET_CLASS (self)->save_wizard_settings (self, wizard_pages, settings);
604 /* Default implementations */
605 static ModestAccountSettingsDialog *
606 modest_account_protocol_create_account_settings_dialog_default (ModestAccountProtocol *self)
608 return modest_default_account_settings_dialog_new ();
611 static ModestPairList*
612 modest_account_protocol_get_easysetupwizard_tabs_default (ModestAccountProtocol *self)
614 g_warning ("You must implement get_easysetupwizard_tabs");
619 modest_account_protocol_save_settings_default (ModestAccountProtocol *self,
620 ModestAccountSettingsDialog *dialog,
621 ModestAccountSettings *settings)
623 g_return_if_fail (MODEST_IS_ACCOUNT_PROTOCOL (self));
624 g_return_if_fail (MODEST_IS_ACCOUNT_SETTINGS_DIALOG (dialog));
625 g_return_if_fail (MODEST_IS_ACCOUNT_SETTINGS (settings));
627 g_warning ("You must implement save_settings");
631 modest_account_protocol_save_wizard_settings_default (ModestAccountProtocol *self,
633 ModestAccountSettings *settings)
635 g_return_if_fail (MODEST_IS_ACCOUNT_PROTOCOL (self));
636 g_return_if_fail (wizard_pages);
637 g_return_if_fail (MODEST_IS_ACCOUNT_SETTINGS (settings));
639 g_warning ("You must implement save_wizard_settings");
642 static ModestWizardDialogResponseOverrideFunc
643 modest_account_protocol_get_wizard_response_override_default (ModestAccountProtocol *self)
645 g_return_val_if_fail (MODEST_IS_ACCOUNT_PROTOCOL (self), NULL);
650 ModestWizardDialogResponseOverrideFunc
651 modest_account_protocol_get_wizard_response_override (ModestAccountProtocol *self)
653 g_return_val_if_fail (MODEST_IS_ACCOUNT_PROTOCOL (self), NULL);
655 return MODEST_ACCOUNT_PROTOCOL_GET_CLASS (self)->get_wizard_response_override (self);
659 modest_account_protocol_is_supported_default (ModestAccountProtocol *self)
665 modest_account_protocol_is_supported (ModestAccountProtocol *self)
667 return MODEST_ACCOUNT_PROTOCOL_GET_CLASS (self)->is_supported (self);
671 modest_account_protocol_check_support_default (ModestAccountProtocol *self,
672 ModestAccountProtocolCheckSupportFunc func,
676 func (self, TRUE, userdata);
680 modest_account_protocol_check_support (ModestAccountProtocol *self,
681 ModestAccountProtocolCheckSupportFunc func,
684 MODEST_ACCOUNT_PROTOCOL_GET_CLASS (self)->check_support (self, func, userdata);
688 modest_account_protocol_cancel_check_support_default (ModestAccountProtocol *self)
694 modest_account_protocol_cancel_check_support (ModestAccountProtocol *self)
696 MODEST_ACCOUNT_PROTOCOL_GET_CLASS (self)->cancel_check_support (self);
700 modest_account_protocol_wizard_finished_default (ModestAccountProtocol *self)
706 modest_account_protocol_wizard_finished (ModestAccountProtocol *self)
708 MODEST_ACCOUNT_PROTOCOL_GET_CLASS (self)->wizard_finished (self);
712 modest_account_protocol_decode_part_to_stream_default (ModestAccountProtocol *self,
714 const gchar *stream_uri,
719 /* By default account protocols do not handle themselves the transfer */
724 modest_account_protocol_decode_part_to_stream (ModestAccountProtocol *self,
726 const gchar *stream_uri,
731 return MODEST_ACCOUNT_PROTOCOL_GET_CLASS (self)->decode_part_to_stream (self,
740 modest_account_protocol_decode_part_to_stream_async_default (ModestAccountProtocol *self,
742 const gchar *stream_uri,
744 TnyMimePartCallback callback,
745 TnyStatusCallback status_callback,
748 /* By default account protocols do not handle themselves the transfer */
753 modest_account_protocol_decode_part_to_stream_async (ModestAccountProtocol *self,
755 const gchar *stream_uri,
757 TnyMimePartCallback callback,
758 TnyStatusCallback status_callback,
761 return MODEST_ACCOUNT_PROTOCOL_GET_CLASS (self)->decode_part_to_stream_async (self,
771 modest_account_protocol_get_from (ModestAccountProtocol *self,
772 const gchar *account_id,
773 const gchar *mailbox)
775 return MODEST_ACCOUNT_PROTOCOL_GET_CLASS (self)->get_from (self, account_id, mailbox);
778 modest_account_protocol_get_from_default (ModestAccountProtocol *self,
779 const gchar *account_id,
780 const gchar *mailbox)
782 g_return_val_if_fail (MODEST_IS_ACCOUNT_PROTOCOL (self), NULL);
788 modest_account_protocol_get_from_list (ModestAccountProtocol *self,
789 const gchar *account_id)
791 return MODEST_ACCOUNT_PROTOCOL_GET_CLASS (self)->get_from_list (self, account_id);
793 static ModestPairList *
794 modest_account_protocol_get_from_list_default (ModestAccountProtocol *self,
795 const gchar *account_id)
797 g_return_val_if_fail (MODEST_IS_ACCOUNT_PROTOCOL (self), NULL);
803 modest_account_protocol_get_signature (ModestAccountProtocol *self,
804 const gchar *account_id,
805 const gchar *mailbox,
806 gboolean *has_signature)
808 return MODEST_ACCOUNT_PROTOCOL_GET_CLASS (self)->get_signature (self, account_id, mailbox, has_signature);
812 modest_account_protocol_get_signature_default (ModestAccountProtocol *self,
813 const gchar *account_id,
814 const gchar *mailbox,
815 gboolean *has_signature)
817 g_return_val_if_fail (MODEST_IS_ACCOUNT_PROTOCOL (self), NULL);
819 *has_signature = FALSE;
825 modest_account_protocol_get_icon (ModestAccountProtocol *self,
826 ModestAccountProtocolIconType icon_type,
830 return MODEST_ACCOUNT_PROTOCOL_GET_CLASS (self)->get_icon (self, icon_type, object, icon_size);
833 static const GdkPixbuf *
834 modest_account_protocol_get_icon_default (ModestAccountProtocol *self, ModestAccountProtocolIconType icon_type,
835 GObject *object, guint icon_size)
837 g_return_val_if_fail (MODEST_IS_ACCOUNT_PROTOCOL (self), NULL);
843 modest_account_protocol_get_service_name (ModestAccountProtocol *self,
844 const gchar *account_id,
845 const gchar *mailbox)
847 return MODEST_ACCOUNT_PROTOCOL_GET_CLASS (self)->get_service_name (self, account_id, mailbox);
851 modest_account_protocol_get_service_name_default (ModestAccountProtocol *self,
852 const gchar *account_id,
853 const gchar *mailbox)
855 g_return_val_if_fail (MODEST_IS_ACCOUNT_PROTOCOL (self), NULL);
861 modest_account_protocol_get_service_icon (ModestAccountProtocol *self,
862 const gchar *account_id,
863 const gchar *mailbox,
866 return MODEST_ACCOUNT_PROTOCOL_GET_CLASS (self)->get_service_icon (self, account_id, mailbox, icon_size);
869 static const GdkPixbuf *
870 modest_account_protocol_get_service_icon_default (ModestAccountProtocol *self,
871 const gchar *account_id,
872 const gchar *mailbox,
875 g_return_val_if_fail (MODEST_IS_ACCOUNT_PROTOCOL (self), NULL);
881 modest_account_protocol_save_remote_draft (ModestAccountProtocol *self,
882 const gchar *account_id,
885 ModestAccountProtocolSaveRemoteDraftCallback callback,
888 MODEST_ACCOUNT_PROTOCOL_GET_CLASS (self)->save_remote_draft (self, account_id,
894 modest_account_protocol_save_remote_draft_default (ModestAccountProtocol *self,
895 const gchar *account_id,
898 ModestAccountProtocolSaveRemoteDraftCallback callback,
902 callback (self, NULL, account_id, NULL, new_msg, old_msg, userdata);