mod_console: Redirect print() to console session when executing commands in global...
[prosody.git] / plugins / mod_muc.lua
index f11cb7e3dd89cf30f775aa5b2aa9b6b6d273515e..38f21b4a43db28ef68d86396bb400edd9d95a2db 100644 (file)
@@ -205,7 +205,7 @@ function broadcast_presence_stanza(room, stanza, code, nick)
                end
        end
 end
-function broadcast_history(room, to)
+function send_history(room, to)
        local history = rooms_info:get(room, 'history'); -- send discussion history
        if history then
                for _, msg in ipairs(history) do
@@ -260,7 +260,7 @@ function handle_to_occupant(origin, stanza) -- PM, vCards, etc
                        end
                elseif not type then -- available
                        if current_nick then
-                               if #pr == #stanza or current_nick ~= to then
+                               --if #pr == #stanza or current_nick ~= to then -- commented because google keeps resending directed presence
                                        if current_nick == to then -- simple presence
                                                log("debug", "%s broadcasted presence", current_nick);
                                                rooms:get(room, current_nick).sessions[from] = pr;
@@ -287,11 +287,11 @@ function handle_to_occupant(origin, stanza) -- PM, vCards, etc
                                                        end
                                                end
                                        end
-                               else -- possible rejoin
-                                       log("debug", "%s had connection replaced", current_nick);
-                                       handle_to_occupant(origin, st.presence({type='unavailable', from=from, to=to}):tag('status'):text('Replaced by new connection'):up()); -- send unavailable
-                                       handle_to_occupant(origin, stanza); -- resend available
-                               end
+                               --else -- possible rejoin
+                               --      log("debug", "%s had connection replaced", current_nick);
+                               --      handle_to_occupant(origin, st.presence({type='unavailable', from=from, to=to}):tag('status'):text('Replaced by new connection'):up()); -- send unavailable
+                               --      handle_to_occupant(origin, stanza); -- resend available
+                               --end
                        else -- enter room
                                local new_nick = to;
                                if rooms:get(room, to) then
@@ -315,7 +315,7 @@ function handle_to_occupant(origin, stanza) -- PM, vCards, etc
                                        send_occupant_list(room, from);
                                        pr.attr.from = to;
                                        broadcast_presence_stanza(room, pr);
-                                       broadcast_history(room, from);
+                                       send_history(room, from);
                                end
                        end
                elseif type ~= 'result' then -- bad type