aboutsummaryrefslogtreecommitdiffstats
path: root/mail/mail-ops.c
diff options
context:
space:
mode:
authorJeffrey Stedfast <fejj@helixcode.com>2000-06-30 06:02:10 +0800
committerJeffrey Stedfast <fejj@src.gnome.org>2000-06-30 06:02:10 +0800
commitfa91d3e6a77644bd487c9b74a862110baa763c19 (patch)
treeb75de316109dcb6a64d7400880c21cadbfeaa7d6 /mail/mail-ops.c
parent06b295079c5daccce7cb3cd1f50d15a8ba9fc6ab (diff)
downloadgsoc2013-evolution-fa91d3e6a77644bd487c9b74a862110baa763c19.tar
gsoc2013-evolution-fa91d3e6a77644bd487c9b74a862110baa763c19.tar.gz
gsoc2013-evolution-fa91d3e6a77644bd487c9b74a862110baa763c19.tar.bz2
gsoc2013-evolution-fa91d3e6a77644bd487c9b74a862110baa763c19.tar.lz
gsoc2013-evolution-fa91d3e6a77644bd487c9b74a862110baa763c19.tar.xz
gsoc2013-evolution-fa91d3e6a77644bd487c9b74a862110baa763c19.tar.zst
gsoc2013-evolution-fa91d3e6a77644bd487c9b74a862110baa763c19.zip
Clean up compile warnings (real_fetch_mail): Fetching from IMAP should do
2000-06-29 Jeffrey Stedfast <fejj@helixcode.com> * mail-ops.c (delete_msg): Clean up compile warnings (real_fetch_mail): Fetching from IMAP should do nothing svn path=/trunk/; revision=3811
Diffstat (limited to 'mail/mail-ops.c')
-rw-r--r--mail/mail-ops.c224
1 files changed, 111 insertions, 113 deletions
diff --git a/mail/mail-ops.c b/mail/mail-ops.c
index b237c3db32..53c1294fc4 100644
--- a/mail/mail-ops.c
+++ b/mail/mail-ops.c
@@ -134,19 +134,23 @@ real_fetch_mail (gpointer user_data )
info = (rfm_t *) user_data;
fb = info->fb;
url = info->source_url;
-
+
path = CAMEL_SERVICE (fb->folder->parent_store)->url->path;
ex = camel_exception_new ();
tmp_mbox = g_strdup_printf ("%s/movemail", path);
+ /* If using IMAP, don't do anything... */
+ if (!strncmp (url, "imap:", 5))
+ goto cleanup;
+
/* If fetching mail from an mbox store, safely copy it to a
* temporary store first.
*/
if (!strncmp (url, "mbox:", 5)) {
int tmpfd;
- printf("moving from a local mbox\n");
+ printf ("moving from a local mbox\n");
tmpfd = open (tmp_mbox, O_RDWR | O_CREAT | O_APPEND, S_IRUSR | S_IWUSR);
@@ -208,7 +212,7 @@ real_fetch_mail (gpointer user_data )
GPtrArray *uids;
int i;
- printf("folder isn't searchable, performing movemail ...\n");
+ printf ("folder isn't searchable, performing movemail ...\n");
folder = camel_store_get_folder (fb->folder->parent_store,
strrchr (tmp_mbox, '/') + 1,
@@ -222,31 +226,32 @@ real_fetch_mail (gpointer user_data )
printf("got %d messages in source\n", uids->len);
for (i = 0; i < uids->len; i++) {
CamelMimeMessage *msg;
+
printf("copying message %d to dest\n", i + 1);
msg = camel_folder_get_message_by_uid (sourcefolder, uids->pdata[i], ex);
if (camel_exception_get_id (ex) != CAMEL_EXCEPTION_NONE) {
async_mail_exception_dialog ("Unable to read message", ex, fb);
- gtk_object_unref((GtkObject *)msg);
- gtk_object_unref((GtkObject *)sourcefolder);
+ gtk_object_unref (GTK_OBJECT (msg));
+ gtk_object_unref (GTK_OBJECT (sourcefolder));
goto cleanup;
}
camel_folder_append_message (folder, msg, ex);
if (camel_exception_get_id (ex) != CAMEL_EXCEPTION_NONE) {
async_mail_exception_dialog ("Unable to write message", ex, fb);
- gtk_object_unref((GtkObject *)msg);
- gtk_object_unref((GtkObject *)sourcefolder);
+ gtk_object_unref (GTK_OBJECT (msg));
+ gtk_object_unref (GTK_OBJECT (sourcefolder));
goto cleanup;
}
- camel_folder_delete_message_by_uid(sourcefolder, uids->pdata[i], ex);
- gtk_object_unref((GtkObject *)msg);
+ camel_folder_delete_message_by_uid (sourcefolder, uids->pdata[i], ex);
+ gtk_object_unref(GTK_OBJECT (msg));
}
camel_folder_free_uids (sourcefolder, uids);
camel_folder_sync (sourcefolder, TRUE, ex);
if (camel_exception_is_set (ex))
async_mail_exception_dialog ("", ex, fb);
- gtk_object_unref((GtkObject *)sourcefolder);
+ gtk_object_unref (GTK_OBJECT (sourcefolder));
} else {
printf("we can search on this folder, performing search!\n");
folder = sourcefolder;
@@ -264,15 +269,15 @@ real_fetch_mail (gpointer user_data )
folder_browser_clear_search (fb);
/* apply filtering rules to this inbox */
- filter = filter_driver_new();
+ filter = filter_driver_new ();
userrules = g_strdup_printf ("%s/filters.xml", evolution_dir);
- systemrules = g_strdup_printf("%s/evolution/filtertypes.xml", EVOLUTION_DATADIR);
- filter_driver_set_rules(filter, systemrules, userrules);
- filter_driver_set_session(filter, session);
- g_free(userrules);
- g_free(systemrules);
+ systemrules = g_strdup_printf ("%s/evolution/filtertypes.xml", EVOLUTION_DATADIR);
+ filter_driver_set_rules (filter, systemrules, userrules);
+ filter_driver_set_session (filter, session);
+ g_free (userrules);
+ g_free (systemrules);
- if (filter_driver_run(filter, folder, fb->folder) == -1) {
+ if (filter_driver_run (filter, folder, fb->folder) == -1) {
async_mail_exception_dialog ("Unable to get new mail", ex, fb);
goto cleanup;
}
@@ -330,13 +335,13 @@ fetch_mail (GtkWidget *button, gpointer user_data)
* would probably work.
*/
- info = g_new( rfm_t, 1 );
- info->fb = FOLDER_BROWSER( user_data );
+ info = g_new (rfm_t, 1);
+ info->fb = FOLDER_BROWSER (user_data);
info->source_url = url;
#ifdef USE_BROKEN_THREADS
- mail_operation_try( _("Fetching mail"), real_fetch_mail, NULL, info );
+ mail_operation_try (_("Fetching mail"), real_fetch_mail, NULL, info);
#else
- real_fetch_mail( info );
+ real_fetch_mail (info);
#endif
}
@@ -360,7 +365,7 @@ ask_confirm_for_empty_subject (EMsgComposer *composer)
}
static void
-real_send_mail( gpointer user_data )
+real_send_mail (gpointer user_data)
{
rsm_t *info = (rsm_t *) user_data;
EMsgComposer *composer = NULL;
@@ -372,8 +377,8 @@ real_send_mail( gpointer user_data )
struct post_send_data *psd = NULL;
#ifdef USE_BROKEN_THREADS
- mail_op_hide_progressbar();
- mail_op_set_message( "Connecting to transport..." );
+ mail_op_hide_progressbar ();
+ mail_op_set_message ("Connecting to transport...");
#endif
ex = camel_exception_new ();
@@ -392,7 +397,7 @@ real_send_mail( gpointer user_data )
camel_service_connect (CAMEL_SERVICE (transport), ex);
#ifdef USE_BROKEN_THREADS
- mail_op_set_message( "Connected. Sending..." );
+ mail_op_set_message ("Connected. Sending...");
#endif
if (!camel_exception_is_set (ex))
@@ -400,7 +405,7 @@ real_send_mail( gpointer user_data )
if (!camel_exception_is_set (ex)) {
#ifdef USE_BROKEN_THREADS
- mail_op_set_message( "Sent. Disconnecting..." );
+ mail_op_set_message ("Sent. Disconnecting...");
#endif
camel_service_disconnect (CAMEL_SERVICE (transport), ex);
}
@@ -425,16 +430,16 @@ real_send_mail( gpointer user_data )
}
static void
-cleanup_send_mail( gpointer userdata )
+cleanup_send_mail (gpointer userdata)
{
rsm_t *info = (rsm_t *) userdata;
- if( info->ok ) {
+ if (info->ok) {
gtk_object_destroy (GTK_OBJECT (info->composer));
}
gtk_object_unref (GTK_OBJECT (info->message));
- g_free( info );
+ g_free (info);
}
static void
@@ -454,13 +459,11 @@ composer_send_cb (EMsgComposer *composer, gpointer data)
if (!from) {
CamelInternetAddress *ciaddr;
- path = g_strdup_printf ("=%s/config=/mail/id_name",
- evolution_dir);
+ path = g_strdup_printf ("=%s/config=/mail/id_name", evolution_dir);
name = gnome_config_get_string (path);
g_assert (name);
g_free (path);
- path = g_strdup_printf ("=%s/config=/mail/id_addr",
- evolution_dir);
+ path = g_strdup_printf ("=%s/config=/mail/id_addr", evolution_dir);
addr = gnome_config_get_string (path);
g_assert (addr);
g_free (path);
@@ -499,7 +502,7 @@ composer_send_cb (EMsgComposer *composer, gpointer data)
}
}
- info = g_new0( rsm_t, 1 );
+ info = g_new0 (rsm_t, 1);
info->composer = composer;
info->transport = transport;
info->message = message;
@@ -508,10 +511,10 @@ composer_send_cb (EMsgComposer *composer, gpointer data)
info->psd = psd;
#ifdef USE_BROKEN_THREADS
- mail_operation_try( "Send Message", real_send_mail, cleanup_send_mail, info );
+ mail_operation_try ("Send Message", real_send_mail, cleanup_send_mail, info);
#else
- real_send_mail( info );
- cleanup_send_mail( info );
+ real_send_mail (info);
+ cleanup_send_mail (info);
#endif
}
@@ -570,8 +573,7 @@ reply (FolderBrowser *fb, gboolean to_all)
psd->uid = fb->message_list->selected_uid;
psd->flags = CAMEL_MESSAGE_ANSWERED;
- composer = mail_generate_reply (fb->mail_display->current_message,
- to_all);
+ composer = mail_generate_reply (fb->mail_display->current_message, to_all);
gtk_signal_connect (GTK_OBJECT (composer), "send",
GTK_SIGNAL_FUNC (composer_send_cb), psd);
@@ -593,16 +595,15 @@ reply_to_all (GtkWidget *button, gpointer user_data)
reply (FOLDER_BROWSER (user_data), TRUE);
}
-
void
forward_msg (GtkWidget *button, gpointer user_data)
{
FolderBrowser *fb;
EMsgComposer *composer;
-
+
if (!check_configured ())
return;
-
+
fb = FOLDER_BROWSER (user_data);
composer = mail_generate_forward (fb->mail_display->current_message,
TRUE, TRUE);
@@ -614,7 +615,7 @@ forward_msg (GtkWidget *button, gpointer user_data)
}
static void
-real_delete_msg( int model_row, gpointer user_data )
+real_delete_msg (int model_row, gpointer user_data)
{
FolderBrowser *fb = user_data;
MessageList *ml = fb->message_list;
@@ -623,7 +624,7 @@ real_delete_msg( int model_row, gpointer user_data )
camel_exception_init (&ex);
- g_assert( model_row < ml->summary_table->len );
+ g_assert (model_row < ml->summary_table->len);
info = ml->summary_table->pdata[model_row];
/* Toggle the deleted flag without touching other flags. */
@@ -632,12 +633,10 @@ real_delete_msg( int model_row, gpointer user_data )
~(info->flags), &ex);
if (camel_exception_is_set (&ex)) {
- mail_exception_dialog ("Could not toggle deleted flag",
- &ex, fb);
+ mail_exception_dialog ("Could not toggle deleted flag", &ex, fb);
camel_exception_clear (&ex);
return;
}
-
}
void
@@ -645,9 +644,9 @@ delete_msg (GtkWidget *button, gpointer user_data)
{
FolderBrowser *fb = user_data;
MessageList *ml = fb->message_list;
- int cursor = e_table_get_cursor_row(ml->etable);
+ int cursor = e_table_get_cursor_row (E_TABLE (ml->etable));
- e_table_selected_row_foreach( ml->etable, real_delete_msg, fb );
+ e_table_selected_row_foreach (E_TABLE (ml->etable), real_delete_msg, fb);
/* Move the cursor down a row... FIXME: should skip other
* deleted messages. FIXME: this implementation is a bit
* questionable
@@ -655,19 +654,19 @@ delete_msg (GtkWidget *button, gpointer user_data)
e_table_set_cursor_row (E_TABLE (ml->etable), cursor + 1);
}
-static void real_expunge_folder( gpointer user_data )
+static void real_expunge_folder (gpointer user_data)
{
- FolderBrowser *fb = FOLDER_BROWSER(user_data);
+ FolderBrowser *fb = FOLDER_BROWSER (user_data);
CamelException ex;
#ifdef USE_BROKEN_THREADS
- mail_op_hide_progressbar();
- mail_op_set_message( "Expunging %s...", fb->message_list->folder->full_name );
+ mail_op_hide_progressbar ();
+ mail_op_set_message ("Expunging %s...", fb->message_list->folder->full_name);
#endif
- camel_exception_init(&ex);
+ camel_exception_init (&ex);
- camel_folder_expunge(fb->message_list->folder, &ex);
+ camel_folder_expunge (fb->message_list->folder, &ex);
/* FIXME: is there a better way to force an update? */
/* FIXME: Folder should raise a signal to say its contents has changed ... */
@@ -685,61 +684,62 @@ expunge_folder (BonoboUIHandler *uih, void *user_data, const char *path)
if (fb->message_list->folder) {
#ifdef USE_BROKEN_THREADS
- mail_operation_try( "Expunge Folder", real_expunge_folder, NULL, fb );
+ mail_operation_try ("Expunge Folder", real_expunge_folder, NULL, fb);
#else
- real_expunge_folder( fb );
+ real_expunge_folder (fb);
#endif
}
}
static void
-filter_druid_clicked(FilterEditor *fe, int button, FolderBrowser *fb)
+filter_druid_clicked (FilterEditor *fe, int button, FolderBrowser *fb)
{
- printf("closing dialog\n");
+ printf ("closing dialog\n");
if (button == 0) {
char *user;
user = g_strdup_printf ("%s/filters.xml", evolution_dir);
- filter_editor_save_rules(fe, user);
- printf("saving filter options to '%s'\n", user);
- g_free(user);
+ filter_editor_save_rules (fe, user);
+ printf ("saving filter options to '%s'\n", user);
+ g_free (user);
}
+
if (button != -1) {
- gnome_dialog_close((GnomeDialog *)fe);
+ gnome_dialog_close (GNOME_DIALOG (fe));
}
}
void
filter_edit (BonoboUIHandler *uih, void *user_data, const char *path)
{
- FolderBrowser *fb = FOLDER_BROWSER(user_data);
+ FolderBrowser *fb = FOLDER_BROWSER (user_data);
FilterEditor *fe;
char *user, *system;
- printf("Editing filters ...\n");
- fe = filter_editor_new();
+ printf ("Editing filters ...\n");
+ fe = filter_editor_new ();
user = g_strdup_printf ("%s/filters.xml", evolution_dir);
- system = g_strdup_printf("%s/evolution/filtertypes.xml", EVOLUTION_DATADIR);
- filter_editor_set_rule_files(fe, system, user);
- g_free(user);
- g_free(system);
- gnome_dialog_append_buttons((GnomeDialog *)fe, GNOME_STOCK_BUTTON_OK, GNOME_STOCK_BUTTON_CANCEL, 0);
- gtk_signal_connect((GtkObject *)fe, "clicked", filter_druid_clicked, fb);
- gtk_widget_show((GtkWidget *)fe);
+ system = g_strdup_printf ("%s/evolution/filtertypes.xml", EVOLUTION_DATADIR);
+ filter_editor_set_rule_files (fe, system, user);
+ g_free (user);
+ g_free (system);
+ gnome_dialog_append_buttons (GNOME_DIALOG (fe), GNOME_STOCK_BUTTON_OK, GNOME_STOCK_BUTTON_CANCEL, 0);
+ gtk_signal_connect (GTK_OBJECT (fe), "clicked", filter_druid_clicked, fb);
+ gtk_widget_show (GTK_OBJECT (fe));
}
static void
vfolder_editor_clicked(FilterEditor *fe, int button, FolderBrowser *fb)
{
- printf("closing dialog\n");
+ printf ("closing dialog\n");
if (button == 0) {
char *user;
user = g_strdup_printf ("%s/vfolders.xml", evolution_dir);
- filter_editor_save_rules(fe, user);
- printf("saving vfolders to '%s'\n", user);
- g_free(user);
+ filter_editor_save_rules (fe, user);
+ printf ("saving vfolders to '%s'\n", user);
+ g_free (user);
/* FIXME: this is also not the way to do this, see also
component-factory.c */
@@ -750,72 +750,70 @@ vfolder_editor_clicked(FilterEditor *fe, int button, FolderBrowser *fb)
char *user, *system;
extern char *evolution_dir;
- storage = gtk_object_get_data((GtkObject *)fb, "e-storage");
+ storage = gtk_object_get_data (GTK_OBJECT (fb), "e-storage");
- fe = filter_driver_new();
+ fe = filter_driver_new ();
user = g_strdup_printf ("%s/vfolders.xml", evolution_dir);
- system = g_strdup_printf("%s/evolution/vfoldertypes.xml", EVOLUTION_DATADIR);
- filter_driver_set_rules(fe, system, user);
- g_free(user);
- g_free(system);
- count = filter_driver_rule_count(fe);
- for (i=0;i<count;i++) {
+ system = g_strdup_printf ("%s/evolution/vfoldertypes.xml", EVOLUTION_DATADIR);
+ filter_driver_set_rules (fe, system, user);
+ g_free (user);
+ g_free (system);
+ count = filter_driver_rule_count (fe);
+ for (i = 0; i < count; i++) {
struct filter_option *fo;
GString *query;
struct filter_desc *desc = NULL;
char *desctext, descunknown[64];
char *name;
- fo = filter_driver_rule_get(fe, i);
+ fo = filter_driver_rule_get (fe, i);
if (fo == NULL)
continue;
- query = g_string_new("");
+ query = g_string_new ("");
if (fo->description)
desc = fo->description->data;
if (desc)
desctext = desc->data;
else {
- sprintf(descunknown, "volder-%p", fo);
+ sprintf (descunknown, "volder-%p", fo);
desctext = descunknown;
}
- g_string_sprintf(query, "vfolder:/%s/vfolder/%s?", evolution_dir, desctext);
- filter_driver_expand_option(fe, query, NULL, fo);
- name = g_strdup_printf("/%s", desctext);
- printf("Adding new vfolder: %s\n", query->str);
- evolution_storage_new_folder (storage, name,
- "mail",
- query->str,
- name+1);
- g_string_free(query, TRUE);
- g_free(name);
+ g_string_sprintf (query, "vfolder:/%s/vfolder/%s?", evolution_dir, desctext);
+ filter_driver_expand_option (fe, query, NULL, fo);
+ name = g_strdup_printf ("/%s", desctext);
+ printf ("Adding new vfolder: %s\n", query->str);
+ evolution_storage_new_folder (storage, name, "mail",
+ query->str, name + 1);
+ g_string_free (query, TRUE);
+ g_free (name);
}
- gtk_object_unref((GtkObject *)fe);
+ gtk_object_unref (GTK_OBJECT (fe));
}
}
if (button != -1) {
- gnome_dialog_close((GnomeDialog *)fe);
+ gnome_dialog_close (GTK_OBJECT (fe));
}
}
void
vfolder_edit (BonoboUIHandler *uih, void *user_data, const char *path)
{
- FolderBrowser *fb = FOLDER_BROWSER(user_data);
+ FolderBrowser *fb = FOLDER_BROWSER (user_data);
FilterEditor *fe;
char *user, *system;
- printf("Editing vfolders ...\n");
- fe = filter_editor_new();
+ printf ("Editing vfolders ...\n");
+ fe = filter_editor_new ();
user = g_strdup_printf ("%s/vfolders.xml", evolution_dir);
- system = g_strdup_printf("%s/evolution/vfoldertypes.xml", EVOLUTION_DATADIR);
- filter_editor_set_rule_files(fe, system, user);
- g_free(user);
- g_free(system);
- gnome_dialog_append_buttons((GnomeDialog *)fe, GNOME_STOCK_BUTTON_OK, GNOME_STOCK_BUTTON_CANCEL, 0);
- gtk_signal_connect((GtkObject *)fe, "clicked", vfolder_editor_clicked, fb);
- gtk_widget_show((GtkWidget *)fe);
+ system = g_strdup_printf ("%s/evolution/vfoldertypes.xml", EVOLUTION_DATADIR);
+ filter_editor_set_rule_files (fe, system, user);
+ g_free (user);
+ g_free (system);
+ gnome_dialog_append_buttons (GNOME_CONFIG (fe), GNOME_STOCK_BUTTON_OK, GNOME_STOCK_BUTTON_CANCEL, 0);
+ gtk_signal_connect (GTK_OBJECT (fe), "clicked", vfolder_editor_clicked, fb);
+ gtk_widget_show (GTK_OBJECT (fe));
}
void
@@ -823,9 +821,9 @@ providers_config (BonoboUIHandler *uih, void *user_data, const char *path)
{
GtkWidget *pc;
- printf("Configuring Providers ...\n");
- pc = providers_config_new();
+ printf ("Configuring Providers ...\n");
+ pc = providers_config_new ();
- gtk_widget_show(pc);
+ gtk_widget_show (pc);
}