comparison mod_sms_clickatell/mod_sms_clickatell.lua @ 2887:65082d91950e

Many modules: Simplify st.message(…):tag("body"):text(…):up() into st.message(…, …)
author Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
date Sat, 17 Feb 2018 08:42:10 +0100
parents 178b8abf8283
children e8d6f602f382
comparison
equal deleted inserted replaced
2886:5ca6d53d3186 2887:65082d91950e
148 end 148 end
149 149
150 function dmsg(jid, msg) 150 function dmsg(jid, msg)
151 module:log("debug", msg or "nil"); 151 module:log("debug", msg or "nil");
152 if jid ~= nil then 152 if jid ~= nil then
153 send_stanza(st.message({to=jid, from=component_host, type='chat'}):tag("body"):text(msg or "nil"):up()); 153 send_stanza(st.message({to=jid, from=component_host, type='chat'}, msg or "nil"));
154 end 154 end
155 end 155 end
156 156
157 function substring(string, start_string, ending_string) 157 function substring(string, start_string, ending_string)
158 local s_value_start, s_value_finish = nil, nil; 158 local s_value_start, s_value_finish = nil, nil;
496 end 496 end
497 497
498 -- Now parse the message 498 -- Now parse the message
499 if stanza.attr.to == component_host then 499 if stanza.attr.to == component_host then
500 -- Messages directly to the component jget echoed 500 -- Messages directly to the component jget echoed
501 origin.send(st.message({to=stanza.attr.from, from=component_host, type='chat'}):tag("body"):text(msg.body):up()); 501 origin.send(st.message({to=stanza.attr.from, from=component_host, type='chat'}, msg.body));
502 elseif users[from_bjid].data.roster[to.node] ~= nil then 502 elseif users[from_bjid].data.roster[to.node] ~= nil then
503 -- If message contains a body, send message to SMS Test User 503 -- If message contains a body, send message to SMS Test User
504 if msg.body ~= nil then 504 if msg.body ~= nil then
505 clickatell_send_sms(users[from_bjid], to.node, msg.body); 505 clickatell_send_sms(users[from_bjid], to.node, msg.body);
506 end 506 end