[NeoStats-Devel] [Commits] r8 - Trunk

[email protected]
Newsgroups gmane.comp.neostats.devel
Message-ID <[email protected]>
Author: DNB
Date: Tue Jul  5 21:43:24 2005
New Revision: 8

Modified:
   Trunk/profileserv.c
   Trunk/profileserv.h
   Trunk/profileserv_help.c
Log:
remove preset marital status options
remove birthday text format
help updates

Modified: Trunk/profileserv.c
==============================================================================
--- Trunk/profileserv.c	(original)
+++ Trunk/profileserv.c	Tue Jul  5 21:43:24 2005
@@ -46,7 +46,7 @@
 */
 static bot_cmd pfs_commands[]=
 {
-	{"VIEW",		pfs_cmd_view,		1,	0,	pfs_help_view},
+	{"PROFILE",		pfs_cmd_profile,	1,	0,	pfs_help_profile},
 	{"REALNAME",		pfs_cmd_realname,	1,	0,	pfs_help_realname},
 	{"BIRTHDAY",		pfs_cmd_birthday,	3,	0,	pfs_help_birthday},
 	{"AGE",			pfs_cmd_age,		1,	0,	pfs_help_age},
@@ -223,7 +223,7 @@
 /*
  * View Nicknames Profile
 */
-int pfs_cmd_view (CmdParams *cmdparams)
+int pfs_cmd_profile (CmdParams *cmdparams)
 {
 	ProfileUser *pu;
 	ProfileData *pd;
@@ -343,7 +343,7 @@
 {
 	ProfileUser *pu;
 	ProfileData *pd;
-	int d, m, y;
+	char *buf;
 	
 	SET_SEGV_LOCATION();
 	if( ( !ProfileServ.enable && !cmdparams->channel ) || ( !ProfileServ.enableprofilechan && cmdparams->channel ) )
@@ -353,25 +353,19 @@
 		profile_report( cmdparams, "You must be Identified for your nickname to add data to the profile" );
 		return NS_SUCCESS;
 	}
-	d = atoi(cmdparams->av[0]);
-	m = atoi(cmdparams->av[1]);
-	y = atoi(cmdparams->av[2]);
-	if ( d < 1 || d > 31 || m < 1 || m > 12 )
-	{
-		profile_report( cmdparams, "Invalid Date Specifed (must be in the format 'dd mm yy')" );
-		return NS_SUCCESS;
-	}
 	pu = ns_calloc( sizeof( ProfileUser ) );
 	pd = ns_calloc( sizeof( ProfileData ) );
 	strlcpy( pu->nick, cmdparams->source->name , MAXNICK );
 	strlcpy( nicklower, cmdparams->source->name , MAXNICK );
 	pu->lastseen = me.now;
 	DBAStore( "UserList", strlwr(nicklower), ( void * )pu, sizeof( ProfileUser ) );
+	buf= joinbuf(cmdparams->av, cmdparams->ac, 0);
 	strlcpy( pd->typenick, "BDT" , PFS_TYPENICKSIZE );
 	strlcat( pd->typenick, nicklower, PFS_TYPENICKSIZE );
-	ircsnprintf( pd->typedata, PFS_TEXTSIZE, "%d %s %d", d , (m == 1) ? "Jan" : (m == 2) ? "Feb" : (m == 3) ? "Mar" : (m == 4) ? "Apr" : (m == 5) ? "May" : (m == 6) ? "Jun" : (m == 7) ? "Jul" : (m == 8) ? "Aug" : (m == 9) ? "Sep" : (m == 10) ? "Oct" : (m == 11) ? "Nov" : "Dec", y);
+	strlcpy( pd->typedata, buf, PFS_TEXTSIZE);
 	DBAStore( "UserData", pd->typenick, ( void * )pd, sizeof( ProfileData ) );
 	profile_report( cmdparams, "Birthday changed to : %s", pd->typedata );
+	ns_free( buf )
 	ns_free( pu );
 	ns_free( pd );
 	return NS_SUCCESS;
@@ -488,6 +482,7 @@
 {
 	ProfileUser *pu;
 	ProfileData *pd;
+	char *buf;
 	
 	SET_SEGV_LOCATION();
 	if( ( !ProfileServ.enable && !cmdparams->channel ) || ( !ProfileServ.enableprofilechan && cmdparams->channel ) )
@@ -503,56 +498,13 @@
 	strlcpy( nicklower, cmdparams->source->name , MAXNICK );
 	pu->lastseen = me.now;
 	DBAStore( "UserList", strlwr(nicklower), ( void * )pu, sizeof( ProfileUser ) );
+	buf= joinbuf(cmdparams->av, cmdparams->ac, 0);
 	strlcpy( pd->typenick, "MST" , PFS_TYPENICKSIZE );
 	strlcat( pd->typenick, nicklower, PFS_TYPENICKSIZE );
-	switch (cmdparams->av[0][0])
-	{
-		case 's':
-		case 'S':
-			strlcpy( pd->typedata, "Single", PFS_TEXTSIZE );
-			break;
-		case 'm':
-		case 'M':
-			strlcpy( pd->typedata, "Married", PFS_TEXTSIZE );
-			break;
-		case 'd':
-		case 'D':
-			strlcpy( pd->typedata, "Divorced", PFS_TEXTSIZE );
-			break;
-		case 'a':
-		case 'A':
-			strlcpy( pd->typedata, "Available", PFS_TEXTSIZE );
-			break;
-		case 'u':
-		case 'U':
-			strlcpy( pd->typedata, "Unavailable", PFS_TEXTSIZE );
-			break;
-		case 'w':
-		case 'W':
-			strlcpy( pd->typedata, "Getting rid of the Witch", PFS_TEXTSIZE );
-			break;
-		case 'b':
-		case 'B':
-			strlcpy( pd->typedata, "Getting rid of the Hubastard", PFS_TEXTSIZE );
-			break;
-		case 't':
-		case 'T':
-			strlcpy( pd->typedata, "Too Bloody Picky", PFS_TEXTSIZE );
-			break;
-		case 'p':
-		case 'P':
-			strlcpy( pd->typedata, "Waiting (because there is no Price Charming/Sleeping Beauty)", PFS_TEXTSIZE );
-			break;
-		default:
-			pd->typedata[0] = '\0';
-			break;
-	}
-	if( strlen( pd->typedata ) < 1 ) {
-		profile_report( cmdparams, "Invalid Marital Status Specified");
-	} else {
-		DBAStore( "UserData", pd->typenick, ( void * )pd, sizeof( ProfileData ) );
-		profile_report( cmdparams, "Marital Status changed to : %s", pd->typedata );
-	}
+	strlcpy( pd->typedata, buf, PFS_TEXTSIZE);
+	DBAStore( "UserData", pd->typenick, ( void * )pd, sizeof( ProfileData ) );
+	profile_report( cmdparams, "Marital Status changed to : %s", pd->typedata );
+	ns_free( buf )
 	ns_free( pu );
 	ns_free( pd );
 	return NS_SUCCESS;

Modified: Trunk/profileserv.h
==============================================================================
--- Trunk/profileserv.h	(original)
+++ Trunk/profileserv.h	Tue Jul  5 21:43:24 2005
@@ -52,7 +52,7 @@
 extern const char *pfs_help_set_enableprofilechan[];
 extern const char *pfs_help_set_profilechan[];
 extern const char *pfs_help_set_expiredays[];
-extern const char *pfs_help_view[];
+extern const char *pfs_help_profile[];
 extern const char *pfs_help_realname[];
 extern const char *pfs_help_birthday[];
 extern const char *pfs_help_age[];
@@ -68,7 +68,7 @@
 int pfs_set_enablechan (CmdParams *cmdparams, SET_REASON reason);
 int pfs_set_profilechan (CmdParams *cmdparams, SET_REASON reason);
 void profile_report( CmdParams *cmdparams, const char *fmt, ... );
-int pfs_cmd_view (CmdParams *cmdparams);
+int pfs_cmd_profile (CmdParams *cmdparams);
 int pfs_cmd_realname (CmdParams *cmdparams);
 int pfs_cmd_birthday (CmdParams *cmdparams);
 int pfs_cmd_age (CmdParams *cmdparams);

Modified: Trunk/profileserv_help.c
==============================================================================
--- Trunk/profileserv_help.c	(original)
+++ Trunk/profileserv_help.c	Tue Jul  5 21:43:24 2005
@@ -55,75 +55,73 @@
 	NULL
 };
 
-const char *pfs_help_view[] = {
-	"View Profile",
-	"Syntax: \2VIEW <nick>\2",
+const char *pfs_help_profile[] = {
+	"View Profile - Syntax: \2PROFILE <nick>\2",
+	"Syntax: \2PROFILE <nick>\2",
 	"",
 	"Displays infomation stored in ProfileServ for the entered Nickname.",
 	NULL
 };
 
 const char *pfs_help_realname[] = {
-	"Add Real Name to Profile",
-	"Syntax: \2SETREALNAME <real name>\2",
+	"Add Real Name to Profile - Syntax: \2REALNAME <real name>\2",
+	"Syntax: \2REALNAME <real name>\2",
 	"",
 	"Add your Real Name to ProfileServ for your current Nick.",
 	NULL
 };
 
 const char *pfs_help_birthday[] = {
-	"Add birthday to Profile",
-	"Syntax: \2SETBIRTHDAY <day> <month> <year>\2",
+	"Add birthday to Profile - Syntax: \2BIRTHDAY <birthday>\2",
+	"Syntax: \2BIRTHDAY <birthday>\2",
 	"",
 	"Add your birthday to ProfileServ for your current Nick.",
-	"NOTE: Age will be calculated automatically if entered.",
 	NULL
 };
 
 const char *pfs_help_age[] = {
-	"Add Age to Profile",
-	"Syntax: \2SETAGE <age>\2",
+	"Add Age to Profile - Syntax: \2AGE <age>\2",
+	"Syntax: \2AGE <age>\2",
 	"",
 	"Add your age (in years) to ProfileServ for your current Nick.",
-	"NOTE: Age will not be used if birthday has been entered.",
 	NULL
 };
 
 const char *pfs_help_gender[] = {
-	"Add Gender to Profile",
-	"Syntax: \2SETGENDER <M|MALE|F|FEMALE|A|ALIEN|O|OTHER>>\2",
+	"Add Gender to Profile - Syntax: \2GENDER <gender>\2",
+	"Syntax: \2GENDER <gender>\2",
 	"",
 	"Add your Gender to ProfileServ for your current Nick.",
 	NULL
 };
 
 const char *pfs_help_maritalstatus[] = {
-	"Add Marital Status to Profile",
-	"Syntax: \2SETMARITAL <S|SINGLE|M|MARRIED|D|DIVORCED|A|AVAILABLE|U|UNAVAILABLE>>\2",
+	"Add Marital Status to Profile - Syntax: \2MARITAL <marital status>\2",
+	"Syntax: \2MARITAL <marital status>\2",
 	"",
 	"Add your Marital Status to ProfileServ for your current Nick.",
 	NULL
 };
 
 const char *pfs_help_location[] = {
-	"Add Location to Profile",
-	"Syntax: \2SETLOCATION <Country / State / Province / City / Suburb>\2",
+	"Add Location to Profile - Syntax: \2LOCATION <Country / State / Province / City / Suburb>\2",
+	"Syntax: \2LOCATION <Country / State / Province / City / Suburb>\2",
 	"",
 	"Add your Location to ProfileServ for your current Nick.",
 	NULL
 };
 
 const char *pfs_help_hobbies[] = {
-	"Add Hobbies to Profile",
-	"Syntax: \2SETHOBBIES <Hobby List>\2",
+	"Add Hobbies to Profile - Syntax: \2HOBBIES <Hobby List>\2",
+	"Syntax: \2HOBBIES <Hobby List>\2",
 	"",
 	"Add your List of Hobbies to ProfileServ for your current Nick.",
 	NULL
 };
 
 const char *pfs_help_general[] = {
-	"Add General information to Profile",
-	"Syntax: \2SETGENERAL <#> <text>\2",
+	"Add General information to Profile - Syntax: \2GENERAL <Line 1-5> <text>\2",
+	"Syntax: \2GENERAL <Line 1-5> <text>\2",
 	"",
 	"Add General information to ProfileServ for your current Nick.",
 	"Up to 5 lines of general Information may be entered.",
@@ -132,7 +130,7 @@
 };
 
 const char *pfs_help_del[] = {
-	"Delete a Profile",
+	"Delete a Profile - Syntax: \2DEL <nick>\2",
 	"Syntax: \2DEL <nick>\2",
 	"",
 	"Allows you to delete your profile.",
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.