3
Fork 0

Added filtering of local node callsign

This commit is contained in:
Artem Prilutskiy 2019-06-04 16:22:31 +03:00
parent e6561f15d1
commit cfb0c9061d
3 changed files with 22 additions and 6 deletions

View file

@ -19,9 +19,11 @@
BrandMeisterBridge::BrandMeisterBridge()
{
proxy = NULL;
handle = NULL;
talker = (char*)malloc(TALKER_BUFFER_SIZE);
proxy = NULL;
handle = NULL;
node = NULL;
length = 0;
talker = (char*)malloc(TALKER_BUFFER_SIZE);
unknown = ECHOLINK_DEFAULT_USER_NUMBER;
}
@ -30,6 +32,7 @@ BrandMeisterBridge::~BrandMeisterBridge()
iconv_close(handle);
DELETE(proxy);
free(talker);
free(node);
}
// Interface methods for ModuleEchoLink
@ -44,6 +47,12 @@ void BrandMeisterBridge::setDefaultConfiguration(const char* configuration)
unknown = strtol(configuration, NULL, 10);
}
void BrandMeisterBridge::setCallConfiguration(const char* configuration)
{
node = strdup(configuration);
length = strlen(configuration);
}
void BrandMeisterBridge::setProxyConfiguration(const char* configuration)
{
char* pointer = const_cast<char*>(configuration);
@ -115,9 +124,11 @@ void BrandMeisterBridge::handleChatMessage(const char* text)
if (strncmp(text, "CONF ", 5) == 0)
{
const char* delimiter = strstr(text, "\n->");
if (delimiter != NULL)
const char* call = delimiter + 3;
if ((delimiter != NULL) &&
((node == NULL) || (strncmp(call, node, length) != 0)))
{
const char* call = delimiter + 3;
// Don't pass local node callsign
setTalkerData(call, call);
}
else

View file

@ -17,6 +17,7 @@ class BrandMeisterBridge
void setEncodingConfiguration(const char* configuration);
void setDefaultConfiguration(const char* configuration);
void setProxyConfiguration(const char* configuration);
void setCallConfiguration(const char* configuration);
const char* getTalker();
void setTalker(const char* call, const char* name);
@ -27,6 +28,8 @@ class BrandMeisterBridge
PatchCord* proxy;
iconv_t handle;
char* talker;
char* node;
int length;
int unknown;
void setTalkerData(const char* call, const char* name);

View file

@ -211,7 +211,7 @@ bool ModuleEchoLink::initialize(void)
<< "/CALLSIGN) to a real callsign\n";
return false;
}
string password;
if (!cfg().getValue(cfgName(), "PASSWORD", password))
{
@ -429,6 +429,8 @@ bool ModuleEchoLink::initialize(void)
bridge.setProxyConfiguration(value.c_str());
}
bridge.setCallConfiguration(mycall);
// Initialize directory server communication
dir = new Directory(servers, mycall, password, location, bind_addr);
dir->statusChanged.connect(mem_fun(*this, &ModuleEchoLink::onStatusChanged));