To use the chat, you need to get the pointer of the chat object with the method getChat.
Use the send method of the chat object. You will get back your own message.
You need to register the newChatMessage signal who will be called for each message get.
Use the method search to create a new search object. Register the found signal to get back the search result. The signal can be emitted several time.
Use search on the search object to begin the search. This function can be called only one time, to make a new search create a new search object. You must (except if you don't care about results but...) have registered to the signal before launching the search !