-/*
- * Delete any messages on the zapped list
- */
-void process_zaplist(void) {
- FILE *zaplist;
- char curr_rm[ROOMNAMELEN];
- char buf[256];
- char room[256];
- char id[256];
- char node[256];
- long localzap = 0L;
- int numzap = 0;
-
- zaplist = fopen(ZAPLIST, "r");
- if (zaplist == NULL) {
- syslog(LOG_ERR, "cannot open %s: %s\n",
- ZAPLIST, strerror(errno));
- return;
- }
-
- strcpy(curr_rm, "_nothing_");
-
- while (fgets(buf, 256, zaplist) != NULL) {
- buf[strlen(buf) - 1] = 0;
-
- extract(room, buf, 0);
- extract(id, buf, 1);
- extract(node, buf, 2);
-
- /* Change rooms if we have to */
- if (strcasecmp(curr_rm, room)) {
- sprintf(buf, "GOTO %s", room);
- serv_puts(buf);
- serv_gets(buf);
- if (buf[0] == '2') {
- extract(curr_rm, &buf[4], 0);
- } else {
- syslog(LOG_ERR, "%s", buf);
- }
- }
-
- /* And only do the zap if we succeeded */
- if (!strcasecmp(curr_rm, room)) {
-
- serv_puts("MSGS ALL|0|1");
- serv_gets(buf);
- if (buf[0]=='1') {
- /* This is bogus, flush and go away */
- while (serv_gets(buf), strcmp(buf, "000")) ;
- }
- else if (buf[0]=='8') {
- sprintf(buf, "msgn|%s\nnode|%s\n000",
- id, node);
- serv_puts(buf);
- numzap = 0;
- while (serv_gets(buf), strcmp(buf, "000")) {
- localzap = atol(buf);
- ++numzap;
- }
- }
-
- if (numzap > 0) {
- sprintf(buf, "DELE %ld", localzap);
- serv_puts(buf);
- serv_gets(buf);
- if (buf[0] != '2') {
- syslog(LOG_ERR, "%s", buf);
- }
- }
- if (numzap > 1) {
- syslog(LOG_ERR, "Multiple messages are <%s@%s>",
- id, node);
- }
-
- }
- }
- fclose(zaplist);
- unlink(ZAPLIST);
-}
-
-
-