Mercurial > prosody-hg
comparison plugins/muc/muc.lib.lua @ 9761:8e83f90bf96b
MUC: add ID to message if no ID is present
| author | Jonas Wielicki <jonas@wielicki.name> |
|---|---|
| date | Sun, 06 Jan 2019 11:28:54 +0100 |
| parents | 941497cdefc3 |
| children | f40b9649e929 |
comparison
equal
deleted
inserted
replaced
| 9756:38f7bde4cfe0 | 9761:8e83f90bf96b |
|---|---|
| 21 local jid_resource = require "util.jid".resource; | 21 local jid_resource = require "util.jid".resource; |
| 22 local resourceprep = require "util.encodings".stringprep.resourceprep; | 22 local resourceprep = require "util.encodings".stringprep.resourceprep; |
| 23 local st = require "util.stanza"; | 23 local st = require "util.stanza"; |
| 24 local base64 = require "util.encodings".base64; | 24 local base64 = require "util.encodings".base64; |
| 25 local md5 = require "util.hashes".md5; | 25 local md5 = require "util.hashes".md5; |
| 26 local id = require "util.id"; | |
| 26 | 27 |
| 27 local log = module._log; | 28 local log = module._log; |
| 28 | 29 |
| 29 local occupant_lib = module:require "muc/occupant" | 30 local occupant_lib = module:require "muc/occupant" |
| 30 local muc_util = module:require "muc/util"; | 31 local muc_util = module:require "muc/util"; |
| 1035 end | 1036 end |
| 1036 | 1037 |
| 1037 function room_mt:handle_groupchat_to_room(origin, stanza) | 1038 function room_mt:handle_groupchat_to_room(origin, stanza) |
| 1038 local from = stanza.attr.from; | 1039 local from = stanza.attr.from; |
| 1039 local occupant = self:get_occupant_by_real_jid(from); | 1040 local occupant = self:get_occupant_by_real_jid(from); |
| 1041 if not stanza.attr.id then | |
| 1042 stanza.attr.id = id.medium() | |
| 1043 end | |
| 1040 if module:fire_event("muc-occupant-groupchat", { | 1044 if module:fire_event("muc-occupant-groupchat", { |
| 1041 room = self; origin = origin; stanza = stanza; from = from; occupant = occupant; | 1045 room = self; origin = origin; stanza = stanza; from = from; occupant = occupant; |
| 1042 }) then return true; end | 1046 }) then return true; end |
| 1043 stanza.attr.from = occupant.nick; | 1047 stanza.attr.from = occupant.nick; |
| 1044 self:broadcast_message(stanza); | 1048 self:broadcast_message(stanza); |
