Index: smsgateway.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/smsgateway/smsgateway.module,v
retrieving revision 1.4.2.1
diff -u -p -r1.4.2.1 smsgateway.module
--- smsgateway.module 18 Dec 2006 22:27:38 -0000 1.4.2.1
+++ smsgateway.module 14 Mar 2007 12:08:26 -0000
@@ -302,7 +302,16 @@ function smsgateway_sendmessage( $destin
$message['destination_number'] = $destination_number;
$message['message_body'] = $message_body;
_smsgateway_ensuregateway( $smsgateway_gateway);
- $result = _smsgateway_invoke('sendsingle', $smsgateway_gateway, $smssettings, $message);
+ if (!variable_get('smsgateway_dev_debug_log', 0)) {
+print 'there'; $result = _smsgateway_invoke('sendsingle', $smsgateway_gateway, $smssettings, $message);
+ }
+ else {
+ $debug = t('settings: ') . implode("
\n -- ", $smssettings) . "
\n";
+ $debug .= t('message: ') . implode("
\n -- ", $message) . "
\n";
+ $debug .= t('gateway: ') . $gateway;
+ $debug .= t('batchmode: '). t('no') ."
\n";
+ watchdog('debug', $debug);
+ }
_smsgateway_smslog($destination_number, $message_body, $result['response']);
}
else {
@@ -335,8 +344,19 @@ function smsgateway_sendmessageset( $sms
if($smsgateway_gateway != '') {
_smsgateway_ensuregateway( $smsgateway_gateway);
- $result = _smsgateway_invoke('sendbatch', $smsgateway_gateway, $smssettings, $sms_messages);
+
+ if (!variable_get('smsgateway_dev_debug_log', 0)) {
+ $result = _smsgateway_invoke('sendbatch', $smsgateway_gateway, $smssettings, $sms_messages);
+ }
+
foreach( $sms_messages as $msgid => $message) {
+ if (variable_get('smsgateway_dev_debug_log', 0)) {
+ $debug = t('settings: ') . implode("
\n -- ", $smssettings) . "
\n";
+ $debug .= t('message: ') . implode("
\n -- ", $message) . "
\n";
+ $debug .= t('gateway: ') . $gateway ."
\n";
+ $debug .= t('batchmode: '). t('yes');
+ watchdog('debug', $debug);
+ }
_smsgateway_smslog($message['destination_number'], $message['message_body'], $result[ $msgid]);
}
}
@@ -505,6 +497,19 @@ function smsgateway_settings() {
'#description' => t('The telephone number that the message is sent from.'),
);
+ $form['devel'] = array(
+ '#type' => 'fieldset',
+ '#title' => t('Development'),
+ '#collapsible' => true,
+ '#collapsed' => true,
+ );
+ $form['devel']['smsgateway_dev_debug_log'] = array(
+ '#type' => 'checkbox',
+ '#title' => t('Log only'),
+ '#default_value' => variable_get('smsgateway_dev_debug_log', 0),
+ '#description' => t('Setting to log only will log all messages to the watchdog, instead of attemting to deliver messages.'),
+ );
+
return $form;
} // function smsgateway_settings