*** sqwebmail/sqwebmail.c.old	Thu Nov  9 18:13:48 2000
--- sqwebmail/sqwebmail.c	Thu Nov  9 19:53:21 2000
***************
*** 875,880 ****
--- 875,901 ----
  		{
  			folder_showquota();
  		}
+ 		else if (strcmp(kw, "DOMAIN") == 0)
+ 		{
+ 			/* This is a simple hack to allow users
+ 			access webmail.domain.com so they don't
+ 			need to type their email, just their login */
+ 			/* Author: Davi de Castro Reis - davi@dcc.ufmg.br */
+ 
+ 			char *domain;
+ 			char *striped_domain;
+ 			domain = getenv("HTTP_HOST");
+ 			striped_domain = strstr(domain,"webmail.");
+ 			if(striped_domain == domain)
+ 			{
+ 				/* Found webmail in front of domain name */
+ 				striped_domain = domain + 8;
+ 				printf("%s",striped_domain);
+ 			}
+ 
+ 			/* End of hack */
+ 			
+ 		}
  		else if (strncmp(kw, "radio:", 6) == 0)
  		{
  		const char *name=strtok(kw+6, ":");
***************
*** 1526,1536 ****
  		if (*(u=cgi("username")))
  			/* Request to log in */
  		{
  		const char *p=cgi("password");
  		const char *mailboxid;
  		const char *u2=cgi("logindomain");
- 		char	*ubuf=malloc(strlen(u)+strlen(u2)+2);
  
  			strcpy(ubuf, u);
  			if (*u2)
  				strcat(strcat(ubuf, "@"), u2);
--- 1547,1577 ----
  		if (*(u=cgi("username")))
  			/* Request to log in */
  		{
+ 
  		const char *p=cgi("password");
  		const char *mailboxid;
  		const char *u2=cgi("logindomain");
  
+ 		char *ubuf;
+ 
+ 		/* This is a simple hack to allow users
+ 		access webmail.domain.com so they don't
+ 		need to type their email, just their login */
+ 		/* Author: Davi de Castro Reis - davi@dcc.ufmg.br */
+ 		char	*domain = getenv("HTTP_HOST");
+ 		char	*striped_domain = strstr(domain,"webmail.");
+ 
+ 			if(striped_domain == domain)
+ 			{
+ 				/* Found webmail in front of domain name */
+ 				u2 = domain + 8;
+ 
+ 			}	
+ 			fprintf(stderr, "Login: %s@%s\n",u,u2);
+ 
+ 		/* End of hack */
+ 
+ 			ubuf=malloc(strlen(u)+strlen(u2)+2);
  			strcpy(ubuf, u);
  			if (*u2)
  				strcat(strcat(ubuf, "@"), u2);
*** sqwebmail/html/en-us/invalid.html.old	Thu Nov  9 19:55:48 2000
--- sqwebmail/html/en-us/invalid.html	Thu Nov  9 19:54:30 2000
***************
*** 36,42 ****
                <tr>
                  <td>User Id:&nbsp;</td>
                  <td><input type="text" size="16" name="username"
!                   maxlength="128" value=""></td>
                  <td>[#h#]&nbsp;</td>
                </tr>
                <tr>
--- 36,42 ----
                <tr>
                  <td>User Id:&nbsp;</td>
                  <td><input type="text" size="16" name="username"
!                   maxlength="128" value="">@[#DOMAIN#]</td>
                  <td>[#h#]&nbsp;</td>
                </tr>
                <tr>
*** sqwebmail/html/en-us/login.html.old	Thu Nov  9 19:55:26 2000
--- sqwebmail/html/en-us/login.html	Thu Nov  9 19:54:11 2000
***************
*** 35,41 ****
                <tr>
                  <td>User Id:&nbsp;</td>
                  <td><input type="text" size="16" name="username"
!                   maxlength="128"></td>
                  <td>[#h#]&nbsp;</td>
                </tr>
                <tr>
--- 35,41 ----
                <tr>
                  <td>User Id:&nbsp;</td>
                  <td><input type="text" size="16" name="username"
!                   maxlength="128">@[#DOMAIN#]</td>
                  <td>[#h#]&nbsp;</td>
                </tr>
                <tr>
