function slack_send_test_message_form_submit in Slack 6
Same name and namespace in other branches
- 7 includes/pages/slack.pages.inc \slack_send_test_message_form_submit()
Submit handler for slack test message form.
File
- includes/
pages/ slack.pages.inc, line 37 - Slack module page functions.
Code
function slack_send_test_message_form_submit($form, &$form_state) {
$channel = $form_state['values']['slack_test_channel'];
$username = $form_state['values']['slack_test_username'];
$message = $form_state['values']['slack_test_message'];
$result = slack_send_message($message, $channel, $username);
if (!$result) {
drupal_set_message(t("Message wasn't sent. Please, check slack module configuration."));
}
elseif (!isset($result->error) && $result->code == SLACK_CODE_OK) {
drupal_set_message(t('Message was successfully sent.'));
}
else {
drupal_set_message(t("Message wasn't sent."), 'error');
slack_watchdog_sending_error($result);
}
}