code_junkie

Good XMPP Java Libraries for server side?

Nov 11th, 2011
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.44 KB | None | 0 0
  1. object Main {
  2.  
  3. /**
  4. * @param args the command line arguments
  5. */
  6. def main(args: Array[String]) :Unit = {
  7. new XMPPComponent(
  8. new ComponentConfig() {
  9. def secret() : String = { "secret.goes.here" }
  10. def server() : String = { "communitivity.com" }
  11. def subdomain() : String = { "weather" }
  12. def name() : String = { "US Weather" }
  13. def description() : String = { "Weather component that also supported SPARQL/XMPP" }
  14. },
  15. actor {
  16. loop {
  17. react {
  18. case (pkt:Packet, out : Actor) =>
  19. Console.println("Received packet...n"+pkt.toXML)
  20. pkt match {
  21. case message:Message =>
  22. val reply = new Message()
  23. reply.setTo(message.getFrom())
  24. reply.setFrom(message.getTo())
  25. reply.setType(message.getType())
  26. reply.setThread(message.getThread())
  27. reply.setBody("Received '"+message.getBody()+"', tyvm")
  28. out ! reply
  29. case _ =>
  30. Console.println("Received something other than Message")
  31. }
  32. case _ =>
  33. Console.println("Received something other than (Packet, actor)")
  34. }
  35. }
  36. }
  37. ).start
  38. }
  39. }
Add Comment
Please, Sign In to add comment