# HG changeset patch # User Kim Alvefur # Date 1316713926 -7200 # Node ID 39af184385cd4596c04ad70d46d6bfd3facded5d # Parent 60db4e738910438b986e2ffc9a3eb82e37502f83 plugins.version: Use get_child_text() and fix traceback on empty iq-result reply. diff -r 60db4e738910 -r 39af184385cd plugins/version.lua --- a/plugins/version.lua Thu Sep 08 18:04:49 2011 +0200 +++ b/plugins/version.lua Thu Sep 22 19:52:06 2011 +0200 @@ -30,15 +30,15 @@ stream:send_iq(verse.iq({ type = "get", to = target_jid }) :tag("query", { xmlns = xmlns_version }), function (reply) - local query = reply:get_child("query", xmlns_version); if reply.attr.type == "result" then - local name = query:get_child("name"); - local version = query:get_child("version"); - local os = query:get_child("os"); + local query = reply:get_child("query", xmlns_version); + local name = query and query:get_child_text("name"); + local version = query and query:get_child_text("version"); + local os = query and query:get_child_text("os"); callback({ - name = name and name:get_text() or nil; - version = version and version:get_text() or nil; - platform = os and os:get_text() or nil; + name = name; + version = version; + platform = os; }); else local type, condition, text = reply:get_error();