🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: borland.public.cppbuilder.internet.socket
8 messages
8 total messages Started by MwnN Mon, 05 Mar 2007 12:53
Indys NNTP Posting problem
#1219
Author: MwnN
Date: Mon, 05 Mar 2007 12:53
37 lines
2300 bytes
Hi,

I was wondering what might be wrong with the below code, it runs fine but 
there's no message being posted onto the server, plus, is there a was I can 
get information back from the Post() method to inform me if it was 
successful or failed? as the OnStatus even tells me "Encoding Text" and then 
that's it, my thread exits. IdNNTP1WorkEnd() ends with 'wmWrite'

Thanks,
MwnN


IdNNTP2->Username = "********";
IdNNTP2->Password  = "********";
IdNNTP2->Host = "my-news-server.com";
IdNNTP2->Port = 119;
IdNNTP2->Connect();

TIdMessage* msg            = new TIdMessage(NULL);
TIdEMailAddressList*  el = new TIdEMailAddressList(NULL);
TIdEMailAddressItem* ei = new TIdEMailAddressItem(NULL);

ei->Address             = "Test@test.co.uk";
el->EMailAddresses =  "Test@test.co.uk";
msg->ReplyTo         = el;
msg->Sender           = ei;
msg->From              = ei;
msg->Body->Text   = "Testing Text Post";
msg->Subject          = "Testing Text Post";

IdNNTP2->SelectGroup("0.test");
IdNNTP2->Post(msg);

delete msg;
delete el;
delete ei;
IdNNTP2->Disconnect(); 
Re: Indys NNTP Posting problem
#1220
Author: Remy Lebeau (TeamB)
Date: Mon, 05 Mar 2007 18:19
59 lines
2540 bytes
"MwnN" <MwnN@localhost.com> wrote in message
news:1NOdncmTj_xWj3HYRVnygAA@giganews.com...

> I was wondering what might be wrong with the below code, it
> runs fine but there's no message being posted onto the server

Is there an exception being thrown?  If not, then the message is
guaranteed to be posted.

> is there a was I can get information back from the Post() method to
> inform me if it was successful or failed?

If no exception is thrown, then it was successful.

> the OnStatus even tells me "Encoding Text" and then that's it, my
thread exits.

Then an exception is likely being thrown that you are not catching.
You should be wrapping your code in try..catch blocks, ie:

    IdNNTP2->Username = "********";
    IdNNTP2->Password  = "********";
    IdNNTP2->Host = "my-news-server.com";
    IdNNTP2->Port = 119;

    try
    {
        TIdMessage* msg = new TIdMessage(NULL);
        try
        {
            msg->ReplyTo->EMailAddresses = "Test@test.co.uk";
            msg->From->Address = "Test@test.co.uk";
            msg->Body->Text = "Testing Text Post";
            msg->Subject = "Testing Text Post";

            IdNNTP2->Connect();
            try
            {
                IdNNTP2->SelectGroup("0.test");
                IdNNTP2->Post(msg);
            }
            __finally
            {
                IdNNTP2->Disconnect();
            }
        }
        __finally
        {
            delete msg;
        }
    }
    catch(const Exception &)
    {
        // error posting the message, do something
    }


Gambit
Re: Indys NNTP Posting problem
#1221
Author: MwnN
Date: Mon, 05 Mar 2007 21:15
32 lines
2422 bytes
"Remy Lebeau (TeamB)" wrote in message 
news:45ec673b@newsgroups.borland.com...
>
>
> Then an exception is likely being thrown that you are not catching.
> You should be wrapping your code in try..catch blocks, ie:
>

> Gambit


Hey Gambit,

I was using a try catch block in my code but nothing came up, so I decided 
to test on the borland.test group news server and I got the exception, very 
strange!!

I needed to call

msg->NewsGroups->Add("borland.public.test");

first inorder for it to post on the newsgroups.borland.com server, however, 
when logging into my nntp server with a username/password to 
news-europe.giganews.com the exception never happened and nothing was 
posted, calling the line above to add the group fist worked on my news 
server too which enabled posting, any ideas as to why the group is needed, 
this could make things messy if the group is removed form the server, having 
to redownload the full list again to verify groups, but at least the 
exception was thrown on both news servers that no such group existed.

Thanks again Gambit!
Re: Indys NNTP Posting problem
#1222
Author: MwnN
Date: Mon, 05 Mar 2007 21:47
22 lines
1793 bytes
Any idea as to why when posting on different times, with the same settings 
my messages are becoming child messages of the first post and not new root 
messages as you might say on the news server?

-Test Message
    Test Message
    Test Message
    Test Message
    Test Message
    Test Message

instead of

- Test Message
- Test Message
- Test Message
- Test Message
- Test Message


Thanks,
MwnN 
Re: Indys NNTP Posting problem
#1223
Author: MwnN
Date: Tue, 06 Mar 2007 22:20
57 lines
2398 bytes
"Remy Lebeau (TeamB)" wrote in message
news:45ec673b@newsgroups.borland.com...
>
>
> Then an exception is likely being thrown that you are not catching.
> You should be wrapping your code in try..catch blocks, ie:
>

> Gambit


Hey Gambit,

I was using a try catch block in my code but nothing came up, so I decided
to test on the borland.test group news server and I got the exception, very
strange!!

I needed to call

msg->NewsGroups->Add("borland.public.test");

first inorder for it to post on the newsgroups.borland.com server, however,
when logging into my nntp server with a username/password to
news-europe.giganews.com the exception never happened and nothing was
posted, calling the line above to add the group fist worked on my news
server too which enabled posting, any ideas as to why the group is needed,
this could make things messy if the group is removed form the server, having
to redownload the full list again to verify groups, but at least the
exception was thrown on both news servers that no such group existed.

Thanks again Gambit!

Also,

Any idea as to why when posting on different times, with the same settings
my messages are becoming child messages of the first post and not new root
messages as you might say on the news server?

-Test Message
    Test Message
    Test Message
    Test Message
    Test Message
    Test Message

instead of

- Test Message
- Test Message
- Test Message
- Test Message
- Test Message


Thanks,
MwnN 
Re: Indys NNTP Posting problem
#1224
Author: Remy Lebeau (TeamB)
Date: Tue, 06 Mar 2007 23:46
34 lines
2169 bytes
"MwnN" <MwnN@localhost.com> wrote in message
news:45ede924$1@newsgroups.borland.com...

> I was using a try catch block in my code but nothing came up

Then no error was occuring.  The message was successfully being
delivered to the server.  Maybe you simply were not refreshing your
reader?

> I needed to call
>
> msg->NewsGroups->Add("borland.public.test");
>
> first inorder for it to post on the newsgroups.borland.com server

That makes sense.  Even though the server knows the specific newsgroup
the client is posting to, the message itself still has to specify the
newsgroup(s) as well.

> any ideas as to why the group is needed

Because NNTP servers require it.

> this could make things messy if the group is removed form the
> server, having to redownload the full list again to verify groups

No, it does not.  You know the group you are posting to, so simply
ensure that the group exists in the message header before posting it.
You don't have to verify anything on the server.  And if the group
disappears from the server, its messages disappear with it anyway.


Gambit
Re: Indys NNTP Posting problem
#1225
Author: Mark Jacobs
Date: Wed, 07 Mar 2007 14:00
10 lines
1455 bytes
Nothing seems to be maintaining the "References" value in the news message 
header. Does Indy handle this automatically, or do you need to add code like 
:-

Set NNTP Message Header section References to References plus Message-ID of 
what you're repying to?
-- 
Mark Jacobs
DK Computing
http://www.dkcomputing.co.uk
Re: Indys NNTP Posting problem
#1226
Author: Remy Lebeau (TeamB)
Date: Wed, 07 Mar 2007 17:54
21 lines
1441 bytes
"Mark Jacobs" <http://www.jacobsm.com/mjmsg.htm?BorlandNG> wrote in
message news:45eec52d@newsgroups.borland.com...

> Nothing seems to be maintaining the "References" value in the
> news message header.

That is not Indy's responsibilty to manage.  You have to do that in
your own code, since only you know which messages you are posting
replies to.

> Does Indy handle this automatically

No.

> or do you need to add code like :-

Yes.


Gambit
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