function sms_actions_do in SMS Framework 6
Same name and namespace in other branches
- 6.2 modules/sms_actions/sms_actions.module \sms_actions_do()
- 7 modules/sms_actions/sms_actions.module \sms_actions_do()
1 call to sms_actions_do()
- sms_actions_sms_incoming in modules/
sms_actions/ sms_actions.module - Implementation of hook_sms_incoming()
File
- modules/
sms_actions/ sms_actions.module, line 35 - Provides a "Send SMS" action and the ability to define custom triggers for incoming messages.
Code
function sms_actions_do($command, $number, $message) {
// Keep objects for reuse so that changes actions make to objects can persist.
static $objects;
$aids = _trigger_get_hook_aids('sms_actions', $command->op);
if (!$aids) {
return;
}
$context = array(
'hook' => 'sms_actions',
'op' => $command->op,
'number' => $number,
);
foreach ($aids as $aid => $action_info) {
if ($action_info['type'] != 'sms') {
if ($action_info['type'] == 'node') {
preg_match('!^[A-z0-9\\-]+\\s(.+)$!', $message, $matches);
$params = explode(' ', $matches[1]);
$node = node_load($params[0]);
if (!isset($objects[$action_info['type']])) {
$objects[$action_info['type']] = _trigger_normalize_comment_context($action_info['type'], $node);
}
$context['hook'] = 'nodeapi';
actions_do($aid, $objects[$action_info['type']], $context, $a3, $a4);
}
}
else {
$result = actions_do($aid, $message, $context, $options);
}
}
}