[jdev] Need help

Remy HAREL remy.harel at GICM.FR
Wed May 26 05:26:42 CDT 2004


Ok Mathias, but I don't understand how to use it. In fact, imagine I ( 
i at gabber) have a session opened... the current "sess" in c2s.c, 
c2s_client_sx_callback. I 'm gonna send a packet to you ( you at gabber ), 
juste before the sm_packet.  the full jid of the session "sess" is mine, 
i at gabber. If I sent a message to you, I should be able to read somewhere 
( in nad I suppose ) that this message is for "you at gabber", no ?

 How should I call nad_find_attr  to do what I want ? I've tried 
something like :

attr_tmp = nad_find_attr(nad,0,-1,"to",NULL);    // here value is '-1'
recipient = (char*) malloc(sizeof(char) * NAD_AVAL_T(nad, attr_tmp);
recipient = (char*)NAD_AVAL(nad, attr_tmp);   // crash, due to 
attr_tmp's value

due to attr_tmp which value's -1; nad_find_attr didn't find the 
attribute "to". Moreover, this attribute value isn't "you at gabber" but 
just "gabber"... so only the domain. I saw this by using  tcpdump.

 Thanks

Matthias Wimmer wrote:

>Hi Remy!
>
>Remy HAREL schrieb am 2004-05-24 12:07:40:
>  
>
>> I'm looking for the full jid of the recipient of a packet, in c2s 
>>module.Can I determine it by using this command :
>>
>>tmp = nad_find_attr ( nad, 0, -1, "to", NULL )
>>
>>But this will return an integer, will not ? I'd prefer a char* because 
>>the full jid is a char*. Is it the good way to get the full jid of the 
>>recipient of a packet or is there a better solution ( need in c2s.c ) ?
>>    
>>
>
>I do not know why you want to check for the receipient of the packet in
>c2s. If you check packets from the sm you might already have the
>receipient parsed in the code as c2s has to deliver the packets.
>If you want it for packets that arrived from a client, I am not sure if
>it is a good idea ...
>
>In any case ... nad_find_attr will return you an integer that is
>something like a handle. You can use the macros NAD_AVAL and NAD_AVAL_L
>... the first will return a pointer to the string (that is NOT zero
>terminated!) and the second will give you the length of the string.
>
>
>Tot kijk
>    Matthias
>
>  
>
>------------------------------------------------------------------------
>
>_______________________________________________
>jdev mailing list
>jdev at jabber.org
>https://jabberstudio.org/mailman/listinfo/jdev
>  
>

-- 
Remy Harel - remy.harel at gicm.fr
G.I.C.M - Distributed Systems & IT
Linux Registered User #224740






More information about the JDev mailing list