Commit cfb0c906 authored by Artem Prilutskiy's avatar Artem Prilutskiy

Added filtering of local node callsign

parent e6561f15
......@@ -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
......
......@@ -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);
......
......@@ -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));
......
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