Software /
code /
verse
Comparison
plugins/disco.lua @ 146:2678048e93e6
plugins.disco: Fix traceback when disco#info isn't returned for a service in disco#items
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Mon, 11 Oct 2010 02:01:07 +0100 (2010-10-11) |
parent | 121:9b31ac5a37ea |
child | 167:a2ae7a9d360f |
comparison
equal
deleted
inserted
replaced
144:46e933d81024 | 146:2678048e93e6 |
---|---|
354 stream:hook("ready", function () | 354 stream:hook("ready", function () |
355 if initial_disco_started then return; end | 355 if initial_disco_started then return; end |
356 initial_disco_started = true; | 356 initial_disco_started = true; |
357 stream:disco_local_services(function (services) | 357 stream:disco_local_services(function (services) |
358 for _, service in ipairs(services) do | 358 for _, service in ipairs(services) do |
359 for identity in pairs(stream.disco.cache[service.jid].identities) do | 359 local service_disco_info = stream.disco.cache[service.jid]; |
360 local category, type = identity:match("^(.*)/(.*)$"); | 360 if service_disco_info then |
361 stream:event("disco/service-discovered/"..category, { | 361 for identity in pairs(service_disco_info.identities) do |
362 type = type, jid = service.jid; | 362 local category, type = identity:match("^(.*)/(.*)$"); |
363 }); | 363 stream:event("disco/service-discovered/"..category, { |
364 type = type, jid = service.jid; | |
365 }); | |
366 end | |
364 end | 367 end |
365 end | 368 end |
366 stream:event("ready"); | 369 stream:event("ready"); |
367 end); | 370 end); |
368 return true; | 371 return true; |