Software /
code /
verse
Comparison
plugins/roster.lua @ 395:e86144a4eaa1
plugins: Cleanup [luacheck]
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Thu, 03 Sep 2015 22:41:27 +0200 |
parent | 380:0891b4e27766 |
child | 490:6b2f31da9610 |
comparison
equal
deleted
inserted
replaced
394:c2e959b60c13 | 395:e86144a4eaa1 |
---|---|
37 | 37 |
38 local function item_xml2lua(xml_item) | 38 local function item_xml2lua(xml_item) |
39 local item_table = { }; | 39 local item_table = { }; |
40 local groups = {}; | 40 local groups = {}; |
41 item_table.groups = groups; | 41 item_table.groups = groups; |
42 local jid = xml_item.attr.jid; | |
43 | 42 |
44 for k, v in pairs(xml_item.attr) do | 43 for k, v in pairs(xml_item.attr) do |
45 if k ~= "xmlns" then | 44 if k ~= "xmlns" then |
46 item_table[k] = v | 45 item_table[k] = v |
47 end | 46 end |
73 stream:send_iq(stanza, function (reply) | 72 stream:send_iq(stanza, function (reply) |
74 if not callback then return end | 73 if not callback then return end |
75 if reply.attr.type == "result" then | 74 if reply.attr.type == "result" then |
76 callback(true); | 75 callback(true); |
77 else | 76 else |
78 local type, condition, text = reply:get_error(); | 77 callback(nil, reply); |
79 callback(nil, { type, condition, text }); | |
80 end | 78 end |
81 end); | 79 end); |
82 end | 80 end |
83 -- What about subscriptions? | 81 -- What about subscriptions? |
84 | 82 |
92 function (reply) | 90 function (reply) |
93 if not callback then return end | 91 if not callback then return end |
94 if reply.attr.type == "result" then | 92 if reply.attr.type == "result" then |
95 callback(true); | 93 callback(true); |
96 else | 94 else |
97 local type, condition, text = reply:get_error(); | 95 callback(nil, reply); |
98 callback(nil, { type, condition, text }); | |
99 end | 96 end |
100 end); | 97 end); |
101 end | 98 end |
102 | 99 |
103 local function add_item(item) -- Takes one roster <item/> | 100 local function add_item(item) -- Takes one roster <item/> |
124 end | 121 end |
125 roster.ver = query.attr.ver or ""; | 122 roster.ver = query.attr.ver or ""; |
126 end | 123 end |
127 callback(roster); | 124 callback(roster); |
128 else | 125 else |
129 local type, condition, text = stanza:get_error(); | 126 callback(nil, result); |
130 callback(nil, { type, condition, text }); --FIXME | |
131 end | 127 end |
132 end); | 128 end); |
133 end | 129 end |
134 | 130 |
135 stream:hook("iq/"..xmlns_roster, function(stanza) | 131 stream:hook("iq/"..xmlns_roster, function(stanza) |