Exemple #1
0
function useredit_update_bounces($user, $usernew) {
    if (!isset($usernew->email)) {
        //locked field
        return;
    }
    if (!isset($user->email) || $user->email !== $usernew->email) {
        set_bounce_count($usernew,true);
        set_send_count($usernew,true);
    }
}
Exemple #2
0
/**
 * ?
 *
 * @todo Finish documenting this function
 *
 * @param string $modargs
 * @param string $body Currently unused
 */
function moodle_process_email($modargs, $body)
{
    global $DB;
    // The first char should be an unencoded letter. We'll take this as an action.
    switch ($modargs[0]) {
        case 'B':
            // Bounce.
            list(, $userid) = unpack('V', base64_decode(substr($modargs, 1, 8)));
            if ($user = $DB->get_record("user", array('id' => $userid), "id,email")) {
                // Check the half md5 of their email.
                $md5check = substr(md5($user->email), 0, 16);
                if ($md5check == substr($modargs, -16)) {
                    set_bounce_count($user);
                }
                // Else maybe they've already changed it?
            }
            break;
            // Maybe more later?
    }
}
Exemple #3
0
function moodle_process_email($modargs, $body)
{
    // the first char should be an unencoded letter. We'll take this as an action
    switch ($modargs[0]) {
        case 'B':
            // bounce
            list(, $userid) = unpack('V', base64_decode(substr($modargs, 1, 8)));
            if ($user = get_record_select("user", "id={$userid}", "id,email")) {
                // check the half md5 of their email
                $md5check = substr(md5($user->email), 0, 16);
                if ($md5check == substr($modargs, -16)) {
                    set_bounce_count($user);
                }
                // else maybe they've already changed it?
            }
            break;
            // maybe more later?
    }
}