Text chat
| Interacting with the server |

### Text chat

In addition to voice chat, TeamSpeak 3 allows clients to communicate with text-chat. Valid targets can be single and multiple clients and channels or the whole server.

#### Sending

To send a text message, call

`unsigned int ts3client_requestSendTextMsg(` | serverConnectionHandlerID, |
| targetMode, |
| message, |
| targetID, |
| returnCode`)`; |

`anyID serverConnectionHandlerID`;
`int targetMode`;
`const char* message`;
`const anyID* targetID`;
`const char* returnCode`;

Parameters

- `serverConnectionHandlerID`

  Id of the target server connection handler.

- `targetMode`

  Sets the target type of the sent message. The value is defined by the enum TextMessageTargetMode:

      enum TextMessageTargetMode {
          TextMessageTarget_CLIENT=1,
          TextMessageTarget_CHANNEL,
          TextMessageTarget_SERVER,
          TextMessageTarget_MAX
      };

- `message`

  String containing the text message

- `targetID`

  NULL-terminated array of target IDs. The type of the given IDs depends on the `targetMode`. If the target mode is for example `TextMessageTarget_CLIENT`, the target IDs will be treated as client IDs.

- `returnCode`

  See return code documentation. Pass NULL if you do not need this feature.

Returns `ERROR_ok` on success, otherwise an error code as defined in `public_errors.h`.

Example to send a text chat to a single client with the ID 123:

    const char *msg = "Hello TeamSpeak!";
    anyID targetIDList[2];
    targetIDList[0] = 123;  /* Client ID in this example */
    targetIDList[1] = NULL; /* NULL-terminated */

    if(ts3client_requestSendTextMsg(scHandlerID, TextMessageTarget_Client, msg, targetIDList) != ERROR_ok) {
      /* Handle error */
    }

#### Receiving

The following event will be called when a text message is received:

`void onTextMessageEvent(` | serverConnectionHandlerID, |
| targetMode, |
| fromID, |
| fromName, |
| fromUniqueIdentifier, |
| message, |
| targets`)`; |

`anyID serverConnectionHandlerID`;
`anyID targetMode`;
`anyID fromID`;
`const char* fromName`;
`const char* fromUniqueIdentifier`;
`const char* message`;
`anyID* targets`;

Parameters

- `serverConnectionHandlerID`

  ID of the server connection handler from which the text message was sent.

- `targetMode`

  The requested targetMode, defined by the enum TextMessageTargetMode.

- `fromID`

  Id of the client who sent the text message.

- `fromName`

  Name of the client who sent the text message.

- `fromUniqueIdentifier`

  Unique ID of the client who sent the text message.

- `message`

  String containing the text message.

- `targets`

  NULL-terminated array of target IDs. The type of the given IDs depends on the targetMode.

Moving a channel |  | Kicking clients