Revert "Merge branch 'master' of git.omp.am:/home/omp/git/conky"
authorBrenden Matthews <brenden@rty.ca>
Fri, 7 Aug 2009 07:23:27 +0000 (01:23 -0600)
committerBrenden Matthews <brenden@rty.ca>
Fri, 7 Aug 2009 07:23:27 +0000 (01:23 -0600)
This reverts commit d710ea8b9d134c1b61510c400f99006f5b07c10c, reversing
changes made to 9827726ae5a13a49a9bcb3528db9a251e0e99530.

Also didn't meant to push this.

src/conky.c
src/conky.h
src/libmpdclient.c
src/mail.c

index d47af06..0945c3f 100644 (file)
@@ -65,6 +65,9 @@
 #include <netdb.h>
 #include <fcntl.h>
 #include <getopt.h>
+#ifdef NCURSES
+#include <ncurses.h>
+#endif
 #ifdef XOAP
 #include <libxml/parser.h>
 #endif /* XOAP */
index d3e3c07..5555ea4 100644 (file)
@@ -124,10 +124,6 @@ char *strndup(const char *s, size_t n);
 #include "apcupsd.h"
 #endif
 
-#ifdef NCURSES
-#include <ncurses.h>
-#endif
-
 /* sony support */
 #include "sony.h"
 
index acc2c2e..791ad89 100644 (file)
@@ -122,7 +122,7 @@ static int do_connect_fail(mpd_Connection *connection,
 
 #ifdef MPD_HAVE_GAI
 static int mpd_connect(mpd_Connection *connection, const char *host, int port,
-               float mpd_timeout)
+               float timeout)
 {
        int error;
        char service[INTLEN + 1];
@@ -170,7 +170,7 @@ static int mpd_connect(mpd_Connection *connection, const char *host, int port,
                        return -1;
                }
 
-               mpd_setConnectionTimeout(connection, mpd_timeout);
+               mpd_setConnectionTimeout(connection, timeout);
 
                /* connect stuff */
                if (do_connect_fail(connection, res->ai_addr, res->ai_addrlen)) {
@@ -196,7 +196,7 @@ static int mpd_connect(mpd_Connection *connection, const char *host, int port,
 }
 #else /* !MPD_HAVE_GAI */
 static int mpd_connect(mpd_Connection *connection, const char *host, int port,
-               float mpd_timeout)
+               float timeout)
 {
        struct hostent he, *he_res = 0;
        int he_errno;
@@ -249,7 +249,7 @@ static int mpd_connect(mpd_Connection *connection, const char *host, int port,
                return -1;
        }
 
-       mpd_setConnectionTimeout(connection, mpd_timeout);
+       mpd_setConnectionTimeout(connection, timeout);
 
        /* connect stuff */
        if (do_connect_fail(connection, dest, destlen)) {
@@ -320,11 +320,11 @@ static void mpd_freeReturnElement(mpd_ReturnElement *re)
        free(re);
 }
 
-void mpd_setConnectionTimeout(mpd_Connection *connection, float mpd_timeout)
+void mpd_setConnectionTimeout(mpd_Connection *connection, float timeout)
 {
        connection->timeout.tv_sec = (int) timeout;
        connection->timeout.tv_usec =
-               (int) ((mpd_timeout - connection->timeout.tv_sec) * 1e6 + 0.5);
+               (int) ((timeout - connection->timeout.tv_sec) * 1e6 + 0.5);
 }
 
 static int mpd_parseWelcome(mpd_Connection *connection, const char *host,
@@ -361,7 +361,7 @@ static int mpd_parseWelcome(mpd_Connection *connection, const char *host,
        return 0;
 }
 
-mpd_Connection *mpd_newConnection(const char *host, int port, float mpd_timeout)
+mpd_Connection *mpd_newConnection(const char *host, int port, float timeout)
 {
        int err;
        char *rt;
@@ -387,7 +387,7 @@ mpd_Connection *mpd_newConnection(const char *host, int port, float mpd_timeout)
                return connection;
        }
 
-       if (mpd_connect(connection, host, port, mpd_timeout) < 0) {
+       if (mpd_connect(connection, host, port, timeout) < 0) {
                return connection;
        }
 
index 91805d8..5db57b6 100644 (file)
@@ -383,18 +383,18 @@ struct mail_s *parse_mail_args(char type, const char *arg)
 
 int imap_command(int sockfd, const char *command, char *response, const char *verify)
 {
-       struct timeval fetchtimeout;
+       struct timeval timeout;
        fd_set fdset;
        int res, numbytes = 0;
        if (send(sockfd, command, strlen(command), 0) == -1) {
                perror("send");
                return -1;
        }
-       fetchtimeout.tv_sec = 60;       // 60 second timeout i guess
-       fetchtimeout.tv_usec = 0;
+       timeout.tv_sec = 60;    // 60 second timeout i guess
+       timeout.tv_usec = 0;
        FD_ZERO(&fdset);
        FD_SET(sockfd, &fdset);
-       res = select(sockfd + 1, &fdset, NULL, NULL, &fetchtimeout);
+       res = select(sockfd + 1, &fdset, NULL, NULL, &timeout);
        if (res > 0) {
                if ((numbytes = recv(sockfd, response, MAXDATASIZE - 1, 0)) == -1) {
                        perror("recv");
@@ -471,7 +471,7 @@ void *imap_thread(void *arg)
        }
 #endif /* HAVE_GETHOSTBYNAME_R */
        while (fail < mail->retries) {
-               struct timeval fetchtimeout;
+               struct timeval timeout;
                int res;
                fd_set fdset;
 
@@ -501,11 +501,11 @@ void *imap_thread(void *arg)
                                break;
                        }
 
-                       fetchtimeout.tv_sec = 60;       // 60 second timeout i guess
-                       fetchtimeout.tv_usec = 0;
+                       timeout.tv_sec = 60;    // 60 second timeout i guess
+                       timeout.tv_usec = 0;
                        FD_ZERO(&fdset);
                        FD_SET(sockfd, &fdset);
-                       res = select(sockfd + 1, &fdset, NULL, NULL, &fetchtimeout);
+                       res = select(sockfd + 1, &fdset, NULL, NULL, &timeout);
                        if (res > 0) {
                                if ((numbytes = recv(sockfd, recvbuf, MAXDATASIZE - 1, 0)) == -1) {
                                        perror("recv");
@@ -576,8 +576,8 @@ void *imap_thread(void *arg)
                                         * RFC 2177 says we have to re-idle every 29 minutes.
                                         * We'll do it every 20 minutes to be safe.
                                         */
-                                       fetchtimeout.tv_sec = 1200;
-                                       fetchtimeout.tv_usec = 0;
+                                       timeout.tv_sec = 1200;
+                                       timeout.tv_usec = 0;
                                        DBGP2("idling...");
                                        FD_ZERO(&fdset);
                                        FD_SET(sockfd, &fdset);
@@ -642,7 +642,7 @@ void *imap_thread(void *arg)
                                                 * something other than 0, or we had a timeout
                                                 */
                                                buf = recvbuf;
-                                               if (recent > 0 || (buf && strstr(buf, " FETCH ")) || fetchtimeout.tv_sec == 0 || force_check) {
+                                               if (recent > 0 || (buf && strstr(buf, " FETCH ")) || timeout.tv_sec == 0 || force_check) {
                                                        // re-check messages and unseen
                                                        if (imap_command(sockfd, "DONE\r\n", recvbuf, "a5 OK")) {
                                                                fail++;
@@ -691,11 +691,11 @@ void *imap_thread(void *arg)
                                        fail++;
                                        break;
                                }
-                               fetchtimeout.tv_sec = 60;       // 60 second timeout i guess
-                               fetchtimeout.tv_usec = 0;
+                               timeout.tv_sec = 60;    // 60 second timeout i guess
+                               timeout.tv_usec = 0;
                                FD_ZERO(&fdset);
                                FD_SET(sockfd, &fdset);
-                               res = select(sockfd + 1, &fdset, NULL, NULL, &fetchtimeout);
+                               res = select(sockfd + 1, &fdset, NULL, NULL, &timeout);
                                if (res > 0) {
                                        if ((numbytes = recv(sockfd, recvbuf, MAXDATASIZE - 1, 0)) == -1) {
                                                perror("recv a3");
@@ -727,18 +727,18 @@ void *imap_thread(void *arg)
 
 int pop3_command(int sockfd, const char *command, char *response, const char *verify)
 {
-       struct timeval fetchtimeout;
+       struct timeval timeout;
        fd_set fdset;
        int res, numbytes = 0;
        if (send(sockfd, command, strlen(command), 0) == -1) {
                perror("send");
                return -1;
        }
-       fetchtimeout.tv_sec = 60;       // 60 second timeout i guess
-       fetchtimeout.tv_usec = 0;
+       timeout.tv_sec = 60;    // 60 second timeout i guess
+       timeout.tv_usec = 0;
        FD_ZERO(&fdset);
        FD_SET(sockfd, &fdset);
-       res = select(sockfd + 1, &fdset, NULL, NULL, &fetchtimeout);
+       res = select(sockfd + 1, &fdset, NULL, NULL, &timeout);
        if (res > 0) {
                if ((numbytes = recv(sockfd, response, MAXDATASIZE - 1, 0)) == -1) {
                        perror("recv");
@@ -780,7 +780,7 @@ void *pop3_thread(void *arg)
        }
 #endif /* HAVE_GETHOSTBYNAME_R */
        while (fail < mail->retries) {
-               struct timeval fetchtimeout;
+               struct timeval timeout;
                int res;
                fd_set fdset;
 
@@ -810,11 +810,11 @@ void *pop3_thread(void *arg)
                                break;
                        }
 
-                       fetchtimeout.tv_sec = 60;       // 60 second timeout i guess
-                       fetchtimeout.tv_usec = 0;
+                       timeout.tv_sec = 60;    // 60 second timeout i guess
+                       timeout.tv_usec = 0;
                        FD_ZERO(&fdset);
                        FD_SET(sockfd, &fdset);
-                       res = select(sockfd + 1, &fdset, NULL, NULL, &fetchtimeout);
+                       res = select(sockfd + 1, &fdset, NULL, NULL, &timeout);
                        if (res > 0) {
                                if ((numbytes = recv(sockfd, recvbuf, MAXDATASIZE - 1, 0)) == -1) {
                                        perror("recv");