Tt_pattern * ttdt_message_accept( Tt_message contract, Ttdt_contract_cb cb, void * clientdata, Widget shell, int accept, int sendStatus );
The ttdt_message_accept() function accepts a contract to handle a ToolTalk request. A tool calls this function when it wants to accept responsibility for handling (that is, failing or rejecting) a request.
A Ttdt_contract_cb argument takes the parameters listed in Table A-10.
Table A-10 Parameters Taken by the Ttdt_contract_cb Argument
Parameter |
Description |
---|---|
Tt_message msg |
The request in the sent state. The client program must either fail, reject, or reply to the message. |
Tttk_op op |
The operation of the incoming request. |
Widget shell |
The shell passed to the ttdt_message_accept() function. |
void *clientdata |
The client data passed to the ttdt_message_accept() function. |
Tt_message contract |
The contract passed to the ttdt_message_accept() function. |
If the callback processes the message msg successfully, it returns zero; otherwise, it returns a tt_error_pointer cast to Tt_message.
If the callback does not consume the message msg, it returns the message and passes the TT_CALLBACK_CONTINUE routine down the call stack to offer the message to other callbacks, or to return it to the tt_message_receive() call.
The ttdt_message_accept() function registers in the default session for the handler-addressed requests described in Table A-11.
Table A-11 Requests for which ttdt_message_accept Registers
If the contract argument has a TT_WRN_START_MESSAGE message status, the message caused the tool to be started.
The started tool should join any scopes it wants to serve before accepting the contract so that it will receive any other messages already dispatched to its ptype; otherwise, the tool should undeclare its ptype while it is busy. If the tool does not join any scopes, the dispatched messages will cause other instances of the ptype to be started.
If the accept argument is true, the ttdt_message_accept() function calls
tt_message_accept( contract )
If the sendStatus argument is true, the ttdt_message_accept() function sends a Status notice to the requestor, using the parameters (if any) passed to the ttdt_open() function.
This function returns a null-terminated array of Tt_pattern. Use the tttk_patterns_destroy() function to destroy the array. If an error is returned, the returned array is an error pointer that can be decoded with tt_ptr_error. Table A-12 is a list of the possible errors returned by the ttdt_message_accept() function.
Table A-12 Possible Errors Returned by ttdt_message_accept
Returned Error |
Description |
---|---|
The ttsession process is not available. The ToolTalk service tries to restart ttsession if it is not running. This error indicates that the ToolTalk service is either not installed or not installed correctly. |
|
The pointer passed does not point at an object of the correct type for this operation. For example, the pointer may point to an integer when a character string is needed. |
|
The ttsession for the default session is a version (1.0 or 1.0.1) that does not support the tt_message_accept() function. Note - Note: If the contract argument has a TT_WRN_START_MESSAGE message status, messages to the tool's ptype will remain blocked until the contract is rejected, replied to, or failed. |