+
+/*
+ * Add a message to the list of messages to be deleted off the local server
+ * at the end of this run.
+ */
+void delete_locally(long msgid, char *roomname) {
+ struct msglist *mptr;
+
+ mptr = (struct msglist *) malloc(sizeof(struct msglist));
+ mptr->next = purgelist;
+ mptr->m_num = msgid;
+ strcpy(mptr->m_rmname, roomname);
+ purgelist = mptr;
+}
+
+
+
+/*
+ * Delete all messages on the purge list from the local server.
+ */
+void process_purgelist(void) {
+ char curr_rm[ROOMNAMELEN];
+ char buf[256];
+ struct msglist *mptr;
+
+
+ strcpy(curr_rm, "__nothing__");
+ while (purgelist != NULL) {
+ if (strcasecmp(curr_rm, purgelist->m_rmname)) {
+ sprintf(buf, "GOTO %s", purgelist->m_rmname);
+ serv_puts(buf);
+ serv_gets(buf);
+ if (buf[0] == '2') extract(curr_rm, &buf[4], 0);
+ }
+ if (strcasecmp(curr_rm, purgelist->m_rmname)) {
+ sprintf(buf, "DELE %ld", purgelist->m_num);
+ serv_puts(buf);
+ serv_gets(buf);
+ }
+ mptr = purgelist->next;
+ free(purgelist);
+ purgelist = mptr;
+ }
+}
+
+
+
+