function marriage_seencleanup($name)
{
    $list = get_module_pref('flirtssent', 'marriage', $name);
    $list = unserialize($list);
    if ($list == "") {
        $list = array();
    }
    $out = array();
    while (list($who, $amount) = each($list)) {
        if ($amount < 1) {
            marriage_receivedcleanup(substr($who, 1));
        } else {
            $out = array_merge($out, array($who => $amount));
        }
    }
    set_module_pref('flirtssent', serialize($out), 'marriage', $name);
}
                 $mailmessage = array("You were forced to get a divorce, due to being unfaithful.", "");
                 systemmail($session['user']['acctid'], $t, $mailmessage);
                 redirect('runmodule.php?module=marriage&op=chapel&op2=divorce', 'Auto-Divorce');
             }
         }
     }
     //give players who were divorced their buff
     $allprefs = unserialize(get_module_pref('allprefs'));
     if ($allprefs['received'] == 2) {
         apply_buff('marriage-divorce', array("name" => "`4Divorce Sadness", "rounds" => 50, "wearoff" => "`\$You no longer feel sad about your divorce.", "defmod" => 0.92, "survivenewday" => 1, "roundmsg" => "`\$Sadness haunts you."));
         output("`n`\$The fact that you've been divorced finally hits you.  It's going to be a sad day.");
         $allprefs['received'] = 0;
     }
     set_module_pref('allprefs', serialize($allprefs));
     marriage_seencleanup($session['user']['acctid']);
     marriage_receivedcleanup($session['user']['acctid']);
     break;
 case "changesetting":
     if ($args['setting'] == "villagename") {
         if ($args['old'] == get_module_setting("chapelloc")) {
             set_module_setting("chapelloc", $args['new']);
         }
     }
     if ($args['setting'] == "oc" && $args['module'] == 'marriage') {
         if ($args['new'] == 1 && !is_module_active('oldchurch')) {
             $args['new'] = 0;
             set_module_setting('oc', 0);
             output_notl("`n`c`b`QMarriage Module - Old Church is not installed`0`b`c");
         }
     }
     break;