28 lines
11 KiB
HTML
28 lines
11 KiB
HTML
<html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>Interacting with the server</title><link rel="stylesheet" href="ts3doc.css" type="text/css"><meta name="generator" content="DocBook XSL Stylesheets V1.74.0"><link rel="home" href="index.html" title="TeamSpeak 3 Client SDK Developer Manual"><link rel="up" href="index.html" title="TeamSpeak 3 Client SDK Developer Manual"><link rel="prev" href="ar01s22s03.html" title="Server information"><link rel="next" href="ar01s23s02.html" title="Creating a new channel"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><img id="logo" src="images/logo.png"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Interacting with the server</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="ar01s22s03.html"><img src="images/prev.png" alt="Prev"></a> </td><th width="60%" align="center"> </th><td width="20%" align="right"> <a accesskey="n" href="ar01s23s02.html"><img src="images/next.png" alt="Next"></a></td></tr></table><hr></div><div class="section" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="interact"></a>Interacting with the server</h2></div></div></div><p>Interacting with the server means various actions, related to both channels and clients. Channels can be joined, created, edited, deleted and subscribed. Clients can use text chat with other clients, be kicked or poked and move between channels.</p><p>All strings passed to and from the Client Lib need to be encoded in UTF-8 format.</p><div class="section" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="joinchannel"></a>Joining a channel</h3></div></div></div><p>When a client logs on to a TeamSpeak 3 server, he will automatically join the channel with the “<span class="quote">Default</span>” flag, unless he specified another channel in <a class="link" href="ar01s09.html" title="Connecting to a server"><code class="function">ts3client_startConnection</code></a>. To have your own or another client switch to a certain channel, call
|
||
</p><div class="funcsynopsis"><table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" class="funcprototype-table"><tr><td><code class="funcdef">unsigned int <b class="fsfunc">ts3client_requestClientMove</b>(</code></td><td><var class="pdparam">serverConnectionHandlerID</var>, </td><td> </td></tr><tr><td> </td><td><var class="pdparam">clientID</var>, </td><td> </td></tr><tr><td> </td><td><var class="pdparam">newChannelID</var>, </td><td> </td></tr><tr><td> </td><td><var class="pdparam">password</var>, </td><td> </td></tr><tr><td> </td><td><var class="pdparam">returnCode</var><code>)</code>;</td><td> </td></tr></table><div class="paramdef-list"><code>uint64 <var class="pdparam">serverConnectionHandlerID</var></code>;<br><code>anyID <var class="pdparam">clientID</var></code>;<br><code>uint64 <var class="pdparam">newChannelID</var></code>;<br><code>const char* <var class="pdparam">password</var></code>;<br><code>const char* <var class="pdparam">returnCode</var></code>;</div><div class="funcprototype-spacer"> </div></div><p>
|
||
<a class="indexterm" name="idm44835433532944"></a></p><div class="itemizedlist"><ul type="disc"><li><p><em class="parameter"><code>serverConnectionHandlerID</code></em></p><p>ID of the server connection handler ID on which this action is requested.</p></li><li><p><em class="parameter"><code>clientID</code></em></p><p>ID of the client to move.</p></li><li><p><em class="parameter"><code>newChannelID</code></em></p><p>ID of the channel the client wants to join.</p></li><li><p><em class="parameter"><code>password</code></em></p><p>An optional password, required for password-protected channels. Pass an empty string if no password is given.</p></li><li><p><em class="parameter"><code>returnCode</code></em></p><p>See <a class="link" href="ar01s04.html#callingReturnCode" title="Return code">return code documentation</a>. Pass NULL if you do not need this feature.</p></li></ul></div><p>Returns <em class="structfield"><code>ERROR_ok</code></em> on success, otherwise an error code as defined in <code class="filename">public_errors.h</code>.</p><div class="literallayout"><p><br>
|
||
</p></div><p>If the move was successful, one the following events will be called:
|
||
<a name="onclientmove"></a>
|
||
</p><div class="funcsynopsis"><table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" class="funcprototype-table"><tr><td><code class="funcdef">void <b class="fsfunc">onClientMoveEvent</b>(</code></td><td><var class="pdparam">serverConnectionHandlerID</var>, </td><td> </td></tr><tr><td> </td><td><var class="pdparam">clientID</var>, </td><td> </td></tr><tr><td> </td><td><var class="pdparam">oldChannelID</var>, </td><td> </td></tr><tr><td> </td><td><var class="pdparam">newChannelID</var>, </td><td> </td></tr><tr><td> </td><td><var class="pdparam">visibility</var>, </td><td> </td></tr><tr><td> </td><td><var class="pdparam">moveMessage</var><code>)</code>;</td><td> </td></tr></table><div class="paramdef-list"><code>uint64 <var class="pdparam">serverConnectionHandlerID</var></code>;<br><code>anyID <var class="pdparam">clientID</var></code>;<br><code>uint64 <var class="pdparam">oldChannelID</var></code>;<br><code>uint64 <var class="pdparam">newChannelID</var></code>;<br><code>int <var class="pdparam">visibility</var></code>;<br><code>const char* <var class="pdparam">moveMessage</var></code>;</div><div class="funcprototype-spacer"> </div></div><p>
|
||
<a class="indexterm" name="idm44835433515184"></a></p><div class="itemizedlist"><ul type="disc"><li><p><em class="parameter"><code>serverConnectionHandlerID</code></em></p><p>ID of the server connection handler on which the action occured.</p></li><li><p><em class="parameter"><code>clientID</code></em></p><p>ID of the moved client.</p></li><li><p><em class="parameter"><code>oldChannelID</code></em></p><p>ID of the old channel left by the client.</p></li><li><p><em class="parameter"><code>newChannelID</code></em></p><p>ID of the new channel joined by the client.</p></li><li><p><em class="parameter"><code>visibility</code></em></p><p>Defined in the enum <span class="structname">Visibility</span><a class="indexterm" name="idm44835433505856"></a>
|
||
<a name="visibility"></a>
|
||
</p><pre class="programlisting">enum Visibility {
|
||
ENTER_VISIBILITY = 0,
|
||
RETAIN_VISIBILITY,
|
||
LEAVE_VISIBILITY
|
||
};</pre><p>
|
||
</p><div class="itemizedlist"><ul type="circle"><li><p><em class="structfield"><code>ENTER_VISIBILITY</code></em></p><p>Client moved and entered visibility. Cannot happen on own client.</p></li><li><p><em class="structfield"><code>RETAIN_VISIBILITY</code></em></p><p>Client moved between two known places. Can happen on own or other client.</p></li><li><p><em class="structfield"><code>LEAVE_VISIBILITY</code></em></p><p>Client moved out of our sight. Cannot happen on own client.</p></li></ul></div></li><li><p><em class="parameter"><code>moveMessage</code></em></p><p>When a client disconnects from the server, this includes the optional message set by the disconnecting client in <a class="link" href="ar01s10.html" title="Disconnecting from a server"><code class="function">ts3client_stopConnection</code></a>.</p></li></ul></div><p>Example: Requesting to move the own client into channel ID 12 (not password-protected):</p><pre class="programlisting">ts3client_requestClientMove(scHandlerID, ts3client_getClientID(scHandlerID), 12, "", NULL);</pre><p>Now wait for the callback:</p><pre class="programlisting">
|
||
void my_onClientMoveEvent(uint64 scHandlerID, anyID clientID,
|
||
uint64 oldChannelID, uint64 newChannelID,
|
||
int visibility, const char* moveMessage) {
|
||
// scHandlerID -> Server connection handler ID, same as above when requesting
|
||
// clientID -> Own client ID, same as above when requesting
|
||
// oldChannelID -> ID of the channel the client has left
|
||
// newChannelID -> 12, as requested above
|
||
// visibility -> One of ENTER_VISIBILITY, RETAIN_VISIBILITY, LEAVE_VISIBILITY
|
||
// moveMessage -> Optional message set by disconnecting clients
|
||
}</pre><div class="literallayout"><p><br>
|
||
</p></div><p>If the move was initiated by another client, instead of <code class="function">onClientMove</code> the following event is called:
|
||
</p><div class="funcsynopsis"><table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" class="funcprototype-table"><tr><td><code class="funcdef">void <b class="fsfunc">onClientMoveMovedEvent</b>(</code></td><td><var class="pdparam">serverConnectionHandlerID</var>, </td><td> </td></tr><tr><td> </td><td><var class="pdparam">clientID</var>, </td><td> </td></tr><tr><td> </td><td><var class="pdparam">oldChannelID</var>, </td><td> </td></tr><tr><td> </td><td><var class="pdparam">newChannelID</var>, </td><td> </td></tr><tr><td> </td><td><var class="pdparam">visibility</var>, </td><td> </td></tr><tr><td> </td><td><var class="pdparam">moverID</var>, </td><td> </td></tr><tr><td> </td><td><var class="pdparam">moverName</var>, </td><td> </td></tr><tr><td> </td><td><var class="pdparam">moverUniqueIdentifier</var>, </td><td> </td></tr><tr><td> </td><td><var class="pdparam">moveMessage</var><code>)</code>;</td><td> </td></tr></table><div class="paramdef-list"><code>uint64 <var class="pdparam">serverConnectionHandlerID</var></code>;<br><code>anyID <var class="pdparam">clientID</var></code>;<br><code>uint64 <var class="pdparam">oldChannelID</var></code>;<br><code>uint64 <var class="pdparam">newChannelID</var></code>;<br><code>int <var class="pdparam">visibility</var></code>;<br><code>anyID <var class="pdparam">moverID</var></code>;<br><code>const char* <var class="pdparam">moverName</var></code>;<br><code>const char* <var class="pdparam">moverUniqueIdentifier</var></code>;<br><code>const char* <var class="pdparam">moveMessage</var></code>;</div><div class="funcprototype-spacer"> </div></div><p>
|
||
<a class="indexterm" name="idm44835433485072"></a></p><p>Like <code class="function">onClientMoveEvent</code> but with additional information about the client, which has initiated the move: <em class="parameter"><code>moverID</code></em> defines the ID, <em class="parameter"><code>moverName</code></em> the nickname and <em class="parameter"><code>moverUniqueIdentifier</code></em> the unique ID of the client who initiated the move. <em class="parameter"><code>moveMessage</code></em> contains a string giving the reason for the move.</p><p>If <em class="parameter"><code>oldChannelID</code></em> is <span class="returnvalue">0</span>, the client has just connected to the server. If <em class="parameter"><code>newChannelID</code></em> is <span class="returnvalue">0</span>, the client disconnected. Both values cannot be <span class="returnvalue">0</span> at the same time.</p></div></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="ar01s22s03.html"><img src="images/prev.png" alt="Prev"></a> </td><td width="20%" align="center"> </td><td width="40%" align="right"> <a accesskey="n" href="ar01s23s02.html"><img src="images/next.png" alt="Next"></a></td></tr><tr><td width="40%" align="left" valign="top">Server information </td><td width="20%" align="center"><a accesskey="h" href="index.html"><img src="images/home.png" alt="Home"></a></td><td width="40%" align="right" valign="top"> Creating a new channel</td></tr></table></div></body></html>
|