Mercurial > prosody-hg
comparison plugins/muc/muc.lib.lua @ 3249:95daf6398dbb
MUC: Persist data in room:set_password() when called programmatically.
| author | Waqas Hussain <waqas20@gmail.com> |
|---|---|
| date | Sun, 13 Jun 2010 20:05:45 +0500 |
| parents | f8d14ea3ad0e |
| children | 38402e874b45 |
comparison
equal
deleted
inserted
replaced
| 3248:f8d14ea3ad0e | 3249:95daf6398dbb |
|---|---|
| 238 :tag('status'):text(error_message); | 238 :tag('status'):text(error_message); |
| 239 end | 239 end |
| 240 | 240 |
| 241 function room_mt:set_password(password) | 241 function room_mt:set_password(password) |
| 242 if password == "" or type(password) ~= "string" then password = nil; end | 242 if password == "" or type(password) ~= "string" then password = nil; end |
| 243 self._data.password = password; | 243 if self._data.password ~= password then |
| 244 return password; | 244 self._data.password = password; |
| 245 if self.save then self:save(true); end | |
| 246 end | |
| 245 end | 247 end |
| 246 function room_mt:get_password() | 248 function room_mt:get_password() |
| 247 return self._data.password; | 249 return self._data.password; |
| 248 end | 250 end |
| 249 | 251 |
