-
-
- // FIXME write the rest ... all this crap was just a test to make sure libcurl is holding open a single connection.
- curl_easy_setopt(curl, CURLOPT_CUSTOMREQUEST, "RETR 1");
- res = curl_easy_perform(curl);
- curl_easy_setopt(curl, CURLOPT_CUSTOMREQUEST, "UIDL");
- res = curl_easy_perform(curl);
-
-
+ // Now go through the UIDL list and look for messages.
+
+ int num_msgs = num_tokens(ChrPtr(Uidls), '\n');
+ syslog(LOG_DEBUG, "There are %d messages.", num_msgs);
+ for (i=0; i<num_msgs; ++i) {
+ char oneuidl[1024];
+ extract_token(oneuidl, ChrPtr(Uidls), i, '\n', sizeof oneuidl);
+ if (strlen(oneuidl) > 2) {
+ if (oneuidl[strlen(oneuidl)-1] == '\r') {
+ oneuidl[strlen(oneuidl)-1] = 0;
+ }
+ int this_msg = atoi(oneuidl);
+ char *c = strchr(oneuidl, ' ');
+ if (c) strcpy(oneuidl, ++c);
+
+ syslog(LOG_DEBUG, "<\033[34m%d\033[0m> <\033[34m%s\033[0m>", this_msg, oneuidl);
+
+ }
+ }