Skip to content

Instantly share code, notes, and snippets.

@hamnis
Created December 6, 2010 19:28
Show Gist options
  • Save hamnis/730779 to your computer and use it in GitHub Desktop.
Save hamnis/730779 to your computer and use it in GitHub Desktop.
Message in an IRC client
Compilation completed with 2 errors and 0 warnings
error: overriding value arguments in class Message of type List[String];
value arguments needs `override' modifier
case class Ping(arguments: List[String]) extends Message(None, PING, arguments)
error: overriding value arguments in class Message of type List[String];
value arguments needs `override' modifier
case class Pong(arguments: List[String]) extends Message(None, PONG, arguments)
case class Message(origin: Option[Origin], command: NameAndFormat, arguments: List[String]) {
def format = {
val builder = new StringBuilder()
origin.foreach(x => builder.append(":").append(x.name).append(" "))
command match {
case Status(c, n) => builder.append(c)
case Command(n) => builder.append(n)
}
builder.append(" ")
builder.append(arguments.mkString(" "))
builder.append("\r\n")
builder.toString
}
}
case class Ping(arguments: List[String]) extends Message(None, PING, arguments)
case class Pong(arguments: List[String]) extends Message(None, PONG, arguments)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment