Stroke is a native Java port of the Swiften XMPP library that Remko and I work on. It came about because Isode (my day job) needed an XMPP library for use in a Java project and none of the alternatives at the time seemed to be suitable, so I’ve been spending some of my work days over the last while porting Swiften. Isode have decided to open-source Stroke and I’ve uploaded the development repository to http://swift.im/git/stroke alongside the Swift and Swiften code.
Stroke’s now in a basic usable state but I’m still working on adding some of the basic necessary features. Particularly, at this stage, it’s lacking in:
I intend to address these as time allows.
On the other hand, it’s already inherited some of the nice features that Swiften has, particularly:
If you’d like to grab a copy to have a look at, experiment with or just follow development of, head over to http://swift.im/git/stroke.
If you’d like to chat about Stroke (or Swiften, or Swift), we’ve got a chat room and a mailing list, linked from our Discussion Page and I’d love to hear from you.
The primary license is the GPL v3, although alternative licensing may be arranged for Stroke (and for Swiften). Contact Us.
]]>The release notes are available at http://swift.im/releases/swift-1.0rc1/ and the changelog since beta9 is:
Please test http://swift.im/releases/swift-1.0rc1/, and encourage friends, families and colleagues to do the same, and we’ll look forward to Swift 1.0.
]]>swift@rooms.swift.im, and let us know!]]>A fuller changelog is available at http://swift.im/releases/swift-1.0beta9/, but the highlights include:
* On servers that support it, users can now perform searches for contacts to add or chat to.
* The roster header can now be configured to show the JID instead of the nick.
* Server certificates are now verified and validated. Certificates not passing the tests require confirmation.
* Added dialog changing your nickname and avatar.
* Swift now uses SCRAM-SHA-1-PLUS authentication on servers that support it.
* Highlighting an item in the login account list and pressing detele will now prompt you to remove the cached credentials for that account. (Thanks to Thilo Cestonaro)
* Added keyboard accelerators for tabs and commands. (Thanks to Arnt Gulbrandsen)
* Security labels (XEP-0258) support has been updated to match the latest version of the specification.
* It is now possible to edit contacts from the standard menus (without needing to right-click on the item)
* Fixed all known bugs.
* Various speed improvements.
* Various aesthetic improvements.
* Added Dutch translation.
Please go forth and test: http://swift.im/releases/swift-1.0beta9/
See you in RC.
]]>== Sluift XMPP Console (20110304) ==
Press Ctrl-D to exit
> c = sluift.new_client("alice@wonderland.lit", "MySecret")
> c:connect()
>
Now that we're connected to the server, let's send out presence (so people can see we’re online), and send the message to one of our contacts:
> c:send_presence("I'm here")
> c:send_message("sister@realworld.lit", "Hi there!")
Now, let's wait 3 seconds for her reply, by printing out all the incoming events, and finish off by disconnecting:
> c:for_event(function(e) tprint(e) end, 3000) ([type] => presence, [from] => sister@realworld.lit/Home, [status] => At home) ([type] => presence, [from] => rabbit@wonderland.lit/Party, [status] => Tea party!) ([type] => message, [from] => sister@realworld.lit/Home, [body] => Hi Alice!) > c:disconnect() >Now for a slightly more complex example. Suppose that you want to switch XMPP servers, but you want to take all your contacts with you to your new account. To do this, you start by logging into your current account, and fetch your contact list:
> c = sluift.new_client("alice@wonderland.lit", "MySecret")
> c:connect()
> contacts = c:get_contacts()
> tprint(contacts)
[sister@wonderland.lit] => table
( [jid] => sister@wonderland.lit
[subscription] => both
[groups] => table ( [1] => Family )
[name] => Sister )
...
Now that we have our contact list, let’s disconnect, log into our second account, and add all the contacts from the list to the second account:
> c:disconnect()
> c = sluift.new_client("alice@teaparty.lit", "MyOtherSecret")
> c:connect()
> for _, contact in pairs(contacts) do c:add_contact(contact) end
That’s it, all your contacts have now been migrated!
So far, we have used Sluift as an interactive XMPP console. However, Sluift’s synchronous/blocking nature (it only executes the next command when you have the results of the previous) also makes it very suitable for writing small batch scripts. For example, you can write a short script to collect statistics about which sever software is popular amongst your contacts:
c = sluift.new_client("alice@wonderland.lit", "MySecret")
c:connect()
versions = {}
for jid, _ in pairs(c:get_contacts()) do
v = c:get_version(sluift.jid_domain(jid))
if v then versions[v["name"]] = (versions[v["name"]] or 0) + 1 end
end
for name, cnt in pairs(versions) do print(name .. ": " .. cnt) end
c:disconnect()
Executing the script gives us the following result:
$ ./sluift CollectVersions.lua jabberd2: 1 Prosody: 25 Isode M-Link: 31 yabberd: 1 SoapBox Server 2007: 1 jabberd: 5 Tigase: 2 ejabberd: 19 Openfire: 4And finally, we can’t show script examples without including our beloved EchoBot from XMPP: The Definitive Guide:
c = sluift.new_client("echobot@wonderland.lit", "mypass")
c:connect():send_presence("Send me a message")
c:for_event(function(e)
if e["type"] == "message" then
c:send_message(e["from"], e["body"])
end
end)
Besides interactive and scripted tasks, another great use for Sluift is for XMPP testing (which is the reason we started Sluift in the first place). However, we will go into details about this use case in a later blog post. For now, if you want to play around with Sluift yourself, you can build a development version from the Swift Git repository (together with some examples), or you can get a snapshot for Windows or Mac OS X here (currently only works on very specific setups).
Finally, note that, although you can already do quite some tasks with Sluift today, the API is still quite limited (and undocumented). We are adding new functionality to Sluift as we need it or as people ask for it, so if you’re interested in Sluift, speak up!
Stay tuned for more on the topic of XMPP scripting!]]>boost::bind to connect
signals to slots, we can now use lambdas to directly specify what should
happen. (for the curious: [&] means that all variables outside
of the lambda, i.e. client, are passed by reference)
The great thing about this is that this works out of the box with recent
compilers: I tried this code with Microsoft Visual Studio 2010 and GCC 4.5.0.
(unfortunately, CLang doesn’t support this feature yet)
If you want to try building your own XMPP applications using Swiften (with or
without C++0x), grab a development version from the Git repository, and consult the Swiften Developers Guide and Swiften API documentation to get
started.]]>