Thanks. I will give a try and let you know
-----Original Message-----
From: Jakob Schroeter [mailto:js@xxxxxxxxxx]
Sent: Monday 2010-03-08 3:40 AM
To: gloox-dev@xxxxxxxxxx
Subject: [gloox-dev] Re: How to handle offline message
Quoting Ruddy Gbaguidi <plugworld@xxxxxxxxxx>:
> Hi all.
>
> First I want to thank to gloox developers for this great library.
>
>
>
> We have a software using gloox to communicate with other software.
>
> When we connect to the jabber network, sometimes, we receive messages
> that was sent when we were offline.
>
> On the handleMessage, in the message, I don't see anything about if
> the received message was one sent when we were offline or not.
>
>
>
> But in the raw xml, I can see a <offline /> tag..
Hi,
You are probably seeing message events in there.
Before connecting, register MessageEvent with ClientBase:
client->registerStanzaExtension( new MessageEvent() );
Then, in handleMessage(), check for the existence of that extension, and check
the return value of events():
const MessageEvent* me = msg->findExtension( ExtMessageEvent );
if( me )
{
if( me->event & MessageEventOffline )
// ... the other client supports message events
}
However, to check if a message was sent while you were offline it is better to
check for the DelayedDelivery extension. Same deal,
basically: Register an empty instance of DelayedDelivery with ClientBase and
check for its existance in handleMessage(). See
XEP-0203 for more details.
cheers,
Jakob