222 end |
222 end |
223 function subscribed(username, host, jid) |
223 function subscribed(username, host, jid) |
224 if is_contact_pending_in(username, host, jid) then |
224 if is_contact_pending_in(username, host, jid) then |
225 local roster = load_roster(username, host); |
225 local roster = load_roster(username, host); |
226 local item = roster[jid]; |
226 local item = roster[jid]; |
|
227 if not item then -- FIXME should roster item be auto-created? |
|
228 item = {subscription = "none", groups = {}}; |
|
229 roster[jid] = item; |
|
230 end |
227 if item.subscription == "none" then |
231 if item.subscription == "none" then |
228 item.subscription = "from"; |
232 item.subscription = "from"; |
229 else -- subscription == to |
233 else -- subscription == to |
230 item.subscription = "both"; |
234 item.subscription = "both"; |
231 end |
235 end |