-
- /*
- * Now start scanning this room's netconfig file for the
- * specified token.
- */
- assoc_file_name(filename, sizeof filename, &qrbuf, ctdl_netcfg_dir);
- begin_critical_section(S_NETCONFIGS);
- ncfp = fopen(filename, "r+");
- if (ncfp != NULL) {
- while (line_offset = ftell(ncfp),
- (fgets(buf, sizeof buf, ncfp) != NULL) ) {
- buf[strlen(buf)-1] = 0;
- line_length = strlen(buf);
- extract_token(cmd, buf, 0, '|', sizeof cmd);
- if (!strcasecmp(cmd, "subpending")) {
- extract_token(email, buf, 1, '|', sizeof email);
- extract_token(subtype, buf, 2, '|', sizeof subtype);
- extract_token(line_token, buf, 3, '|', sizeof line_token);
- if (!strcasecmp(token, line_token)) {
- if (!strcasecmp(subtype, "digest")) {
- safestrncpy(buf, "digestrecp|", sizeof buf);
- }
- else {
- safestrncpy(buf, "listrecp|", sizeof buf);
- }
- strcat(buf, email);
- strcat(buf, "|");
- /* SLEAZY HACK: pad the line out so
- * it's the same length as the line
- * we're replacing.
- */
- while (strlen(buf) < line_length) {
- strcat(buf, " ");
- }
- fseek(ncfp, line_offset, SEEK_SET);
- fprintf(ncfp, "%s\n", buf);
- ++success;
- }
- }
- if (!strcasecmp(cmd, "unsubpending")) {
- extract_token(line_token, buf, 2, '|', sizeof line_token);
- if (!strcasecmp(token, line_token)) {
- extract_token(address_to_unsubscribe, buf, 1, '|',
- sizeof address_to_unsubscribe);
- }
- }
- }
- fclose(ncfp);