Comparison

plugins/mod_roster.lua @ 1200:57a72472e1bc

mod_roster: Add some comments for the error cases to improve readability
author Matthew Wild <mwild1@gmail.com>
date Tue, 26 May 2009 01:27:07 +0100
parent 1198:545c81364939
child 1354:a27eb60a77cd
comparison
equal deleted inserted replaced
1199:db2a55fe94f2 1200:57a72472e1bc
112 end 112 end
113 end 113 end
114 end 114 end
115 local success, err_type, err_cond, err_msg = rm_add_to_roster(session, jid, r_item); 115 local success, err_type, err_cond, err_msg = rm_add_to_roster(session, jid, r_item);
116 if success then 116 if success then
117 -- Ok, send success
117 session.send(st.reply(stanza)); 118 session.send(st.reply(stanza));
119 -- and push change to all resources
118 rm_roster_push(from_node, from_host, jid); 120 rm_roster_push(from_node, from_host, jid);
119 else 121 else
122 -- Adding to roster failed
120 session.send(st.error_reply(stanza, err_type, err_cond, err_msg)); 123 session.send(st.error_reply(stanza, err_type, err_cond, err_msg));
121 end 124 end
122 end 125 end
123 else 126 else
127 -- Trying to add self to roster
124 session.send(st.error_reply(stanza, "cancel", "not-allowed")); 128 session.send(st.error_reply(stanza, "cancel", "not-allowed"));
125 end 129 end
126 else 130 else
131 -- Invalid JID added to roster
127 session.send(st.error_reply(stanza, "modify", "bad-request")); -- FIXME what's the correct error? 132 session.send(st.error_reply(stanza, "modify", "bad-request")); -- FIXME what's the correct error?
128 end 133 end
129 else 134 else
135 -- Roster set didn't include a single item, or its name wasn't 'item'
130 session.send(st.error_reply(stanza, "modify", "bad-request")); 136 session.send(st.error_reply(stanza, "modify", "bad-request"));
131 end 137 end
132 return true; 138 return true;
133 end 139 end
134 end 140 end