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);
560 settings = modest_account_mgr_load_account_settings (modest_runtime_get_account_mgr (),
562 modest_account_settings_dialog_load_settings (dialog, settings);
564 /* Close dialog on response */
565 g_signal_connect_swapped (dialog,
567 G_CALLBACK (gtk_widget_destroy),
570 g_hash_table_insert (priv->account_dialogs, g_strdup (account_name), dialog);
571 g_object_weak_ref (G_OBJECT (dialog), (GWeakNotify) account_dialog_weak_handler, self);
578 modest_account_protocol_get_easysetupwizard_tabs (ModestAccountProtocol *self)
580 return MODEST_ACCOUNT_PROTOCOL_GET_CLASS (self)->get_easysetupwizard_tabs (self);
585 modest_account_protocol_save_settings (ModestAccountProtocol *self,
586 ModestAccountSettingsDialog *dialog,
587 ModestAccountSettings *settings)
589 return MODEST_ACCOUNT_PROTOCOL_GET_CLASS (self)->save_settings (self, dialog, settings);
593 modest_account_protocol_save_wizard_settings (ModestAccountProtocol *self,
595 ModestAccountSettings *settings)
597 return MODEST_ACCOUNT_PROTOCOL_GET_CLASS (self)->save_wizard_settings (self, wizard_pages, settings);
600 /* Default implementations */
601 static ModestAccountSettingsDialog *
602 modest_account_protocol_create_account_settings_dialog_default (ModestAccountProtocol *self)
604 return modest_default_account_settings_dialog_new ();
607 static ModestPairList*
608 modest_account_protocol_get_easysetupwizard_tabs_default (ModestAccountProtocol *self)
610 g_warning ("You must implement get_easysetupwizard_tabs");
615 modest_account_protocol_save_settings_default (ModestAccountProtocol *self,
616 ModestAccountSettingsDialog *dialog,
617 ModestAccountSettings *settings)
619 g_return_if_fail (MODEST_IS_ACCOUNT_PROTOCOL (self));
620 g_return_if_fail (MODEST_IS_ACCOUNT_SETTINGS_DIALOG (dialog));
621 g_return_if_fail (MODEST_IS_ACCOUNT_SETTINGS (settings));
623 g_warning ("You must implement save_settings");
627 modest_account_protocol_save_wizard_settings_default (ModestAccountProtocol *self,
629 ModestAccountSettings *settings)
631 g_return_if_fail (MODEST_IS_ACCOUNT_PROTOCOL (self));
632 g_return_if_fail (wizard_pages);
633 g_return_if_fail (MODEST_IS_ACCOUNT_SETTINGS (settings));
635 g_warning ("You must implement save_wizard_settings");
638 static ModestWizardDialogResponseOverrideFunc
639 modest_account_protocol_get_wizard_response_override_default (ModestAccountProtocol *self)
641 g_return_val_if_fail (MODEST_IS_ACCOUNT_PROTOCOL (self), NULL);
646 ModestWizardDialogResponseOverrideFunc
647 modest_account_protocol_get_wizard_response_override (ModestAccountProtocol *self)
649 g_return_val_if_fail (MODEST_IS_ACCOUNT_PROTOCOL (self), NULL);
651 return MODEST_ACCOUNT_PROTOCOL_GET_CLASS (self)->get_wizard_response_override (self);
655 modest_account_protocol_is_supported_default (ModestAccountProtocol *self)
661 modest_account_protocol_is_supported (ModestAccountProtocol *self)
663 return MODEST_ACCOUNT_PROTOCOL_GET_CLASS (self)->is_supported (self);
667 modest_account_protocol_check_support_default (ModestAccountProtocol *self,
668 ModestAccountProtocolCheckSupportFunc func,
672 func (self, TRUE, userdata);
676 modest_account_protocol_check_support (ModestAccountProtocol *self,
677 ModestAccountProtocolCheckSupportFunc func,
680 MODEST_ACCOUNT_PROTOCOL_GET_CLASS (self)->check_support (self, func, userdata);
684 modest_account_protocol_cancel_check_support_default (ModestAccountProtocol *self)
690 modest_account_protocol_cancel_check_support (ModestAccountProtocol *self)
692 MODEST_ACCOUNT_PROTOCOL_GET_CLASS (self)->cancel_check_support (self);
696 modest_account_protocol_wizard_finished_default (ModestAccountProtocol *self)
702 modest_account_protocol_wizard_finished (ModestAccountProtocol *self)
704 MODEST_ACCOUNT_PROTOCOL_GET_CLASS (self)->wizard_finished (self);
708 modest_account_protocol_decode_part_to_stream_default (ModestAccountProtocol *self,
710 const gchar *stream_uri,
715 /* By default account protocols do not handle themselves the transfer */
720 modest_account_protocol_decode_part_to_stream (ModestAccountProtocol *self,
722 const gchar *stream_uri,
727 return MODEST_ACCOUNT_PROTOCOL_GET_CLASS (self)->decode_part_to_stream (self,
736 modest_account_protocol_decode_part_to_stream_async_default (ModestAccountProtocol *self,
738 const gchar *stream_uri,
740 TnyMimePartCallback callback,
741 TnyStatusCallback status_callback,
744 /* By default account protocols do not handle themselves the transfer */
749 modest_account_protocol_decode_part_to_stream_async (ModestAccountProtocol *self,
751 const gchar *stream_uri,
753 TnyMimePartCallback callback,
754 TnyStatusCallback status_callback,
757 return MODEST_ACCOUNT_PROTOCOL_GET_CLASS (self)->decode_part_to_stream_async (self,
767 modest_account_protocol_get_from (ModestAccountProtocol *self,
768 const gchar *account_id,
769 const gchar *mailbox)
771 return MODEST_ACCOUNT_PROTOCOL_GET_CLASS (self)->get_from (self, account_id, mailbox);
774 modest_account_protocol_get_from_default (ModestAccountProtocol *self,
775 const gchar *account_id,
776 const gchar *mailbox)
778 g_return_val_if_fail (MODEST_IS_ACCOUNT_PROTOCOL (self), NULL);
784 modest_account_protocol_get_from_list (ModestAccountProtocol *self,
785 const gchar *account_id)
787 return MODEST_ACCOUNT_PROTOCOL_GET_CLASS (self)->get_from_list (self, account_id);
789 static ModestPairList *
790 modest_account_protocol_get_from_list_default (ModestAccountProtocol *self,
791 const gchar *account_id)
793 g_return_val_if_fail (MODEST_IS_ACCOUNT_PROTOCOL (self), NULL);
799 modest_account_protocol_get_signature (ModestAccountProtocol *self,
800 const gchar *account_id,
801 const gchar *mailbox,
802 gboolean *has_signature)
804 return MODEST_ACCOUNT_PROTOCOL_GET_CLASS (self)->get_signature (self, account_id, mailbox, has_signature);
808 modest_account_protocol_get_signature_default (ModestAccountProtocol *self,
809 const gchar *account_id,
810 const gchar *mailbox,
811 gboolean *has_signature)
813 g_return_val_if_fail (MODEST_IS_ACCOUNT_PROTOCOL (self), NULL);
815 *has_signature = FALSE;
821 modest_account_protocol_get_icon (ModestAccountProtocol *self,
822 ModestAccountProtocolIconType icon_type,
826 return MODEST_ACCOUNT_PROTOCOL_GET_CLASS (self)->get_icon (self, icon_type, object, icon_size);
829 static const GdkPixbuf *
830 modest_account_protocol_get_icon_default (ModestAccountProtocol *self, ModestAccountProtocolIconType icon_type,
831 GObject *object, guint icon_size)
833 g_return_val_if_fail (MODEST_IS_ACCOUNT_PROTOCOL (self), NULL);
839 modest_account_protocol_get_service_name (ModestAccountProtocol *self,
840 const gchar *account_id,
841 const gchar *mailbox)
843 return MODEST_ACCOUNT_PROTOCOL_GET_CLASS (self)->get_service_name (self, account_id, mailbox);
847 modest_account_protocol_get_service_name_default (ModestAccountProtocol *self,
848 const gchar *account_id,
849 const gchar *mailbox)
851 g_return_val_if_fail (MODEST_IS_ACCOUNT_PROTOCOL (self), NULL);
857 modest_account_protocol_get_service_icon (ModestAccountProtocol *self,
858 const gchar *account_id,
859 const gchar *mailbox,
862 return MODEST_ACCOUNT_PROTOCOL_GET_CLASS (self)->get_service_icon (self, account_id, mailbox, icon_size);
865 static const GdkPixbuf *
866 modest_account_protocol_get_service_icon_default (ModestAccountProtocol *self,
867 const gchar *account_id,
868 const gchar *mailbox,
871 g_return_val_if_fail (MODEST_IS_ACCOUNT_PROTOCOL (self), NULL);
877 modest_account_protocol_save_remote_draft (ModestAccountProtocol *self,
878 const gchar *account_id,
881 ModestAccountProtocolSaveRemoteDraftCallback callback,
884 MODEST_ACCOUNT_PROTOCOL_GET_CLASS (self)->save_remote_draft (self, account_id,
890 modest_account_protocol_save_remote_draft_default (ModestAccountProtocol *self,
891 const gchar *account_id,
894 ModestAccountProtocolSaveRemoteDraftCallback callback,
898 callback (self, NULL, account_id, NULL, new_msg, old_msg, userdata);