+
+gchar *
+modest_images_cache_get_id (const gchar *account, const gchar *uri)
+{
+ GnomeVFSURI *vfs_uri;
+ gchar *result;
+
+ vfs_uri = gnome_vfs_uri_new (uri);
+ if (vfs_uri == NULL)
+ return NULL;
+
+ result = g_strdup_printf ("%s__%x", account, gnome_vfs_uri_hash (vfs_uri));
+ gnome_vfs_uri_unref (vfs_uri);
+
+ return result;
+}
+
+gchar *
+modest_utils_get_account_name_from_recipient (const gchar *from_header)
+{
+ gchar *account_name = NULL;
+ ModestAccountMgr *mgr = NULL;
+ GSList *accounts = NULL, *node = NULL;
+
+ g_return_val_if_fail (from_header, NULL);
+
+ mgr = modest_runtime_get_account_mgr ();
+ accounts = modest_account_mgr_account_names (mgr, TRUE);
+
+ for (node = accounts; node != NULL; node = g_slist_next (node)) {
+ gchar *from =
+ modest_account_mgr_get_from_string (mgr, node->data);
+
+ if (from) {
+ gchar *from_email =
+ modest_text_utils_get_email_address (from);
+ gchar *from_header_email =
+ modest_text_utils_get_email_address (from_header);
+
+ if (from_email && from_header_email) {
+ if (!modest_text_utils_utf8_strcmp (from_header_email, from_email, TRUE)) {
+ account_name = g_strdup (node->data);
+ g_free (from);
+ g_free (from_email);
+ break;
+ }
+ }
+ g_free (from_email);
+ g_free (from_header_email);
+ g_free (from);
+ }
+ }
+ g_slist_foreach (accounts, (GFunc) g_free, NULL);
+ g_slist_free (accounts);
+
+ return account_name;
+}
+
+void
+modest_utils_on_entry_invalid_character (ModestValidatingEntry *self,
+ const gchar* character,
+ gpointer user_data)
+{
+ gchar *message = NULL;
+ const gchar *show_char = NULL;
+
+ if (character)
+ show_char = character;
+ else {
+ show_char = "' '";
+ }
+
+ message = g_strdup_printf (_CS("ckdg_ib_illegal_characters_entered"), show_char);
+ modest_platform_information_banner (GTK_WIDGET (self), NULL, message);
+ g_free (message);
+}