Added parameter filter for installed handlers.
git-svn-id: http://yate.null.ro/svn/yate/trunk@561 acf43c95-373e-0410-b603-e72c3f656dc1
This commit is contained in:
parent
2081baa8ef
commit
ec58e83ddd
|
@ -105,13 +105,15 @@ if the message has been declared processed by one of the handlers<br />
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<p><b>Keyword: %%>install</b><br />
|
<p><b>Keyword: %%>install</b><br />
|
||||||
%%>install:[<priority>]:<name><br />
|
%%>install:[<priority>]:<name>[:<filter-name>[:<filter-value>]]<br />
|
||||||
<b>Direction: Application to engine</b><br />
|
<b>Direction: Application to engine</b><br />
|
||||||
Always from the application to the engine, requests the installing of a message
|
Always from the application to the engine, requests the installing of a message
|
||||||
handler for the application that requested it<br />
|
handler for the application that requested it<br />
|
||||||
The answer to the install request is delivered asynchronously (see below).<br />
|
The answer to the install request is delivered asynchronously (see below).<br />
|
||||||
<priority> - priority in chain, use default (100) if missing<br />
|
<priority> - priority in chain, use default (100) if missing<br />
|
||||||
<name> - name of the messages for that a handler should be installed<br />
|
<name> - name of the messages for that a handler should be installed<br />
|
||||||
|
<filter-name> - name of a variable the handler will filter<br />
|
||||||
|
<filter-value> - matching value for the filtered variable<br />
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<p><b>Keyword: %%<install</b><br />
|
<p><b>Keyword: %%<install</b><br />
|
||||||
|
|
|
@ -770,16 +770,21 @@ void ExtModReceiver::processLine(const char *line)
|
||||||
int prio = 100;
|
int prio = 100;
|
||||||
id >> prio >> ":";
|
id >> prio >> ":";
|
||||||
bool ok = true;
|
bool ok = true;
|
||||||
ObjList *p = &m_relays;
|
String fname;
|
||||||
for (; p; p=p->next()) {
|
String fvalue;
|
||||||
MessageRelay *r = static_cast<MessageRelay *>(p->get());
|
Regexp r("^\\([^:]*\\):\\([^:]*\\):\\?\\(.*\\)");
|
||||||
if (r && (*r == id)) {
|
if (id.matches(r)) {
|
||||||
ok = false;
|
// a filter is specified
|
||||||
break;
|
fname = id.matchString(2);
|
||||||
}
|
fvalue = id.matchString(3);
|
||||||
|
id = id.matchString(1);
|
||||||
}
|
}
|
||||||
|
// sanity checks
|
||||||
|
ok = ok && id && !m_relays.find(id);
|
||||||
if (ok) {
|
if (ok) {
|
||||||
MessageRelay *r = new MessageRelay(id,this,0,prio);
|
MessageRelay *r = new MessageRelay(id,this,0,prio);
|
||||||
|
if (fname)
|
||||||
|
r->setFilter(fname,fvalue);
|
||||||
m_relays.append(r);
|
m_relays.append(r);
|
||||||
Engine::install(r);
|
Engine::install(r);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue