Allow to have multiple groups with same logoff

pull/2/head
Geoffrey Merck 6 years ago
parent f4b2e26e48
commit b1019ea26d

@ -70,11 +70,22 @@ void CG2Handler::process(CHeaderData& header)
return;
}
std::list<CGroupHandler*> groups;
// Check to see if this is for Smart Group
CGroupHandler* handler = CGroupHandler::findGroup(header);
if (handler != NULL) {
handler->process(header);
return;
CGroupHandler* group = CGroupHandler::findGroup(header);//look first for login group
if(group != NULL) {
groups.push_back(group);
}
else {
CGroupHandler::findGroupsByLogoff(header, groups);//get all groups having a matching logoff
}
for(auto it = groups.begin();it != groups.end(); it++)
{
if ((*it) != NULL) {
(*it)->process(header);
}
}
}

@ -222,12 +222,20 @@ CGroupHandler *CGroupHandler::findGroup(const CHeaderData &header)
for (auto it=m_Groups.begin(); it!=m_Groups.end(); it++) {
if (0 == (*it)->m_groupCallsign.compare(your))
return *it;
if (0 == (*it)->m_offCallsign.compare(your))
return *it;
}
return NULL;
}
void CGroupHandler::findGroupsByLogoff(const CHeaderData &header, std::list<CGroupHandler*> & groups)
{
std::string your = header.getYourCall();
for (auto it=m_Groups.begin(); it!=m_Groups.end(); it++) {
if (0 == (*it)->m_offCallsign.compare(your))
groups.push_back(*it);
}
}
CGroupHandler *CGroupHandler::findGroup(const CAMBEData &data)
{
unsigned int id = data.getId();

@ -120,6 +120,7 @@ public:
static CGroupHandler *findGroup(const std::string &callsign);
static CGroupHandler *findGroup(const CHeaderData &header);
static CGroupHandler *findGroup(const CAMBEData &data);
static void findGroupsByLogoff(const CHeaderData &header, std::list<CGroupHandler*> & groups);
static void finalise();

Loading…
Cancel
Save

Powered by TurnKey Linux.