diff -r 6bd70113e1ed -r 71e65564afd2 src/irc_proto.h --- a/src/irc_proto.h Thu Mar 12 22:06:01 2009 +0200 +++ b/src/irc_proto.h Thu Mar 12 22:50:08 2009 +0200 @@ -10,11 +10,18 @@ #include /** - * Maximum length of an IRC nickname including terminating NUL + * Maximum length of an IRC nickname including terminating NUL. */ #define IRC_NICK_MAX 31 /** + * Maximum length of an IRC prefix/nickmask string, including any termianting NULs. + * + * XXX: currently this is pretty large, but does it really matter? We have more than 4k stack... + */ +#define IRC_PREFIX_MAX 510 + +/** * Parsed nickmask */ struct irc_nm { @@ -31,9 +38,10 @@ /** * Parse a full nickmask from a prefix. This fails if the prefix is a server name. * - * XXX: not implemented, and memory-management issues + * Since we cannot modify the prefix string, the user must provide a buffer of at least IRC_PREFIX_MAX bytes to store + * the procesed prefix. The returned nm's fields will point into this buffer. */ -err_t irc_nm_parse (struct irc_nm *nm, char *prefix); +err_t irc_nm_parse (struct irc_nm *nm, char *buf, const char *prefix); /** * Compare two nicknames for equality, with standard strcmp() semantics.