mirror of
https://github.com/Llewellynvdm/conky.git
synced 2024-12-25 04:06:03 +00:00
ahhh stupid mistake
git-svn-id: https://conky.svn.sourceforge.net/svnroot/conky/trunk/conky1@634 7f574dfc-610e-0410-a909-a81674777703
This commit is contained in:
parent
6af9a98aa0
commit
215876c14b
72
src/conky.c
72
src/conky.c
@ -1219,11 +1219,14 @@ void *imap_thread(struct mail_s* mail)
|
|||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
while (threads_runnable == run_code && fail < 5) {
|
while (threads_runnable == run_code && fail < 5) {
|
||||||
|
if (fail > 0) {
|
||||||
|
ERR("Trying IMAP connection again for %s@%s (try %i/5)", mail->user, mail->host, fail + 1);
|
||||||
|
}
|
||||||
update_time = get_time();
|
update_time = get_time();
|
||||||
if ((sockfd = socket(PF_INET, SOCK_STREAM, 0)) == -1) {
|
if ((sockfd = socket(PF_INET, SOCK_STREAM, 0)) == -1) {
|
||||||
perror("socket");
|
perror("socket");
|
||||||
fail++;
|
fail++;
|
||||||
break;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
their_addr.sin_family = AF_INET; // host byte order
|
their_addr.sin_family = AF_INET; // host byte order
|
||||||
@ -1236,7 +1239,7 @@ void *imap_thread(struct mail_s* mail)
|
|||||||
sizeof(struct sockaddr)) == -1) {
|
sizeof(struct sockaddr)) == -1) {
|
||||||
perror("connect");
|
perror("connect");
|
||||||
fail++;
|
fail++;
|
||||||
break;
|
continue;
|
||||||
}
|
}
|
||||||
struct timeval timeout;
|
struct timeval timeout;
|
||||||
int res;
|
int res;
|
||||||
@ -1252,18 +1255,18 @@ void *imap_thread(struct mail_s* mail)
|
|||||||
0)) == -1) {
|
0)) == -1) {
|
||||||
perror("recv");
|
perror("recv");
|
||||||
fail++;
|
fail++;
|
||||||
break;
|
continue;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
ERR("IMAP connection failed: timeout\n");
|
ERR("IMAP connection failed: timeout\n");
|
||||||
fail++;
|
fail++;
|
||||||
break;
|
continue;
|
||||||
}
|
}
|
||||||
recvbuf[numbytes] = '\0';
|
recvbuf[numbytes] = '\0';
|
||||||
if (strstr(recvbuf, "* OK") != recvbuf) {
|
if (strstr(recvbuf, "* OK") != recvbuf) {
|
||||||
ERR("IMAP connection failed, probably not an IMAP server\n");
|
ERR("IMAP connection failed, probably not an IMAP server\n");
|
||||||
fail++;
|
fail++;
|
||||||
break;
|
continue;
|
||||||
}
|
}
|
||||||
strncpy(sendbuf, "a1 login ", MAXDATASIZE);
|
strncpy(sendbuf, "a1 login ", MAXDATASIZE);
|
||||||
strncat(sendbuf, mail->user,
|
strncat(sendbuf, mail->user,
|
||||||
@ -1275,7 +1278,7 @@ void *imap_thread(struct mail_s* mail)
|
|||||||
if (send(sockfd, sendbuf, strlen(sendbuf), 0) == -1) {
|
if (send(sockfd, sendbuf, strlen(sendbuf), 0) == -1) {
|
||||||
perror("send a1");
|
perror("send a1");
|
||||||
fail++;
|
fail++;
|
||||||
break;
|
continue;
|
||||||
}
|
}
|
||||||
timeout.tv_sec = 60; // 60 second timeout i guess
|
timeout.tv_sec = 60; // 60 second timeout i guess
|
||||||
timeout.tv_usec = 0;
|
timeout.tv_usec = 0;
|
||||||
@ -1288,14 +1291,14 @@ void *imap_thread(struct mail_s* mail)
|
|||||||
0)) == -1) {
|
0)) == -1) {
|
||||||
perror("recv a1");
|
perror("recv a1");
|
||||||
fail++;
|
fail++;
|
||||||
break;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
recvbuf[numbytes] = '\0';
|
recvbuf[numbytes] = '\0';
|
||||||
if (strstr(recvbuf, "a1 OK") == NULL) {
|
if (strstr(recvbuf, "a1 OK") == NULL) {
|
||||||
ERR("IMAP server login failed: %s\n", recvbuf);
|
ERR("IMAP server login failed: %s\n", recvbuf);
|
||||||
fail++;
|
fail++;
|
||||||
break;
|
continue;
|
||||||
}
|
}
|
||||||
strncpy(sendbuf, "a2 STATUS ", MAXDATASIZE);
|
strncpy(sendbuf, "a2 STATUS ", MAXDATASIZE);
|
||||||
strncat(sendbuf, mail->folder,
|
strncat(sendbuf, mail->folder,
|
||||||
@ -1305,7 +1308,7 @@ void *imap_thread(struct mail_s* mail)
|
|||||||
if (send(sockfd, sendbuf, strlen(sendbuf), 0) == -1) {
|
if (send(sockfd, sendbuf, strlen(sendbuf), 0) == -1) {
|
||||||
perror("send a2");
|
perror("send a2");
|
||||||
fail++;
|
fail++;
|
||||||
break;
|
continue;
|
||||||
}
|
}
|
||||||
timeout.tv_sec = 60; // 60 second timeout i guess
|
timeout.tv_sec = 60; // 60 second timeout i guess
|
||||||
timeout.tv_usec = 0;
|
timeout.tv_usec = 0;
|
||||||
@ -1318,14 +1321,14 @@ void *imap_thread(struct mail_s* mail)
|
|||||||
0)) == -1) {
|
0)) == -1) {
|
||||||
perror("recv a2");
|
perror("recv a2");
|
||||||
fail++;
|
fail++;
|
||||||
break;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
recvbuf[numbytes] = '\0';
|
recvbuf[numbytes] = '\0';
|
||||||
if (strstr(recvbuf, "a2 OK") == NULL) {
|
if (strstr(recvbuf, "a2 OK") == NULL) {
|
||||||
ERR("IMAP status failed: %s\n", recvbuf);
|
ERR("IMAP status failed: %s\n", recvbuf);
|
||||||
fail++;
|
fail++;
|
||||||
break;
|
continue;
|
||||||
}
|
}
|
||||||
// now we get the data
|
// now we get the data
|
||||||
reply = strstr(recvbuf, " (MESSAGES ");
|
reply = strstr(recvbuf, " (MESSAGES ");
|
||||||
@ -1334,7 +1337,7 @@ void *imap_thread(struct mail_s* mail)
|
|||||||
if (reply == NULL) {
|
if (reply == NULL) {
|
||||||
ERR("Error parsing IMAP response: %s", recvbuf);
|
ERR("Error parsing IMAP response: %s", recvbuf);
|
||||||
fail++;
|
fail++;
|
||||||
break;
|
continue;
|
||||||
} else {
|
} else {
|
||||||
pthread_mutex_lock(&(mail->thread_info.mutex));
|
pthread_mutex_lock(&(mail->thread_info.mutex));
|
||||||
sscanf(reply, "MESSAGES %lu UNSEEN %lu",
|
sscanf(reply, "MESSAGES %lu UNSEEN %lu",
|
||||||
@ -1346,7 +1349,7 @@ void *imap_thread(struct mail_s* mail)
|
|||||||
if (send(sockfd, sendbuf, strlen(sendbuf), 0) == -1) {
|
if (send(sockfd, sendbuf, strlen(sendbuf), 0) == -1) {
|
||||||
perror("send a3");
|
perror("send a3");
|
||||||
fail++;
|
fail++;
|
||||||
break;
|
continue;
|
||||||
}
|
}
|
||||||
timeout.tv_sec = 60; // 60 second timeout i guess
|
timeout.tv_sec = 60; // 60 second timeout i guess
|
||||||
timeout.tv_usec = 0;
|
timeout.tv_usec = 0;
|
||||||
@ -1359,14 +1362,14 @@ void *imap_thread(struct mail_s* mail)
|
|||||||
0)) == -1) {
|
0)) == -1) {
|
||||||
perror("recv a3");
|
perror("recv a3");
|
||||||
fail++;
|
fail++;
|
||||||
break;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
recvbuf[numbytes] = '\0';
|
recvbuf[numbytes] = '\0';
|
||||||
if (strstr(recvbuf, "a3 OK") == NULL) {
|
if (strstr(recvbuf, "a3 OK") == NULL) {
|
||||||
ERR("IMAP logout failed: %s\n", recvbuf);
|
ERR("IMAP logout failed: %s\n", recvbuf);
|
||||||
fail++;
|
fail++;
|
||||||
break;
|
continue;
|
||||||
}
|
}
|
||||||
close(sockfd);
|
close(sockfd);
|
||||||
if (strlen(mail->command) > 1 && mail->unseen > old_unseen) { // new mail goodie
|
if (strlen(mail->command) > 1 && mail->unseen > old_unseen) { // new mail goodie
|
||||||
@ -1415,11 +1418,14 @@ void *pop3_thread(struct mail_s *mail)
|
|||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
while (threads_runnable == run_code && fail < 5) {
|
while (threads_runnable == run_code && fail < 5) {
|
||||||
|
if (fail > 0) {
|
||||||
|
ERR("Trying POP3 connection again for %s@%s (try %i/5)", mail->user, mail->host, fail + 1);
|
||||||
|
}
|
||||||
update_time = get_time();
|
update_time = get_time();
|
||||||
if ((sockfd = socket(PF_INET, SOCK_STREAM, 0)) == -1) {
|
if ((sockfd = socket(PF_INET, SOCK_STREAM, 0)) == -1) {
|
||||||
perror("socket");
|
perror("socket");
|
||||||
fail++;
|
fail++;
|
||||||
break;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
their_addr.sin_family = AF_INET; // host byte order
|
their_addr.sin_family = AF_INET; // host byte order
|
||||||
@ -1432,7 +1438,7 @@ void *pop3_thread(struct mail_s *mail)
|
|||||||
sizeof(struct sockaddr)) == -1) {
|
sizeof(struct sockaddr)) == -1) {
|
||||||
perror("connect");
|
perror("connect");
|
||||||
fail++;
|
fail++;
|
||||||
break;
|
continue;
|
||||||
}
|
}
|
||||||
struct timeval timeout;
|
struct timeval timeout;
|
||||||
int res;
|
int res;
|
||||||
@ -1448,18 +1454,18 @@ void *pop3_thread(struct mail_s *mail)
|
|||||||
0)) == -1) {
|
0)) == -1) {
|
||||||
perror("recv");
|
perror("recv");
|
||||||
fail++;
|
fail++;
|
||||||
break;
|
continue;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
ERR("POP3 connection failed: timeout\n");
|
ERR("POP3 connection failed: timeout\n");
|
||||||
fail++;
|
fail++;
|
||||||
break;
|
continue;
|
||||||
}
|
}
|
||||||
recvbuf[numbytes] = '\0';
|
recvbuf[numbytes] = '\0';
|
||||||
if (strstr(recvbuf, "+OK ") != recvbuf) {
|
if (strstr(recvbuf, "+OK ") != recvbuf) {
|
||||||
ERR("POP3 connection failed, probably not a POP3 server\n");
|
ERR("POP3 connection failed, probably not a POP3 server\n");
|
||||||
fail++;
|
fail++;
|
||||||
break;
|
continue;
|
||||||
}
|
}
|
||||||
strncpy(sendbuf, "USER ", MAXDATASIZE);
|
strncpy(sendbuf, "USER ", MAXDATASIZE);
|
||||||
strncat(sendbuf, mail->user,
|
strncat(sendbuf, mail->user,
|
||||||
@ -1468,7 +1474,7 @@ void *pop3_thread(struct mail_s *mail)
|
|||||||
if (send(sockfd, sendbuf, strlen(sendbuf), 0) == -1) {
|
if (send(sockfd, sendbuf, strlen(sendbuf), 0) == -1) {
|
||||||
perror("send USER");
|
perror("send USER");
|
||||||
fail++;
|
fail++;
|
||||||
break;
|
continue;
|
||||||
}
|
}
|
||||||
timeout.tv_sec = 60; // 60 second timeout i guess
|
timeout.tv_sec = 60; // 60 second timeout i guess
|
||||||
timeout.tv_usec = 0;
|
timeout.tv_usec = 0;
|
||||||
@ -1481,14 +1487,14 @@ void *pop3_thread(struct mail_s *mail)
|
|||||||
0)) == -1) {
|
0)) == -1) {
|
||||||
perror("recv USER");
|
perror("recv USER");
|
||||||
fail++;
|
fail++;
|
||||||
break;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
recvbuf[numbytes] = '\0';
|
recvbuf[numbytes] = '\0';
|
||||||
if (strstr(recvbuf, "+OK ") == NULL) {
|
if (strstr(recvbuf, "+OK ") == NULL) {
|
||||||
ERR("POP3 server login failed: %s\n", recvbuf);
|
ERR("POP3 server login failed: %s\n", recvbuf);
|
||||||
fail++;
|
fail++;
|
||||||
break;
|
continue;
|
||||||
}
|
}
|
||||||
strncpy(sendbuf, "PASS ", MAXDATASIZE);
|
strncpy(sendbuf, "PASS ", MAXDATASIZE);
|
||||||
strncat(sendbuf, mail->pass,
|
strncat(sendbuf, mail->pass,
|
||||||
@ -1497,7 +1503,7 @@ void *pop3_thread(struct mail_s *mail)
|
|||||||
if (send(sockfd, sendbuf, strlen(sendbuf), 0) == -1) {
|
if (send(sockfd, sendbuf, strlen(sendbuf), 0) == -1) {
|
||||||
perror("send PASS");
|
perror("send PASS");
|
||||||
fail++;
|
fail++;
|
||||||
break;
|
continue;
|
||||||
}
|
}
|
||||||
timeout.tv_sec = 60; // 60 second timeout i guess
|
timeout.tv_sec = 60; // 60 second timeout i guess
|
||||||
timeout.tv_usec = 0;
|
timeout.tv_usec = 0;
|
||||||
@ -1510,20 +1516,20 @@ void *pop3_thread(struct mail_s *mail)
|
|||||||
0)) == -1) {
|
0)) == -1) {
|
||||||
perror("recv PASS");
|
perror("recv PASS");
|
||||||
fail++;
|
fail++;
|
||||||
break;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
recvbuf[numbytes] = '\0';
|
recvbuf[numbytes] = '\0';
|
||||||
if (strstr(recvbuf, "+OK ") == NULL) {
|
if (strstr(recvbuf, "+OK ") == NULL) {
|
||||||
ERR("POP3 server login failed: %s\n", recvbuf);
|
ERR("POP3 server login failed: %s\n", recvbuf);
|
||||||
fail++;
|
fail++;
|
||||||
break;
|
continue;
|
||||||
}
|
}
|
||||||
strncpy(sendbuf, "STAT\n", MAXDATASIZE);
|
strncpy(sendbuf, "STAT\n", MAXDATASIZE);
|
||||||
if (send(sockfd, sendbuf, strlen(sendbuf), 0) == -1) {
|
if (send(sockfd, sendbuf, strlen(sendbuf), 0) == -1) {
|
||||||
perror("send STAT");
|
perror("send STAT");
|
||||||
fail++;
|
fail++;
|
||||||
break;
|
continue;
|
||||||
}
|
}
|
||||||
timeout.tv_sec = 60; // 60 second timeout i guess
|
timeout.tv_sec = 60; // 60 second timeout i guess
|
||||||
timeout.tv_usec = 0;
|
timeout.tv_usec = 0;
|
||||||
@ -1536,21 +1542,21 @@ void *pop3_thread(struct mail_s *mail)
|
|||||||
0)) == -1) {
|
0)) == -1) {
|
||||||
perror("recv STAT");
|
perror("recv STAT");
|
||||||
fail++;
|
fail++;
|
||||||
break;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
recvbuf[numbytes] = '\0';
|
recvbuf[numbytes] = '\0';
|
||||||
if (strstr(recvbuf, "+OK ") == NULL) {
|
if (strstr(recvbuf, "+OK ") == NULL) {
|
||||||
ERR("POP3 status failed: %s\n", recvbuf);
|
ERR("POP3 status failed: %s\n", recvbuf);
|
||||||
fail++;
|
fail++;
|
||||||
break;
|
continue;
|
||||||
}
|
}
|
||||||
// now we get the data
|
// now we get the data
|
||||||
reply = recvbuf + 4;
|
reply = recvbuf + 4;
|
||||||
if (reply == NULL) {
|
if (reply == NULL) {
|
||||||
ERR("Error parsing POP3 response: %s", recvbuf);
|
ERR("Error parsing POP3 response: %s", recvbuf);
|
||||||
fail++;
|
fail++;
|
||||||
break;
|
continue;
|
||||||
} else {
|
} else {
|
||||||
pthread_mutex_lock(&(mail->thread_info.mutex));
|
pthread_mutex_lock(&(mail->thread_info.mutex));
|
||||||
sscanf(reply, "%lu %lu", &mail->unseen,
|
sscanf(reply, "%lu %lu", &mail->unseen,
|
||||||
@ -1561,7 +1567,7 @@ void *pop3_thread(struct mail_s *mail)
|
|||||||
if (send(sockfd, sendbuf, strlen(sendbuf), 0) == -1) {
|
if (send(sockfd, sendbuf, strlen(sendbuf), 0) == -1) {
|
||||||
perror("send QUIT");
|
perror("send QUIT");
|
||||||
fail++;
|
fail++;
|
||||||
break;
|
continue;
|
||||||
}
|
}
|
||||||
timeout.tv_sec = 60; // 60 second timeout i guess
|
timeout.tv_sec = 60; // 60 second timeout i guess
|
||||||
timeout.tv_usec = 0;
|
timeout.tv_usec = 0;
|
||||||
@ -1574,14 +1580,14 @@ void *pop3_thread(struct mail_s *mail)
|
|||||||
0)) == -1) {
|
0)) == -1) {
|
||||||
perror("recv QUIT");
|
perror("recv QUIT");
|
||||||
fail++;
|
fail++;
|
||||||
break;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
recvbuf[numbytes] = '\0';
|
recvbuf[numbytes] = '\0';
|
||||||
if (strstr(recvbuf, "+OK") == NULL) {
|
if (strstr(recvbuf, "+OK") == NULL) {
|
||||||
ERR("POP3 logout failed: %s\n", recvbuf);
|
ERR("POP3 logout failed: %s\n", recvbuf);
|
||||||
fail++;
|
fail++;
|
||||||
break;
|
continue;
|
||||||
}
|
}
|
||||||
close(sockfd);
|
close(sockfd);
|
||||||
if (strlen(mail->command) > 1 && mail->unseen > old_unseen) { // new mail goodie
|
if (strlen(mail->command) > 1 && mail->unseen > old_unseen) { // new mail goodie
|
||||||
|
Loading…
Reference in New Issue
Block a user