86 |
*/ |
*/ |
87 |
int status_response(unsigned int tag, char *mbox) |
int status_response(unsigned int tag, char *mbox) |
88 |
{ |
{ |
89 |
|
int r; |
90 |
char buf[RESPONSE_BUF]; |
char buf[RESPONSE_BUF]; |
91 |
unsigned int exist, recent, unseen; |
unsigned int exist, recent, unseen; |
92 |
char *c; |
char *c; |
97 |
receive_response(buf); |
receive_response(buf); |
98 |
while (!strcasestr(buf, ultostr(tag, 16))); |
while (!strcasestr(buf, ultostr(tag, 16))); |
99 |
|
|
100 |
|
r = analyze_response(buf); |
101 |
|
|
102 |
|
if (r == RESPONSE_NO) |
103 |
|
return -2; |
104 |
|
|
105 |
if ((c = strcasestr(buf, "MESSAGES"))) { |
if ((c = strcasestr(buf, "MESSAGES"))) { |
106 |
c += 9; |
c += 9; |
107 |
exist = strtoul(c, NULL, 10); |
exist = strtoul(c, NULL, 10); |
121 |
info("%d message%s, %d recent, %d unseen, in mailbox %s.\n", exist, plural(exist), |
info("%d message%s, %d recent, %d unseen, in mailbox %s.\n", exist, plural(exist), |
122 |
recent, unseen, mbox); |
recent, unseen, mbox); |
123 |
|
|
124 |
return analyze_response(buf); |
return r; |
125 |
} |
} |
126 |
|
|
127 |
|
|
150 |
{ |
{ |
151 |
char buf[RESPONSE_BUF]; |
char buf[RESPONSE_BUF]; |
152 |
char *c, *m; |
char *c, *m; |
153 |
short f; |
int f; |
154 |
unsigned int blen, mlen; |
unsigned int blen, mlen; |
155 |
|
|
156 |
f = blen = mlen = 0; |
f = blen = mlen = 0; |
194 |
{ |
{ |
195 |
char buf[RESPONSE_BUF]; |
char buf[RESPONSE_BUF]; |
196 |
char hdrs[HEADERS_BUF]; |
char hdrs[HEADERS_BUF]; |
197 |
short f; |
int f; |
198 |
unsigned int sa, sb, i, n; |
unsigned int sa, sb, i, n; |
199 |
char s[8]; |
char s[8]; |
200 |
char *b; |
char *b; |