[C++] Arkadaş listesi fix

Kuqsal

Aktif Üye
Üye
Mesaj
93
Beğeni
18
Puan
439
Kanıt

Server_source:
common/service.h gir

Ekle:
#define ENABLE_DELETE_FRIEND_REFRESH_FIX

game/src/messenger_manager.cpp gir

Arat:
MessengerManager::MessengerManager()

Üstüne ekle:
static char    __account[CHARACTER_NAME_MAX_LEN*2+1];
static char    __companion[CHARACTER_NAME_MAX_LEN*2+1];

Arat:
DBManager::instance().FuncQuery(std::bind1st(std::mem_fun(&MessengerManager::LoadList)

Üstüne ekle:
    DBManager::instance().EscapeString(__account, sizeof(__account), account.c_str(), account.size());
    if (account.compare(__account))
        return;

Arat:
    if (m_Relation[account].find(companion) != m_Relation[account].end())

Altına ekle:
    DBManager::instance().EscapeString(__account, sizeof(__account), account.c_str(), account.size());
    DBManager::instance().EscapeString(__companion, sizeof(__companion), companion.c_str(), companion.size());
    if (account.compare(__account) || companion.compare(__companion))
        return;

Arat:
    sys_log(1, "Messenger Remove %s %s", account.c_str(), companion.c_str());

Üstüne ekle:
    DBManager::instance().EscapeString(__account, sizeof(__account), account.c_str(), account.size());
    DBManager::instance().EscapeString(__companion, sizeof(__companion), companion.c_str(), companion.size());
 
    if (account.compare(__account) || companion.compare(__companion))
        return;

Arat:
std::set<keyT>    company(m_Relation[account]);

Altına ekle:
    DBManager::instance().EscapeString(__account, sizeof(__account), account.c_str(), account.size());
    if (account.compare(__account))
        return;

Arat:
    m_InverseRelation[companion].erase(account);

Altına ekle:
#ifdef ENABLE_DELETE_FRIEND_REFRESH_FIX
    m_Relation[companion].erase(account);
    m_InverseRelation[account].erase(companion);
#endif

Arat:
        ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<Messenger> You deleted %s off the list."), companion.c_str());

Altına ekle:
#ifdef ENABLE_DELETE_FRIEND_REFRESH_FIX
    LPCHARACTER tch = CHARACTER_MANAGER::Instance().FindPC(companion.c_str());
    if (tch && tch->GetDesc())
    {
        TPacketGCMessenger p;
        p.header        = HEADER_GC_MESSENGER;
        p.subheader        = MESSENGER_SUBHEADER_GC_REMOVE_FRIEND;
        p.size            = sizeof(TPacketGCMessenger) + sizeof(BYTE) + account.size();
        BYTE bLen        = account.size();
        tch->GetDesc()->BufferedPacket(&p, sizeof(p));
        tch->GetDesc()->BufferedPacket(&bLen, sizeof(BYTE));
        tch->GetDesc()->Packet(account.c_str(), account.size());
    }
#endif
Client_Source:
Userinterface/packet.h gir:

Arat:
MESSENGER_SUBHEADER_GC_INVITE,

Altına ekle:
#ifdef ENABLE_DELETE_FRIEND_REFRESH_FIX
    MESSENGER_SUBHEADER_GC_REMOVE_FRIEND,
#endif

Userinterface/PythonMessenger.cpp gir

Arat:
m_FriendNameMap.erase(c_szKey);

Direkt altına ekle:
#ifdef ENABLE_DELETE_FRIEND_REFRESH_FIX
    if (m_poMessengerHandler)
        PyCallClassMemberFunc(m_poMessengerHandler, "OnRemoveList", Py_BuildValue("(is)", MESSENGER_GRUOP_INDEX_FRIEND, c_szKey));
#endif

Sonucu böyle olmalı:

void CPythonMessenger::RemoveFriend(const char * c_szKey)
{
    m_FriendNameMap.erase(c_szKey);
 
#ifdef ENABLE_DELETE_FRIEND_REFRESH_FIX
    if (m_poMessengerHandler)
        PyCallClassMemberFunc(m_poMessengerHandler, "OnRemoveList", Py_BuildValue("(is)", MESSENGER_GRUOP_INDEX_FRIEND, c_szKey));
#endif
}

Arat:
case MESSENGER_SUBHEADER_GC_LOGOUT:

Komut bloğunun sonuna ekle:
#ifdef ENABLE_DELETE_FRIEND_REFRESH_FIX
        case MESSENGER_SUBHEADER_GC_REMOVE_FRIEND:
        {
            BYTE bLength;
            if (!Recv(sizeof(bLength), &bLength))
                return false;

            if (!Recv(bLength, char_name))
                return false;

            char_name[bLength] = 0;
            CPythonMessenger::Instance().RemoveFriend(char_name);
            break;
        }
#endif
 
En son bir moderatör tarafından düzenlenmiş:

xlyn

Üye
Üye
Mesaj
79
Beğeni
18
Puan
74
konuyu görünce fileste denedim bugluymuş arkadaş listesi şimdi bunu deneyeceğim çalışırsa yazacağım
 

Üst