Re: Starting troubles with gloox
From: Benjamin van den Hout <bvdhout@xxxxxxxxx>
Date: Fri, 21 Aug 2009 13:06:54 +0200 (CEST)
Hi,

Visual studio should do fine I think, I see a lot of people getting it to
work there. I think the difficulty level is probably about the same, look
around the mailing list archives for people with a similar setup here:
http://camaya.net/glooxlist/dev/

I don't develop on Windows so I can't be much help but it should be easy
enough to get going. Good luck!

Regards,
Benjamin

On 21/08/2009, Ershad K <ershad92@xxxxxxxxx> wrote:
>
> Dear Sir,
>
> I'm using dial-up, hence i couldn't install eclipse in GNU/Linux as
> expected. I have Visual Studio 2009 express installed in Window$. What's
> your opinion on doing the project in Window$ ? Will that be easier than that
> of in Linux ?
>
> As a novice, my tries to install gloox under window$  fails. Could you
> please help me to do that ?
>
> Thanks,
> Ershad
>
> PS: Sorry if the topic has diverted. Feel free to say such things to me.
>
> On Tue, Aug 18, 2009 at 6:21 PM, Ershad K <ershad92@xxxxxxxxx> wrote:
>
>> Sir,
>> Thank you very much. I find your replies very useful and informative. As
>> you said, I would install eclipse and read the complete API documentation.
>> Thanks again for your active response.
>>
>> - Ershad
>>
>>
>> On Tue, Aug 18, 2009 at 6:15 PM, Benjamin van den Hout <bvdhout@xxxxxxxxx
>> > wrote:
>>
>>> Hi,
>>>
>>> If you look in the file 'tag.h' (because a Stanza is inherited from Tag)
>>> you'll see this as the return type:
>>>
>>>   /**
>>>        * This function can be used to retrieve the complete XML of a tag
>>> as a string.
>>>        * It includes all the attributes, child nodes and character data.
>>>        * @return The complete XML.
>>>        */
>>>       virtual const std::string xml() const;
>>>
>>> So yeah, it's a const std::string :)
>>>
>>> Regarding your second question, take a look at 'stanza.h' again and look
>>> at the return type of the from() method:
>>>
>>>     /**
>>>        * Returns the JID the stanza comes from.
>>>        * @return The origin of the stanza.
>>>        */
>>>       virtual const JID& from() const { return m_from; }
>>>
>>> So you're right, that returns a JID. fortunately there is also 'jid.h'
>>> which defines the 'JID' class and provides a method like this for instance:
>>>
>>>       /**
>>>        * Returns the full (prepped) JID (user\@host/resource).
>>>        * @return The full JID.
>>>        */
>>>       const std::string& full() const { return m_full; }
>>>
>>> So there's your string again. And if you want char, just do
>>> stanza->from().full().c_str() similar to the body.
>>>
>>> I think it would be wise to look at the 'api documentation' section of
>>> http://camaya.net/glooxdoc because it will document a lot of these
>>> things. Or get a decent IDE that allows you to easily go to
>>> definintion/implementation of highlighted identifiers (visual studio,
>>> eclipse, or even cscope..)
>>>
>>> Regards,
>>> Benjamin
>>>
>>>
>>>
>>> On 18/08/2009, Ershad K <ershad92@xxxxxxxxx> wrote:
>>>>
>>>> Dear Sir,
>>>>
>>>> I'm facing some difficulties now. Could you please say me the datatype
>>>> of stanza->xml ? Is that a 'std::string' ?
>>>>
>>>> I also would like to extract 'from address' from raw XML but I couldn't
>>>> do it since it's not a 'char'.  Is there any variable which holds the 'from
>>>> address' like that of body ( stanza->body().c_str() ) ?
>>>>
>>>> Please help me to solve these problems.
>>>>
>>>> Thanks,
>>>> Ershad
>>>>
>>>> On Mon, Aug 17, 2009 at 6:27 PM, Benjamin van den Hout <
>>>> bvdhout@xxxxxxxxx> wrote:
>>>>
>>>>> No problem, enjoy experimenting with this great library :)
>>>>>
>>>>> Kind regards,
>>>>>
>>>>> Benjamin
>>>>>
>>>>> On 17/08/2009, Ershad K <ershad92@xxxxxxxxx> wrote:
>>>>>>
>>>>>> It worked !! I have no words to express my gratitude towards you !
>>>>>> Thank you Very much.
>>>>>>
>>>>>> All the very best,
>>>>>>
>>>>>> - Ershad
>>>>>>
>>>>>> On Mon, Aug 17, 2009 at 6:20 PM, Benjamin van den Hout <
>>>>>> bvdhout@xxxxxxxxx> wrote:
>>>>>>
>>>>>>> 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
>>>>>>>
>>>>>>> --
>>>>>>> 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
>>>>>
>>>>> --
>>>>> 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
>>>
>>> --
>>> 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