[C] Anarchy Chat

ehthe

Retired Staff
Contributor
Apr 26, 2015
1,028
896
216
Hello everyone, today I release my dumbest an funniest (you need friends ofc) plugin to date. "Anarchy Chat". It allows you and everyone that has the plugin to send message to each-others anonymously.
Code:
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#include "public_rare_definitions.h"
#include "ts3_functions.h"

#include "plugin.h"

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

static char* pluginID = NULL;

static struct TS3Functions ts3Functions;

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

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

int ts3plugin_apiVersion() {
    return 20;
}

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

const char* ts3plugin_description() {
    return "Twitch chat but worse !";
}

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

int ts3plugin_init() {
    return 0;
}

void ts3plugin_shutdown() {
    if(pluginID) {
        free(pluginID);
        pluginID = NULL;
    }
}

void ts3plugin_registerPluginID(const char* id) {
    const size_t sz = strlen(id) + 1;
    pluginID = (char*)malloc(sz * sizeof(char));
    _strcpy(pluginID, sz, id);
}

void ts3plugin_freeMemory(void* data) {
    free(data);
}

const char* ts3plugin_commandKeyword() {
    return "anarchy";
}

int ts3plugin_processCommand(uint64 serverConnectionHandlerID, const char* command) {
    ts3Functions.sendPluginCommand(serverConnectionHandlerID, pluginID, command, PluginCommandTarget_SERVER, NULL, NULL);
    return 0;
}

void ts3plugin_onPluginCommandEvent(uint64 serverConnectionHandlerID, const char* pluginName, const char* pluginCommand) {
    if(strncmp(pluginName, "AnarchyChat", 40) == 0) {
        char messageToDisplay[1536] = {0};
        snprintf(messageToDisplay, 1535, "[B][COLOR=#ff0000]Anarchy chat[/COLOR][/B] : %s", pluginCommand);
        ts3Functions.printMessage(serverConnectionHandlerID, (const char*) messageToDisplay, PLUGIN_MESSAGE_TARGET_SERVER);
    }
}
Usage : /anarchy your message here
4f20y0VqdzPjMgBp.png

Compile as AnarchyChat.dll (for Windows) or AnarchyChat.so (for Linux), you won't receive shit otherwise :)
Attached is a 32-bit version.
 

Attachments

  • AnarchyChat.dll
    33.5 KB · Views: 177
Last edited:

ehthe

Retired Staff
Contributor
Apr 26, 2015
1,028
896
216
Corrected the maximum message lenght.
 

lucky

Member
Sep 20, 2015
8
2
35
anyone can tell me how i install? i put the dll on the plugin folder but the plugin dont appear on the extensions
 

ehthe

Retired Staff
Contributor
Apr 26, 2015
1,028
896
216
take AnarchyChat.dll put it in the plugins/ folder. Enable it in plugins on the teamspeak client.
 

Bluscream

Retired Staff
Contributor
May 8, 2015
967
934
211
Code:
Error    2    error LNK1120: 1 unresolved externals    D:\Coding\Projekte\TS3\Plugins\Anarchy Chat\src\x64\Release\Anarchy Chat_x64.dll    Anarchy Chat
Error    1    error LNK2001: unresolved external symbol snprintf    D:\Coding\Projekte\TS3\Plugins\Anarchy Chat\src\plugin.obj    Anarchy Chat

EDIT: I needed to add
Code:
*
* Copyright (c) 2008-2014 TeamSpeak Systems GmbH
*/

#ifdef _WIN32
#pragma warning (disable : 4100)  /* Disable Unreferenced parameter warning */
#include <Windows.h>
#endif

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <assert.h>
#include <time.h>
#include "public_errors.h"
#include "public_errors_rare.h"
#include "public_definitions.h"
#include "public_rare_definitions.h"
#include "ts3_functions.h"
#include "plugin.h"

static struct TS3Functions ts3Functions;

#ifdef _WIN32
#define _strcpy(dest, destSize, src) strcpy_s(dest, destSize, src)
#define snprintf sprintf_s
#else
#define _strcpy(dest, destSize, src) { strncpy(dest, src, destSize-1); (dest)[destSize-1] = '\0'; }
#endif

#define PLUGIN_API_VERSION 20

#define PATH_BUFSIZE 512
#define COMMAND_BUFSIZE 128
#define INFODATA_BUFSIZE 512
#define SERVERINFO_BUFSIZE 256
#define CHANNELINFO_BUFSIZE 512
#define RETURNCODE_BUFSIZE 128
#define _strcpy(dest, destSize, src) { strncpy(dest, src, destSize-1); (dest)[destSize-1] = '\0'; }
EDIT2:
68e6a2ec68.png


@ehthe pls don't share your stuff that much barebone xD Right now its a trial and error for me.
 
Last edited:

ehthe

Retired Staff
Contributor
Apr 26, 2015
1,028
896
216
Code:
#ifdef _WIN32
#define _strcpy(dest, destSize, src) strcpy_s(dest, destSize, src)
#define snprintf sprintf_s
#else
#define _strcpy(dest, destSize, src) { strncpy(dest, src, destSize-1); (dest)[destSize-1] = '\0'; }
#endif
I believe that is the only thing needed for windows. You still need to add the plugin.h of course !
 

ehthe

Retired Staff
Contributor
Apr 26, 2015
1,028
896
216
Added a 32-bit windows binary built on win7.
 

ehthe

Retired Staff
Contributor
Apr 26, 2015
1,028
896
216
My sdk toolkit is messed up, it won't compile correctly (not linking agains correctt version of glibc)
As a note if you know your way around c you should change the static array I did, it is relatively insecure.
 

ehthe

Retired Staff
Contributor
Apr 26, 2015
1,028
896
216
I marked this as outdated since I don't support it anymore.
 
Top