Forum

Results 1 to 2 of 2
  1. #1
    Join Date
    September 2016
    Posts
    1

    Editing channel name via setChannelVariableAsString

    Hi, recently I've tried to create plugin that will edit name of channels with offensive words in them, but I came across issue with flushChannelUpdates function, I've found in ts3 sdk that after calling setChannelVariableAsString you need to call flushChannelUpdates, but I don't know how to call flushChannel because of its 3rd parameter, I couldn't find any info about it, in documentation there's only implementation of this function with 2 parameters, but in C++ sdk you have to call it with 3 parameters, take a look at my code:

    Code:
    void ts3plugin_onUpdateChannelEditedEvent ( uint64 serverConnectionHandlerID , uint64 channelID , anyID invokerID , const char* invokerName , const char* invokerUniqueIdentifier )
    {
    	char* channelName;
    	ts3Functions.getChannelVariableAsString ( serverConnectionHandlerID , channelID , CHANNEL_NAME , &channelName );
    	printf ( "Checking channel name %s\n" , channelName );
    
    
    	for ( i = 0; i < sizeof ( forbiddenWords ) / sizeof ( char* ); i++ )
    	{
    		if ( strstr ( buffer , forbiddenWords [ i ] ) != 0 )
    		{
    			printf ( "Found forbidden word %s in channel name %s, editing!\n" , forbiddenWords [ i ] , buffer );
    
    			ts3Functions.setChannelVariableAsString ( serverConnectionHandlerID , channelID , CHANNEL_NAME , toset );
    			ts3Functions.flushChannelUpdates ( serverConnectionHandlerID , channelID , toset);
    
    			break;
    		}
    	}
    }
    the problem is, I don't know how to call flushChannelUpdates, it's defined as
    Code:
    	unsigned int (*flushChannelUpdates)(uint64 serverConnectionHandlerID, uint64 channelID, const char* returnCode);
    what's the returnCode parameter? I tried passing there many strings, like previous channel name, new channel name, empty, or null, but none of it worked, sometimes it changes channel name, and sometimes not, showing me error:
    Code:
    <15:14:16> invalid parameter size
    and sometimes when it works it changes channel name and prints 'OK' in chat

  2. #2
    Join Date
    May 2016
    Location
    Idar-Oberstein
    Posts
    155
    An errorCode is optionally used with functions that require communication with the server.
    Using an errorCode, you can identify the cause of an onServerErrorEvent for failed requests, for example when the permission system denies it.
    See client sdk manual, p.4.

    With the SDK, the string is up to you, with plugins you use createReturnCode, as shown in the example plugin. returnCode being optional, you can pass NULL to not use this feature. Note that with returnCode, onServerErrorEvent also gets called with ERROR_OK, without using the returnCode it'll only be called for errors.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. SDK Plugin: ts3Functions.setChannelVariableAsString() not working
    By binarycode in forum Client Plugins / Lua Scripts
    Replies: 4
    Last Post: November 16th, 2015, 01:20 PM
  2. Channel Editing Permissions for Channel Admin
    By dsflyerds in forum Permission System
    Replies: 6
    Last Post: October 7th, 2015, 08:17 PM
  3. possibilities for setChannelVariableAsString / setChannelVariableAsInt
    By ZauberPole in forum Client Plugins / Lua Scripts
    Replies: 1
    Last Post: February 21st, 2014, 02:19 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •