#include "mod_core.h"
#include "ap_config.h"
#include "http_log.h"

#include "http_config.h"
#include "scoreboard.h"
#include "ap_mpm.h"
#include "apr_lib.h"


char *get_email_user(request_rec *r, char *email)
{
	char *sep = NULL;
	int len = 0;


	if (!email) return NULL;
	if (*email == '<') email++; 

	sep = strchr(email, '@');

	if (!sep) return NULL;
	len = sep - email;
	return apr_pstrndup(r->pool, email, len);
}

char *get_email_domain(request_rec *r, char *email)
{
	char *sep = NULL;
	int len = 0;

	if (!email) return NULL;

	sep = strchr(email, '@');
	if (!sep) return NULL;
	sep++;
	if (sep[strlen(sep) - 1] == '>') sep[strlen(sep) - 1] = 0;
	return apr_pstrdup(r->pool, sep);
}

