Skip to content
This repository has been archived by the owner on Jan 22, 2018. It is now read-only.

Latest commit

 

History

History
67 lines (43 loc) · 1.75 KB

README.markdown

File metadata and controls

67 lines (43 loc) · 1.75 KB

smackScalaHelpers

This repository holds a collection of little helpers for the XMPP Smack library. They are written in Scala.

Most of the helpers are just wrappers for an easier (but also less powerful) API of existing Smack functionalities.

WARNING: They might be incomplete and unstable so be careful ;-)

Helpers

XEP-0133 - Service Administration

XEP-0133 is a recommendation for best practices for service-level administration of servers and components using Ad-Hoc Commands.

Implemented use cases

  • Add User
  • Delete User
  • Disable User
  • Re-Enable User
  • Change User Password

Usage

val serviceAdmin = new ServiceAdministration( connection, "example.org" )

serviceAdmin.addUser("new@example.org", "secret")
serviceAdmin.deleteUser("old@example.org")

serviceAdmin.disableUser("badguy@example.org")
serviceAdmin.reEnableUser("goodguy@example.org")

serviceAdmin.changeUserPassword("goodguy@example.org", "newSecret")

XEP-0222/XEP-0223 - Persistent Storage of Public/Private Data via PubSub

XEP-0222 and XEP-0223 define best practices for using the XMPP publish-subscribe extension to persistently store semi-public/private data objects.

Usage

val db = new PubSubStorage( connection )
val storageNode = db.createNode("myNodeId")

val myObj = storageNode.get("myItemId") match {

  case o:Some[MyObjClass] => MyObjClass.fromXmlNode(o)
  case None               => throw new Exception("could not load object")
}

myObj.changeSomething()

storageNode.set(myObj.toXmlNode, myObj.getId)