core/rostermanager.lua

changeset 2909
bcfd76cc9b7d
parent 2050
adc1b92b8c6b
child 2925
692b3c6c5bd2
equal deleted inserted replaced
2908:4d9a73abb237 2909:bcfd76cc9b7d
112 -- --roster = load_roster(username, host); 112 -- --roster = load_roster(username, host);
113 -- return true; -- roster unchanged, no reason to save 113 -- return true; -- roster unchanged, no reason to save
114 --end 114 --end
115 end 115 end
116 if roster then 116 if roster then
117 if not roster[false] then roster[false] = {}; end 117 local metadata = roster[false];
118 roster[false].version = (roster[false].version or 0) + 1; 118 if not metadata then
119 metadata = {};
120 roster[false] = metadata;
121 end
122 if metadata.version ~= true then
123 metadata.version = (metadata.version or 0) + 1;
124 end
119 return datamanager.store(username, host, "roster", roster); 125 return datamanager.store(username, host, "roster", roster);
120 end 126 end
121 log("warn", "save_roster: user had no roster to save"); 127 log("warn", "save_roster: user had no roster to save");
122 return nil; 128 return nil;
123 end 129 end

mercurial