mirror of
https://github.com/ShaYmez/xlxd.git
synced 2024-12-22 01:20:56 -05:00
Merge pull request #197 from narspt/patch-11
allow YSF clients to change linked module by DG-ID
This commit is contained in:
commit
4a6a1dd50d
@ -253,8 +253,17 @@ bool CYsfProtocol::OnDvHeaderPacketIn(CDvHeaderPacket *Header, const CIp &Ip)
|
|||||||
{
|
{
|
||||||
// get client callsign
|
// get client callsign
|
||||||
via = client->GetCallsign();
|
via = client->GetCallsign();
|
||||||
// get module it's linked to
|
|
||||||
Header->SetRpt2Module(client->GetReflectorModule());
|
if ( Header->GetRpt2Module() == ' ' ) {
|
||||||
|
// module not filled, get module it's linked to
|
||||||
|
Header->SetRpt2Module(client->GetReflectorModule());
|
||||||
|
} else {
|
||||||
|
// handle changing linked module to the one set on rpt2
|
||||||
|
if ( client->GetReflectorModule() != Header->GetRpt2Module() ) {
|
||||||
|
std::cout << "YSF client " << client->GetCallsign() << " linking on module " << Header->GetRpt2Module() << std::endl;
|
||||||
|
client->SetReflectorModule(Header->GetRpt2Module());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// and try to open the stream
|
// and try to open the stream
|
||||||
if ( (stream = g_Reflector.OpenStream(Header, client)) != NULL )
|
if ( (stream = g_Reflector.OpenStream(Header, client)) != NULL )
|
||||||
@ -466,10 +475,16 @@ bool CYsfProtocol::IsValidDvHeaderPacket(const CIp &Ip, const CYSFFICH &Fich, co
|
|||||||
CCallsign rpt1 = CCallsign((const char *)sz);
|
CCallsign rpt1 = CCallsign((const char *)sz);
|
||||||
rpt1.SetModule(YSF_MODULE_ID);
|
rpt1.SetModule(YSF_MODULE_ID);
|
||||||
CCallsign rpt2 = m_ReflectorCallsign;
|
CCallsign rpt2 = m_ReflectorCallsign;
|
||||||
// as YSF protocol does not provide a module-tranlatable
|
|
||||||
// destid, set module to none and rely on OnDvHeaderPacketIn()
|
if ( (Fich.getSQ() >= 10) && (Fich.getSQ() < 10+NB_OF_MODULES) ) {
|
||||||
// to later fill it with proper value
|
// set module based on DG-ID value
|
||||||
rpt2.SetModule(' ');
|
rpt2.SetModule( 'A' + (char)(Fich.getSQ() - 10) );
|
||||||
|
} else {
|
||||||
|
// as YSF protocol does not provide a module-tranlatable
|
||||||
|
// destid, set module to none and rely on OnDvHeaderPacketIn()
|
||||||
|
// to later fill it with proper value
|
||||||
|
rpt2.SetModule(' ');
|
||||||
|
}
|
||||||
|
|
||||||
// and packet
|
// and packet
|
||||||
*header = new CDvHeaderPacket(csMY, CCallsign("CQCQCQ"), rpt1, rpt2, uiStreamId, Fich.getFN());
|
*header = new CDvHeaderPacket(csMY, CCallsign("CQCQCQ"), rpt1, rpt2, uiStreamId, Fich.getFN());
|
||||||
|
Loading…
Reference in New Issue
Block a user