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; return;
} }
std::list<CGroupHandler*> groups;
// Check to see if this is for Smart Group // Check to see if this is for Smart Group
CGroupHandler* handler = CGroupHandler::findGroup(header); CGroupHandler* group = CGroupHandler::findGroup(header);//look first for login group
if (handler != NULL) { if(group != NULL) {
handler->process(header); groups.push_back(group);
return; }
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++) { for (auto it=m_Groups.begin(); it!=m_Groups.end(); it++) {
if (0 == (*it)->m_groupCallsign.compare(your)) if (0 == (*it)->m_groupCallsign.compare(your))
return *it; return *it;
if (0 == (*it)->m_offCallsign.compare(your))
return *it;
} }
return NULL; 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) CGroupHandler *CGroupHandler::findGroup(const CAMBEData &data)
{ {
unsigned int id = data.getId(); unsigned int id = data.getId();

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

Loading…
Cancel
Save

Powered by TurnKey Linux.