function sms_actions_sms_incoming in SMS Framework 7
Same name and namespace in other branches
- 6.2 modules/sms_actions/sms_actions.module \sms_actions_sms_incoming()
- 6 modules/sms_actions/sms_actions.module \sms_actions_sms_incoming()
Implementation of hook_sms_incoming().
File
- modules/
sms_actions/ sms_actions.module, line 12 - Provides a "Send SMS" action and the ability to define custom triggers for incoming messages.
Code
function sms_actions_sms_incoming($op, $number, $message) {
if ($op == 'process') {
$commands = sms_actions_get_commands();
foreach ($commands as $command) {
if (stripos($message, $command->discriminator) === 0) {
$active_command = $command;
}
}
if (!empty($active_command)) {
sms_actions_do($active_command, $number, $message);
}
else {
// Try to figure out what command was actually given
// preg_match('!^([A-z0-9\-]+).+$!', $message, $matches);
// if (variable_get('sms_actions_invalid_cmd_reply', 0)) {
// sms_send($number, t('The command @command was not found.', array('@command' => $matches[1])));
// }
// watchdog('sms', t('Command %command not found from @number.', array('%command' => $matches[1], '@number' => $number)), WATCHDOG_WARNING);
}
}
}