Text chat

In addition to voice chat, TeamSpeak 3 allows clients to communicate with text-chat. Valid targets can be a client, channel or virtual server. Depending on the target, there are three functions to send text messages and one callback to receive them.

Sending

To send a private text message to a client:

unsigned int ts3client_requestSendPrivateTextMsg(serverConnectionHandlerID, á
ámessage, á
átargetClientID, á
áreturnCode);á
uint64 serverConnectionHandlerID;
const char* message;
anyID targetClientID;
const char* returnCode;
á

Parameters

  • serverConnectionHandlerID

    Id of the target server connection handler.

  • message

    String containing the text message

  • targetClientID

    Id of the target client.

  • 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.


To send a text message to a channel:

unsigned int ts3client_requestSendChannelTextMsg(serverConnectionHandlerID, á
ámessage, á
átargetChannelID, á
áreturnCode);á
uint64 serverConnectionHandlerID;
const char* message;
anyID targetChannelID;
const char* returnCode;
á

Parameters

  • serverConnectionHandlerID

    Id of the target server connection handler.

  • message

    String containing the text message

  • targetChannelID

    Id of the target channel.

  • 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.


To send a text message to the virtual server:

unsigned int ts3client_requestSendServerTextMsg(serverConnectionHandlerID, á
ámessage, á
áreturnCode);á
uint64 serverConnectionHandlerID;
const char* message;
const char* returnCode;
á

Parameters

  • serverConnectionHandlerID

    Id of the target server connection handler.

  • message

    String containing the text message

  • 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 client with ID 123:

const char *msg = "Hello TeamSpeak!";
anyID targetClientID = 123;

if(ts3client_requestSendPrivateTextMsg(scHandlerID, msg, targetClient, NULL) != ERROR_ok) {
  /* Handle error */
}

Receiving

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

void onTextMessageEvent(serverConnectionHandlerID, á
átargetMode, á
átoID, á
áfromID, á
áfromName, á
áfromUniqueIdentifier, á
ámessage);á
uint64 serverConnectionHandlerID;
anyID targetMode;
anyID toID;
anyID fromID;
const char* fromName;
const char* fromUniqueIdentifier;
const char* message;
á

Parameters

  • serverConnectionHandlerID

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

  • targetMode

    Target mode of this text message. The value is defined by the enum TextMessageTargetMode:

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

    Id of the target of the text message.

  • 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.