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:
paulc 2005-11-07 01:28:12 +00:00
parent 2081baa8ef
commit ec58e83ddd
2 changed files with 15 additions and 8 deletions

View File

@ -105,13 +105,15 @@ if the message has been declared processed by one of the handlers<br />
</p>
<p><b>Keyword: %%&gt;install</b><br />
%%&gt;install:[&lt;priority&gt;]:&lt;name&gt;<br />
%%&gt;install:[&lt;priority&gt;]:&lt;name&gt;[:&lt;filter-name&gt;[:&lt;filter-value&gt;]]<br />
<b>Direction: Application to engine</b><br />
Always from the application to the engine, requests the installing of a message
handler for the application that requested it<br />
The answer to the install request is delivered asynchronously (see below).<br />
&lt;priority&gt; - priority in chain, use default (100) if missing<br />
&lt;name&gt; - name of the messages for that a handler should be installed<br />
&lt;filter-name&gt; - name of a variable the handler will filter<br />
&lt;filter-value&gt; - matching value for the filtered variable<br />
</p>
<p><b>Keyword: %%&lt;install</b><br />

View File

@ -770,16 +770,21 @@ void ExtModReceiver::processLine(const char *line)
int prio = 100;
id >> prio >> ":";
bool ok = true;
ObjList *p = &m_relays;
for (; p; p=p->next()) {
MessageRelay *r = static_cast<MessageRelay *>(p->get());
if (r && (*r == id)) {
ok = false;
break;
}
String fname;
String fvalue;
Regexp r("^\\([^:]*\\):\\([^:]*\\):\\?\\(.*\\)");
if (id.matches(r)) {
// a filter is specified
fname = id.matchString(2);
fvalue = id.matchString(3);
id = id.matchString(1);
}
// sanity checks
ok = ok && id && !m_relays.find(id);
if (ok) {
MessageRelay *r = new MessageRelay(id,this,0,prio);
if (fname)
r->setFilter(fname,fvalue);
m_relays.append(r);
Engine::install(r);
}