Commit b892d126 authored by Carsten Fuhrmann's avatar Carsten Fuhrmann

fixed crash,

now better implementation (don't just delete clients if channels did not change),
parent b1ee63c7
......@@ -213,15 +213,17 @@ void OverlayController::reset()
void OverlayController::updateChannelList()
{
// remove old stuff
while (int nb = m_tree->getTree()->topLevelItemCount())
delete m_tree->getTree()->takeTopLevelItem(nb - 1);
// get list of all channelIDs
uint64* channelIDList;
if (ts3.getChannelList(m_SCHID, &channelIDList) != ERROR_ok)
return;
// remove old stuff
while (int nb = m_tree->getTree()->topLevelItemCount())
delete m_tree->getTree()->takeTopLevelItem(nb - 1);
m_clientList.clear();
m_channelList.clear();
// get a list of all channels containing name, id, parent,..
int i(0);
while (channelIDList[i] != NULL)
......@@ -303,7 +305,8 @@ void OverlayController::updateClientList()
for (auto& it : m_channelList)
{
anyID* clientIDList;
ts3.getChannelClientList(m_SCHID, it.id, &clientIDList);
if (ts3.getChannelClientList(m_SCHID, it.id, &clientIDList) != ERROR_ok)
continue;
int i(0);
while (clientIDList[i] != NULL)
......
......@@ -351,35 +351,38 @@ void ts3plugin_onConnectStatusChangeEvent(uint64 serverConnectionHandlerID, int
auto tmp = g_serverList.take(serverConnectionHandlerID);
delete tmp;
}
else if (newStatus == STATUS_CONNECTED)
{
// let helper insert new controller to avoid double entries
getController(serverConnectionHandlerID);
}
else if (newStatus == STATUS_CONNECTION_ESTABLISHED)
{
g_serverList.insert(serverConnectionHandlerID, new OverlayController(ts3Functions, serverConnectionHandlerID));
getController(serverConnectionHandlerID)->updateChannelList();
getController(serverConnectionHandlerID)->displayChannelList();
}
}
void ts3plugin_onNewChannelEvent(uint64 serverConnectionHandlerID, uint64 channelID, uint64 channelParentID) {
//getController(serverConnectionHandlerID)->updateChannelList();
}
void ts3plugin_onNewChannelCreatedEvent(uint64 serverConnectionHandlerID, uint64 channelID, uint64 channelParentID, anyID invokerID, const char* invokerName, const char* invokerUniqueIdentifier) {
//getController(serverConnectionHandlerID)->updateChannelList();
getController(serverConnectionHandlerID)->updateChannelList();
}
void ts3plugin_onDelChannelEvent(uint64 serverConnectionHandlerID, uint64 channelID, anyID invokerID, const char* invokerName, const char* invokerUniqueIdentifier) {
//getController(serverConnectionHandlerID)->updateChannelList();
getController(serverConnectionHandlerID)->updateChannelList();
}
void ts3plugin_onChannelMoveEvent(uint64 serverConnectionHandlerID, uint64 channelID, uint64 newChannelParentID, anyID invokerID, const char* invokerName, const char* invokerUniqueIdentifier) {
//getController(serverConnectionHandlerID)->updateChannelList();
getController(serverConnectionHandlerID)->updateChannelList();
}
void ts3plugin_onUpdateChannelEvent(uint64 serverConnectionHandlerID, uint64 channelID) {
//getController(serverConnectionHandlerID)->updateChannelList();
}
void ts3plugin_onUpdateChannelEditedEvent(uint64 serverConnectionHandlerID, uint64 channelID, anyID invokerID, const char* invokerName, const char* invokerUniqueIdentifier) {
//getController(serverConnectionHandlerID)->updateChannelList();
getController(serverConnectionHandlerID)->updateChannelList();
}
void ts3plugin_onUpdateClientEvent(uint64 serverConnectionHandlerID, anyID clientID, anyID invokerID, const char* invokerName, const char* invokerUniqueIdentifier) {
......@@ -542,6 +545,7 @@ void ts3plugin_onChannelSubscribeEvent(uint64 serverConnectionHandlerID, uint64
}
void ts3plugin_onChannelSubscribeFinishedEvent(uint64 serverConnectionHandlerID) {
getController(serverConnectionHandlerID)->updateClientList();
}
void ts3plugin_onChannelUnsubscribeEvent(uint64 serverConnectionHandlerID, uint64 channelID) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment