Index: src/modules/m_setname.c
===================================================================
RCS file: /home/cmunk/ircsystems/cvsroot/unreal/src/modules/Attic/m_setname.c,v
retrieving revision 1.1.2.13.2.2
diff -u -r1.1.2.13.2.2 m_setname.c
--- src/modules/m_setname.c	16 Nov 2005 23:58:02 -0000	1.1.2.13.2.2
+++ src/modules/m_setname.c	28 Jan 2007 00:07:42 -0000
@@ -94,6 +94,10 @@
 */ 
 DLLFUNC CMD_FUNC(m_setname)
 {
+    int xx;
+    char tmpinfo[REALLEN + 1];
+    char spamfilter_user[NICKLEN + USERLEN + HOSTLEN + REALLEN + 64];
+
  	if ((parc < 2) || BadPtr(parv[1]))
  	{
  		sendto_one(sptr, err_str(ERR_NEEDMOREPARAMS), me.name, parv[0], "SETNAME");
@@ -110,8 +114,17 @@
 		return 0;
 	}
 
-	/* set the new name before we check, but don't send to servers unless it is ok */
-	strcpy(sptr->info, parv[1]);
+    /* set temp info for spamfilter check*/
+    strcpy(tmpinfo, sptr->info);
+    /* set the new name before we check, but don't send to servers unless it is ok */
+    strcpy(sptr->info, parv[1]);
+    spamfilter_build_user_string(spamfilter_user, sptr->name, sptr);
+    xx = dospamfilter(sptr, spamfilter_user, SPAMF_USER, NULL, 0, NULL);
+    if (xx < 0) {
+        if (sptr)
+            strcpy(sptr->info, tmpinfo);
+        return xx;
+    }
 
 	/* Check for n:lines here too */
 	if (!IsAnOper(sptr) && Find_ban(NULL, sptr->info, CONF_BAN_REALNAME))
