src/irc_proto.h
changeset 75 ff6272398d2e
parent 72 43084f103c2a
child 87 f0db6ebf18b9
equal deleted inserted replaced
74:11ec458d1cbf 75:ff6272398d2e
    30  * The set of characters that are considered nickname channel flag prefixes (i.e. op, voice, etc).
    30  * The set of characters that are considered nickname channel flag prefixes (i.e. op, voice, etc).
    31  */
    31  */
    32 #define IRC_CHANFLAGS "@+"
    32 #define IRC_CHANFLAGS "@+"
    33 
    33 
    34 /**
    34 /**
    35  * Parsed nickmask
    35  * Parsed nickmask. For normal user prefixes, all fields will be non-NULL. For server prefixes, nickname and username
       
    36  * will be NULL, and hostname will be the server name.
    36  */
    37  */
    37 struct irc_nm {
    38 struct irc_nm {
    38     /** Nickname, not normalized */
    39     /** Nickname, not normalized */
    39     const char *nickname;
    40     const char *nickname;
    40     
    41     
    44     /** Hostname, either reverse DNS hostname, literal IPv4 or literal IPv6 */
    45     /** Hostname, either reverse DNS hostname, literal IPv4 or literal IPv6 */
    45     const char *hostname;
    46     const char *hostname;
    46 };
    47 };
    47 
    48 
    48 /**
    49 /**
    49  * Parse a full nickmask from a prefix. This fails if the prefix is a server name.
    50  * Parse a full nickmask from a prefix, mutating the value of the given buffer, and returning pointers into the buffer
    50  *
    51  * inside \a nm.
    51  * Since we cannot modify the prefix string, the user must provide a buffer of at least IRC_PREFIX_MAX bytes to store
    52  */
    52  * the procesed prefix. The returned nm's fields will point into this buffer.
    53 err_t irc_nm_parse_buf (struct irc_nm *nm, char *prefix);
       
    54 
       
    55 /**
       
    56  * Same as irc_nm_parse_buf(), but copies the prefix into the given mutable buffer of at least IRC_PREFIX_MAX bytes and
       
    57  * returns pointers into that instead.
    53  */
    58  */
    54 err_t irc_nm_parse (struct irc_nm *nm, char *buf, const char *prefix);
    59 err_t irc_nm_parse (struct irc_nm *nm, char *buf, const char *prefix);
    55 
    60 
    56 /**
    61 /**
    57  * Compare two nicknames for equality, with standard strcmp() semantics.
    62  * Compare two nicknames for equality, with standard strcmp() semantics.