src/irc_line.h
changeset 87 f0db6ebf18b9
parent 75 ff6272398d2e
child 90 9d489b1039b2
equal deleted inserted replaced
86:5e7e64544cb7 87:f0db6ebf18b9
    21 
    21 
    22 /**
    22 /**
    23  * Chars that are invalid inside of tokens
    23  * Chars that are invalid inside of tokens
    24  */
    24  */
    25 #define IRC_TOKEN_INVALID "\r\n\n "
    25 #define IRC_TOKEN_INVALID "\r\n\n "
       
    26 
       
    27 /**
       
    28  * Chars that are invalid inside of the trailing-argument token
       
    29  */
    26 #define IRC_TOKEN_TRAILING_INVALID "\r\n\n"
    30 #define IRC_TOKEN_TRAILING_INVALID "\r\n\n"
    27 
    31 
    28 /**
    32 /**
    29  * Low-level IRC protocol unit
    33  * Low-level IRC protocol unit. Note that all fields are specifically constant strings, MUST NOT be modified, and 
       
    34  * usually point at stack-allocated memory. Hence, if you need to mutate or store these values, you must copy them.
    30  */
    35  */
    31 struct irc_line {
    36 struct irc_line {
    32     /** The message source as a nickmask, for those messages that have a valid prefix. May be NULL otherwise */
    37     /** The message source as a nickmask, for those messages that have a valid prefix. May be NULL otherwise */
    33     const struct irc_nm *source;
    38     const struct irc_nm *source;
    34 
    39 
    38     /** The arguments, with unused ones set to NULL */
    43     /** The arguments, with unused ones set to NULL */
    39     const char *args[IRC_ARG_MAX];
    44     const char *args[IRC_ARG_MAX];
    40 };
    45 };
    41 
    46 
    42 /**
    47 /**
    43  * Parse an IRC message to fill in an irc_line. This mutates the value of data (to insert NULs between tokens), and
    48  * Parse an IRC message to fill in an irc_line. This mutates the contents of data (to insert NULs between tokens), and
    44  * stores pointers into this data into the irc_line.
    49  * stores pointers into this memory in the irc_line.
    45  *
    50  *
    46  * If the prefix is a valid nickmask, it will be stored in the given given irc_nm, and irc_line.nm set to this.
    51  * If the prefix is a valid nickmask, it will be stored in the given given irc_nm, and irc_line.nm set to this.
    47  *
    52  *
    48  * The irc_line will have the first N args values set to valid values, and all the rest set to NULL.
    53  * The irc_line will have the first N args values set to valid values, and all the rest set to NULL.
    49  */
    54  */