Permalink
Browse files

There is a new setting in Messaging, so that you can block any

new messages from people not on your contacts list

I will need this on moodle.org I can tell you!!
  • Loading branch information...
1 parent 830d0af commit 3f85157ba7171afdc02bad20c2dfc046747c1e4f moodler committed Apr 23, 2005
Showing with 14 additions and 0 deletions.
  1. +2 −0 lang/en/message.php
  2. +2 −0 message/lib.php
  3. +6 −0 message/send.php
  4. +4 −0 message/settings.html
View
@@ -10,6 +10,7 @@
$string['backupmessageshelp'] = 'If enabled, then instant messages will be included in SITE automated backups';
$string['beepnewmessage'] = 'Beep when a new message comes in';
$string['blockcontact'] = 'Block contact';
+$string['blocknoncontacts'] = 'Block all new messages from people who are not on my contact list';
$string['blockedmessages'] = '$a message(s) to/from blocked users';
$string['context'] = 'context';
$string['contactlistempty'] = 'Your contact list is currently empty';
@@ -59,6 +60,7 @@
$string['unblockcontact'] = 'Unblock contact';
$string['unreadmessages'] = '$a unread messages';
$string['userisblockingyou'] = 'This user has blocked you from sending messages to them';
+$string['userisblockingyounoncontact'] = 'This user is only accepting messages from people listed as contacts, and you are not currently on the list.';
$string['userssearchresults'] = 'Search results: $a users found';
View
@@ -253,6 +253,7 @@ function message_print_settings() {
$pref = array();
$pref['message_showmessagewindow'] = (isset($frm->showmessagewindow)) ? '1' : '0';
$pref['message_beepnewmessage'] = (isset($frm->beepnewmessage)) ? '1' : '0';
+ $pref['message_blocknoncontacts'] = (isset($frm->blocknoncontacts)) ? '1' : '0';
$pref['message_usehtmleditor'] = (isset($frm->usehtmleditor)) ? '1' : '0';
$pref['message_emailmessages'] = (isset($frm->emailmessages)) ? '1' : '0';
$pref['message_emailtimenosee'] = ((int)$frm->emailtimenosee > 0) ? (int)$frm->emailtimenosee : '10';
@@ -266,6 +267,7 @@ function message_print_settings() {
$cbshowmessagewindow = (get_user_preferences('message_showmessagewindow', 1) == '1') ? 'checked="checked"' : '';
$cbbeepnewmessage = (get_user_preferences('message_beepnewmessage', 0) == '1') ? 'checked="checked"' : '';
+ $cbblocknoncontacts = (get_user_preferences('message_blocknoncontacts', 0) == '1') ? 'checked="checked"' : '';
$cbusehtmleditor = (get_user_preferences('message_usehtmleditor', 0) == '1') ? 'checked="checked"' : '';
$cbemailmessages = (get_user_preferences('message_emailmessages', 1) == '1') ? 'checked="checked"' : '';
$txemailaddress = get_user_preferences('message_emailaddress', $USER->email);
View
@@ -39,6 +39,12 @@
exit;
}
}
+ if (get_user_preferences('message_blocknoncontacts', 0, $user->id)) { // User is blocking non-contacts
+ if (empty($contact)) { // We are not a contact!
+ print_heading(get_string('userisblockingyounoncontact', 'message'));
+ exit;
+ }
+ }
if ($message and confirm_sesskey()) { /// Current user has just sent a message
@@ -9,6 +9,10 @@
<td colspan="2"><?php print_string('showmessagewindow', 'message') ?></td>
</tr>
<tr valign="top">
+ <td align="right"><input type="checkbox" name="blocknoncontacts" alt="<?php print_string('blocknoncontacts', 'message') ?>" <?php echo $cbblocknoncontacts ?> /></td>
+ <td colspan="2"><?php print_string('blocknoncontacts', 'message') ?></td>
+ </tr>
+ <tr valign="top">
<td align="right"><input type="checkbox" name="beepnewmessage" alt="<?php print_string('beepnewmessage', 'message') ?>" <?php echo $cbbeepnewmessage ?> /></td>
<td colspan="2"><?php print_string('beepnewmessage', 'message') ?></td>
</tr>

0 comments on commit 3f85157

Please sign in to comment.