home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 5 Edit
/
05-Edit.zip
/
epmsmp.zip
/
NR2POST.E
< prev
next >
Wrap
Text File
|
1996-05-21
|
8KB
|
188 lines
; I use NR/2 as my newsreader. I have it set up to invoke EPM
; (select Configure / Editor, deselect "Use NewsReader/2 Editor",
; for Editor Name enter EPM.EXE, and for parameters enter
; /m % 'nr2post'
; ). The latter part of the line passes the NR2POST command to EPM
; whenever NR/2 opens an editor session. That's the command defined
; below. It checks for some common problems and warns you about them.
; - You get a warning if the Newsgroups: line contains a test group.
; (If it does, a line is added to the header to cut down on replies
; in case you don't remove the test group(s).)
; - You get a warning if the Newsgroups line contains both a comp.
; group and a .sex group.
; - You optionally get a warning if there are more than a certain number
; of newsgroups being posted to at once. Set NEWSGROUPS_LIMIT to the
; limit if this feature is desired; leave it undefined if it is not.
; - You optionally get a warning if the subject line contains any "bad words".
; This is a reminder for you to change the subject line if you're
; replying to the thread. Set BAD_SUBJECT_WORDS to the list of words
; you want to check for if this feature is desired; leave it undefined
; if it is not. The list below is silly, in order to avoid offending
; anyone; instead use any curse words, swear words, and racist epithets
; which you don't want to accidentally be associated with your name.
; This command also sets the tabs to 8 (mine are normally 3), sets the
; margins, and adds '/o' to the default save options, so the file will
; be saved in OS/2 format. (NR/2 might otherwise have problems if you
; import some text that has abnormal line terminators.)
; This is NR/2 specific in that it assumes the post header is stored
; separately with the same path and filename as the current file, but
; with an extension of .hdr. This could easily be changed to work
; with other newsreaders, as long as they let you configure the editor
; and its parameters.
; This can be included by your MYSTUFF.E, or compiled as a separate
; command.
; Power EPM user notes: I keep a number of versions of EPM around; my
; actual NR/2 setup fully-qualifies the editor: F:\EPM\603\EPM.EXE
; and the parameters field uses the /e option so EPM will load the
; EPM.EX file in my \epm\603 directory: /ef:\epm\603\epm.ex /m % 'nr2post'
; My MYCNF.E sets a number of machine-specific constants at the beginning
; so that my other MY*.EX files can be shared on all machines without
; modification. That's what the below EPM_VER_DIR is for - I prefer to
; switch to my EPM working directory. The relevant parts of my MYCNF.E
; are:
; const
; EPM_DRIVE = 'f:' -- The drive containing \epm, \epm\551, \epm\603, ...
; compile if EVERSION >= 6.04
; -- EPM version directory unknown (yet) - hope it's first in path.
; compile elseif EVERSION >= 6.03
; EPM_VER_DIR = EPM_DRIVE'\epm\603'
; compile elseif EVERSION >= 5.51
; EPM_VER_DIR = EPM_DRIVE'\epm\551'
; compile endif -- (Lots of other versions omitted for this example)
define
EDIT_NR2POST_HEADER__MSG = \10\10'Execute: e =.hdr'\10'to edit header and correct the problem.'
NEWSGROUPS_LIMIT = 8
BAD_SUBJECT_WORDS = 'TUSHY POOPHEAD HOSER' -- Use only upper case!
; Uncomment the following & modify appropriately if a disclaimer is desired in the header.
; POST_DISCLAIMER = "Disclaimer: This posting represents the poster's views, not necessarily those of their employer."
compile if not defined(SMALL) -- Allow for separate compilation
include 'stdconst.e'
tryinclude 'MYCNF.E' -- Include user's config
defmain
'nr2post' arg(1)
compile endif -- not defined(SMALL)
defc nr2post =
universal default_save_options
'postme tabs 8' -- Set the tabs to 8, so quoted stuff looks right.
'postme ma 1 65 1' -- Set the margins narrow, so post can be quoted a
-- few times without growing beyond 80 columns.
compile if defined(EPM_VER_DIR)
call directory(EPM_VER_DIR)
compile endif
compile if EPM32
default_save_options = default_save_options '/o' -- Save in OS/2 format.
compile endif
compile if 1 -- Want to turn on dynamic spell-checking for posts?
if .keyset<>'SPELL_KEYS' then -- Not already on?
'postme dynaspell'
endif
compile endif
'e =.hdr'
if rc then return; endif
0
wng = ''
edit_hdr_msg = ''
compile if 0 -- Include this section if you have problems with long lines in the header
l = longestline()
if l>255 then
wng = 'Caution: Longest line in header is' l 'characters.'
edit_hdr_msg = EDIT_NR2POST_HEADER__MSG
endif
compile endif
compile if defined(BAD_SUBJECT_WORDS)
compile if EPM32
'xcom l /^Subject\:/cx'
compile else
'xcom l /^Subject:/cg'
compile endif
if rc then
subject = ''
else
getline subject
compile if 1 -- Fix for bug in "NeoLogic News for OS/2 [version: 4.5 999]"
if leftstr(subject, 16) = 'Subject: Re: Re:' then
replaceline 'Subject: Re:' strip(substr(subject, 17), 'L')
'save /q'
endif
compile endif
subject = upcase(subject)
0
endif
compile endif -- defined(BAD_SUBJECT_WORDS)
compile if EPM32
'xcom l /^Newsgroups\:/cx'
compile else
'xcom l /^Newsgroups:/cg'
compile endif
; if rc then sayerror '"Newsgroups:" missing!'; return; endif
if rc then 'quit'; return; endif -- Could be missing because it's a note, not a post...
newsgroups = lowcase(textline(.line))
compile if defined(POST_DISCLAIMER)
insertline POST_DISCLAIMER, .last+1
compile endif
if pos('test', newsgroups) then
if wng <> '' then wng = wng\10\10; endif
wng = wng || 'Newsgroups line contains a test group!'
edit_hdr_msg = EDIT_NR2POST_HEADER__MSG
insertline 'X-test-avoider: No Reply', .line+1
compile if not defined(POST_DISCLAIMER) -- If no disclaimer added,
'file /q' -- File it if test avoider added,
else -- otherwise
'quit' -- just Quit.
endif
compile else -- If disclaimer added,
endif
'file /q' -- always File it.
compile endif
if pos('comp.', newsgroups) & pos('.sex', newsgroups) then
if wng <> '' then wng = wng\10\10; endif
wng = wng || 'Newsgroups: line cross-posted to both a comp and a sex group!'
edit_hdr_msg = EDIT_NR2POST_HEADER__MSG
endif
if pos('amiga', newsgroups) & pos('os2', newsgroups) then
if wng <> '' then wng = wng\10\10; endif
wng = wng || 'Newsgroups: line cross-posted between an Amiga & an OS/2 group!'
edit_hdr_msg = EDIT_NR2POST_HEADER__MSG
endif
if pos('alt.org.team-os2', newsgroups) & pos(',', newsgroups) then
if wng <> '' then wng = wng\10\10; endif
wng = wng || 'Newsgroups: line cross-posted to alt.org.team-os2'
edit_hdr_msg = EDIT_NR2POST_HEADER__MSG
endif
compile if defined(BAD_SUBJECT_WORDS)
do i = 1 to words(BAD_SUBJECT_WORDS)
if pos(word(BAD_SUBJECT_WORDS, i), subject) then
if wng <> '' then wng = wng\10\10; endif
wng = wng || 'Subject: line contains something undesirable.'
edit_hdr_msg = EDIT_NR2POST_HEADER__MSG
leave
endif
enddo
compile endif -- defined(BAD_SUBJECT_WORDS)
compile if defined(NEWSGROUPS_LIMIT)
c = count(',', newsgroups)
if c >= NEWSGROUPS_LIMIT then
if wng <> '' then wng = wng\10\10; endif
wng = wng || 'Newsgroups: line contains' c+1 'newsgroups.'
edit_hdr_msg = EDIT_NR2POST_HEADER__MSG
endif
compile endif -- defined(NEWSGROUPS_LIMIT)
compile if 0 -- Include this section if you have problems with long lines in the post body
l = longestline()
if l>255 then
if wng <> '' then wng = wng\10\10; endif
wng = wng || 'Caution: Longest line is' l 'characters.'
endif
compile endif
if wng <> '' then
call winmessagebox('Newsgroup warning', wng || edit_hdr_msg, MB_OK + MB_MOVEABLE)
endif