Comparison

plugins/muc/muc.lib.lua @ 8839:dcd53a565c01

MUC: Handle setting default history messages when history length is unset (thanks tmolitor)
author Kim Alvefur <zash@zash.se>
date Tue, 29 May 2018 22:33:22 +0200
parent 8838:6d4b0895f76d
child 8842:463505cc75d5
comparison
equal deleted inserted replaced
8838:6d4b0895f76d 8839:dcd53a565c01
363 -- Default number of history messages the room returns 363 -- Default number of history messages the room returns
364 function room_mt:get_defaulthistorymessages() 364 function room_mt:get_defaulthistorymessages()
365 return self._data.default_history_messages or default_history_length; 365 return self._data.default_history_messages or default_history_length;
366 end 366 end
367 function room_mt:set_defaulthistorymessages(number) 367 function room_mt:set_defaulthistorymessages(number)
368 number = math.min(tonumber(number) or default_history_length, self._data.history_length); 368 number = math.min(tonumber(number) or default_history_length, self._data.history_length or default_history_length);
369 if number == default_history_length then 369 if number == default_history_length then
370 number = nil; 370 number = nil;
371 end 371 end
372 self._data.default_history_messages = number; 372 self._data.default_history_messages = number;
373 end 373 end