SDK Plugin: ts3Functions.setChannelVariableAsString() not working

samedi 14 novembre 2015

Hello,

Currently i'm programming a simple plugin for teamspeak3 Clients on Linux.

The Addon should change a channel name when someone moves to another channel.

The Problem is, that the function doesn't return ERROR_ok, but the channel won't change the name.

But i don't know why. There is no error. so it should change. But it doesn't

Here's my code:

Code:

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <assert.h>

#include <ts3_functions.h>
#include <teamspeak/public_errors.h>


#define _strcpy(dest, destSize, src) { strncpy(dest, src, destSize-1); (dest)[destSize-1] = '\0'; }

#define PLUGIN_API_VERSION 20

#define PATH_BUFSIZE 512
#define COMMAND_BUFSIZE 128
#define INFODATA_BUFSIZE 128
#define SERVERINFO_BUFSIZE 256
#define CHANNELINFO_BUFSIZE 512
#define RETURNCODE_BUFSIZE 128

static struct TS3Functions ts3Functions;


static char* pluginID = NULL;


/** Required **/

const char* ts3plugin_name(){return "Channelrename";}

const char* ts3plugin_version(){return "0.1";}

int ts3plugin_apiVersion(){return PLUGIN_API_VERSION;}

const char* ts3plugin_author(){return "binarycode";}

const char* ts3plugin_description(){return "Change Channel Name!";}

void ts3plugin_setFunctionPointers(const struct TS3Functions funcs)
{
        ts3Functions = funcs;
}

int ts3plugin_init()
{

        printf("PLUGIN %s init()\n", ts3plugin_name());

       
        return 0;
}

void ts3plugin_shutdown()
{
        printf("PLUGIN: shutdown\n");
        /* Free pluginID if we registered it */
        if (pluginID) {
                free(pluginID);
                pluginID = NULL;
        }
}


/* OPT */
int ts3plugin_onTextMessageEvent(uint64 serverConnectionHandlerID, anyID targetMode, anyID toID, anyID fromID, const char* fromName, const char* fromUniqueIdentifier, const char* message, int ffIgnored)
{
        printf("PLUGIN: onTextMessageEvent %llu %d %d %s %s %d\n", (long long unsigned int)serverConnectionHandlerID, targetMode, fromID, fromName, message, ffIgnored);
        return 0;  /* 0 = handle normally, 1 = client will ignore the text message */
}

void ts3plugin_onClientMoveEvent(uint64 serverConnectionHandlerID, anyID clientID, uint64 oldChannelID, uint64 newChannelID, int visibility, const char* moveMessage)
{
        char eventmsg[512];

        printf("PLUGIN: ClientMoveEvent: %d, %d", (int)oldChannelID, (int)newChannelID);
        sprintf(eventmsg, "ClientMoveEvent: User %d went from %d to %d", clientID, (int)oldChannelID, (int)newChannelID);

        ts3Functions.requestSendChannelTextMsg(serverConnectionHandlerID, eventmsg, 6, NULL);


        if(ts3Functions.setChannelVariableAsString(serverConnectionHandlerID, 6, CHANNEL_NAME, "Technik | Manuel Manz | Online") != ERROR_ok)
        {
                ts3Functions.requestSendChannelTextMsg(serverConnectionHandlerID, "error Setting Channel name", 6, NULL);
        }

        if(ts3Functions.flushChannelUpdates(serverConnectionHandlerID,6, NULL) != ERROR_ok)
        {
                ts3Functions.requestSendChannelTextMsg(serverConnectionHandlerID, "Error flushing channel updates", 6, NULL);
        }

        ts3Functions.requestSendChannelTextMsg(serverConnectionHandlerID, "END", 6, NULL);

}

Thanks,
binarycode
SDK Plugin: ts3Functions.setChannelVariableAsString() not working

0 commentaires:

Enregistrer un commentaire