Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 149
  • Last Modified:

EASY POSTING QUESTION!


I am developing a NewsGroup posting application and I just want to a have a message attached to every message the enduser post.  How can I do this?  Also on a different subject how do I create a counter to count the number of lines automatically in a Memo or ListsBox?   I need a quick answer to both questions if possible.

Thanks

0
aj85
Asked:
aj85
  • 4
  • 4
  • 2
  • +2
1 Solution
 
viktornetCommented:
Q#2) CountLines := Memo1.Lines.Count;

Regards,
Viktor Ivanov

0
 
erajojCommented:
You have to be more specific on the first question.
NNTP components? How do you store messages?
Are the messages in a memo control? How should the messages be attached? Appended? Inserted? Formatted?

If you are using a richedit, memo or other TString based control then to append a previously defined "message"/text from another TStrings/TStringList (which is very common), then just use:

  MyMessage: TStringList;  
  ...
  Memo1.Lines.AddStrings( MyMessage );
  or
  Memo1.Lines.AddStrings( Memo2.Lines );
  or
  UserMessage{TStringList}.AddStrings( MyMessage );

/// John
0
 
clopezCommented:
I don't get your Idea.

1.- You want to send a second  message each time the user send one? You want to automaticaly replay?

2.- You mean a counter on the form (like whe editing strings in the IDE)?

procedure TForm1.Memo1Change(Sender: TObject);
begin
   Label1.Caption:=IntToStr(Memo1.Lines.Count);
end;



0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
aj85Author Commented:

Clopez,

You have the second question, I think.  What I am saying is that if I had a listbox and wanted to count the number of lines of data as it they are being added.  The first question is that I just want to add a message to every message the enduser post.
0
 
clopezCommented:
I don't get the second one.

1.- Is your application:
   A.- A new server (It receives messages.)
   B.- A client (It sends messages to a server on a user command)
   C.- A proxy (It gets data from a client app and send it to a news server).

2.- Do you want to:
   A.- Add that message to the end of the user message.
   B.- Add another message to the news server.
   C.- Send back a message to the client. ??? (Not easy)
0
 
aj85Author Commented:


Clopez,

Thanks for giving me several options to choose from, the answer that I am looking for is: 1B & 2A.  I want the enduser to send massages to the server & I want to have a hard-code message attached to the message the enduser post.  I hope this helps you answer this one so that I can give you the points.  Your answer to my first question was very clear and it worked like a charm!

Thanks,
Tony
0
 
aj85Author Commented:

Sorry, I meant your answer to my second question, i.e. the counter question.

Tony
0
 
erajojCommented:
Isn't the information already provided sufficient to solve your problems? In that case, what are you missing? There is really nothing else to add here?!

/// John
0
 
clopezCommented:
Lets see if I am right.

I suppose you have a form with a couple of edits (as an news group address, subject ...)  and a memo (as the message), you also have a button (or a menu option) that whe the user press it the message gets sent to the server.  It's that ok?

What you what to do is to send another message to the server at the same time.  And you also want to have this message linked to the first message like a follow up message?

Or, you what to send a file (or some attached data like a signature) in the same message?


0
 
aj85Author Commented:


Clopez,

You are correct in that I want to attach a file much like a data signature, in the same message.  I you can answer this, I will release your points.

Thanks


0
 
rickpetCommented:
aj85...

It really comes down to how you are sending through your NNTP component...(I assume you are using a component)


slSignature: TStringList;
.
slSignature := TStringList.create;
with slSignature do begin
  Add('This is a signature');
end;

.

with Memo1 do begin
  for i:= 0 to slSignature.count -1 do
    Add(slSignature.Lines[i];

???PostNewsMessage(Message: TString);

If this is the case...use Assign to copy your Memo to your Message...

Rick
0
 
clopezCommented:
Ok, sorry it took me so long.  I've been trying to chekck if the answer works.

Add to the end of the text message a line like:

begin <filesize> <filename>

then UUEncode your signature (attachment) and place it after that

end up with a line saying "end" and thats it.  So it will look like

begin <filesize> <filename>
<UUEncoded Data>
<UUEncoded Data>
<UUEncoded Data>
<UUEncoded Data>
end

If you whant to see how it is done.  I took a look to the Forte Agent News reader.  I posted a message with an attachment to a group and the when I got it back I set in the menu Message\Show Raw Message.   Before posting check that under Group\Default properties, on the Send Files Tab that Attachment Placement is "Inline MIME Section".

For UUEncoding you can find a couple of component in the DSP page:

http://SunSITE.icm.edu.pl/delphi/

Hope it works for you.
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

  • 4
  • 4
  • 2
  • +2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now