Skip to content

darkrurik

Forum Replies Created

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #191133
    darkrurik
    Member

    DDL_C++.cpp

    #include "stdafx.h"
    #include "sample.h"
    
    BEGIN_MESSAGE_MAP(CsampleApp, CWinApp)
    END_MESSAGE_MAP()
    
    // plugin unique ID
    #define PLUGIN_UNIQID "CSLLCSPL"
    
    CsampleApp::CsampleApp()
    {
    // construction
    }
    
    CsampleApp theApp;
    
    // fill plugin information
    void __cdecl cfbot_plugininformation(CFBOT_PLUGININFORMATION *info)
    {
    strcpy(info->uniqid, PLUGIN_UNIQID); // 8 chars UNIQUE ID + as a line end
    info->pluginversion = CF_BOT_VERSION(0, 2);
    info->desired_botversion = CF_BOT_VERSION(3, 94);
    
    // 254 characters maximum + as a line end
    _tcscpy(info->authors, _T("DARKRURIK plugin"));
    _tcscpy(info->email, _T("mailto:rurik@supereva.it"));
    _tcscpy(info->http, _T("http://www.darkrurik.com"));
    _tcscpy(info->plugindescription, _T("DARKRURIK version plugin"));
    }
    
    int __cdecl cfbot_initialize(CFBOT_CALLBACKS *callbacks, char *path, void *context)
    {
    CopyMemory(&theApp.host, callbacks, sizeof(CFBOT_CALLBACKS));
    theApp.context = context;
    
    // subscribe to events
    theApp.host.cfbot_subscribe(theApp.context, PLUGIN_UNIQID, CF_BOT_IM_EVENTS);
    theApp.host.cfbot_subscribe(theApp.context, PLUGIN_UNIQID, CF_BOT_ROOM_EVENTS);
    
    return 1;
    }
    
    void Testo(char *event_data, int event_size, _tstring t_data, const wchar_t *c_data)
    {
    _bot_exchange_format f;
    if (f.receive(std::string(event_data, event_size)))
    {
    switch(f.pid)
    {
    case BOT_EVENT_ROOM_TEXT: //Comandi dentro la Box di Yesto Principale
    {
    _tstring nickname = (_tstring)f[0x01];
    _tstring text = (_tstring)f[0x02];
    BYTE attributes = (BYTE)f[0x03];
    BYTE size = (BYTE)f[0x04];
    DWORD color = (DWORD)f[0x05];
    DWORD effects = (DWORD)f[0x06];
    BYTE charset = (BYTE)f[0x07];
    BYTE pitch = (BYTE)f[0x08];
    std::string font = (std::string)f[0x09];
    
    if (text.length() > 0)
    {
    _tcsupr((TCHAR *)text.c_str());
    if (!_tcscmp(text.c_str(), c_data))
    {
    //if ( _bot_value(0x01, nickname), _T("Galimar"))
    //{
    _bot_exchange_format p(PLUGIN_EVENT_ROOM_TEXT); //PLUGIN_EVENT_ROOM_TEXT); //PLUGIN_EVENT_IM);
    p << _bot_value(0x01, t_data);
    p << _bot_value(0x02, attributes);
    p << _bot_value(0x03, size);
    p << _bot_value(0x04, color);
    p << _bot_value(0x05, effects);
    p << _bot_value(0x06, charset);
    p << _bot_value(0x07, pitch);
    p << _bot_value(0x08, font);
    
    std::string d = p.data();
    theApp.host.cfbot_pushevent(theApp.context, PLUGIN_UNIQID, (char *)d.data(), d.size());
    }
    }
    } break;
    }
    }
    }
    
    void Testo1(char *event_data, int event_size, _tstring t_data, const wchar_t *c_data)
    {
    _bot_exchange_format f;
    if (f.receive(std::string(event_data, event_size)))
    {
    switch(f.pid)
    {
    case BOT_EVENT_ROOM_TEXT: //Comandi dentro la Box di Yesto Principale
    {
    _tstring nickname = (_tstring)f[0x01];
    _tstring text = (_tstring)f[0x02];
    BYTE attributes = (BYTE)f[0x03];
    BYTE size = (BYTE)f[0x04];
    DWORD color = (DWORD)f[0x05];
    DWORD effects = (DWORD)f[0x06];
    BYTE charset = (BYTE)f[0x07];
    BYTE pitch = (BYTE)f[0x08];
    std::string font = (std::string)f[0x09];
    if (text.length() > 0)
    {
    _tcsupr((TCHAR *)text.c_str());
    if (!_tcscmp(text.c_str(), c_data))
    {
    _bot_exchange_format p(PLUGIN_EVENT_ROOM_TEXT); //PLUGIN_EVENT_ROOM_TEXT); //PLUGIN_EVENT_IM);
    p << _bot_value(0x01, t_data);
    p << _bot_value(0x02, attributes);
    p << _bot_value(0x03, size);
    p << _bot_value(0x04, color);
    p << _bot_value(0x05, effects);
    p << _bot_value(0x06, charset);
    p << _bot_value(0x07, pitch);
    p << _bot_value(0x08, font);
    
    std::string d = p.data();
    theApp.host.cfbot_pushevent(theApp.context, PLUGIN_UNIQID, (char *)d.data(), d.size());
    }
    }
    } break;
    }
    }
    }
    
    void __cdecl cfbot_pushevent(char *event_data, int event_size)
    {
    Testo(event_data, event_size, _T("Comando Riuscito"), L"!DARK");
    Testo1(event_data, event_size, _T("Comando Riuscito 1"), L"!DARK1");
    
    }
    
    void __cdecl cfbot_finalize(void)
    {
    // finalize plugin
    }
    
    void __cdecl cfbot_display_settings(void)
    {
    AfxMessageBox(_T("Settings window is not available for this plugin"), MB_OK | MB_ICONINFORMATION);
    }
    
    BOOL CsampleApp::InitInstance()
    {
    CWinApp::InitInstance();
    
    return TRUE;
    }

     

    #191134
    darkrurik
    Member

    cfbotapi.h

    /************************************************************************/
    /* Camfrog Bot 3.91 plugins API header */
    /* (c) 2005-2007 Camshare LLC */
    /* (c) Alex Potahov (camfrog:im:pap) */
    /************************************************************************/
    
    #pragma once
    
    /*
    bot version defines
    */
    
    // construct
    #define CF_BOT_VERSION(a,b) (((((short)(a))&0xFF)<<8)|(((short)(b))&0xFF))
    // extract
    #define CF_BOT_VERSION_MAJOR(a) ((BYTE)((((short)(a))>>8)&0xFF))
    #define CF_BOT_VERSION_MINOR(a) (((BYTE)(a))&0xFF)
    
    /*
    plugin information
    */
    
    typedef struct {
    // plugin DLL version
    short pluginversion;
    // required bot version
    // bot will use this plugin only in case [BOT VERSION >= DESIRED_BOTVERSION]
    short desired_botversion;
    
    // unique plugin ID. 8 chars +
    char uniqid[9];
    
    // plugin information
    wchar_t plugindescription[255];
    wchar_t authors[255];
    wchar_t email[255];
    wchar_t http[255];
    } CFBOT_PLUGININFORMATION;
    
    /*
    subscribe event types
    */
    
    // chatroom connect/disconnect events
    #define CF_BOT_CONNECTION_EVENTS 0x01
    // central server IM events
    #define CF_BOT_IM_EVENTS 0x02
    // chatroom text/talk/users events
    #define CF_BOT_ROOM_EVENTS 0x04
    // bot to bot operations
    #define CF_BOT_2_BOT_EVENTS 0x08
    // room timer. every 100 msec only when connected to the room
    #define CF_BOT_ROOM_TIMER 0x10
    
    /*
    externals from the bot
    */
    
    typedef struct {
    // subscribe to events
    void (*cfbot_subscribe)(void *context, char *plugin_id, DWORD events_type);
    // unsubscribe from events
    void (*cfbot_unsubscrive)(void *context, char *plugin_id, DWORD events_type);
    // push outgoing event
    void (*cfbot_pushevent)(void *context, char *plugin_id, char *event_data, int event_size);
    } CFBOT_CALLBACKS;
    
    /*
    externals should be defined in plugin DLL
    */
    
    typedef struct {
    // request plugin information
    void (*cfbot_plugininformation)(CFBOT_PLUGININFORMATION *info);
    // initialize plugin (bot startup)
    int (*cfbot_initialize)(CFBOT_CALLBACKS *callbacks, wchar_t *path, void *context);
    // push event
    void (*cfbot_pushevent)(char *event_data, int event_size);
    // finalize plugin (bot shutdown)
    void (*cfbot_finalize)(void);
    // request plugin settings dialog
    void (*cfbot_display_settings)(HWND parent);
    } CFBOT_PLUGIN_CALLBACKS;
    
    /************************************************************************/
    /* Bot -> Plugin event types */
    /************************************************************************/
    
    #define BOT_EVENT_ROOM_CONNECTED 0x0101
    // room connected
    // empty message
    
    #define BOT_EVENT_ROOM_DENIED 0x0102
    // denied from room
    // deny reason std::wstring 0x01
    
    #define BOT_EVENT_ROOM_KILLED 0x0103
    // kicked from room
    // kick reason std::wstring 0x01
    
    #define BOT_EVENT_ROOM_DISCONNECTED 0x0104
    // disconnected from room
    // empty message
    
    #define BOT_EVENT_ROOM_IN 0x0401
    // user in
    // nickname std::wstring 0x01
    // flags DWORD 0x02
    // age BYTE 0x03
    // count int 0x04
    //
    // count value will be set in some "N" value in case of initial user list (bot room logon)
    // in other cases this value will be "1"
    // this event is repeating few times for every user in case of flags changing
    // flags description:
    // audio 1
    // video 2
    // female user 4
    // OP or OPPLUS 8
    // FRIEND 16
    // OWNER 32
    // punished user 64
    // BOT 128
    // privacy mode 256
    // ignored user 512
    // audio blocked 1024
    // PRO user 2048
    
    #define BOT_EVENT_ROOM_OUT 0x0402
    // user out
    // nickname (std::wstring) 0x01
    
    #define BOT_EVENT_ROOM_TALK 0x0403
    // room talk event
    // state BYTE 0x01
    // nickname std::wstring 0x02
    //
    // state = "1" - start talk, "0" - stop talk
    // nickname is available only if state is set to "1"
    
    #define BOT_EVENT_ROOM_MOTD 0x0404
    // room MOTD
    // MOTD text std::wstring 0x01
    
    #define BOT_EVENT_ROOM_TOPIC 0x0405
    // room topic
    // state BYTE 0x01
    // topic text std::wstring 0x02
    //
    // state = "1" - topic on, "0" - topic off
    // text is available only if state is set to "1"
    
    #define BOT_EVENT_ROOM_TEXT 0x0406
    // room text
    // nickname std::wstring 0x01
    // text std::wstring 0x02
    // attributes BYTE 0x03
    // size BYTE 0x04
    // color DWORD 0x05
    // effects DWORD 0x06
    // charset BYTE 0x07
    // pitch and family BYTE 0x08
    // font name std::string 0x09
    //
    // nickname can be empty. in this case this text is a server message
    // attributes can be set to "0" - in this case all following parameters are absent
    // effects can contain following flags CFE_BOLD | CFE_ITALIC | CFE_UNDERLINE
    
    #define BOT_EVENT_IM 0x0201
    // IM message
    // nickname_from std::wstring 0x01
    // feedback int 0x02
    // age BYTE 0x03
    // text std::wstring 0x04
    // attributes BYTE 0x05
    // size BYTE 0x06
    // color DWORD 0x07
    // effects DWORD 0x08
    // charset BYTE 0x09
    // pitch and family BYTE 0x0A
    // font name std::string 0x0B
    //
    // attributes can be set to "0" - in this case all following parameters are absent
    // effects can contain following flags CFE_BOLD | CFE_ITALIC | CFE_UNDERLINE
    
    #define BOT_EVENT_BOT_2_BOT 0x0801
    // plugin to plugin message
    // UNIQID std::string 0x01
    // ...
    // ...
    // SENDER UNIQID std::string 0xFFFF
    
    #define BOT_EVENT_ROOM_TIMER 0x1001
    // room timer. raises every 100 msec only when bot connected to the room
    // empty message
    
    #define BOT_EVENT_MODULES 0x2001
    // installed modules notifier
    // COUNT int 0x01
    // UNIQID std::string 0x02 + i
    
    /************************************************************************/
    /* Plugin -> Bot event types */
    /************************************************************************/
    
    #define PLUGIN_EVENT_ROOM_TEXT 0x0451
    // send message to the room
    // text std::wstring 0x01
    // attributes BYTE 0x02
    // size BYTE 0x03
    // color DWORD 0x04
    // effects DWORD 0x05
    // charset BYTE 0x06
    // pitch and family BYTE 0x07
    // font name std::string 0x08
    //
    // attributes can be set to "0" - in this case all following parameters are absent - message will be default font/size
    // effects can contain following flags CFE_BOLD | CFE_ITALIC | CFE_UNDERLINE
    
    #define PLUGIN_EVENT_IM 0x0251
    // send IM message
    // nickname_to std::wstring 0x01
    // text std::wstring 0x02
    // attributes BYTE 0x03
    // size BYTE 0x04
    // color DWORD 0x05
    // effects DWORD 0x06
    // charset BYTE 0x07
    // pitch and family BYTE 0x08
    // font name std::string 0x09
    //
    // attributes can be set to "0" - in this case all following parameters are absent
    // effects can contain following flags CFE_BOLD | CFE_ITALIC | CFE_UNDERLINE
    
    #define PLUGIN_BOT_2_BOT 0x0851
    // send message to another plugin
    // UNIQID std::string 0x01
    // ...
    // ...
    
    #define PLUGIN_EVENT_DISCONNECT 0x0151
    // disconnect from the active room

     

    #191135
    darkrurik
    Member

    Packet.h

    #pragma once
    
    #include
    #include
    #include
    
    #ifdef UNICODE
    #define _tstring std::wstring
    #else
    #define _tstring std::string
    #endif
    
    class _bot_value {
    public:
    _bot_value();
    _bot_value(int, BYTE);
    _bot_value(int, unsigned long);
    _bot_value(int, int);
    _bot_value(int, __int64);
    _bot_value(int, TCHAR *);
    _bot_value(int, _tstring);
    #ifdef UNICODE
    _bot_value(int ival, char *val);
    _bot_value(int, std::string);
    #endif
    
    operator _tstring();
    #ifdef UNICODE
    operator std::string();
    #endif
    operator BYTE();
    operator unsigned long();
    operator int();
    operator __int64();
    
    int iid;
    
    unsigned long size();
    const char *data();
    private:
    std::string obj;
    };
    
    class _bot_exchange_format
    {
    public:
    _bot_exchange_format();
    _bot_exchange_format(int pval);
    ~_bot_exchange_format();
    
    bool receive(BYTE *data, unsigned long size);
    bool receive(std::string data);
    
    std::string data();
    int size();
    
    _bot_value operator[](int iid);
    _bot_exchange_format& operator<<(_bot_value val);
    
    int pid;
    
    protected:
    std::map _data;
    };

     

    #191136
    darkrurik
    Member

    Thanks for your response but does not work.

    and the sample code camfrog bot and I can not save the contents into a file and read it now put the library and the code base if he can put your code inside me a great help.

    The problem that DDL_C + +. Cpp I can not put a Funzine who writes in the works Testo(), and then inside the variable letter and std:: string contents of a text file and You will then want to put in the content of thanks a mysql.

    the problem and that I put into the text feature an inscription taken from a text file, and after capturing the same variable in internal and save it in another text file.

    is is the function:

    Testo(event_data, event_size, _T(“Command Successful”), L”!DARK”);

    I would replace _T ( “Command Successful”) with a variable that contains the text inside the text file .

    thanks in advance.

Viewing 4 posts - 1 through 4 (of 4 total)