..
This commit is contained in:
parent
c937c9b2d6
commit
f9bcb35800
1 changed files with 17 additions and 6 deletions
|
@ -89,23 +89,33 @@ void BrandMeisterBridge::setTalker(const char* call, const char* name)
|
|||
return;
|
||||
}
|
||||
|
||||
const char* delimiter = strpbrk(call, " -\n");
|
||||
if (delimiter != NULL)
|
||||
const char* delimiter1 = strpbrk(call, " -\n");
|
||||
const char* delimiter2 = strpbrk(name, "\n");
|
||||
|
||||
if (delimiter1 != NULL)
|
||||
{
|
||||
// Remove characters after call-sign
|
||||
size_t length = delimiter - call;
|
||||
size_t length = delimiter1 - call;
|
||||
char* buffer = (char*)alloca(length + sizeof(uint32_t));
|
||||
strncpy(buffer, call, length);
|
||||
call = buffer;
|
||||
}
|
||||
if (delimiter2 != NULL)
|
||||
{
|
||||
// Remove characters after talker name
|
||||
size_t length = delimiter2 - name;
|
||||
char* buffer = (char*)alloca(length + sizeof(uint32_t));
|
||||
strncpy(buffer, name, length);
|
||||
name = buffer;
|
||||
}
|
||||
|
||||
uint32_t number = store->getPrivateIDForCall(call);
|
||||
if (number == 0)
|
||||
number = unknown;
|
||||
|
||||
syslog(LOG_INFO, "Set talker ID to %d for call-sign %s", number, call);
|
||||
syslog(LOG_INFO, "Set talker ID to %d for call-sign %s (%s)", number, call, name);
|
||||
proxy->setTalkerID(number);
|
||||
proxy->setTalkerAlias(call);
|
||||
proxy->setTalkerAlias(name);
|
||||
}
|
||||
|
||||
void BrandMeisterBridge::handleChatMessage(const char* text)
|
||||
|
@ -128,12 +138,13 @@ void BrandMeisterBridge::handleChatMessage(const char* text)
|
|||
if (delimiter != NULL)
|
||||
{
|
||||
const char* call = delimiter + 3;
|
||||
setTalker(call, NULL);
|
||||
setTalker(call, call);
|
||||
}
|
||||
else
|
||||
{
|
||||
syslog(LOG_INFO, "Set talker ID to %d (call-sign was not fit into chat message)", unknown);
|
||||
proxy->setTalkerID(unknown);
|
||||
proxy->setTalkerAlias("<unknown>");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue