Software /
code /
prosody
Comparison
plugins/muc/mod_muc.lua @ 6111:f8b94903be52
plugins/muc: Provide a reasonable default `route_stanza`
author | daurnimator <quae@daurnimator.com> |
---|---|
date | Wed, 19 Mar 2014 12:03:15 -0400 |
parent | 6110:d007b3c49078 |
child | 6129:6c66571ab0f9 |
comparison
equal
deleted
inserted
replaced
6110:d007b3c49078 | 6111:f8b94903be52 |
---|---|
62 function muclib.room_mt:set_affiliation(actor, jid, affiliation, callback, reason) | 62 function muclib.room_mt:set_affiliation(actor, jid, affiliation, callback, reason) |
63 if is_admin(jid) then return nil, "modify", "not-acceptable"; end | 63 if is_admin(jid) then return nil, "modify", "not-acceptable"; end |
64 return _set_affiliation(self, actor, jid, affiliation, callback, reason); | 64 return _set_affiliation(self, actor, jid, affiliation, callback, reason); |
65 end | 65 end |
66 | 66 |
67 local function room_route_stanza(room, stanza) module:send(stanza); end | |
68 local function room_save(room, forced) | 67 local function room_save(room, forced) |
69 local node = jid_split(room.jid); | 68 local node = jid_split(room.jid); |
70 persistent_rooms[room.jid] = room._data.persistent; | 69 persistent_rooms[room.jid] = room._data.persistent; |
71 if room._data.persistent then | 70 if room._data.persistent then |
72 local history = room._data.history; | 71 local history = room._data.history; |
87 if forced then persistent_rooms_storage:set(nil, persistent_rooms); end | 86 if forced then persistent_rooms_storage:set(nil, persistent_rooms); end |
88 end | 87 end |
89 | 88 |
90 function create_room(jid) | 89 function create_room(jid) |
91 local room = muc_new_room(jid); | 90 local room = muc_new_room(jid); |
92 room.route_stanza = room_route_stanza; | |
93 room.save = room_save; | 91 room.save = room_save; |
94 rooms[jid] = room; | 92 rooms[jid] = room; |
95 if lock_rooms then | 93 if lock_rooms then |
96 room.locked = true; | 94 room.locked = true; |
97 if lock_room_timeout and lock_room_timeout > 0 then | 95 if lock_room_timeout and lock_room_timeout > 0 then |
129 end | 127 end |
130 end | 128 end |
131 if persistent_errors then persistent_rooms_storage:set(nil, persistent_rooms); end | 129 if persistent_errors then persistent_rooms_storage:set(nil, persistent_rooms); end |
132 | 130 |
133 local host_room = muc_new_room(muc_host); | 131 local host_room = muc_new_room(muc_host); |
134 host_room.route_stanza = room_route_stanza; | |
135 host_room.save = room_save; | 132 host_room.save = room_save; |
136 rooms[muc_host] = host_room; | 133 rooms[muc_host] = host_room; |
137 | 134 |
138 module:hook("host-disco-items", function(event) | 135 module:hook("host-disco-items", function(event) |
139 local reply = event.reply; | 136 local reply = event.reply; |