🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: borland.public.cppbuilder.internet.socket
7 messages
7 total messages Started by John Sat, 17 Sep 2005 20:08
Set message read/unread
#3445
Author: John
Date: Sat, 17 Sep 2005 20:08
11 lines
1115 bytes
Hi,

how can I set a message as read / unread? My code does not work:

  int UID;
  if (IdIMAP4->StoreFlags(UID,sdAddSilent,mfSeen))
    ShowMessage("Success");
  else
    ShowMessage("Error");

Can you help me please? I'm using C++Builder 6. 
Re: Set message read/unread
#3447
Author: Remy Lebeau (TeamB)
Date: Mon, 19 Sep 2005 06:27
25 lines
1547 bytes
"John" <qwertzuiopmiller@web.de> wrote in message
news:432c778a@newsgroups.borland.com...

> how can I set a message as read / unread? My code does not work:

Just saying it does not work says nothing about the actual problem you are
having.  Always provide specific details.

>   if (IdIMAP4->StoreFlags(UID,sdAddSilent,mfSeen))

That will not compile.  You need to use the following instead:

    int UID = some actual value;
    if( IdIMAP4->StoreFlags(OPENARRAY(int, (UID)), sdAddSilent,
TIdMessageFlagsSet() << mfSeen) )

Alternatively, use UIDStoreFlags() instead:

    int UID = some actual value;
    if( IdIMAP4->UIDStoreFlags(IntToStr(UID), sdAddSilent,
TIdMessageFlagsSet() << mfSeen) )


Gambit
Re: Set message read/unread
#3452
Author: John
Date: Mon, 19 Sep 2005 11:10
18 lines
1543 bytes
> Alternatively, use UIDStoreFlags() instead:
>
>    int UID = some actual value;
>    if( IdIMAP4->UIDStoreFlags(IntToStr(UID), sdAddSilent, 
> TIdMessageFlagsSet() << mfSeen) )

Hmm..
I receive the error "Invalid UID Store attribute". But I tried also the 
following code without success:

  TIdMessageFlagsSet MsgFlags;
  String UID = "8";
  IdIMAP4->UIDRetrieveFlags(UID, MsgFlags);

  if (IdIMAP4->UIDStoreFlags(UID, sdReplaceSilent, MsgFlags >> mfSeen))
  ...

What's wrong? Thank you for your help. 
Re: Set message read/unread
#3455
Author: Remy Lebeau (TeamB)
Date: Mon, 19 Sep 2005 17:28
17 lines
1481 bytes
"John" <qwertzuiopmiller@web.de> wrote in message
news:432e9c3b@newsgroups.borland.com...

> I receive the error "Invalid UID Store attribute".

That is a server error.  You are not supplying the proper parameter values
for the command.

> But I tried also the following code without success:

Where exactly is it failing?  Is UIDRetrieveFlags() succeeding at all?  What
happens if you don't change the flags silently?  Did you verify that you are
specifying a valid UID to begin with?


Gambit
Re: Set message read/unread
#3449
Author: John
Date: Mon, 19 Sep 2005 22:06
19 lines
1745 bytes
> That is a server error.  You are not supplying the proper parameter values 
> for the command.
What should I do? I have used your code.
PS: I have captured the network traffic:
----------
C29 UID FETCH 1 (FLAGS)
* 1 FETCH (FLAGS (\Seen) UID 1)
C29 OK Completed (0.000 sec)
C30 UID STORE 1  ()
C30 BAD Invalid UID Store attribute
----------

> Is UIDRetrieveFlags() succeeding at all?
Yes! No problems.

> What happens if you don't change the flags silently?  Did you verify that 
> you are specifying a valid UID to begin with?
The same error if I don't change the message flags.. and the UID is valid. 
Should I test the code with an other imap server? 
Re: Set message read/unread
#3451
Author: Remy Lebeau (TeamB)
Date: Mon, 19 Sep 2005 22:30
14 lines
1575 bytes
"John" <qwertzuiopmiller@web.de> wrote in message
news:432f361a$1@newsgroups.borland.com...

> C30 UID STORE 1  ()
> C30 BAD Invalid UID Store attribute

It would appear that both StoreFlags() and UIDStoreFlags() suffer from the
same bug - TIdIMAP4 is not constructing the command properly.  Until the bug
is fixed, try using the non-silent methods.  In other words, use sdAdd or
sdReplace instead of sdAddSilent or sdReplaceSilent, respectively.


Gambit
Re: Set message read/unread
#3463
Author: John
Date: Tue, 20 Sep 2005 11:14
1 lines
1211 bytes
Ok, thank you very much! It works. :-) 
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