241 return true; |
241 return true; |
242 end |
242 end |
243 |
243 |
244 local function build_unavailable_presence_from_error(stanza) |
244 local function build_unavailable_presence_from_error(stanza) |
245 local type, condition, text = stanza:get_error(); |
245 local type, condition, text = stanza:get_error(); |
246 local error_message = "Kicked: "..condition:gsub("%-", " "); |
246 local error_message = "Kicked: "..(condition and condition:gsub("%-", " ") or "presence error"); |
247 if text then |
247 if text then |
248 error_message = error_message..": "..text; |
248 error_message = error_message..": "..text; |
249 end |
249 end |
250 return st.presence({type='unavailable', from=stanza.attr.from, to=stanza.attr.to}) |
250 return st.presence({type='unavailable', from=stanza.attr.from, to=stanza.attr.to}) |
251 :tag('status'):text(error_message); |
251 :tag('status'):text(error_message); |