<commit_before>package im.mange.jetboot.comet

import net.liftweb.actor.LiftActor
import net.liftweb.http.CometActor

trait BaseMessageCapturingActor extends HandleMultipleTimesMessageHandler {
  override def onMessage = capture :: super.onMessage

  def onCapturedMessage(message: Any, actor: LiftActor): Unit

  def capture: PartialFunction[Any, Unit] = {
    case x => onCapturedMessage(x, this)
  }
}

trait MessageCapturingLiftActor extends LiftActor with BaseMessageCapturingActor {
  override final protected def messageHandler = {
    case x => doOnMessage(x)
  }
}

trait MessageCapturingCometActor extends CometActor with BaseMessageCapturingActor {
  override final def lowPriority = {
    case x => doOnMessage(x)
  }
}

trait HandleMultipleTimesMessageHandler extends LiftActor {
  def onMessage: List[PartialFunction[Any, Unit]] = Nil

  final def doOnMessage(message: Any) {
    onMessage.reverse.foreach(_(message))
  }
}

<commit_msg>tidy up message capture a bit<commit_after>package im.mange.jetboot.comet

import im.mange.jetboot.Renderable
import net.liftweb.actor.LiftActor
import net.liftweb.http.CometActor
import net.liftweb.http.js.JsCmd

trait BaseMessageCapturingActor extends HandleMultipleTimesMessageHandler {
  override def onMessage = capture :: super.onMessage

  def onCapturedMessage(message: Any): Unit

  def capture: PartialFunction[Any, Unit] = {
    case x => onCapturedMessage(x)
  }
}

trait MessageCapturingLiftActor extends LiftActor with BaseMessageCapturingActor {
  override final protected def messageHandler = {
    case x => doOnMessage(x)
  }
}

trait MessageCapturingCometActor extends CometActor with BaseMessageCapturingActor {
  override final def lowPriority = {
    case x => doOnMessage(x)
  }
}

//trait MessagableAgent extends Renderable {
//  def on(message: Any): JsCmd
//  //TODO: should we have onModelChanged() ? at which point this is then no-longer jetbootable
//}
//
//trait MessageCapturingAgent extends MessagableAgent with BaseMessageCapturingActor {
//  override final def on(message: Any): JsCmd = {
//    case x => doOnMessage(x)
//  }
//}


trait HandleMultipleTimesMessageHandler {
  def onMessage: List[PartialFunction[Any, Unit]] = Nil

  final def doOnMessage(message: Any) {
    onMessage.reverse.foreach(_(message))
  }
}


{'fraction_non_alphanumeric': 0.0859002169197397, 'fraction_numerical': 0.0, 'mean_word_length': 4.722084367245658, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 10, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '679862', 'n_tokens_mistral': 701, 'n_tokens_neox': 696, 'n_words': 180}