Enlightenment CVS committal

Author  : tsauerbeck
Project : misc
Module  : embrace

Dir     : misc/embrace/src/plugins/pop3


Modified Files:
        pop3.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/pop3/pop3.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -3 -r1.5 -r1.6
--- pop3.c      9 Apr 2004 10:21:37 -0000       1.5
+++ pop3.c      17 Apr 2004 10:16:40 -0000      1.6
@@ -1,5 +1,5 @@
 /*
- * $Id: pop3.c,v 1.5 2004/04/09 10:21:37 tsauerbeck Exp $
+ * $Id: pop3.c,v 1.6 2004/04/17 10:16:40 tsauerbeck Exp $
  *
  * Copyright (C) 2004 Embrace project.
  *
@@ -112,6 +112,7 @@
 
                                ecore_con_server_send (ev->server, "QUIT", 4);
                                ecore_con_server_del (ev->server);
+                               mailbox_property_set (mb, "server", NULL);
                        }
 
                        break;
@@ -140,6 +141,7 @@
        }
 
        ecore_con_server_del (ev->server);
+       mailbox_property_set (mb, "server", NULL);
 
        return 0;
 }
@@ -147,9 +149,15 @@
 static bool pop3_check (MailBox *mb)
 {
        Ecore_Con_Type type = ECORE_CON_REMOTE_SYSTEM;
+       Ecore_Con_Server *server;
        char *host;
        int port;
 
+       if (mailbox_property_get (mb, "server")) {
+               fprintf (stderr, "[pop3] already connected!\n");
+               return false;
+       }
+
        host = mailbox_property_get (mb, "host"),
        port = (int) mailbox_property_get (mb, "port");
 
@@ -161,8 +169,10 @@
                type |= ECORE_CON_USE_SSL;
 #endif
 
+       server = ecore_con_server_connect (type, host, port, mb);
+
        mailbox_property_set (mb, "state", STATE_DISCONNECTED);
-       ecore_con_server_connect (type, host, port, mb);
+       mailbox_property_set (mb, "server", server);
 
        return true;
 }
@@ -181,7 +191,7 @@
 
        assert (mb);
 
-       interval = MAX(mailbox_poll_interval_get (mb), MAX_INTERVAL);
+       interval = MAX (mailbox_poll_interval_get (mb), MAX_INTERVAL);
 
        if (!(timer = ecore_timer_add (interval, on_timer, mb)))
                return false;
@@ -197,7 +207,7 @@
 
        assert (mb);
 
-       if (!(timer = mailbox_property_get (mb, "timer")))
+       if ((timer = mailbox_property_get (mb, "timer")))
                ecore_timer_del (timer);
 
        free (mailbox_property_get (mb, "host"));




-------------------------------------------------------
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