Use the de-facto standard for handing RFC2812 ambiguous prefix parsing
This commit is contained in:
parent
56df6c09d6
commit
1e6aa0afdc
|
@ -113,7 +113,16 @@ signed int Tok_user(char* str, IRC_User* out, bool useorig)
|
|||
*(out->orig++) = '\0';
|
||||
if ((out->user = strchr(pos, '!')) != NULL) /* RFC2812 says this cannot be here without the host but RFC1459 says it can, we accept both options */
|
||||
*((char*)out->user++) = '\0';
|
||||
if (!*(out->nick = pos)) /* NOTE: This may be the server instead of a nick according to RFC2812, it is left to the library out to decide how to interpret this based on the context. */
|
||||
if (!*(out->nick = pos))
|
||||
return ERR_UIRC_INVALID_FORMAT;
|
||||
/* NOTE: De-facto standard below
|
||||
* This assumes that every prefix without a '@host' and '!user' is itself a host prefix only
|
||||
* It might be a actual nickname, but this is the most common around every network
|
||||
* It is left to the user to decide and handle the result accordingly
|
||||
*/
|
||||
if (out->host == NULL && out->nick == NULL) {
|
||||
out->host = out->nick;
|
||||
out->nick = NULL;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
|
Reference in New Issue