Added support of default ID
This commit is contained in:
parent
fd65ad7769
commit
ebc4aa16bc
3 changed files with 22 additions and 7 deletions
|
@ -9,6 +9,7 @@
|
|||
|
||||
#define VECTORS_COUNT 8
|
||||
#define DEFAULT_USER_NUMBER 1
|
||||
#define DEFAULT_LINK_NUMBER 10
|
||||
|
||||
int main(int argc, const char* argv[])
|
||||
{
|
||||
|
@ -25,6 +26,7 @@ int main(int argc, const char* argv[])
|
|||
{ "connection", required_argument, NULL, 'c' },
|
||||
{ "identity", required_argument, NULL, 'i' },
|
||||
{ "network", required_argument, NULL, 'n' },
|
||||
{ "unknown", required_argument, NULL, 'u' },
|
||||
{ "link", required_argument, NULL, 'l' },
|
||||
{ NULL, 0, NULL, 0 }
|
||||
};
|
||||
|
@ -32,13 +34,14 @@ int main(int argc, const char* argv[])
|
|||
pcre* expression = NULL;
|
||||
const char* file = NULL;
|
||||
uint32_t network = 0;
|
||||
uint32_t link = 10;
|
||||
uint32_t unknown = DEFAULT_USER_NUMBER;
|
||||
uint32_t link = DEFAULT_LINK_NUMBER;
|
||||
|
||||
int position = 0;
|
||||
const char* error = NULL;
|
||||
|
||||
int selection = 0;
|
||||
while ((selection = getopt_long(argc, const_cast<char* const*>(argv), "e:c:n:l:", options, NULL)) != EOF)
|
||||
while ((selection = getopt_long(argc, const_cast<char* const*>(argv), "e:c:u:n:l:", options, NULL)) != EOF)
|
||||
switch (selection)
|
||||
{
|
||||
case 'e':
|
||||
|
@ -53,6 +56,10 @@ int main(int argc, const char* argv[])
|
|||
openlog(optarg, 0, LOG_USER);
|
||||
break;
|
||||
|
||||
case 'u':
|
||||
unknown = atoi(optarg);
|
||||
break;
|
||||
|
||||
case 'n':
|
||||
network = atoi(optarg);
|
||||
break;
|
||||
|
@ -77,6 +84,7 @@ int main(int argc, const char* argv[])
|
|||
"Usage: %s"
|
||||
" --expression <regular expression>"
|
||||
" --connection <path to configuration file>"
|
||||
" [--unknown <ID for unknown call-signs>]"
|
||||
" --network <network number>"
|
||||
" --link <link number>"
|
||||
" [--identity <identity>]"
|
||||
|
@ -107,7 +115,7 @@ int main(int argc, const char* argv[])
|
|||
|
||||
uint32_t number = store.getPrivateIDForCall(call);
|
||||
if (number == 0)
|
||||
number = DEFAULT_USER_NUMBER;
|
||||
number = unknown;
|
||||
proxy.setTalkerID(number);
|
||||
syslog(LOG_INFO, "*** Found call-sign: %s (ID: %d)", call, number);
|
||||
|
||||
|
|
|
@ -18,6 +18,7 @@ BrandMeisterBridge::BrandMeisterBridge()
|
|||
proxy = NULL;
|
||||
store = NULL;
|
||||
talker = NULL;
|
||||
unknown = ECHOLINK_DEFAULT_USER_NUMBER;
|
||||
}
|
||||
|
||||
BrandMeisterBridge::~BrandMeisterBridge()
|
||||
|
@ -29,6 +30,11 @@ BrandMeisterBridge::~BrandMeisterBridge()
|
|||
|
||||
// Interface methods for ModuleEchoLink
|
||||
|
||||
void BrandMeisterBridge::setDefaultConfiguration(const char* configuration)
|
||||
{
|
||||
unknown = strtol(configuration, NULL, 10);
|
||||
}
|
||||
|
||||
void BrandMeisterBridge::setProxyConfiguration(const char* configuration)
|
||||
{
|
||||
char* pointer = const_cast<char*>(configuration);
|
||||
|
@ -95,7 +101,7 @@ void BrandMeisterBridge::setTalker(const char* call, const char* name)
|
|||
|
||||
uint32_t number = store->getPrivateIDForCall(call);
|
||||
if (number == 0)
|
||||
number = ECHOLINK_DEFAULT_USER_NUMBER;
|
||||
number = unknown;
|
||||
|
||||
syslog(LOG_INFO, "Set talker ID to %d for call-sign %s", number, call);
|
||||
proxy->setTalkerID(number);
|
||||
|
@ -125,9 +131,8 @@ void BrandMeisterBridge::handleChatMessage(const char* text)
|
|||
}
|
||||
else
|
||||
{
|
||||
uint32_t number = ECHOLINK_DEFAULT_USER_NUMBER;
|
||||
syslog(LOG_INFO, "Set talker ID to %d (call-sign was not fit into chat message)", number);
|
||||
proxy->setTalkerID(number);
|
||||
syslog(LOG_INFO, "Set talker ID to %d (call-sign was not fit into chat message)", unknown);
|
||||
proxy->setTalkerID(unknown);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -13,6 +13,7 @@ class BrandMeisterBridge
|
|||
BrandMeisterBridge();
|
||||
~BrandMeisterBridge();
|
||||
|
||||
void setDefaultConfiguration(const char* configuration);
|
||||
void setProxyConfiguration(const char* configuration);
|
||||
void setStoreConfiguration(const char* configuration);
|
||||
|
||||
|
@ -25,6 +26,7 @@ class BrandMeisterBridge
|
|||
PatchCordProxy* proxy;
|
||||
UserDataStore* store;
|
||||
char* talker;
|
||||
int unknown;
|
||||
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue