Ok Mathias, but I don't understand how to use it. In fact, imagine I ( [EMAIL PROTECTED]) have a session opened... the current "sess" in c2s.c, c2s_client_sx_callback. I 'm gonna send a packet to you ( [EMAIL PROTECTED] ), juste before the sm_packet. the full jid of the session "sess" is mine, [EMAIL PROTECTED] If I sent a message to you, I should be able to read somewhere ( in nad I suppose ) that this message is for "[EMAIL PROTECTED]", 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 "[EMAIL PROTECTED]" 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
[EMAIL PROTECTED]
https://jabberstudio.org/mailman/listinfo/jdev



-- Remy Harel - [EMAIL PROTECTED] G.I.C.M - Distributed Systems & IT Linux Registered User #224740



_______________________________________________
jdev mailing list
[EMAIL PROTECTED]
https://jabberstudio.org/mailman/listinfo/jdev

Reply via email to