Here's something you could do but its still using On Text/Action. But also using signals..

Code:
On *:Text:*:#: { .signal -n event | %event.type = $event | %event.msg = $1- }
On *:Action:*:#: { .signal -n event | %event.type = $event | %event.msg = $1- }

On *:SIGNAL:event: {
  if (%event.type == text) || (%event.type == action)) {
    if (@yahoo.com isin %event.msg) [Task to perform]
  }
}


Hope this helps.

-Andy