Enlightenment CVS committal

Author  : tsauerbeck
Project : misc
Module  : embrace

Dir     : misc/embrace/src/plugins/maildir


Modified Files:
        maildir.c 


Log Message:
pop3: don't connect twice to the same server. maildir: added timer-based checking to 
support systems that don't have dnotify
===================================================================
RCS file: /cvsroot/enlightenment/misc/embrace/src/plugins/maildir/maildir.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -3 -r1.4 -r1.5
--- maildir.c   4 Apr 2004 20:19:30 -0000       1.4
+++ maildir.c   17 Apr 2004 10:16:39 -0000      1.5
@@ -1,5 +1,5 @@
 /*
- * $Id: maildir.c,v 1.4 2004/04/04 20:19:30 tsauerbeck Exp $
+ * $Id: maildir.c,v 1.5 2004/04/17 10:16:39 tsauerbeck Exp $
  *
  * Copyright (C) 2004 Embrace project.
  *
@@ -30,8 +30,6 @@
 #ifdef __linux__
 # define USE_DNOTIFY
 # include <fcntl.h>
-#else
-# error Linux 2.4+ is required at the moment (yeah, this sucks)
 #endif
 
 #include <embrace_plugin.h>
@@ -177,22 +175,47 @@
 
        return true;
 }
+#endif
+
+#ifndef USE_DNOTIFY
+static int on_timer (void *udata)
+{
+       maildir_check (udata);
+
+       return 1;
+}
+#endif
 
 static bool maildir_add_mailbox (MailBox *mb)
 {
+#ifdef USE_DNOTIFY
        char *str, *prop[] = {"path_cur", "path_new"};
        int i;
+#else
+       Ecore_Timer *timer;
+       int interval;
+#endif
 
        assert (mb);
 
+#ifdef USE_DNOTIFY
        for (i = 0; i < 2; i++) {
                str = mailbox_property_get (mb, prop[i]);
                monitor_dir (mb, str, !!i);
        }
+#else
+       interval = mailbox_poll_interval_get (mb);
+
+       if (!(timer = ecore_timer_add (interval, on_timer, mb)))
+               return false;
+
+       mailbox_property_set (mb, "timer", timer);
+#endif
 
        return true;
 }
 
+#ifdef USE_DNOTIFY
 static Evas_List *find_notify_data (MailBox *mb, int signal)
 {
        NotifyData *data;
@@ -214,6 +237,8 @@
 #ifdef USE_DNOTIFY
        NotifyData *data;
        Evas_List *l;
+#else
+       Ecore_Timer *timer;
 #endif
 
        assert (mb);
@@ -231,6 +256,9 @@
 
                notify_data = evas_list_remove_list (notify_data, l);
        }
+#else
+       if ((timer = mailbox_property_get (mb, "timer")))
+               ecore_timer_del (timer);
 #endif
 
        return true;
@@ -284,9 +312,9 @@
 
 #ifdef USE_DNOTIFY
        ep->shutdown = maildir_shutdown;
-       ep->add_mailbox = maildir_add_mailbox;
 #endif
 
+       ep->add_mailbox = maildir_add_mailbox;
        ep->remove_mailbox = maildir_remove_mailbox;
 
 #ifdef USE_DNOTIFY




-------------------------------------------------------
This SF.Net email is sponsored by: IBM Linux Tutorials
Free Linux tutorial presented by Daniel Robbins, President and CEO of
GenToo technologies. Learn everything from fundamentals to system
administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click
_______________________________________________
enlightenment-cvs mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to