-
-
Notifications
You must be signed in to change notification settings - Fork 84
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add userhost-in-names capability (#1374)
Patch by: Geo Fixes #1188 This updates channel records with hostmasks received from the userhost-in-names capability, and nothing more. It also adds the isupport_get_prefixchars() function to get valid prefixchars from the 005 message, which we can use in other areas of the codebase now.
- Loading branch information
Showing
5 changed files
with
89 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1214,7 +1214,7 @@ static int got354(char *from, char *msg) | |
} | ||
return 0; | ||
} | ||
|
||
/* React to IRCv3 CHGHOST command. CHGHOST changes the hostname and/or | ||
* ident of the user. Format: | ||
* :[email protected] CHGHOST tehgeo foo.io | ||
|
@@ -1251,6 +1251,65 @@ static int gotchghost(char *from, char *msg){ | |
return 0; | ||
} | ||
|
||
/* got 353: NAMES | ||
* <server> 353 <client> <symbol> <chan> :[+/@]nick [+/@]nick .... | ||
* | ||
* if userhost-in-names is enabled, nick is [email protected] | ||
* this function is added solely to handle userhost-in-names stuff, and will | ||
* update hostnames for nicks received | ||
*/ | ||
static int got353(char *from, char *msg) | ||
{ | ||
char prefixchars[64]; | ||
char *nameptr, *chname, *uhost, *nick, *p, *host; | ||
struct chanset_t *chan; | ||
int i; | ||
|
||
if (find_capability("userhost-in-names")) { | ||
strlcpy(prefixchars, isupport_get_prefixchars(), sizeof prefixchars); | ||
newsplit(&msg); | ||
newsplit(&msg); /* Get rid of =, @, or * symbol */ | ||
chname = newsplit(&msg); | ||
nameptr = newsplit(&msg); | ||
fixcolon(nameptr); | ||
while ((uhost = newsplit(&nameptr))) { | ||
if (!strcmp(uhost, "")) { | ||
break; | ||
} | ||
fixcolon(uhost); | ||
nick = splitnick(&uhost); | ||
/* Strip @, +, etc chars prefixed to nicks in NAMES */ | ||
for (i = 0; prefixchars[i]; i++) { | ||
if(nick[0] == prefixchars[i]) { | ||
nick=nick+1; | ||
} | ||
} | ||
if ((nick[0] == '+') || (nick[0] == '%')) { | ||
nick=nick+1; | ||
} | ||
p = strchr(uhost, '@'); | ||
if (p) { | ||
*p = 0; | ||
host = p+1; | ||
} | ||
chan = findchan(chname); /* See if I'm on channel */ | ||
if (chan && host) { | ||
/* Pretend we got a WHO and pass the info we got from NAMES */ | ||
got352or4(chan, uhost, host, nick, "", NULL); | ||
} | ||
} | ||
/* The assumption here is the user enabled userhost-in-names because WHO | ||
* is disabled. We remove the pending flag here because we'll never get a | ||
* a WHO to do it | ||
*/ | ||
if (chan) { | ||
chan->status |= CHAN_ACTIVE; | ||
chan->status &= ~CHAN_PEND; | ||
} | ||
} | ||
return 0; | ||
} | ||
|
||
/* React to 396 numeric (HOSTHIDDEN), sent when user mode +x (hostmasking) was | ||
* successfully set. Format: | ||
* :barjavel.freenode.net 396 BeerBot unaffiliated/geo/bot/beerbot :is now your hidden host (set by services.) | ||
|
@@ -2820,6 +2879,7 @@ static int gotrawt(char *from, char *msg, Tcl_Obj *tags) { | |
static cmd_t irc_raw[] = { | ||
{"324", "", (IntFunc) got324, "irc:324"}, | ||
{"352", "", (IntFunc) got352, "irc:352"}, | ||
{"353", "", (IntFunc) got353, "irc:353"}, | ||
{"354", "", (IntFunc) got354, "irc:354"}, | ||
{"315", "", (IntFunc) got315, "irc:315"}, | ||
{"366", "", (IntFunc) gottwitch366, "irc:t366"}, | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
05377ac
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Found by: ZarTek-Creole