🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: news.software.nntp
1 messages
1 total messages Started by Mach Thu, 19 Apr 2001 17:11
Canceling articles from within a newsreader, was Re: Can someone make a delete button?
#51920
Author: Mach
Date: Thu, 19 Apr 2001 17:11
143 lines
4716 bytes

>   BuZZard:
>
>   I think along with k/f's, news readers should just have a "delete"
>   button.
>   You come across a post you dont like, one click and its gone.


If you happen to run INND, you can use the program at the bottom of
this article to (locally) cancel articles from within a news 
reader like Messenger.

In Messenger, you select the article(s) you wish to cancel, then
forward them as an attachment to newskill@your.news.server

You need to place a line similar to the following in your mail
server's alias file (/etc/mail/aliases ?):

   newskill:           "|/usr/local/bin/newskill"

You need to SUID /usr/local/bin/newskill to the User ID (UID) of 
an INND administrator (i.e. a user that can execute ctlinnd).

________________________________cut_________________________________

/*  This is newskill V1.0 written by mach (c) 2000        *
 *  EMail: mach@nym.alias.net                             *
 *  Feel free to copy and redistribute in terms of the    *
 *  GNU public license.                                   */

#ifndef lint
  static char *const rcsid = "$Id: newskill.c,v 0.1 2000/07/28 20:34:05 pb Exp $";
#endif /* lint */

static char *const version = "newskill 0.1";

#include <stdio.h>
#include <stdlib.h>
#include <syslog.h>

#ifndef LOG_FACILITY
  #define LOG_FACILITY   LOG_LOCAL7
#endif /* LOG_FACILITY */

#define DONTCARE  -1
#define FALSE      0
#define TRUE       1

#define MAXLINELEN 1024

#define DEBUG

#ifdef DEBUG
  #include <assert.h>
  #define MESSAGE(s)  if (OptionDebug) syslog (LOG_NOTICE, (s))
  #define MESSAGE_1(s,a)  if (OptionDebug) syslog (LOG_NOTICE, (s), (a))
  #define MESSAGE_2(s,a,b)  if (OptionDebug) syslog (LOG_NOTICE,(s),(a),(b))
  #define MESSAGE_3(s,a,b,c)  if (OptionDebug) syslog (LOG_NOTICE,(s),(a),(b),(c))
  #define MESSAGE_4(s,a,b,c,d)  if (OptionDebug) syslog (LOG_NOTICE,(s),(a),(b),(c),(d))
  #define MESSAGE_5(s,a,b,c,d,e)  if (OptionDebug) syslog (LOG_NOTICE,(s),(a),(b),(c),(d),(e))
#else
  #define MESSAGE(s)
  #define MESSAGE_1(s,a)
  #define MESSAGE_2(s,a,b)
  #define MESSAGE_3(s,a,b,c)
  #define MESSAGE_4(s,a,b,c,d)
  #define MESSAGE_5(s,a,b,c,d,e)
#endif /* DEBUG */

static char OptionAction = FALSE;
static char OptionDebug = FALSE;

int main(int argc, char **argv) {
  int c;
  char cmdString[MAXLINELEN + 38];
  char msgIDHeader[] = {"Message-ID: "};
  char nl[MAXLINELEN];
  int nlLen;
  int returnVal;

  OptionAction = FALSE;
  OptionDebug = FALSE;

  while ((c = getopt(argc, argv, "ad")) != EOF) {
    switch (c) {
    case 'a':
      OptionAction = TRUE;
      break;
    case 'd':
      #ifdef DEBUG
        OptionDebug = TRUE;
      #endif
      break;
      #endif
      break;
    }
  }

  if (OptionAction) {
    openlog ("newskill", LOG_NDELAY, LOG_LOCAL7);
  } else {
    openlog ("newskill", LOG_NDELAY, LOG_LOCAL7);
  }

  /* find mailer's Message-ID */
  for (;;) {
    if (fgets(nl, sizeof nl, stdin) == NULL)
      return -1;
    if (strncmp(msgIDHeader, nl, sizeof msgIDHeader - 1) == 0) {
      nlLen = strlen(nl);
      if (nl[nlLen - 1] == '\n') { /* remove new line */
        nl[nlLen - 1] = 0;
      }
      sprintf(cmdString, "/usr/local/news/bin/ctlinnd cancel '%s'", &(nl[sizeofmsgIDHeader - 1]));
      MESSAGE(cmdString);
      returnVal = system(cmdString);
      if (returnVal == -1) {
        syslog (LOG_ERR, "Problem invoking: %s", cmdString);
      }
    }
  }

  for (;;) {
    if (fgets(nl, sizeof nl, stdin) == NULL)
      break;
    if (strncmp(msgIDHeader, nl, sizeof msgIDHeader - 1) == 0) {
      nlLen = strlen(nl);
      if (nl[nlLen - 1] == '\n') { /* remove new line */
        nl[nlLen - 1] = 0;
      }
      sprintf(cmdString, "/usr/local/news/bin/ctlinnd cancel '%s'", &(nl[sizeofmsgIDHeader - 1]));
      MESSAGE(cmdString);
      returnVal = system(cmdString);
      if (returnVal == -1) {
        syslog (LOG_ERR, "Problem invoking: %s", cmdString);
      }
    }
  }

  return 0;
}
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads