1
0
mirror of https://github.com/Llewellynvdm/conky.git synced 2024-12-25 04:06:03 +00:00

Allow spaces in mail folder names for pop/imap.

For example, you can specify "-f '[Gmail]/All Mail'" in your mail args
to view all mails in your Google mail IMAP folder.
This commit is contained in:
Brenden Matthews 2009-09-27 10:40:06 -07:00
parent a7df1681bb
commit 7fc4d40eb2
3 changed files with 21 additions and 14 deletions

View File

@ -316,8 +316,8 @@
</command>
</term>
<listitem>Default global IMAP server. Arguments are: "host
user pass [-i interval (in seconds)] [-f folder] [-p port]
[-e command] [-r retries]". Default port is 143, default
user pass [-i interval (in seconds)] [-f 'folder'] [-p port]
[-e 'command'] [-r retries]". Default port is 143, default
folder is 'INBOX', default interval is 5 minutes, and
default number of retries before giving up is 5. If the
password is supplied as '*', you will be prompted to enter
@ -704,7 +704,7 @@
</command>
</term>
<listitem>Default global POP3 server. Arguments are: "host
user pass [-i interval (in seconds)] [-p port] [-e command]
user pass [-i interval (in seconds)] [-p port] [-e 'command']
[-r retries]". Default port is 110, default interval is 5
minutes, and default number of retries before giving up is
5. If the password is supplied as '*', you will be prompted

View File

@ -1701,7 +1701,7 @@
IMAP inbox by default. You can define individual IMAP
inboxes seperately by passing arguments to this object.
Arguments are: "host user pass [-i interval (in seconds)]
[-f folder] [-p port] [-e command] [-r retries]". Default
[-f 'folder'] [-p port] [-e 'command'] [-r retries]". Default
port is 143, default folder is 'INBOX', default interval is
5 minutes, and default number of retries before giving up
is 5. If the password is supplied as '*', you will be
@ -1719,7 +1719,7 @@
global IMAP inbox by default. You can define individual
IMAP inboxes seperately by passing arguments to this
object. Arguments are: "host user pass [-i interval (in
seconds)] [-f folder] [-p port] [-e command] [-r retries]".
seconds)] [-f 'folder'] [-p port] [-e 'command'] [-r retries]".
Default port is 143, default folder is 'INBOX', default
interval is 5 minutes, and default number of retries before
giving up is 5. If the password is supplied as '*', you
@ -2514,7 +2514,7 @@
global POP3 inbox by default. You can define individual
POP3 inboxes seperately by passing arguments to this
object. Arguments are: "host user pass [-i interval (in
seconds)] [-p port] [-e command] [-r retries]". Default
seconds)] [-p port] [-e 'command'] [-r retries]". Default
port is 110, default interval is 5 minutes, and default
number of retries before giving up is 5. If the password is
supplied as '*', you will be prompted to enter the password
@ -2532,7 +2532,7 @@
in your global POP3 inbox by default. You can define
individual POP3 inboxes seperately by passing arguments to
this object. Arguments are: "host user pass [-i interval
(in seconds)] [-p port] [-e command] [-r retries]". Default
(in seconds)] [-p port] [-e 'command'] [-r retries]". Default
port is 110, default interval is 5 minutes, and default
number of retries before giving up is 5. If the password is
supplied as '*', you will be prompted to enter the password

View File

@ -355,8 +355,15 @@ struct mail_s *parse_mail_args(char type, const char *arg)
if (type == IMAP_TYPE) {
tmp = strstr(arg, "-f ");
if (tmp) {
int len = 1024;
tmp += 3;
sscanf(tmp, "%s", mail->folder);
if (tmp[0] == '\'') {
len = strstr(tmp + 1, "'") - tmp - 1;
if (len > 1024) {
len = 1024;
}
}
strncpy(mail->folder, tmp + 1, len);
} else {
strncpy(mail->folder, "INBOX", 128); // default imap inbox
}
@ -542,9 +549,9 @@ void *imap_thread(void *arg)
break;
}
strncpy(sendbuf, "a2 STATUS ", MAXDATASIZE);
strncpy(sendbuf, "a2 STATUS \"", MAXDATASIZE);
strncat(sendbuf, mail->folder, MAXDATASIZE - strlen(sendbuf) - 1);
strncat(sendbuf, " (MESSAGES UNSEEN)\r\n",
strncat(sendbuf, "\" (MESSAGES UNSEEN)\r\n",
MAXDATASIZE - strlen(sendbuf) - 1);
if (imap_command(sockfd, sendbuf, recvbuf, "a2 OK")) {
fail++;
@ -561,9 +568,9 @@ void *imap_thread(void *arg)
old_messages = mail->messages;
if (has_idle) {
strncpy(sendbuf, "a4 SELECT ", MAXDATASIZE);
strncpy(sendbuf, "a4 SELECT \"", MAXDATASIZE);
strncat(sendbuf, mail->folder, MAXDATASIZE - strlen(sendbuf) - 1);
strncat(sendbuf, "\r\n", MAXDATASIZE - strlen(sendbuf) - 1);
strncat(sendbuf, "\"\r\n", MAXDATASIZE - strlen(sendbuf) - 1);
if (imap_command(sockfd, sendbuf, recvbuf, "a4 OK")) {
fail++;
break;
@ -653,9 +660,9 @@ void *imap_thread(void *arg)
fail++;
break;
}
strncpy(sendbuf, "a2 STATUS ", MAXDATASIZE);
strncpy(sendbuf, "a2 STATUS \"", MAXDATASIZE);
strncat(sendbuf, mail->folder, MAXDATASIZE - strlen(sendbuf) - 1);
strncat(sendbuf, " (MESSAGES UNSEEN)\r\n",
strncat(sendbuf, "\" (MESSAGES UNSEEN)\r\n",
MAXDATASIZE - strlen(sendbuf) - 1);
if (imap_command(sockfd, sendbuf, recvbuf, "a2 OK")) {
fail++;