comparison mod_message_logging/mod_message_logging.lua @ 1377:92f3b4d81b52

mod_message_logging: Treat messages with no 'to' as directed to the sender
author Kim Alvefur <zash@zash.se>
date Thu, 03 Apr 2014 00:19:18 +0200
parents 7dbde05b48a9
children 045720a5fccd
comparison
equal deleted inserted replaced
1376:f4de4a35778d 1377:92f3b4d81b52
54 local origin, stanza = event.origin, event.stanza; 54 local origin, stanza = event.origin, event.stanza;
55 local message_type = stanza.attr.type; 55 local message_type = stanza.attr.type;
56 56
57 if message_type == "error" then return; end 57 if message_type == "error" then return; end
58 58
59 local from, to = jid_bare(stanza.attr.from), jid_bare(stanza.attr.to); 59 local from, to = jid_bare(stanza.attr.from), jid_bare(stanza.attr.to or stanza.attr.from);
60 local body = stanza:get_child("body"); 60 local body = stanza:get_child("body");
61 if not body then return; end 61 if not body then return; end
62 body = body:get_text(); 62 body = body:get_text();
63 63
64 local f = open_files[to]; 64 local f = open_files[to];
76 local origin, stanza = event.origin, event.stanza; 76 local origin, stanza = event.origin, event.stanza;
77 local message_type = stanza.attr.type; 77 local message_type = stanza.attr.type;
78 78
79 if message_type == "error" or message_type == "groupchat" then return; end 79 if message_type == "error" or message_type == "groupchat" then return; end
80 80
81 local from, to = jid_bare(stanza.attr.from), jid_bare(stanza.attr.to); 81 local from, to = jid_bare(stanza.attr.from), jid_bare(stanza.attr.to or origin.full_jid);
82 local body = stanza:get_child("body"); 82 local body = stanza:get_child("body");
83 if not body then return; end 83 if not body then return; end
84 body = body:get_text(); 84 body = body:get_text();
85 85
86 local f = open_files[from]; 86 local f = open_files[from];