Re: Starting troubles with gloox
From: Benjamin van den Hout <bvdhout@xxxxxxxxx>
Date: Mon, 17 Aug 2009 14:56:22 +0200 (CEST)
I presume you're now looking for the actual message text right?

If you look in your gloox source directory, there should be a file called
src/examples/message_example.cpp. Look there and you'll find this snippet of
code:

virtual void handleMessage( Stanza *stanza, MessageSession * /*session*/ )
{
      printf( "type: %d, subject: %s, message: %s, thread id: %s\n",
stanza->subtype(),
              stanza->subject().c_str(), stanza->body().c_str(),
stanza->thread().c_str() );
}

That should get you started probably on which fields you want to look at :)

Regards,
Benjamin



On 17/08/2009, Ershad K <ershad92@xxxxxxxxx> wrote:
>
> Thank you very much. I got the raw XML in console ! What should i do to get
> its processed version (plain text)?
>
> If a user sends a command to the bot, I would like to print his ID and the
> command in the console. This is what i meant by "current user id", sorry if
> o had made any confusion. The second part is almost solved now.
>
> Thanks again for your kind and speedy response.
>
>
> On Mon, Aug 17, 2009 at 6:04 PM, Benjamin van den Hout 
> <bvdhout@xxxxxxxxx>wrote:
>
>> Hi Ershad,
>>
>> Have you looked at this page? http://camaya.net/glooxexample
>>
>> If you want to print the raw XML of stanza's do this:
>>
>> std::cout << stanza->xml() << std::endl;
>>
>> Regarding the current user id, what do you mean exactly? If you want to
>> know where the message came from the
>> stanza->from().full() call in the example page does exactly what you want,
>> it gives you the full JID of the 'from' field...
>>
>> Regards,
>> Benjamin
>>
>> On 17/08/2009, Ershad K <ershad92@xxxxxxxxx> wrote:
>>
>>> Dear Sir,
>>>
>>>     First of all, I would like to congratulate gloox members who give a
>>> wonderful support to novices like me. This time, I have some simple starting
>>> troubles. As a beginner in C++, It's almost impossible to understand the
>>> complete working of gloox. I couldn't find a tutorial also.  Hence I request
>>> you to give me a hand in solving some of my issues :
>>>
>>> My aim is to develop a simple jabber bot which gives output according to
>>> the commands given by the user. These are the problems in my way :
>>>
>>> 1. How could i receive and print incoming messages in console? is there
>>> any function for that ?
>>> 2. How to get the current user's ID ?
>>>
>>> Please help me to solve these issues. Thanks in advance.
>>>
>>> Regards,
>>> Ershad
>>>
>>>
>>>
>>>
>>>
>>> --
>>> gloox-dev mailing list
>>> to unsubscribe:
>>> send a message with subject 'unsubscribe gloox-dev' to
>>> minimalist@xxxxxxxxxx
>>>
>>>
>>
>>
>> --
>> Groeten,
>> Benjamin
>> --
>> gloox-dev mailing list
>> to unsubscribe:
>> send a message with subject 'unsubscribe gloox-dev' to
>> minimalist@xxxxxxxxxx
>>
>
>
> --
> gloox-dev mailing list
> to unsubscribe:
> send a message with subject 'unsubscribe gloox-dev' to
> minimalist@xxxxxxxxxx
>
>


-- 
Groeten,
Benjamin