Skip to content

Commit

Permalink
Move initialisation into Feeder.
Browse files Browse the repository at this point in the history
This is slightly better, as the caller doesn't have to care about performing the initialisation.  But it's still not pretty.  In particular the "this" instead of "self" jumps out.
  • Loading branch information
happygiraffe committed Apr 30, 2009
1 parent b1dd4a4 commit 1930ea0
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
1 change: 0 additions & 1 deletion src/main/scala/net/happygiraffe/bender/Bender.scala
Expand Up @@ -25,7 +25,6 @@ class Bender extends PircBot {
// For managing feeds.
val feeder = new Feeder(messenger)
feeder.start()
feeder ! "init"

val commands = Map[String, Command](
"fetch" -> FetchCommand,
Expand Down
10 changes: 10 additions & 0 deletions src/main/scala/net/happygiraffe/bender/Feeder.scala
Expand Up @@ -63,6 +63,16 @@ class Feeder(messenger: Actor) extends Actor {
private def messageFor(entry: SyndEntry) : String =
entry.getTitle() + " :: " + entry.getLink()

/**
* Override for initialisation.
*/
override def start(): Actor = {
val rv = super.start()
// NB: Have to use "this" rather than "self" as that returns an
// ActorProxy at this point in time.
this ! "init"
rv
}

def act() {
loop {
Expand Down

0 comments on commit 1930ea0

Please sign in to comment.