program OnBeforeSendingMessage;
function OnBeforeSendingMessage(var Message: TStringlist; Servername: string; IsEmail: boolean):boolean;
begin
message.insert (1, 'Distribution: world');
end;
begin
end.
Now, if I wanted to check which newsgroup the message is sent to, and
then only add the header if that group is "foo.bar", how would I go
about doing that?
> Now, if I wanted to check which newsgroup the message is sent to, and
> then only add the header if that group is "foo.bar", how would I go
> about doing that?
I'm not a scripting expert, but you might want to take a look at
http://40tude.com/dialog/wiki/index.php/JustifyMessage
The script contains the function you're looking for and you should be able
to extract it for your own use.
--
J. Cifer
program OnBeforeSendingMessage;
const cNewsgroups = 'Newsgroups: ';
cGroup = 'foo.bar';
cDistribution = 'Distribution: world';
function OnBeforeSendingMessage(var Message: TStringlist; Servername: string; IsEmail: boolean):boolean;
var i : integer;
begin
for i := 0 to message.count-1 do
begin
if copy(message.strings[i], 1, length(cNewsgroups)) = cNewsgroups then
begin
if pos(cGroup, message.strings[i]) > 0 then
begin
message.insert (1, cDistribution);
break;
end;
end;
end;
end;
begin
end.
of course, this won't work properly if you're posting to a
group called 'megafoo.bar' :)
(all possible typos and compile errors are due to the fact that
i woke up a couple of minutes ago.)
--
there is a cheer. the gnomes have learned a new way to say hooray. [-shpongle]
address is scrambled - remove SPAMISEVIL to reply
> (all possible typos and compile errors are due to the fact that
> i woke up a couple of minutes ago.)
Thanks, Matija! It works perfectly.
sometimes i scare myself. if i'm able to make a working piece
of code exactly four and a half minutes after being violently
woken up from my sleep, well...