On Sunday March 19 2006 21:19, Patrick Bichler wrote:
> i cannot get the sending code to work as i want.
> in the example codes it is always like: when you receive a message you
> answer on it immidiately.
> but i want it that i can send a message any time when i call a specific
> function.
When a contact first messages you, you get a MessageSession from ClientBase.
You should save this MessageSession alongside your chat window, or whatever.
A MessageSession always is associated with one specific contact (full JID).
If another one messages you, you will get another MessageSession, specific to
that full JID, etc...
When you want to message a contact you don't have a MessageSession for, just
create a new one for that contact (and store it for future use).
To send a message to the MessageSession's remote contact, use
MessageSession::send().
When you don't need a MessageSession anymore (e.g, because the user closed the
respective chat window), you may delete the MessageSession.
HTH,
Jakob
Attachment:
pgpejmS00n8nz.pgp
Description: PGP signature
--
gloox-dev mailing list
to unsubscribe:
send a message with subject 'unsubscribe gloox-dev' to minimalist@xxxxxxxxxx