- extract_token(buf, netconfig, i, '\n', sizeof buf);
- if ( (!IsEmptyStr(buf)) && (strncasecmp(buf, "lastsent|", 9)) ) {
+ extract_token(buf, oldnetconfig, i, '\n', sizeof buf);
+ int keep_this_line =1; // set to nonzero if we are discarding a line
+
+ if (IsEmptyStr(buf)) {
+ keep_this_line = 0;
+ }
+
+ char buf_token[1024];
+ char buf_email[1024];
+ extract_token(buf_token, buf, 0, '|', sizeof buf_token);
+ extract_token(buf_email, buf, 1, '|', sizeof buf_email);
+
+ if ( ( (!strcasecmp(buf_token, "listrecp")) || (!strcasecmp(buf_token, "digestrecp")) )
+ && (!strcasecmp(buf_email, emailaddr))
+ ) {
+ is_already_subscribed = 1;
+ }
+
+ if ( (!strcasecmp(buf_token, "subpending")) || (!strcasecmp(buf_token, "unsubpending")) ) {
+ time_t pendingtime = extract_long(buf, 3);
+ if ((time(NULL) - pendingtime) > 259200) {
+ syslog(LOG_DEBUG, "%s %s is %ld seconds old - deleting it", buf_email, buf_token, time(NULL) - pendingtime);
+ keep_this_line = 0;
+ }
+ }
+
+ if (keep_this_line) {